fixed compiler crash when using cx16.r0H as function call argument

This commit is contained in:
Irmen de Jong 2022-01-23 01:28:16 +01:00
parent 5b9af0b5ae
commit 3d1b0eb843
4 changed files with 44 additions and 19 deletions

View File

@ -1084,9 +1084,7 @@ internal class AstChecker(private val program: Program,
}
if(ident!=null && ident.nameInSource[0] == "cx16" && ident.nameInSource[1].startsWith("r")) {
var regname = ident.nameInSource[1].uppercase()
if(regname.endsWith('L'))
regname=regname.substring(0, regname.length-1)
if(regname.endsWith('s'))
if(regname.endsWith('L') || regname.endsWith('H') || regname.endsWith('s'))
regname=regname.substring(0, regname.length-1)
val reg = RegisterOrPair.valueOf(regname)
val same = params.filter { it.value.registerOrPair==reg }

View File

@ -222,7 +222,8 @@ class CallGraph(private val program: Program) : IAstVisitor {
return allIdentifiersAndTargets.filter { decl===it.value }.map{ it.key.first }
}
private fun nameInAssemblyCode(name: String) = allAssemblyNodes.any { it.assembly.contains(name) }
private fun nameInAssemblyCode(name: String) =
allAssemblyNodes.any { it.assembly.contains(name) } // TODO be smarter about what to search in assembly (only labels starting in column 0?)
inline fun unused(label: Label) = false // just always output labels

View File

@ -3,7 +3,31 @@ TODO
For next release
^^^^^^^^^^^^^^^^
...
- FIx: cx16.r0 = $1fc0f compiler crash
- Fix: uword addr = label ; addr will be 0! required to use &label!
- Fix compiler stack overflow crash:
sub sprite_y_for_row(ubyte row) -> word {
return (8-row as byte)
}
- fix crash:
word[33] sprites_x = sprites.sprites_x
word[33] sprites_y = sprites.sprites_y
- fix assignment code generated for: (memcopying manuall does work correctly)
word[33] sprites_x
word[33] sprites_y
sprites_x = sprites.sprites_x
sprites_y = sprites.sprites_y
- Fix: better error message for len() in:
ubyte[64] chessboard
sub init() {
ubyte xx=len(board)
sys.memset(chessboard, len(board), 0)
}
- move vload() to cx16diskio module
- nameInAssemblyCode() should search smarter
- if char in "string" should fall back to string.find if string is longer than... 12?
also.. is "string" removed from the interned strings?
- add option to memory() to get aligned memory block (word, page aligned)
Need help with

View File

@ -3,20 +3,22 @@
main {
sub start() {
txt.print("yo\n")
uword jumps = $4000
if_cc
goto jumps
move()
}
goto jumps
sub move() {
ubyte mb = cx16.mouse_pos()
ubyte @shared xx = cx16.r0H
ubyte @shared yy = cx16.r0L
func(cx16.r0H)
func(cx16.r0L)
cx16.vpoke(1, $fc08+2, cx16.r0H)
cx16.vpoke(1, $fc08+3, cx16.r0L)
}
asmsub func(ubyte qq @A) {
%asm {{
rts
}}
}
}
test $4000 {
%option force_output
jumper:
%asm {{
rts
}}
}