mirror of
https://github.com/irmen/prog8.git
synced 2024-10-17 10:24:55 +00:00
todo about fixing argclobbering
This commit is contained in:
parent
b6e2b36692
commit
d89f5b0df8
@ -2,10 +2,13 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- BUG FIX: fix register argument clobbering when calling asmsubs. (see fixme_argclobber.p8)
|
||||||
|
|
||||||
|
|
||||||
- finalize (most) of the still missing "new" assignment asm code generation
|
- finalize (most) of the still missing "new" assignment asm code generation
|
||||||
- aliases for imported symbols for example perhaps '%alias print = c64scr.print'
|
- aliases for imported symbols for example perhaps '%alias print = c64scr.print'
|
||||||
- option to load library files from a directory instead of the embedded ones (easier library development/debugging)
|
- option to load library files from a directory instead of the embedded ones (easier library development/debugging)
|
||||||
- investigate support for 8bitguy's Commander X16 platform https://murray2.com/forums/commander-x16.9/ and https://github.com/commanderx16/x16-docs
|
- investigate support for 8bitguy's Commander X16 platform https://www.commanderx16.com and https://github.com/commanderx16/x16-docs
|
||||||
- see if we can group some errors together for instance the (now single) errors about unidentified symbols
|
- see if we can group some errors together for instance the (now single) errors about unidentified symbols
|
||||||
|
|
||||||
|
|
||||||
|
47
examples/fixme_argclobber.p8
Normal file
47
examples/fixme_argclobber.p8
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
%import c64lib
|
||||||
|
%import c64utils
|
||||||
|
%import c64flt
|
||||||
|
%zeropage basicsafe
|
||||||
|
%option enable_floats
|
||||||
|
|
||||||
|
|
||||||
|
; TODO: fix register argument clobbering when calling asmsubs.
|
||||||
|
; for instance if the first arg goes into Y, and the second in A,
|
||||||
|
; but when calculating the second argument clobbers Y, the first argument gets destroyed.
|
||||||
|
|
||||||
|
main {
|
||||||
|
|
||||||
|
sub start() {
|
||||||
|
function(20, calculate())
|
||||||
|
asmfunction(20, calculate())
|
||||||
|
|
||||||
|
c64.CHROUT('\n')
|
||||||
|
|
||||||
|
if @($0400)==@($0402) and @($0401) == @($0403) {
|
||||||
|
c64scr.print("ok: results are same\n")
|
||||||
|
} else {
|
||||||
|
c64scr.print("error: result differ; arg got clobbered\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub function(ubyte a1, ubyte a2) {
|
||||||
|
; non-asm function passes via stack, this is ok
|
||||||
|
@($0400) = a1
|
||||||
|
@($0401) = a2
|
||||||
|
}
|
||||||
|
|
||||||
|
asmsub asmfunction(ubyte a1 @ Y, ubyte a2 @ A) {
|
||||||
|
; asm-function passes via registers, risk of clobbering
|
||||||
|
%asm {{
|
||||||
|
sty $0402
|
||||||
|
sta $0403
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub calculate() -> ubyte {
|
||||||
|
Y = 99
|
||||||
|
return Y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ main {
|
|||||||
|
|
||||||
other = purple
|
other = purple
|
||||||
|
|
||||||
other.red /= 3
|
other.red /= 2
|
||||||
other.green = 10 + other.green / 2
|
other.green = 10 + other.green / 2
|
||||||
other.blue = 99
|
other.blue = 99
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ blocklogic {
|
|||||||
sub noCollision(ubyte xpos, ubyte ypos) -> ubyte {
|
sub noCollision(ubyte xpos, ubyte ypos) -> ubyte {
|
||||||
ubyte i
|
ubyte i
|
||||||
for i in 15 downto 0 {
|
for i in 15 downto 0 {
|
||||||
; TODO FIX THIS when compiling without optimizations (codegen problem: clobbering register arguments):
|
; TODO FIX THIS when compiling without optimizations (codegen problem: clobbering register arguments, see fixme_argclobber):
|
||||||
if currentBlock[i] and c64scr.getchr(xpos + (i&3), ypos+i/4)!=32
|
if currentBlock[i] and c64scr.getchr(xpos + (i&3), ypos+i/4)!=32
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user