From c69c17de4259d33a810289a38cad393cfe1135b3 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 21 May 2023 15:03:33 +0200 Subject: [PATCH] cx16 avoid ram bank issue with RDTIM in sys.wait() and c64.RDTIM16() --- compiler/res/prog8lib/cx16/syslib.p8 | 10 ++++++++-- examples/test.p8 | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 85333f7aa..37542bc08 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -70,7 +70,9 @@ asmsub RDTIM16() -> uword @AY { ; -- like RDTIM() but only returning the lower 16 bits in AY for convenience %asm {{ phx + sei jsr c64.RDTIM + cli pha txa tay @@ -936,9 +938,13 @@ _loop lda P8ZP_SCRATCH_W1 plx rts -+ jsr c64.RDTIM ++ sei + jsr c64.RDTIM + cli sta P8ZP_SCRATCH_B1 -- jsr c64.RDTIM +- sei + jsr c64.RDTIM + cli cmp P8ZP_SCRATCH_B1 beq - diff --git a/examples/test.p8 b/examples/test.p8 index fdee3a0c9..474a0deaa 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -9,7 +9,7 @@ main { ubyte pos for pos in 0 to 7 { - pokew(table + 64 + pos*2, ($000a-pos)*200) ; TODO FIX WRONG CODE + pokew(table + 64 + pos*2, ($000a-pos)*200) } for pos in 0 to 7 {