comparison sms.c @ 1507:2455662378ed mame_interp

Added MAME Z80 core, re-enabled 68K tracing in Musashi core, disabled a bunch of code gen stuff when using interpreters from MAME
author Michael Pavone <pavone@retrodev.com>
date Sat, 30 Dec 2017 18:27:06 -0800
parents c886c54d8cf1
children b7ecd0d6a77b
comparison
equal deleted inserted replaced
1506:ded16f3d7eb4 1507:2455662378ed
346 uint32_t target_cycle = sms->z80->current_cycle + 3420*16; 346 uint32_t target_cycle = sms->z80->current_cycle + 3420*16;
347 //TODO: PAL support 347 //TODO: PAL support
348 render_set_video_standard(VID_NTSC); 348 render_set_video_standard(VID_NTSC);
349 while (!sms->should_return) 349 while (!sms->should_return)
350 { 350 {
351 #ifdef USE_NATIVE
351 if (system->enter_debugger && sms->z80->pc) { 352 if (system->enter_debugger && sms->z80->pc) {
352 system->enter_debugger = 0; 353 system->enter_debugger = 0;
353 zdebugger(sms->z80, sms->z80->pc); 354 zdebugger(sms->z80, sms->z80->pc);
354 } 355 }
356 #endif
355 if (sms->z80->nmi_start == CYCLE_NEVER) { 357 if (sms->z80->nmi_start == CYCLE_NEVER) {
356 uint32_t nmi = vdp_next_nmi(sms->vdp); 358 uint32_t nmi = vdp_next_nmi(sms->vdp);
357 if (nmi != CYCLE_NEVER) { 359 if (nmi != CYCLE_NEVER) {
358 z80_assert_nmi(sms->z80, nmi); 360 z80_assert_nmi(sms->z80, nmi);
359 } 361 }
364 } 366 }
365 target_cycle = sms->z80->current_cycle; 367 target_cycle = sms->z80->current_cycle;
366 vdp_run_context(sms->vdp, target_cycle); 368 vdp_run_context(sms->vdp, target_cycle);
367 psg_run(sms->psg, target_cycle); 369 psg_run(sms->psg, target_cycle);
368 370
371 #ifdef USE_NATIVE
369 if (system->save_state) { 372 if (system->save_state) {
370 while (!sms->z80->pc) { 373 while (!sms->z80->pc) {
371 //advance Z80 to an instruction boundary 374 //advance Z80 to an instruction boundary
372 z80_run(sms->z80, sms->z80->current_cycle + 1); 375 z80_run(sms->z80, sms->z80->current_cycle + 1);
373 } 376 }
374 save_state(sms, system->save_state - 1); 377 save_state(sms, system->save_state - 1);
375 system->save_state = 0; 378 system->save_state = 0;
376 } 379 }
380 #endif
377 381
378 target_cycle += 3420*16; 382 target_cycle += 3420*16;
379 if (target_cycle > 0x10000000) { 383 if (target_cycle > 0x10000000) {
380 uint32_t adjust = sms->z80->current_cycle - 3420*262*2; 384 uint32_t adjust = sms->z80->current_cycle - 3420*262*2;
381 io_adjust_cycles(sms->io.ports, sms->z80->current_cycle, adjust); 385 io_adjust_cycles(sms->io.ports, sms->z80->current_cycle, adjust);
408 412
409 if (statefile) { 413 if (statefile) {
410 load_state_path(sms, statefile); 414 load_state_path(sms, statefile);
411 } 415 }
412 416
417 #ifdef USE_NATIVE
413 if (system->enter_debugger) { 418 if (system->enter_debugger) {
414 system->enter_debugger = 0; 419 system->enter_debugger = 0;
415 zinsert_breakpoint(sms->z80, sms->z80->pc, (uint8_t *)zdebugger); 420 zinsert_breakpoint(sms->z80, sms->z80->pc, (uint8_t *)zdebugger);
416 } 421 }
422 #endif
417 423
418 run_sms(system); 424 run_sms(system);
419 } 425 }
420 426
421 static void soft_reset(system_header *system) 427 static void soft_reset(system_header *system)
422 { 428 {
423 sms_context *sms = (sms_context *)system; 429 sms_context *sms = (sms_context *)system;
424 z80_assert_reset(sms->z80, sms->z80->current_cycle); 430 z80_assert_reset(sms->z80, sms->z80->current_cycle);
431 #ifdef USE_NATIVE
425 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->current_cycle; 432 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->current_cycle;
433 #endif
426 } 434 }
427 435
428 static void free_sms(system_header *system) 436 static void free_sms(system_header *system)
429 { 437 {
430 sms_context *sms = (sms_context *)system; 438 sms_context *sms = (sms_context *)system;