int dbg_68k_run(Uint32 nbcycle) { int i = 0; while (i < nbcycle) { // printf("%x\n",cpu_68k_getpc()); if (check_bp(cpu_68k_getpc())) { cpu_68k_disassemble(cpu_68k_getpc(), 1); debug_interf(); } i += cpu_68k_run_step(); } return i; }
void cpu_68k_dpg_step(void) { static Uint32 nb_cycle; static Uint32 line_cycle; Uint32 cpu_68k_timeslice = 200000; Uint32 cpu_68k_timeslice_scanline = 200000/(float)262; Uint32 cycle; if (nb_cycle==0) { main_loop(); /* update event etc. */ } cycle=cpu_68k_run_step(); add_bt(cpu_68k_getpc()); line_cycle+=cycle; nb_cycle+=cycle; if (nb_cycle>=cpu_68k_timeslice) { nb_cycle=line_cycle=0; if (conf.raster) { update_screen(); } else { neo_interrupt(); } state_handling(pending_save_state,pending_load_state); cpu_68k_interrupt(1); } else { if (line_cycle>=cpu_68k_timeslice_scanline) { line_cycle=0; if (conf.raster) { if (update_scanline()) cpu_68k_interrupt(2); } } } }
static void dbg_get(char* s, int size) { //char buf[size]; char *args,*argsend; int pc; fgets(s, size, stdin); args = s + 1; while((*args) && ((*args) < 32)) args++; switch (s[0]) { case '?': printf("B [address] Add a breakpoint at [address]\n" "N [address] Del breakpoint at [address]\n" "R Run until breakpoint\n"); return; case 'B': if (args) { pc=strtoul(args,&argsend,0); if (args != argsend) add_bp(pc); else printf("Invalid input\n"); } s[0]=0; break; case 'N': if (args) { pc=strtoul(args,&argsend,0); if (args != argsend) del_bp(pc); else printf("Invalid input\n"); } s[0]=0; break; case 'R': while(check_bp(cpu_68k_getpc())!=SDL_TRUE && dbg_step==0) { cpu_68k_dpg_step(); } if (dbg_step) dbg_step=0; s[0]=0; break; } }