v99xx: fix timing problem when reading from higher pages
authorgeijoenr <geijoenr@gmail.com>
Fri, 9 Jun 2017 15:21:47 +0000 (17:21 +0200)
committergeijoenr <geijoenr@gmail.com>
Fri, 9 Jun 2017 15:28:20 +0000 (17:28 +0200)
when reading from addresses above 0x3fff the first byte
returned by vdp is always zero. we probably should be doing
a di before setting the low byte of the address then di before
setting the low bit, but that that does not seem feasible
at the moment.

Kernel/dev/v99xx.c

index c920231..4b637c3 100644 (file)
@@ -136,6 +136,7 @@ void v99xx_copy_from_vram(uint8_t *dst, uint16_t vaddr, uint16_t size)
        pop de
        ld bc, (_vdpport)
        out (c),e
+       ld a,d
        out (c),d
        pop de
        push de
@@ -143,6 +144,9 @@ void v99xx_copy_from_vram(uint8_t *dst, uint16_t vaddr, uint16_t size)
        push hl
        push iy
        dec c
+       cp #0x3f
+       jp m,cpfvram_loop
+       in a,(c)
 cpfvram_loop:
        ini
        dec de
@@ -216,5 +220,3 @@ void v99xx_set_blink_period(uint8_t fg, uint8_t bg)
 {
     v99xx_write_reg(V99xx_REG_BLINK_PERIOD, (fg << 4) | (bg & 0xf));
 }
-
-