summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-11 22:45:05 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-11 22:45:05 -0700
commit4fd8e5c9fe3b0dcbd1f77076b9a10ecb5afff238 (patch)
treed4ca121354f25b89318b1cc9b37d5e73d2e720f8 /vdp.c
parentbd37bedca78611c47b5ecbc7f8a9fbc78c39b910 (diff)
Remove z80_ram reference in SDL renderer to get stateview compiling again. Print out the sprite list in stateview.
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/vdp.c b/vdp.c
index bda38ba..b77d29b 100644
--- a/vdp.c
+++ b/vdp.c
@@ -66,6 +66,24 @@ void render_sprite_cells(vdp_context * context)
}
}
+void vdp_print_sprite_table(vdp_context * context)
+{
+ uint16_t sat_address = (context->regs[REG_SAT] & 0x7F) << 9;
+ uint16_t current_index = 0;
+ uint8_t count = 0;
+ do {
+ uint16_t address = current_index * 8 + sat_address;
+ uint8_t height = ((context->vdpmem[address+2] & 0x3) + 1) * 8;
+ uint8_t width = (((context->vdpmem[address+2] >> 2) & 0x3) + 1) * 8;
+ int16_t y = ((context->vdpmem[address] & 0x3) << 8 | context->vdpmem[address+1]) & 0x1FF;
+ int16_t x = ((context->vdpmem[address+ 2] & 0x3) << 8 | context->vdpmem[address + 3]) & 0x1FF;
+ uint16_t link = context->vdpmem[address+3] & 0x7F;
+ printf("Sprite %d: X=%d, Y=%d, Width=%u, Height=%u, Link=%u\n", current_index, x, y, width, height, link);
+ current_index = link;
+ count++;
+ } while (current_index != 0 && count < 80);
+}
+
void scan_sprite_table(uint32_t line, vdp_context * context)
{
if (context->sprite_index && context->slot_counter) {