added a few more simple special codegen segements for the logic operators on a memmory-read

This commit is contained in:
Irmen de Jong 2021-04-29 19:38:42 +02:00
parent 5ee36c897d
commit 71fec4c555
3 changed files with 62 additions and 25 deletions

View File

@ -689,6 +689,18 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
sbc P8ZP_SCRATCH_B1 sbc P8ZP_SCRATCH_B1
sta $name""") sta $name""")
} }
"|", "or" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" ora $name | sta $name")
}
"&", "and" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" and $name | sta $name")
}
"^", "xor" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" eor $name | sta $name")
}
// TODO: tuned code for more operators // TODO: tuned code for more operators
else -> { else -> {
inplaceModification_byte_value_to_variable(name, dt, operator, memread) inplaceModification_byte_value_to_variable(name, dt, operator, memread)
@ -720,6 +732,24 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
dec $name+1 dec $name+1
+""") +""")
} }
"|", "or" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" ora $name | sta $name")
}
"&", "and" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" and $name | sta $name")
if(dt in WordDatatypes) {
if(asmgen.isTargetCpu(CpuType.CPU65c02))
asmgen.out(" stz $name+1")
else
asmgen.out(" lda #0 | sta $name+1")
}
}
"^", "xor" -> {
exprAsmGen.translateDirectMemReadExpression(memread, false)
asmgen.out(" eor $name | sta $name")
}
// TODO: tuned code for more operators // TODO: tuned code for more operators
else -> { else -> {
inplaceModification_word_value_to_variable(name, dt, operator, memread) inplaceModification_word_value_to_variable(name, dt, operator, memread)

View File

@ -2,6 +2,8 @@
TODO TODO
==== ====
- test all examples before release of the new version
- simplify cx16.joystick_get2() once this cx16 rom issue is resolved: https://github.com/commanderx16/x16-rom/issues/203 - simplify cx16.joystick_get2() once this cx16 rom issue is resolved: https://github.com/commanderx16/x16-rom/issues/203
- c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking) - c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking)
- get rid of all other TODO's in the code ;-) - get rid of all other TODO's in the code ;-)

View File

@ -3,18 +3,23 @@ main {
sub start() { sub start() {
repeat {
ubyte xx ubyte xx
ubyte yy=xx
ubyte aa
ubyte bb
ubyte cc
ubyte dd
}
repeat { xx |= 44
xx=1 xx &= 44
yy=xx xx ^= 44
}
xx |= @($d020)
xx &= @($d020)
xx ^= @($d020)
uword ww
ww |= $4433
ww &= $4433
ww ^= $4433
ww |= @($d020)
ww &= @($d020)
ww ^= @($d020)
} }
} }