summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-03-09 19:23:24 -0800
committerMichael Pavone <pavone@retrodev.com>2017-03-09 19:23:24 -0800
commit4bfa16d18f683c01bbc8b67de5575e6e54123f92 (patch)
tree50d9b6f891d64f1665ae9c2e76b7f30844207a15 /vdp.c
parent85fc5a03bc006e3edcca16c40cfb974b5c80743b (diff)
Fix graphical corruption and sprite flickering introduced into some games by the last change for horizontal border support
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vdp.c b/vdp.c
index c36c2ab..5b96b6e 100644
--- a/vdp.c
+++ b/vdp.c
@@ -1497,6 +1497,7 @@ static void vdp_advance_line(vdp_context *context)
} else if (context->vcounter == 0xDB) {
context->vcounter = 0x1D5;
}
+ context->vcounter &= 0x1FF;
if (context->vcounter > context->inactive_start) {
context->hint_counter = context->regs[REG_HINT];
@@ -1517,7 +1518,7 @@ static void advance_output_line(vdp_context *context)
}
context->vcounter &= 0x1FF;
} else {
- if (context->vcounter == context->inactive_start) {
+ if (context->vcounter == (context->inactive_start & 0x1FF)) {
render_framebuffer_updated(context->flags2 & FLAG2_EVEN_FIELD ? FRAMEBUFFER_EVEN: FRAMEBUFFER_ODD, context->h40_lines > (context->inactive_start + context->border_top) / 2 ? LINEBUF_SIZE : (256+HORIZ_BORDER));
if (context->double_res) {
context->flags2 ^= FLAG2_EVEN_FIELD;
@@ -1526,7 +1527,6 @@ static void advance_output_line(vdp_context *context)
context->h40_lines = 0;
context->frame++;
}
- context->vcounter &= 0x1FF;
uint32_t output_line;
if (context->vcounter < context->inactive_start + context->border_bot) {
output_line = context->border_top + context->vcounter;