Skip to main content

Posts

Jamestation: An Ambitious Project

Intro  Of all the projects I've ever conceived, the Jamestation is the most complex. I've never put any work into it other than learning and ideation, but there's plenty I'd need to do to see it through, most of which is currently beyond me. It started from conversations with a co-worker a couple of years before COVID hit, and the name is a play on Playstation and my name. Concept  The idea behind the Jamestation is to make a game console based loosely on tech available when the original Playstation came out. 32-bit processor, small amount of RAM, that sort of thing. There'd need to be some sort of physical media to give it the flavour of that era of console, probably something NFC based, since who wants to have a spinning media like a CD, or a physical cartridge interface that'd cost quite a bit to implement? I'd implement a lot of components, but I'd make use of off-the-shelf bits when appropriate. In an ideal world it could be productized and made f...
Recent posts

Projects I Wish I Had Mental Space For: nand2tetris in an FPGA

I've been working my way through the nand2tetris book, and am at the point where you pull everything together into a working computer. I got distracted and haven't had the chance to come back to it. But I had plans… Once I'd finished the CPU design I was going to implement it in Verilog  for the DE10 nano . The idea was to output the design's screen to a texture that Linux running on the ARM SoC could put into a window. I'd actually started on the Verilog for different components of the system, although that was just to complete the lessons, using someone else's Verilog of the different chips as a base, and improved on their designs. They were using too many gates for their adder, I believe, among other inefficiencies. I'm a neophyte at FPGA design, but I realized that implementing all the multiplexers and RAM using NAND gates directly was going to under-perform. Not that the design needs the full 50 MHz offered by the board, but it's the principle of t...

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...

Emulator Deep Dive - The Instruction Set: Part 4

This is the fourth part in this series, and will cover flow control instructions. You can find the first post here , the second here , and the third here . Prerequisites None of the flow control operations use the data stack, and only two make use of the return address stack, so knowing about stacks is less important in this post than in the others. Knowledge of other assembly language variants would definitely be an asset, as these follow the same patterns found in other processors. Last Time The last post covered arithmetic and logic unit (ALU) instructions, which modify the condition code (CC) register. Many of the flow control instructions make use of the CC flags to determine whether or not to move execution flow elsewhere. Jumps Jump ( jmp , jsr , rts ) instructions change the program counter (PC) to an absolute address in memory. They are all unconditional, that is, the change in the PC happens regardless of the system's state. jmp changes the PC to an address specified as ...

Emulator Deep Dive - The Instruction Set Part 3

This is the third post in this series and will cover arithmetic and logic unit (ALU) instructions. The operations are pretty straightforward, and there are few caveats, if any. You can find a table of these instructions at the end of the post. You can find the first post here , the second here . Prerequisites There are a couple of prerequisites to fully understanding this series of posts. It will assume you know what a stack is and that you have some knowledge of assembly language. But the content could still be interesting even without that knowledge. I'll leave it to you to decide. Last Time In the last post I covered stack and memory manipulation instructions. Those instructions allowed for manipulation of the values on the stack; shuffling items around, adding items, and removing them. They can be combined with ALU instructions to produce a number of effects. ALU instructions These instructions apply mathematical operators to values from the stack. ALU operations operate exclus...

Emulator Deep Dive - The Instruction Set: Part 2

This is the second post in this series, and will cover stack manipulation instructions. You can find a table of all the stack instructions at the end of this post. You can find the first post here . Prerequisites There are a couple of prerequisites to fully understanding this post. It will assume you know what a stack is (but I've included a refresher) and that you have some knowledge of assembly language. But the content could still be interesting even without that knowledge. I'll leave it to you to decide. Notation The table at the end of this post uses a stack effect notation typically used by Forth . These effect notations are enclosed in parentheses, and consist of a before state and an after state, separated by two dashes. For instance, the swap instruction exchanges the top two items on the stack. This would be noted as (a b -- b a) , showing that before the instruction is executed, b is at the top of the stack, and a is one below the top of the stack. After t...