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("""
|
asmgen.out("""
|
||||||
tay
|
tay
|
||||||
beq +
|
|
||||||
lda $variable
|
lda $variable
|
||||||
|
cpy #0
|
||||||
|
beq +
|
||||||
- asl a
|
- asl a
|
||||||
dey
|
dey
|
||||||
bne -
|
bne -
|
||||||
@ -929,8 +930,9 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
if(!signed) {
|
if(!signed) {
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
tay
|
tay
|
||||||
beq +
|
|
||||||
lda $variable
|
lda $variable
|
||||||
|
cpy #0
|
||||||
|
beq +
|
||||||
- lsr a
|
- lsr a
|
||||||
dey
|
dey
|
||||||
bne -
|
bne -
|
||||||
@ -938,8 +940,9 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
} else {
|
} else {
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
tay
|
tay
|
||||||
beq +
|
|
||||||
lda $variable
|
lda $variable
|
||||||
|
cpy #0
|
||||||
|
beq +
|
||||||
sta P8ZP_SCRATCH_B1
|
sta P8ZP_SCRATCH_B1
|
||||||
- asl a
|
- asl a
|
||||||
ror P8ZP_SCRATCH_B1
|
ror P8ZP_SCRATCH_B1
|
||||||
@ -1899,12 +1902,12 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
}
|
}
|
||||||
"<<" -> {
|
"<<" -> {
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
ldy $otherName
|
ldy $otherName
|
||||||
beq +
|
beq +
|
||||||
- asl $name
|
- asl $name
|
||||||
rol $name+1
|
rol $name+1
|
||||||
dey
|
dey
|
||||||
bne -
|
bne -
|
||||||
+""")
|
+""")
|
||||||
}
|
}
|
||||||
">>" -> {
|
">>" -> {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
TODO
|
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)
|
- why does cx16.r1L = lsb(xx) & 3 generate 5 asm instructions? (noopt)
|
||||||
- optimize asm: sta VAR / <something with A> / sta VAR
|
- optimize asm: sta VAR / <something with A> / sta VAR
|
||||||
- gfx2/monogfx: use vera auto in/decrement in the flood fill routine (getpixels)
|
- gfx2/monogfx: use vera auto in/decrement in the flood fill routine (getpixels)
|
||||||
|
@ -9,6 +9,23 @@
|
|||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
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)
|
gfx2.screen_mode(2)
|
||||||
demofill()
|
demofill()
|
||||||
repeat {
|
repeat {
|
||||||
|
Loading…
Reference in New Issue
Block a user