fix cpu register overwrites when using @(...) arguments to an asmsub

This commit is contained in:
Irmen de Jong 2024-02-09 19:55:35 +01:00
parent e941d2665a
commit 6c8c8e11cc
3 changed files with 14 additions and 32 deletions

View File

@ -82,7 +82,7 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
is PtAddressOf -> false
is PtIdentifier -> false
is PtMachineRegister -> false
is PtMemoryByte -> false
is PtMemoryByte -> return usesOtherRegistersWhileEvaluating(arg.address)
is PtNumber -> false
else -> true
}

View File

@ -1,8 +1,6 @@
TODO
====
fix bug: txt.setchr(x, y, @(bytes+$1000)) bytes++ doesn't fill the whole screen only the first 256 bytes or something
fix TODO's to assign from and to split arrays (BuiltinFuncGen + BuiltinFunctionAsmGen) -- cannot use simple single memcopy here (6502 + IR)
assembler, imageviewer is bigger than before (since commit "added string.lstripped() and string.ltrimmed()" )

View File

@ -6,40 +6,24 @@
main {
sub start() {
ubyte x
ubyte y
uword bytes = $a000
for y in 0 to 59 {
for x in 0 to 79 {
txt.setchr(x, y, @(bytes+$1000))
bytes++
}
}
}
sub stringcopy() {
str name1 = "name1"
str name2 = "name2"
uword[] @split names = [name1, name2, "name3"]
uword[] addresses = [0,0,0]
names = [1111,2222,3333]
addresses = names
;foo("zzz")
}
sub foo (str sarg) {
ubyte[3] svar
txt.print_uwhex(svar, true)
txt.nl()
txt.print_uwhex(&svar, true)
txt.nl()
txt.print_uwhex(&svar[2], true)
txt.nl()
cx16.r1L = 3
txt.print_uwhex(&svar[cx16.r1L], true)
txt.nl()
txt.nl()
txt.print_uwhex(sarg, true)
txt.nl()
txt.print_uwhex(&sarg, true)
txt.nl()
txt.print_uwhex(sarg+2, true)
txt.nl()
cx16.r0 = &sarg[2]
txt.print_uwhex(cx16.r0, true) ; TODO should be the same as the previous one sarg+2 (13)!
txt.nl()
cx16.r1L=3
cx16.r0 = &sarg[cx16.r1L]
txt.print_uwhex(cx16.r0, true) ; TODO should be the same as the previous one sarg+2 (13)!
txt.nl()
}
}