mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
inplace not and invert for memory now without translateExpression()
This commit is contained in:
parent
4278f64682
commit
2da28864e9
@ -1696,16 +1696,14 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
|||||||
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
|
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
if(asmgen.options.slowCodegenWarnings)
|
asmgen.assignExpressionToVariable(mem.addressExpression, asmgen.asmVariableName("P8ZP_SCRATCH_W2"), DataType.UWORD, target.scope)
|
||||||
println("warning: slow stack evaluation used (6): ${mem.addressExpression::class.simpleName} at ${mem.addressExpression.position}") // TODO
|
|
||||||
asmgen.translateExpression(mem.addressExpression) // TODO directly into P8ZP_SCRATCH_W2
|
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
jsr prog8_lib.read_byte_from_address_on_stack
|
ldy #0
|
||||||
|
lda (P8ZP_SCRATCH_W2),y
|
||||||
beq +
|
beq +
|
||||||
lda #1
|
lda #1
|
||||||
+ eor #1
|
+ eor #1
|
||||||
jsr prog8_lib.write_byte_to_address_on_stack
|
sta (P8ZP_SCRATCH_W2),y""")
|
||||||
inx""")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1766,14 +1764,12 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
|||||||
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
|
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
if(asmgen.options.slowCodegenWarnings)
|
asmgen.assignExpressionToVariable(memory.addressExpression, asmgen.asmVariableName("P8ZP_SCRATCH_W2"), DataType.UWORD, target.scope)
|
||||||
println("warning: slow stack evaluation used (7): ${memory.addressExpression::class.simpleName} at ${memory.addressExpression.position}") // TODO
|
|
||||||
asmgen.translateExpression(memory.addressExpression) // TODO directly into P8ZP_SCRATCH_W2
|
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
jsr prog8_lib.read_byte_from_address_on_stack
|
ldy #0
|
||||||
|
lda (P8ZP_SCRATCH_W2),y
|
||||||
eor #255
|
eor #255
|
||||||
jsr prog8_lib.write_byte_to_address_on_stack
|
sta (P8ZP_SCRATCH_W2),y""")
|
||||||
inx""")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,14 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
ubyte ub = 2
|
ubyte ub = 1
|
||||||
ubyte ub2 = 8
|
ubyte ub2 = %11000011
|
||||||
uword uw = 5
|
|
||||||
|
|
||||||
ub2 <<= (ub-1)
|
@($c001) = %1
|
||||||
txt.print_ub(ub2)
|
|
||||||
txt.chrout('\n')
|
|
||||||
|
|
||||||
ub2 >>= (ub-1)
|
@($c000+ub) += @($c000+ub)
|
||||||
txt.print_ub(ub2)
|
ub2 = @($c000+ub)
|
||||||
|
txt.print_ubbin(ub2, 1)
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
|
|
||||||
testX()
|
testX()
|
||||||
|
Loading…
Reference in New Issue
Block a user