A little thingy I made a random computer :3

Its a SAP computer. There would be multiple more here. Fun fact its written in Rust. Which I'm compiling to WASM and runs here.

Currently this computer is preloaded with these instructions for 4 - 2 + 5 + 3 - 6 - 1
You can modify the memory. (You may want to reset the computer to rerun from scratch)

LDA 0x0C
SUB 0x0B
ADD 0x0D
SUB 0x0E
SUB 0x09
OUT
HLT

Extra data at memory
0x09 => 0x01
0x0A => 0x03
0x0B => 0x02
0x0C => 0x04
0x0D => 0x05
0x0E => 0x06

Format of the Instruction :3

So this has pretty simple format where each byte is one instruction splits into two portions. Like 0x83 splits into two portions. The opcode part is high nibble of the hex number so its 0x8 while the other nibble is the operand like argument/parameter for the opcode which is 0x3.

There are 5 specified instructions which are

Opcode Mnemonic Description
0x0 LDA <operand> Loads byte from memory addressed <operand> into accumulator
0x1 ADD <operand> Add byte from memory addressed <operand> into accumulator
0x2 SUB <operand> Subtract byte from memory addressed <operand> from accumulator
0xE OUT Copies byte currently in accumulator into output register
0xF HLT Stop the computer. Computer will not continue execution after this
Mnemonic is a understandable name of what the opcode doing. So instead of 0x14 you can say ADD 0x4.