mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 01:29:28 +00:00
fix codegen for var1>>=var2 and var1<<=var2 when var2 is zero
This commit is contained in:
parent
1fb94e7a7b
commit
97c5c90eff
@ -918,8 +918,9 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
||||
"<<" -> {
|
||||
asmgen.out("""
|
||||
tay
|
||||
beq +
|
||||
lda $variable
|
||||
cpy #0
|
||||
beq +
|
||||
- asl a
|
||||
dey
|
||||
bne -
|
||||
@ -929,8 +930,9 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
||||
if(!signed) {
|
||||
asmgen.out("""
|
||||
tay
|
||||
beq +
|
||||
lda $variable
|
||||
cpy #0
|
||||
beq +
|
||||
- lsr a
|
||||
dey
|
||||
bne -
|
||||
@ -938,8 +940,9 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
||||
} else {
|
||||
asmgen.out("""
|
||||
tay
|
||||
beq +
|
||||
lda $variable
|
||||
cpy #0
|
||||
beq +
|
||||
sta P8ZP_SCRATCH_B1
|
||||
- asl a
|
||||
ror P8ZP_SCRATCH_B1
|
||||
@ -1899,12 +1902,12 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
||||
}
|
||||
"<<" -> {
|
||||
asmgen.out("""
|
||||
ldy $otherName
|
||||
beq +
|
||||
- asl $name
|
||||
rol $name+1
|
||||
dey
|
||||
bne -
|
||||
ldy $otherName
|
||||
beq +
|
||||
- asl $name
|
||||
rol $name+1
|
||||
dey
|
||||
bne -
|
||||
+""")
|
||||
}
|
||||
">>" -> {
|
||||
|
@ -1,7 +1,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- codegen for cx16.r2L >>= gfx2.plot.shift4c[cx16.r1L] is wrong (gfx2.p8 older version fill hires 4c)
|
||||
- why does cx16.r1L = lsb(xx) & 3 generate 5 asm instructions? (noopt)
|
||||
- optimize asm: sta VAR / <something with A> / sta VAR
|
||||
- gfx2/monogfx: use vera auto in/decrement in the flood fill routine (getpixels)
|
||||
|
@ -9,6 +9,23 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
ubyte[] shifts = [0,2,4,6]
|
||||
ubyte value = 100
|
||||
ubyte index = 2
|
||||
value >>= shifts[index]
|
||||
txt.print_ub(value)
|
||||
txt.nl()
|
||||
value = 100
|
||||
index = 1
|
||||
value >>= shifts[index]
|
||||
txt.print_ub(value)
|
||||
txt.nl()
|
||||
value = 100
|
||||
index = 0
|
||||
value >>= shifts[index]
|
||||
txt.print_ub(value)
|
||||
txt.nl()
|
||||
|
||||
gfx2.screen_mode(2)
|
||||
demofill()
|
||||
repeat {
|
||||
|
Loading…
Reference in New Issue
Block a user