summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render_sdl.c7
-rw-r--r--stateview.c1
-rw-r--r--vdp.c18
-rw-r--r--vdp.h1
4 files changed, 20 insertions, 7 deletions
diff --git a/render_sdl.c b/render_sdl.c
index a884fe4..a40887f 100644
--- a/render_sdl.c
+++ b/render_sdl.c
@@ -232,7 +232,6 @@ void render_wait_quit(vdp_context * context)
#define MIN_DELAY 5
uint32_t frame_counter = 0;
uint32_t start = 0;
-extern uint8_t z80_ram[];
int wait_render_frame(vdp_context * context)
{
FILE * outfile;
@@ -352,12 +351,6 @@ int wait_render_frame(vdp_context * context)
case SDLK_f:
gamepad_1.input[GAMEPAD_EXTRA] &= ~BUTTON_MODE;
break;
- case SDLK_z:{
- FILE * f = fopen("zram.bin", "wb");
- fwrite(z80_ram, 1, 8 * 1024, f);
- fclose(f);
- break;
- }
}
break;
case SDL_QUIT:
diff --git a/stateview.c b/stateview.c
index a7c030c..db19cfa 100644
--- a/stateview.c
+++ b/stateview.c
@@ -38,6 +38,7 @@ int main(int argc, char ** argv)
init_vdp_context(&context);
vdp_load_savestate(&context, state_file);
vdp_run_to_vblank(&context);
+ vdp_print_sprite_table(&context);
printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
render_init(width, height);
render_context(&context);
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) {
diff --git a/vdp.h b/vdp.h
index 435ccf0..cd131b2 100644
--- a/vdp.h
+++ b/vdp.h
@@ -141,5 +141,6 @@ void vdp_adjust_cycles(vdp_context * context, uint32_t deduction);
uint32_t vdp_next_hint(vdp_context * context);
uint32_t vdp_next_vint(vdp_context * context);
void vdp_int_ack(vdp_context * context, uint16_t int_num);
+void vdp_print_sprite_table(vdp_context * context);
#endif //VDP_H_