2022-02-02 12:49:45 -08:00
|
|
|
#include <spencer.c>
|
|
|
|
|
2022-02-12 10:52:11 -08:00
|
|
|
uint8_t mmr(spc_cpu* s, uint8_t reg, uint8_t d, uint8_t rw) {
|
2022-02-17 12:27:47 -08:00
|
|
|
//return 0;
|
2022-02-12 10:52:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void stop(spc_cpu* s) {
|
2022-02-02 12:49:45 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
spc_cpu s;
|
2022-02-12 10:52:11 -08:00
|
|
|
spc_init(&s, malloc(0x10000), &mmr, &stop);
|
2022-02-17 12:27:47 -08:00
|
|
|
memset(s.mem, 0, 0x10000);
|
|
|
|
unsigned int icount = 0;
|
2022-02-02 12:49:45 -08:00
|
|
|
// TODO copy in new spc data
|
|
|
|
while(1) {
|
|
|
|
printf( "WAIT: %u\n"
|
|
|
|
"\tPC: 0x%04X\n"
|
|
|
|
"\tSP: 0x%02X\n"
|
|
|
|
"\tA: 0x%02X\n"
|
|
|
|
"\tX: 0x%02X\n"
|
|
|
|
"\tY: 0x%02X\n"
|
2022-02-17 12:27:47 -08:00
|
|
|
"\tP: %c%c%c%c%c%c%c%c\n"
|
|
|
|
"\ticount %u\n"
|
2022-02-02 12:49:45 -08:00
|
|
|
,
|
|
|
|
s.wait,
|
|
|
|
s.PC,
|
|
|
|
s.SP,
|
|
|
|
s.A,
|
|
|
|
s.X,
|
2022-02-17 12:27:47 -08:00
|
|
|
s.Y,
|
|
|
|
s.P >> 7 ? 'N' : '.',
|
|
|
|
s.P >> 6 ? 'V' : '.',
|
|
|
|
s.P >> 5 ? 'P' : '.',
|
|
|
|
s.P >> 4 ? 'B' : '.',
|
|
|
|
s.P >> 3 ? 'H' : '.',
|
|
|
|
s.P >> 2 ? 'I' : '.',
|
|
|
|
s.P >> 1 ? 'Z' : '.',
|
|
|
|
s.P >> 0 ? 'C' : '.',
|
|
|
|
icount
|
2022-02-02 12:49:45 -08:00
|
|
|
);
|
|
|
|
int r = spc_loop(&s);
|
2022-02-17 12:27:47 -08:00
|
|
|
icount++;
|
|
|
|
if(r < 0) exit(printf("error\n"));
|
2022-02-02 12:49:45 -08:00
|
|
|
}
|
|
|
|
return printf("stub\n");
|
|
|
|
}
|