summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-05-05 22:08:30 -0700
committerMichael Pavone <pavone@retrodev.com>2017-05-05 22:08:30 -0700
commit4dab06dd79a27f462f5071e6162c7231b49d66fe (patch)
tree0bcb2bf3b45957d9497bd439ae7d2d6e03ab1d53
parent9a868a039c51cc277540aabc897e091befe46de0 (diff)
Fix vscroll latching when full screen vscroll is used in combination with the window plane on the left side of the screen
-rw-r--r--vdp.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/vdp.c b/vdp.c
index 9548c14..be89bd7 100644
--- a/vdp.c
+++ b/vdp.c
@@ -1052,6 +1052,26 @@ static void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line,
v_offset_mask = 0x7;
vscroll_shift = 3;
}
+ //TODO: Further research on vscroll latch behavior and the "first column bug"
+ if (!column) {
+ if (context->regs[REG_MODE_3] & BIT_VSCROLL) {
+ if (context->regs[REG_MODE_4] & BIT_H40) {
+ //Based on observed behavior documented by Eke-Eke, I'm guessing the VDP
+ //ends up fetching the last value on the VSRAM bus in the H40 case
+ //getting the last latched value should be close enough for now
+ if (!vsram_off) {
+ context->vscroll_latch[0] = context->vscroll_latch[1];
+ }
+ } else {
+ //supposedly it's always forced to 0 in the H32 case
+ context->vscroll_latch[0] = context->vscroll_latch[1] = 0;
+ }
+ } else {
+ context->vscroll_latch[vsram_off] = context->vsram[vsram_off];
+ }
+ } else if (context->regs[REG_MODE_3] & BIT_VSCROLL) {
+ context->vscroll_latch[vsram_off] = context->vsram[column - 2 + vsram_off];
+ }
if (!vsram_off) {
uint16_t left_col, right_col;
if (context->regs[REG_WINDOW_H] & WINDOW_RIGHT) {
@@ -1106,26 +1126,6 @@ static void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line,
vscroll <<= 1;
vscroll |= 1;
}
- //TODO: Further research on vscroll latch behavior and the "first column bug"
- if (!column) {
- if (context->regs[REG_MODE_3] & BIT_VSCROLL) {
- if (context->regs[REG_MODE_4] & BIT_H40) {
- //Based on observed behavior documented by Eke-Eke, I'm guessing the VDP
- //ends up fetching the last value on the VSRAM bus in the H40 case
- //getting the last latched value should be close enough for now
- if (!vsram_off) {
- context->vscroll_latch[0] = context->vscroll_latch[1];
- }
- } else {
- //supposedly it's always forced to 0 in the H32 case
- context->vscroll_latch[0] = context->vscroll_latch[1] = 0;
- }
- } else {
- context->vscroll_latch[vsram_off] = context->vsram[vsram_off];
- }
- } else if (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);