2026-07-15 15:02:54 +10:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "emu.h"
|
2026-07-16 12:04:17 +10:00
|
|
|
#include "util.h"
|
2026-07-15 15:02:54 +10:00
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
Emulator* emu = initEmulator(0x00010FFF);
|
|
|
|
|
if (!emu) {
|
|
|
|
|
fprintf(stderr, "emu: error: failed to allocate memory for emulator\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-16 12:04:17 +10:00
|
|
|
RomFile* romFile = readProgramFromFile("../test.bin");
|
|
|
|
|
|
|
|
|
|
/*Instruction program[] = {
|
2026-07-15 17:31:10 +10:00
|
|
|
{INST_MVI, {REG_A, 0, 0}, 5, true},
|
|
|
|
|
{INST_MVI, {REG_B, 0, 0}, 3, true},
|
2026-07-15 17:52:09 +10:00
|
|
|
{INST_ADD, {REG_A, REG_B, 0}, 0, false},
|
|
|
|
|
{INST_HLT, {}, 0, false}
|
2026-07-16 12:04:17 +10:00
|
|
|
};*/
|
|
|
|
|
printf("%d\n", romFile->header.numInstructions);
|
|
|
|
|
memoryLoadProgram(emu->mem, romFile->instructions, romFile->header.numInstructions);
|
|
|
|
|
|
2026-07-15 15:54:51 +10:00
|
|
|
|
2026-07-16 12:04:17 +10:00
|
|
|
//startEmulator(emu);
|
2026-07-15 15:54:51 +10:00
|
|
|
freeEmulator(emu);
|
2026-07-15 15:02:54 +10:00
|
|
|
|
|
|
|
|
return 0;
|
2026-07-15 15:54:51 +10:00
|
|
|
}
|