tweak pointer access, fix and optimize reading memory from a label as pointer

This commit is contained in:
Irmen de Jong
2025-01-05 03:53:28 +01:00
parent 478e2b4ebd
commit 0ffebc25d0
7 changed files with 246 additions and 118 deletions
+38 -15
View File
@@ -1,23 +1,46 @@
%import textio
%option no_sysinit
%zeropage basicsafe
%zeropage kernalsafe
main {
sub start() {
word @shared dx
uword @shared udx
dx++
udx++
dx = -5000
if abs(dx) < 9999
txt.print("yes1")
else
txt.print("no2")
ubyte[] array = [11,22,33,44,55,66,77,88,99]
uword @shared ptr = &array[5]
ubyte @shared offset
cx16.r0L = @(&start + 1)
cx16.r1L = @(&start - 1)
@(&start+1) = 99
@(&start-1) = 99
; @(ptr+1) = cx16.r0L
; @(ptr+2) = cx16.r0L
; @(ptr+offset) = cx16.r0L
; @(ptr-1) = cx16.r0L
; @(ptr-2) = cx16.r0L
; @(ptr-offset) = cx16.r0L
; cx16.r0L = @(ptr+1)
; cx16.r1L = @(ptr+2)
; cx16.r2L = @(ptr+offset)
; cx16.r3L = @(ptr-1)
; cx16.r4L = @(ptr-2)
; cx16.r5L = @(ptr-offset)
; %asm {{
; dec p8v_ptr+1
; ldy #255
; lda (p8v_ptr),y
; inc p8v_ptr+1
; sta cx16.r0L
; }}
repeat {
}
dx = -15000
if abs(dx) < 9999
txt.print("yes2")
else
txt.print("no2")
}
}