diff --git a/README.md b/README.md index 7b4ee72..5acfb89 100644 --- a/README.md +++ b/README.md @@ -69,4 +69,4 @@ HLT ## Known bugs -- R0 is not usable (confusion with NOP opcode 0 in memory) +- None for now? If you find one, please open an issue. diff --git a/cpu.c b/cpu.c index 48d6558..d4f0487 100644 --- a/cpu.c +++ b/cpu.c @@ -197,7 +197,7 @@ void cpu_dump() { printf("\n*** CPU state dump ***\nPC: 0x%x\nEqual flag: %d\nHalted: %d\n\n", cpu.pc, cpu.equal_flag, cpu.halted); - for (size_t i=1; i No operation - NOP = 0, - // 0xA? -> Memory operations MOV = 0xA0, - PUT = 0xA1, + PUT = 0xA1, // 0xB? -> Arithmetic operations ADD = 0xB0, @@ -41,12 +38,13 @@ typedef enum CMP = 0xE2, // 0xF? -> Misc operations + NOP = 0xFE, HLT = 0xFF } instruction_set_t; /* * CPU structure definition - * Contains 4 8-bit registers, memory, a program counter, a halt switch, and flags. + * Contains 8-bit registers, memory, a program counter, a halt switch, and flags. */ typedef struct diff --git a/program.asm b/program.asm index 4b8d7ad..664de0c 100644 --- a/program.asm +++ b/program.asm @@ -1,6 +1,6 @@ ;this is a comment -PUT R2, 5 +PUT R0, 5 PUT R3, 2 -DIV R2, R3 +ADD R0, R3 HLT