mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +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...
|
||||
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"
|
||||
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)
|
||||
// TODO optimize: don't use scratch var if possible
|
||||
val tmpByte = if(name!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
||||
asmgen.out("""
|
||||
sta $tmpByte
|
||||
@ -1249,7 +1249,7 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
||||
sec
|
||||
sbc $tmpByte
|
||||
sta $name
|
||||
bcc +
|
||||
bcs +
|
||||
dec $name+1
|
||||
+""")
|
||||
}
|
||||
|
@ -3,25 +3,25 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
byte index = 100
|
||||
byte[] t_index = [-1,-2,-3,-4,-5]
|
||||
|
||||
index = 4
|
||||
index = index>t_index[4]
|
||||
txt.print_b(index)
|
||||
txt.nl()
|
||||
index = index>t_index[4]
|
||||
txt.print_b(index)
|
||||
txt.nl()
|
||||
uword ww= 300
|
||||
@($4000) = 100
|
||||
ww -= @($4000)
|
||||
ww -= 100
|
||||
txt.print_uw(ww) ; 100
|
||||
|
||||
; index = index < t_index[4]
|
||||
; index = index < t_index[nibble]
|
||||
; txt.print_ub(index)
|
||||
; ubyte index = 100
|
||||
; ubyte[] t_index = [1,2,3,4,5]
|
||||
; ubyte nibble = 0
|
||||
;
|
||||
; index = index + t_index[4]
|
||||
; index = index + t_index[nibble]
|
||||
; txt.print_ub(index) ; 106
|
||||
; txt.nl()
|
||||
;
|
||||
; nibble++
|
||||
; index = index > t_index[3]
|
||||
; index = index > t_index[nibble]
|
||||
; index = index - t_index[3]
|
||||
; index = index - t_index[nibble]
|
||||
; txt.print_ub(index) ; 100
|
||||
; txt.nl()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user