int sms_z80_init(void) { cpuz80 = (CrabZ80_t *)malloc(sizeof(CrabZ80_t)); if(cpuz80 == NULL) { fprintf(stderr, "Out of memory while initializing Z80 in debug mode\n"); return -1; } /* Initialize CrabZ80 */ CrabZ80_init(cpuz80); CrabZ80_reset(cpuz80); CrabZ80_set_memwrite(cpuz80, sms_debug_memwrite); CrabZ80_set_memread(cpuz80, sms_debug_memread); CrabZ80_set_portwrite(cpuz80, sms_debug_portwrite); CrabZ80_set_portread(cpuz80, sms_debug_portread); z80_init(); z80_reset(); return 0; }
void sms_z80_set_mread(uint8 (*mread)(uint16)) { CrabZ80_set_memread(cpuz80, mread); }