Mercurial > repos > blastem
comparison sms.c @ 2243:0d1d5dccdd28
Initial implementation of oscilloscope debug view
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 22 Nov 2022 17:57:02 -0800 |
parents | ee6d30c56eeb |
children | cbe1ba70c247 |
comparison
equal
deleted
inserted
replaced
2240:8e8db9141209 | 2243:0d1d5dccdd28 |
---|---|
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 if (sms->psg->scope) { | |
430 scope_render(sms->psg->scope); | |
431 } | |
429 uint32_t elapsed = sms->vdp->frame - sms->last_frame; | 432 uint32_t elapsed = sms->vdp->frame - sms->last_frame; |
430 sms->last_frame = sms->vdp->frame; | 433 sms->last_frame = sms->vdp->frame; |
431 if (system->enter_debugger_frames) { | 434 if (system->enter_debugger_frames) { |
432 if (elapsed >= system->enter_debugger_frames) { | 435 if (elapsed >= system->enter_debugger_frames) { |
433 system->enter_debugger_frames = 0; | 436 system->enter_debugger_frames = 0; |
646 { | 649 { |
647 sms_context *sms = (sms_context *)system; | 650 sms_context *sms = (sms_context *)system; |
648 setup_io_devices(config, &system->info, &sms->io); | 651 setup_io_devices(config, &system->info, &sms->io); |
649 } | 652 } |
650 | 653 |
654 static void toggle_debug_view(system_header *system, uint8_t debug_view) | |
655 { | |
656 sms_context *sms = (sms_context *)system; | |
657 if (debug_view < DEBUG_OSCILLOSCOPE) { | |
658 vdp_toggle_debug_view(sms->vdp, debug_view); | |
659 } else if (debug_view == DEBUG_OSCILLOSCOPE) { | |
660 if (sms->psg->scope) { | |
661 oscilloscope *scope = sms->psg->scope; | |
662 sms->psg->scope = NULL; | |
663 scope_close(scope); | |
664 } else { | |
665 oscilloscope *scope = create_oscilloscope(); | |
666 psg_enable_scope(sms->psg, scope); | |
667 } | |
668 } | |
669 } | |
651 | 670 |
652 sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t force_region) | 671 sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t force_region) |
653 { | 672 { |
654 sms_context *sms = calloc(1, sizeof(sms_context)); | 673 sms_context *sms = calloc(1, sizeof(sms_context)); |
655 uint32_t rom_size = nearest_pow2(media->size); | 674 uint32_t rom_size = nearest_pow2(media->size); |
748 sms->header.keyboard_down = keyboard_down; | 767 sms->header.keyboard_down = keyboard_down; |
749 sms->header.keyboard_up = keyboard_up; | 768 sms->header.keyboard_up = keyboard_up; |
750 sms->header.config_updated = config_updated; | 769 sms->header.config_updated = config_updated; |
751 sms->header.serialize = serialize; | 770 sms->header.serialize = serialize; |
752 sms->header.deserialize = deserialize; | 771 sms->header.deserialize = deserialize; |
772 sms->header.toggle_debug_view = toggle_debug_view; | |
753 sms->header.type = SYSTEM_SMS; | 773 sms->header.type = SYSTEM_SMS; |
754 | 774 |
755 return sms; | 775 return sms; |
756 } | 776 } |