more changes

This commit is contained in:
Rose Apollo 2024-12-10 11:03:41 +00:00 committed by ROSE BARRATT
parent b5ff47346c
commit f177471663
4 changed files with 10 additions and 6 deletions

View File

@ -14,6 +14,8 @@ add_executable(r16a
./asm/assembler.c ./asm/assembler.c
./asm/assembler.h ./asm/assembler.h
./asm/asm_const.h ./asm/asm_const.h
./emu/cpu_const.h
./emu/cpu_human.h
) )
add_executable(r16e add_executable(r16e

View File

@ -207,7 +207,7 @@ uint16_t *BinaryInstructionToBin(BinaryInstruction instruction)
return bin; 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++) for (int i = 0; i < x; i++)
{ {
@ -333,6 +333,7 @@ uint16_t *CompileAsembly(AsmInstructionArray *assembly, AsmLabelArray *labels)
BinaryInstruction binaryIns; BinaryInstruction binaryIns;
int instruction = WhereIn2DCharArray(LEN(CpuInstructionsHumanReadable), int instruction = WhereIn2DCharArray(LEN(CpuInstructionsHumanReadable),
LEN(CpuInstructionsHumanReadable[0]),
CpuInstructionsHumanReadable, CpuInstructionsHumanReadable,
assembly->instruction[i].instruction); assembly->instruction[i].instruction);

View File

@ -6,11 +6,11 @@
#include <stdint.h> #include <stdint.h>
const char demo[] = const char demo[] =
"mov R0, 1\n\ "mov R0, 0x1\n\
mov ACU, 0\n\ mov ACU, 0x0\n\
loop: add ACU, R0\n\ loop: add ACU, R0\n\
out ACU\n\ out ACU, 0x0\n\
jmp loop\n"; jmp loop, 0x0\n";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {

View File

@ -47,6 +47,7 @@ char CpuInstructionsHumanReadable[25][4] =
"OUT", "OUT",
"DIN", "DIN",
"DOT", "DOT",
"MOV"}; "MOV"
};
#endif #endif