fix mkword(@(ptr), 0) wrong asm

This commit is contained in:
Irmen de Jong 2022-08-11 23:01:14 +02:00
parent 4d840c7db8
commit d6b8936376
3 changed files with 11 additions and 15 deletions

View File

@ -865,9 +865,9 @@ internal class BuiltinFunctionsAsmGen(private val program: Program,
val mr0 = fcall.args[0] as? DirectMemoryRead
val mr1 = fcall.args[1] as? DirectMemoryRead
if (mr0 != null)
needAsave = mr0.addressExpression !is NumericLiteral && mr0.addressExpression !is IdentifierReference
needAsave = mr0.addressExpression !is NumericLiteral
if (mr1 != null)
needAsave = needAsave or (mr1.addressExpression !is NumericLiteral && mr1.addressExpression !is IdentifierReference)
needAsave = needAsave or (mr1.addressExpression !is NumericLiteral)
}
when(reg) {
RegisterOrPair.AX -> {

View File

@ -3,8 +3,6 @@ TODO
For next release
^^^^^^^^^^^^^^^^
- crc ^= mkword(@(data), 0) produces faulty asm, as opposed to crc ^= mkword(variable, 0)
...

View File

@ -3,18 +3,16 @@
main {
sub start() {
ubyte left = $12
ubyte right = $34
uword ww
ubyte[] buffer = [$11,$22,$33,$44]
uword data = &buffer
ww = mkword(left, right)
txt.print_uwhex(ww, true)
ww = mkword(left, 0)
txt.print_uwhex(ww, true)
ww = mkword(0, right)
txt.print_uwhex(ww, true)
ww = right as uword
txt.print_uwhex(ww, true)
uword crc = $ffff
crc ^= mkword(@(data), 0)
txt.print_uwhex(crc, true)
crc = $ffff
ubyte variable = @(data)
crc ^= mkword(variable, 0)
txt.print_uwhex(crc, true)
}
; sub start2() {