2015-09-13 00:09:01 +00:00
|
|
|
//
|
|
|
|
// main.c
|
|
|
|
// apple1
|
|
|
|
//
|
|
|
|
// Created by Daniel Loffgren on 9/12/15.
|
|
|
|
// Copyright (c) 2015 Daniel Loffgren. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2015-09-13 00:17:41 +00:00
|
|
|
#include <v6502/cpu.h>
|
|
|
|
#include <v6502/mem.h>
|
2015-09-13 00:09:01 +00:00
|
|
|
|
2015-09-13 00:17:41 +00:00
|
|
|
void fault(void *ctx, const char *e) {
|
|
|
|
(*(int *)ctx)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, const char * argv[])
|
|
|
|
{
|
|
|
|
int faulted = 0;
|
|
|
|
|
|
|
|
v6502_cpu *cpu = v6502_createCPU();
|
|
|
|
cpu->memory = v6502_createMemory(0xFFFF);
|
|
|
|
cpu->fault_callback = fault;
|
|
|
|
cpu->fault_context = &faulted;
|
|
|
|
|
|
|
|
v6502_reset(cpu);
|
|
|
|
|
|
|
|
while (!faulted) {
|
|
|
|
v6502_step(cpu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
v6502_destroyMemory(cpu->memory);
|
|
|
|
v6502_destroyCPU(cpu);
|
2015-09-13 00:09:01 +00:00
|
|
|
}
|