Close

An assembler and an emulator

A project log for The W-4096: A Computer Made From RTL Logic

A 12-bit computer with a custom CPU made only from individual 2n3904s and 1K and 5K resistors

buzz-pendarvisBuzz Pendarvis 03/22/2021 at 06:130 Comments

bemu: A W-4096/0 Emulator

While developing the ALU board (video coming soon, assuming the boards I ordered work), I created an emulator in C++ that will execute code like the W-4096/0 will. It takes a binary file full of 12-bit little-endian values that are loaded into memory and then executed. 

You can choose to have the accumulator or all of the registers printed to the console either after a halt or after every instruction execution. There's also an option to display a 24-bit number at 4004q whenever 4010q is set to 1.

Currently, the emulator doesn't emulate any of the actual hardware or busses, it just immediately modifies memory based on the instruction that is fed to it. I might change this later, as it makes I/O difficult to emulate. This may also help me fix any bugs that currently exist

The source code can be found here, though I'm not sure if it will work on Windows:

https://github.com/Runnerguy1234/bemu

basm: A W-4096/0 Assembler

Without knowledge of the instruction set or an assembler, the emulator would be difficult to use. That's why my friend pythondude on my Discord server created an assembler written in Racket, a variant of Lisp. Documentation for the instruction set and assembly language can be found in the git repo below.

The source code can be found here:

https://github.com/Runnerguy1234/basm

included in /test_files is demo.asm, a test program that will calculate the Fibonacci sequence using 24 bits until it overflows.

What's next:

Assuming the ALU board design works, there could be a video and post on the ALU within a few days. If it doesn't work, it could be up to a few months before I have a working design. 

Thanks for reading

Discussions