Perri Nelson's Electromechanical Computer Simulation


Published Friday, February 22, 2008 10:01 AM
Updated Tuesday, September 30, 2008 2:23 PM

My Electromechanical Computer simulation can be found here. Currently it's in ALPHA release.

As I implement more features, you can expect to see more detail here.

Setup Application


The current version's setup application can always be found here. This is a Windows Installer package that will remove any existing versions of the application and install the current version.

[Update: I have fixed the "Use Fast RAM" menu item. It now displays a checkmark if the simulation is using the "Fast" RAM (implemented using 64KB of real RAM) rather than the simulated relay based RAM.]

[Update 2: I've finally gotten around to implementing the trackbar that I had in the original .NET version. This trackbar will adjust the delay between "steps" of the clock. The smallest delay results in the fastest clock speed, and vice versa. With the trackbar slider all the way to the left, the delay will be the smallest and your programs will execute the fastest. With the trackbar slider all the way to the right, there will be a significant delay between clock cycles, allowing you to view the execution of your program in more detail.]

Division Routines


I've implemented a simple eight bit division program and a more useful sixteen bit division program using the simulation. A zip file containing the assembly language source code, complete with the hand assembled machine code can be found here. There are also two memory image files so that you don't have to toggle in the complete programs using the control panel interface.

Instruction Set


These instructions require three bytes, the Opcode, the high-order byte of the 16-bit address, and the low order byte of the 16-bit address.

Mnemonic Opcode
(hexadecimal)
Opcode
(binary)
Description
LOD 10 0001 0000 Load byte into accumulator
STO 11 0001 0001 Store byte in accumulator to memory
ADD 20 0010 0000 Add byte to accumulator
SUB 21 0010 0001 Subtract byte from accumulator
ADC 22 0010 0010 Add byte to accumulator, with carry input
SBB 23 0010 0011 Subtract byte from accumulator, with borrow
JMP 30 0011 0000 Unconditional jump
JZ 31 0011 0001 Jump if zero
JC 32 0011 0010 Jump if carry
JNZ 33 0011 0011 Jump if not zero
JNC 34 0011 0100 Jump if not carry
OR 40 0100 0000 Bitwise OR byte in accumulator with memory.
AND 41 0100 0001 Bitwise AND byte in accumulator with memory.
XOR 42 0100 0010 Bitwise XOR byte in accumulator with memory.

These instructions require one byte, the Opcode.

Mnemonic Opcode
(hexadecimal)
Opcode
(binary)
Description
SHL 44 0100 0100 Shift accumulator left 1 bit
SHR 45 0100 0101 Shift accumulator right 1 bit
HLT FF 1111 1111 Halt the processor