mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
fix wordvar -= @(memory)
This commit is contained in:
parent
95be1c9e22
commit
e1b3582f08
@ -892,7 +892,7 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
// now implement the non-assiciative operators...
|
// now implement the non-assiciative operators...
|
||||||
when (operator) {
|
when (operator) {
|
||||||
"-" -> {
|
"-" -> {
|
||||||
// TODO optimize: don't use scratch var
|
// A = variable - A
|
||||||
val tmpVar = if(variable!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
val tmpVar = if(variable!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
||||||
asmgen.out(" sta $tmpVar | lda $variable | sec | sbc $tmpVar")
|
asmgen.out(" sta $tmpVar | lda $variable | sec | sbc $tmpVar")
|
||||||
}
|
}
|
||||||
@ -1240,8 +1240,8 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
+""")
|
+""")
|
||||||
}
|
}
|
||||||
"-" -> {
|
"-" -> {
|
||||||
|
// name -= @(memory)
|
||||||
asmgen.translateDirectMemReadExpressionToRegA(memread)
|
asmgen.translateDirectMemReadExpressionToRegA(memread)
|
||||||
// TODO optimize: don't use scratch var if possible
|
|
||||||
val tmpByte = if(name!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
val tmpByte = if(name!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
sta $tmpByte
|
sta $tmpByte
|
||||||
@ -1249,7 +1249,7 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
sec
|
sec
|
||||||
sbc $tmpByte
|
sbc $tmpByte
|
||||||
sta $name
|
sta $name
|
||||||
bcc +
|
bcs +
|
||||||
dec $name+1
|
dec $name+1
|
||||||
+""")
|
+""")
|
||||||
}
|
}
|
||||||
|
@ -3,25 +3,25 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
byte index = 100
|
|
||||||
byte[] t_index = [-1,-2,-3,-4,-5]
|
|
||||||
|
|
||||||
index = 4
|
uword ww= 300
|
||||||
index = index>t_index[4]
|
@($4000) = 100
|
||||||
txt.print_b(index)
|
ww -= @($4000)
|
||||||
txt.nl()
|
ww -= 100
|
||||||
index = index>t_index[4]
|
txt.print_uw(ww) ; 100
|
||||||
txt.print_b(index)
|
|
||||||
txt.nl()
|
|
||||||
|
|
||||||
; index = index < t_index[4]
|
; ubyte index = 100
|
||||||
; index = index < t_index[nibble]
|
; ubyte[] t_index = [1,2,3,4,5]
|
||||||
; txt.print_ub(index)
|
; ubyte nibble = 0
|
||||||
|
;
|
||||||
|
; index = index + t_index[4]
|
||||||
|
; index = index + t_index[nibble]
|
||||||
|
; txt.print_ub(index) ; 106
|
||||||
; txt.nl()
|
; txt.nl()
|
||||||
;
|
;
|
||||||
; nibble++
|
; nibble++
|
||||||
; index = index > t_index[3]
|
; index = index - t_index[3]
|
||||||
; index = index > t_index[nibble]
|
; index = index - t_index[nibble]
|
||||||
; txt.print_ub(index) ; 100
|
; txt.print_ub(index) ; 100
|
||||||
; txt.nl()
|
; txt.nl()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user