Mercurial > repos > blastem
comparison vdp.c @ 2358:4b2ac43c106e
Give debugger expression engine access to VDP and Sub CPU values. Add basic variable support
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 28 Oct 2023 00:52:10 -0700 |
parents | bc17ece8dd00 |
children | 04d29635d238 |
comparison
equal
deleted
inserted
replaced
2357:344c6a3fe8a8 | 2358:4b2ac43c106e |
---|---|
714 "HINT Pending: %s\n" | 714 "HINT Pending: %s\n" |
715 "Status: %X\n", | 715 "Status: %X\n", |
716 context->address, context->cd, cd_name(context->cd), | 716 context->address, context->cd, cd_name(context->cd), |
717 (context->flags & FLAG_PENDING) ? "word" : (context->flags2 & FLAG2_BYTE_PENDING) ? "byte" : "none", | 717 (context->flags & FLAG_PENDING) ? "word" : (context->flags2 & FLAG2_BYTE_PENDING) ? "byte" : "none", |
718 context->vcounter, context->hslot*2, (context->flags2 & FLAG2_VINT_PENDING) ? "true" : "false", | 718 context->vcounter, context->hslot*2, (context->flags2 & FLAG2_VINT_PENDING) ? "true" : "false", |
719 (context->flags2 & FLAG2_HINT_PENDING) ? "true" : "false", vdp_control_port_read(context)); | 719 (context->flags2 & FLAG2_HINT_PENDING) ? "true" : "false", vdp_status(context)); |
720 printf("\nDebug Register: %X | Output disabled: %s, Force Layer: %d\n", context->test_port, | 720 printf("\nDebug Register: %X | Output disabled: %s, Force Layer: %d\n", context->test_port, |
721 (context->test_port & TEST_BIT_DISABLE) ? "true" : "false", context->test_port >> 7 & 3 | 721 (context->test_port & TEST_BIT_DISABLE) ? "true" : "false", context->test_port >> 7 & 3 |
722 ); | 722 ); |
723 //restore flags as calling vdp_control_port_read can change them | |
724 context->flags = old_flags; | |
725 context->flags2 = old_flags2; | |
726 } | 723 } |
727 | 724 |
728 static uint8_t is_active(vdp_context *context) | 725 static uint8_t is_active(vdp_context *context) |
729 { | 726 { |
730 return context->state != INACTIVE && (context->regs[REG_MODE_2] & BIT_DISP_EN) != 0; | 727 return context->state != INACTIVE && (context->regs[REG_MODE_2] & BIT_DISP_EN) != 0; |
4829 void vdp_test_port_write(vdp_context * context, uint16_t value) | 4826 void vdp_test_port_write(vdp_context * context, uint16_t value) |
4830 { | 4827 { |
4831 context->test_port = value; | 4828 context->test_port = value; |
4832 } | 4829 } |
4833 | 4830 |
4834 uint16_t vdp_control_port_read(vdp_context * context) | 4831 uint16_t vdp_status(vdp_context *context) |
4835 { | 4832 { |
4836 context->flags &= ~FLAG_PENDING; | |
4837 context->flags2 &= ~FLAG2_BYTE_PENDING; | |
4838 //Bits 15-10 are not fixed like Charles MacDonald's doc suggests, but instead open bus values that reflect 68K prefetch | 4833 //Bits 15-10 are not fixed like Charles MacDonald's doc suggests, but instead open bus values that reflect 68K prefetch |
4839 uint16_t value = context->system->get_open_bus_value(context->system) & 0xFC00; | 4834 uint16_t value = context->system->get_open_bus_value(context->system) & 0xFC00; |
4840 if (context->fifo_read < 0) { | 4835 if (context->fifo_read < 0) { |
4841 value |= 0x200; | 4836 value |= 0x200; |
4842 } | 4837 } |
4846 if (context->flags2 & FLAG2_VINT_PENDING) { | 4841 if (context->flags2 & FLAG2_VINT_PENDING) { |
4847 value |= 0x80; | 4842 value |= 0x80; |
4848 } | 4843 } |
4849 if (context->flags & FLAG_DOT_OFLOW) { | 4844 if (context->flags & FLAG_DOT_OFLOW) { |
4850 value |= 0x40; | 4845 value |= 0x40; |
4851 context->flags &= ~FLAG_DOT_OFLOW; | |
4852 } | 4846 } |
4853 if (context->flags2 & FLAG2_SPRITE_COLLIDE) { | 4847 if (context->flags2 & FLAG2_SPRITE_COLLIDE) { |
4854 value |= 0x20; | 4848 value |= 0x20; |
4855 context->flags2 &= ~FLAG2_SPRITE_COLLIDE; | |
4856 } | 4849 } |
4857 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && !(context->flags2 & FLAG2_EVEN_FIELD)) { | 4850 if ((context->regs[REG_MODE_4] & BIT_INTERLACE) && !(context->flags2 & FLAG2_EVEN_FIELD)) { |
4858 value |= 0x10; | 4851 value |= 0x10; |
4859 } | 4852 } |
4860 uint32_t slot = context->hslot; | 4853 uint32_t slot = context->hslot; |
4874 value |= 0x2; | 4867 value |= 0x2; |
4875 } | 4868 } |
4876 if (context->flags2 & FLAG2_REGION_PAL) { | 4869 if (context->flags2 & FLAG2_REGION_PAL) { |
4877 value |= 0x1; | 4870 value |= 0x1; |
4878 } | 4871 } |
4872 return value; | |
4873 } | |
4874 | |
4875 uint16_t vdp_control_port_read(vdp_context * context) | |
4876 { | |
4877 uint16_t value = vdp_status(context); | |
4878 context->flags &= ~(FLAG_DOT_OFLOW|FLAG_PENDING); | |
4879 context->flags2 &= ~(FLAG2_SPRITE_COLLIDE|FLAG2_BYTE_PENDING); | |
4879 //printf("status read at cycle %d returned %X\n", context->cycles, value); | 4880 //printf("status read at cycle %d returned %X\n", context->cycles, value); |
4880 return value; | 4881 return value; |
4881 } | 4882 } |
4882 | 4883 |
4883 uint16_t vdp_data_port_read(vdp_context * context, uint32_t *cpu_cycle, uint32_t cpu_divider) | 4884 uint16_t vdp_data_port_read(vdp_context * context, uint32_t *cpu_cycle, uint32_t cpu_divider) |