From f177471663530653699330e2c2c447b1ce75cced Mon Sep 17 00:00:00 2001 From: Rose Apollo Date: Tue, 10 Dec 2024 11:03:41 +0000 Subject: [PATCH] more changes --- CMakeLists.txt | 2 ++ asm/assembler.c | 3 ++- asm/main.c | 8 ++++---- emu/cpu_human.h | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25470fd..9bf51fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ add_executable(r16a ./asm/assembler.c ./asm/assembler.h ./asm/asm_const.h + ./emu/cpu_const.h + ./emu/cpu_human.h ) add_executable(r16e diff --git a/asm/assembler.c b/asm/assembler.c index 97d7eba..9d9be4d 100644 --- a/asm/assembler.c +++ b/asm/assembler.c @@ -207,7 +207,7 @@ uint16_t *BinaryInstructionToBin(BinaryInstruction instruction) return bin; } -int WhereIn2DCharArray(int x, char **array, char *val) +int WhereIn2DCharArray(int x, int y, char array[25][4], char* val) { for (int i = 0; i < x; i++) { @@ -333,6 +333,7 @@ uint16_t *CompileAsembly(AsmInstructionArray *assembly, AsmLabelArray *labels) BinaryInstruction binaryIns; int instruction = WhereIn2DCharArray(LEN(CpuInstructionsHumanReadable), + LEN(CpuInstructionsHumanReadable[0]), CpuInstructionsHumanReadable, assembly->instruction[i].instruction); diff --git a/asm/main.c b/asm/main.c index 513b2b3..358b146 100644 --- a/asm/main.c +++ b/asm/main.c @@ -6,11 +6,11 @@ #include const char demo[] = -"mov R0, 1\n\ -mov ACU, 0\n\ +"mov R0, 0x1\n\ +mov ACU, 0x0\n\ loop: add ACU, R0\n\ -out ACU\n\ -jmp loop\n"; +out ACU, 0x0\n\ +jmp loop, 0x0\n"; int main(int argc, char **argv) { diff --git a/emu/cpu_human.h b/emu/cpu_human.h index 58173b8..0d96e58 100644 --- a/emu/cpu_human.h +++ b/emu/cpu_human.h @@ -47,6 +47,7 @@ char CpuInstructionsHumanReadable[25][4] = "OUT", "DIN", "DOT", - "MOV"}; + "MOV" +}; #endif \ No newline at end of file