fix crash in asm code generated for bitshift operation with memory address operand

This commit is contained in:
Irmen de Jong 2020-03-13 01:26:53 +01:00
parent 2af86a10b2
commit 796d07a7f8
5 changed files with 16 additions and 9 deletions

View File

@ -313,7 +313,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
sta (+) +1
sty (+) +2
lda $sourceName
+ sta ${65535.toHex()} ; modified
+ sta ${'$'}ffff ; modified
""")
}
}
@ -469,7 +469,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
sta (+) +1
lda $ESTACK_HI_HEX,x
sta (+) +2
+ sty ${65535.toHex()} ; modified
+ sty ${'$'}ffff ; modified
""")
}
}

View File

@ -149,7 +149,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
sta (+) + 1
lda $ESTACK_HI_HEX,x
sta (+) + 2
+ asl 0 ; modified
+ asl ${'$'}ffff ; modified
""")
}
}
@ -205,7 +205,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
sta (+) + 1
lda $ESTACK_HI_HEX,x
sta (+) + 2
+ lsr 0 ; modified
+ lsr ${'$'}ffff ; modified
""")
}
}
@ -286,7 +286,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
sta (+) + 1
lda $ESTACK_HI_HEX,x
sta (+) + 2
+ rol 0 ; modified
+ rol ${'$'}ffff ; modified
""")
}
}
@ -397,7 +397,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
sta (+) + 1
lda $ESTACK_HI_HEX,x
sta (+) + 2
+ ror 0 ; modified
+ ror ${'$'}ffff ; modified
""") }
}
is RegisterExpr -> {

View File

@ -4,7 +4,8 @@ TODO
- option to load library files from a directory instead of the embedded ones
- exit('message', returncode) function to immediately exit the program with this message (restores stack)
- vector inc/dec/add/sub/lsl/asl/mul/div...?
- vector inc/dec/add/sub/mul/div...?
arrayvar++ / arrayvar-- / arrayvar += 2 / arrayvar -= 2 / arrayvar *= 3 / arrayvar /= 3
Memory Block Operations integrated in language?

View File

@ -74,7 +74,7 @@ main {
ror2(@(9999))
rol2(@(9999))
lsl(@(9999+A)) ; TODO optimizer generates invalid code here -> crash
lsl(@(9999+A))
lsr(@(9999+A))
ror(@(9999+A))
rol(@(9999+A))

View File

@ -5,7 +5,13 @@ main {
sub start() {
byte[] barr = [22,-33,-44,55,66]
lsr(@(9999+A))
ror(@(9999+A))
rol(@(9999+A))
ror2(@(9999+A))
rol2(@(9999+A))
c64scr.print_ub(X)
}
}