summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-16 23:04:57 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-16 23:04:57 -0700
commit7e2fdcb2f3378827b1286e8d7ee5290303e71d6b (patch)
treefadfddd2b45590a2bfc77a4905e827df947bb98a
parentb31d70dcda706dbf8a3a34ea27ff614617c1c9c1 (diff)
First pass at emulating a vscroll latch. Titan's Overdrive demo seems to depend on the scroll value being latched early in the line before the HINT gets a chance to change it
-rw-r--r--vdp.c7
-rw-r--r--vdp.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/vdp.c b/vdp.c
index a7f9d1b..0c016f0 100644
--- a/vdp.c
+++ b/vdp.c
@@ -657,7 +657,12 @@ void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line, uint16_
vscroll <<= 1;
vscroll |= 1;
}
- vscroll &= (context->vsram[(context->regs[REG_MODE_3] & BIT_VSCROLL ? (column-2)&63 : 0) + vsram_off] + line);
+ //TODO: Further research on vscroll latch behavior and the "first column bug" seen in Gynoug
+ //this should be close, but won't match the exact behavior Eke-Eke has written about
+ if (column == 2 || (column && (context->regs[REG_MODE_3] & BIT_VSCROLL))) {
+ context->vscroll_latch[vsram_off] = context->vsram[column - 2 + vsram_off];
+ }
+ vscroll &= context->vscroll_latch[vsram_off] + line;
context->v_offset = vscroll & v_offset_mask;
//printf("%s | line %d, vsram: %d, vscroll: %d, v_offset: %d\n",(vsram_off ? "B" : "A"), line, context->vsram[context->regs[REG_MODE_3] & 0x4 ? column : 0], vscroll, context->v_offset);
vscroll >>= vscroll_shift;
diff --git a/vdp.h b/vdp.h
index 31bd4e7..7950c38 100644
--- a/vdp.h
+++ b/vdp.h
@@ -143,6 +143,7 @@ typedef struct {
uint32_t colors[CRAM_SIZE*3];
uint32_t debugcolors[1 << (3 + 1 + 1 + 1)];//3 bits for source, 1 bit for priority, 1 bit for shadow, 1 bit for hilight
uint16_t vsram[VSRAM_SIZE];
+ uint16_t vscroll_latch[2];
uint32_t frame;
uint16_t vcounter;
uint16_t hslot; //hcounter/2