instruction encoding and decoding working
This commit is contained in:
12
src/main.c
12
src/main.c
@@ -8,8 +8,16 @@ int main() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Instruction inst = decodeInstruction(emu->mem, &emu->pc);
|
||||
printf("%s\n", instructionToCStr(inst));
|
||||
Instruction program[] = {
|
||||
{INST_MVI, {REG_A, 0, 0}, 5, true},
|
||||
{INST_MVI, {REG_B, 0, 0}, 3, true},
|
||||
{INST_ADD, {REG_A, REG_B, 0}, 0, false}
|
||||
};
|
||||
memoryLoadProgram(emu->mem, program, sizeof(program)/sizeof(program[0]));
|
||||
|
||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||
|
||||
freeEmulator(emu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user