From 6eb02b3b586b8bc604c643e2ccc1ff09394f72a3 Mon Sep 17 00:00:00 2001 From: xamidev <121681048+xamidev@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:25:09 +0200 Subject: [PATCH] fix doc + add 8 regs --- README.md | 6 ++++-- cpu.c | 6 +++--- cpu.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 54b960d..7b4ee72 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ make - 8-bit processing unit - RISC (reduced instruction set computer) -- 4 general purpose registers (labeled R0 to R3) +- 8 general purpose registers (labeled Rx) - 1 input port, 1 output port (via getchar and putchar) - Turing-completeness: bitwise and arithmetic operations @@ -33,9 +33,11 @@ MOV RX, RY ; Put value X in register RX PUT RX, X -; Arithmetic addition and substraction stored in RX +; Arithmetic operations. Result stored in RX ADD RX, RY SUB RX, RY +MUL RX, RY +DIV RX, RY ; Bitwise operations stored in RX OR RX, RY diff --git a/cpu.c b/cpu.c index 7f92d2f..48d6558 100644 --- a/cpu.c +++ b/cpu.c @@ -196,10 +196,10 @@ void cpu_run() 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=0; i