add file loading
This commit is contained in:
17
src/main.c
17
src/main.c
@@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include "emu.h"
|
||||
#include "util.h"
|
||||
|
||||
int main() {
|
||||
Emulator* emu = initEmulator(0x00010FFF);
|
||||
@@ -8,19 +9,19 @@ int main() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Instruction program[] = {
|
||||
RomFile* romFile = readProgramFromFile("../test.bin");
|
||||
|
||||
/*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},
|
||||
{INST_HLT, {}, 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)));
|
||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||
};*/
|
||||
printf("%d\n", romFile->header.numInstructions);
|
||||
memoryLoadProgram(emu->mem, romFile->instructions, romFile->header.numInstructions);
|
||||
|
||||
|
||||
//startEmulator(emu);
|
||||
freeEmulator(emu);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user