This is a technically-finished 16-bit CPU instruction set and emulator, written for a CS301 project. I didn't have as much time to work on it as I wanted, so as a result it's not as polished or feature-complete as I planned, but it does work.
nop nop: Does nothingmov dst, src: Copies data from one register to anotheradd dst, src: Adds two registerssub dst, src: Subtractsdstregister fromsrcregisterpush src: Pushessrconto the stackpop dst: Pops the value on top of the stack intodstjmp dst: Sets the instruction pointer to the literal addressdstcmp arg0, arg1: Comparesarg0andarg1je dst: Jumps to literal valuedstifarg0andarg1were equaljg dst: Jumps ifarg0>arg1jge dst: Jumps ifarg0>=arg1jl dst: Jumps ifarg0<arg1jle dst: Jumps ifarg0<=arg1jne dst: Jumps ifarg0!=arg1set dst, value: Sets registerdstto literalvaluesave dst, src: Saves registersrcto memory at literaldstload dst, src: Loads memory at literalsrcinto registerdstout src: Passes the integer at registersrcto the output functionmul dst, src: Multipliessrcanddstregisters
- Parse and map labels
- Let
outprint non-integers retinstruction