Skip to main content

Posts

Showing posts from October, 2021

Emulator: System Calls

This post will cover some basic I/O system calls, enough to implement a game or two, other than sound support or holotape support. The holotape calls required a little more explanation, and the sound system data is more complex than for the calls covered here. Prerequisites Hopefully you've read the post on running code in the emulator. It describes the easiest, fastest way to get your code running. Console Calls In the Clear The CLEAR system call will remove all text and attributes from the screen, and set the cursor to top-left (0,0).  Character I/O The only console input system call is GETCH. It takes a byte off the stack as the blocking mode (=0 no blocking, != 0 blocking), grabs a key from the input queue and returns a 16-bit value indicating which character was pressed. If the MSB is 0 then the LSB contains the ASCII value. There are two output calls, SETCH and PRINT. They both increment the cursor to the next character after their output is printed to screen at the current

Emulator Basics - Running Code

Now that I've covered the instruction set, it's time to talk about the assembler and running your assembly programs. The assembler is available as a standalone tool, but is also bundled into the emulator, allowing you to go directly from assembly to running your code in one step. Previous Posts The following posts cover the instruction set for the emulator. They can serve as a good resource once you decide to start writing code of your own. Instruction Set Part 1 Instruction Set Part 2 Instruction Set Part 3 Instruction Set Part 4 Setup If you haven't already, clone https://github.com/skwirl42/robco-processor into the directory of your choice. At the moment only the macOS port is fully maintained, so the instructions will be focused on using the project on macOS. Linux I have yet to port it to linux, but that is planned. If you would like to work on it, there's a task available on the repository. Ideally, this should be straightforward. If you plan to work on the linu