summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/vdp.c b/vdp.c
index 560d273..f03c516 100644
--- a/vdp.c
+++ b/vdp.c
@@ -140,6 +140,19 @@ void init_vdp_context(vdp_context * context, uint8_t region_pal)
}
}
+void vdp_free(vdp_context *context)
+{
+ free(context->vdpmem);
+ free(context->linebuf);
+ if (headless) {
+ free(context->oddbuf);
+ free(context->evenbuf);
+ } else {
+ render_free_surfaces(context);
+ }
+ free(context);
+}
+
int is_refresh(vdp_context * context, uint32_t slot)
{
if (context->regs[REG_MODE_4] & BIT_H40) {
@@ -847,7 +860,7 @@ void render_map_output(uint32_t line, int32_t col, vdp_context * context)
src |= DBG_HILIGHT;
colors += CRAM_SIZE*2;
}
-
+
uint32_t outpixel;
if (context->debug) {
outpixel = context->debugcolors[src];
@@ -949,7 +962,7 @@ void vdp_advance_line(vdp_context *context)
} else if (!(context->latched_mode & BIT_PAL) && context->vcounter == 0xEB) {
context->vcounter = 0x1E5;
}
-
+
if (context->vcounter > (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START)) {
context->hint_counter = context->regs[REG_HINT];
} else if (context->hint_counter) {
@@ -1020,7 +1033,7 @@ void vdp_advance_line(vdp_context *context)
vdp_advance_line(context);\
}\
CHECK_LIMIT
-
+
#define SPRITE_RENDER_H40(slot) \
case slot:\
render_sprite_cells( context);\
@@ -1038,7 +1051,7 @@ void vdp_advance_line(vdp_context *context)
}\
}\
CHECK_ONLY
-
+
#define SPRITE_RENDER_H32(slot) \
case slot:\
render_sprite_cells( context);\
@@ -1051,7 +1064,7 @@ void vdp_advance_line(vdp_context *context)
}\
context->cycles += slot_cycles;\
CHECK_ONLY
-
+
void vdp_h40(vdp_context * context, uint32_t target_cycles)
{
@@ -1684,7 +1697,7 @@ uint16_t vdp_control_port_read(vdp_context * context)
line > inactive_start
&& line < 0x1FF
)
- || (line == inactive_start
+ || (line == inactive_start
&& (
slot >= (context->regs[REG_MODE_4] & BIT_H40 ? VBLANK_START_H40 : VBLANK_START_H32)
|| slot < (context->regs[REG_MODE_4] & BIT_H40 ? LINE_CHANGE_H40 : LINE_CHANGE_H32)