comparison sms.c @ 2305:6aca1734d573

Merge
author Michael Pavone <pavone@retrodev.com>
date Wed, 15 Mar 2023 19:28:11 -0700
parents 0343f0d5add0
children 8016dbb0fcde
comparison
equal deleted inserted replaced
2304:b3832f73444f 2305:6aca1734d573
424 load_state(system, system->delayed_load_slot - 1); 424 load_state(system, system->delayed_load_slot - 1);
425 system->delayed_load_slot = 0; 425 system->delayed_load_slot = 0;
426 426
427 } 427 }
428 if (sms->vdp->frame != sms->last_frame) { 428 if (sms->vdp->frame != sms->last_frame) {
429 #ifndef IS_LIB
429 if (sms->psg->scope) { 430 if (sms->psg->scope) {
430 scope_render(sms->psg->scope); 431 scope_render(sms->psg->scope);
431 } 432 }
433 #endif
432 uint32_t elapsed = sms->vdp->frame - sms->last_frame; 434 uint32_t elapsed = sms->vdp->frame - sms->last_frame;
433 sms->last_frame = sms->vdp->frame; 435 sms->last_frame = sms->vdp->frame;
434 if (system->enter_debugger_frames) { 436 if (system->enter_debugger_frames) {
435 if (elapsed >= system->enter_debugger_frames) { 437 if (elapsed >= system->enter_debugger_frames) {
436 system->enter_debugger_frames = 0; 438 system->enter_debugger_frames = 0;
448 } 450 }
449 } 451 }
450 } 452 }
451 if (system->enter_debugger && sms->z80->pc) { 453 if (system->enter_debugger && sms->z80->pc) {
452 system->enter_debugger = 0; 454 system->enter_debugger = 0;
455 #ifndef IS_LIB
453 zdebugger(sms->z80, sms->z80->pc); 456 zdebugger(sms->z80, sms->z80->pc);
457 #endif
454 } 458 }
455 #ifdef NEW_CORE 459 #ifdef NEW_CORE
456 if (sms->z80->nmi_cycle == CYCLE_NEVER) { 460 if (sms->z80->nmi_cycle == CYCLE_NEVER) {
457 #else 461 #else
458 if (sms->z80->nmi_start == CYCLE_NEVER) { 462 if (sms->z80->nmi_start == CYCLE_NEVER) {
521 load_state_path(sms, statefile); 525 load_state_path(sms, statefile);
522 } 526 }
523 527
524 if (system->enter_debugger) { 528 if (system->enter_debugger) {
525 system->enter_debugger = 0; 529 system->enter_debugger = 0;
530 #ifndef IS_LIB
526 zinsert_breakpoint(sms->z80, sms->z80->pc, (uint8_t *)zdebugger); 531 zinsert_breakpoint(sms->z80, sms->z80->pc, (uint8_t *)zdebugger);
532 #endif
527 } 533 }
528 534
529 run_sms(system); 535 run_sms(system);
530 } 536 }
531 537
651 setup_io_devices(config, &system->info, &sms->io); 657 setup_io_devices(config, &system->info, &sms->io);
652 } 658 }
653 659
654 static void toggle_debug_view(system_header *system, uint8_t debug_view) 660 static void toggle_debug_view(system_header *system, uint8_t debug_view)
655 { 661 {
662 #ifndef IS_LIB
656 sms_context *sms = (sms_context *)system; 663 sms_context *sms = (sms_context *)system;
657 if (debug_view < DEBUG_OSCILLOSCOPE) { 664 if (debug_view < DEBUG_OSCILLOSCOPE) {
658 vdp_toggle_debug_view(sms->vdp, debug_view); 665 vdp_toggle_debug_view(sms->vdp, debug_view);
659 } else if (debug_view == DEBUG_OSCILLOSCOPE) { 666 } else if (debug_view == DEBUG_OSCILLOSCOPE) {
660 if (sms->psg->scope) { 667 if (sms->psg->scope) {
664 } else { 671 } else {
665 oscilloscope *scope = create_oscilloscope(); 672 oscilloscope *scope = create_oscilloscope();
666 psg_enable_scope(sms->psg, scope, sms->normal_clock); 673 psg_enable_scope(sms->psg, scope, sms->normal_clock);
667 } 674 }
668 } 675 }
676 #endif
669 } 677 }
670 678
671 sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t force_region) 679 sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t force_region)
672 { 680 {
673 sms_context *sms = calloc(1, sizeof(sms_context)); 681 sms_context *sms = calloc(1, sizeof(sms_context));