mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
implemented missing memory postincrdecr codegen
This commit is contained in:
parent
513a68584c
commit
58f323c087
@ -7,6 +7,8 @@ import prog8.ast.expressions.NumericLiteralValue
|
|||||||
import prog8.ast.statements.PostIncrDecr
|
import prog8.ast.statements.PostIncrDecr
|
||||||
import prog8.compiler.AssemblyError
|
import prog8.compiler.AssemblyError
|
||||||
import prog8.compiler.target.c64.C64MachineDefinition.C64Zeropage
|
import prog8.compiler.target.c64.C64MachineDefinition.C64Zeropage
|
||||||
|
import prog8.compiler.target.c64.C64MachineDefinition.ESTACK_HI_HEX
|
||||||
|
import prog8.compiler.target.c64.C64MachineDefinition.ESTACK_LO_HEX
|
||||||
import prog8.compiler.toHex
|
import prog8.compiler.toHex
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +55,20 @@ internal class PostIncrDecrAsmGen(private val program: Program, private val asmg
|
|||||||
else
|
else
|
||||||
asmgen.out("+\tdec ${'$'}ffff\t; modified")
|
asmgen.out("+\tdec ${'$'}ffff\t; modified")
|
||||||
}
|
}
|
||||||
else -> TODO("asmgen postincrdecr on memory expression")
|
else -> {
|
||||||
|
asmgen.translateExpression(addressExpr)
|
||||||
|
asmgen.out("""
|
||||||
|
inx
|
||||||
|
lda $ESTACK_LO_HEX,x
|
||||||
|
sta (+) + 1
|
||||||
|
lda $ESTACK_HI_HEX,x
|
||||||
|
sta (+) + 2
|
||||||
|
""")
|
||||||
|
if(incr)
|
||||||
|
asmgen.out("+\tinc ${'$'}ffff\t; modified")
|
||||||
|
else
|
||||||
|
asmgen.out("+\tdec ${'$'}ffff\t; modified")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetArrayIdx!=null -> {
|
targetArrayIdx!=null -> {
|
||||||
|
@ -8,20 +8,17 @@ main {
|
|||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
;@($d020) += @($d020) ; TODO fix compiler hang
|
;@($d020) += @($d020) ; TODO fix compiler hang
|
||||||
;@($c000+A) ++ ; TODO implement this
|
|
||||||
|
|
||||||
uword addr = $c000
|
ubyte A = 10
|
||||||
@(addr) = $f1
|
@($c00a) = $4a
|
||||||
c64scr.print_ubhex(@(addr), true)
|
@($c000+A) ++ ; TODO implement this
|
||||||
|
|
||||||
|
c64scr.print_ubhex(@($c00a), true)
|
||||||
c64.CHROUT('\n')
|
c64.CHROUT('\n')
|
||||||
@(addr) = - @(addr)
|
@($c000+A) -- ; TODO implement this
|
||||||
c64scr.print_ubhex(@(addr), true)
|
|
||||||
c64.CHROUT('\n')
|
c64scr.print_ubhex(@($c00a), true)
|
||||||
@(addr) = - @(addr)
|
|
||||||
c64scr.print_ubhex(@(addr), true)
|
|
||||||
c64.CHROUT('\n')
|
c64.CHROUT('\n')
|
||||||
|
|
||||||
;@($c000) = ! @($c000)
|
|
||||||
;@($c000) = ~ @($c000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user