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; }
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; } }