diff --git a/compiler/res/prog8lib/cx16/gfx2.p8 b/compiler/res/prog8lib/cx16/gfx2.p8 index bb9d6822c..6e7868662 100644 --- a/compiler/res/prog8lib/cx16/gfx2.p8 +++ b/compiler/res/prog8lib/cx16/gfx2.p8 @@ -653,6 +653,7 @@ _done } sub position(uword @zp x, uword y) { + ubyte bank when active_mode { 1 -> { ; lores monochrome @@ -663,7 +664,8 @@ _done 4 -> { ; lores 256c void addr_mul_24_for_lores_256c(y, x) ; 24 bits result is in r0 and r1L (highest byte) - cx16.vaddr(lsb(cx16.r1), cx16.r0, 0, 1) + bank = lsb(cx16.r1) + cx16.vaddr(bank, cx16.r0, 0, 1) } 5 -> { ; highres monochrome @@ -673,7 +675,8 @@ _done 6 -> { ; highres 4c void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte) - cx16.vaddr(lsb(cx16.r1), cx16.r0, 0, 1) + bank = lsb(cx16.r1) + cx16.vaddr(bank, cx16.r0, 0, 1) } } } diff --git a/examples/test.p8 b/examples/test.p8 index 22a8ab335..7ce2204b6 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -4,6 +4,12 @@ main { sub start() { + ubyte bank + + ; TODO give error that a register is used as an argument value and at the same time is a register parameter taking a new value. + ; (note: this is OK if the register is used as an argument for a register param that is the same register) + cx16.vaddr(lsb(cx16.r1), cx16.r0, 0, 1) + txt.print("hello") } }