2019-06-03 10:19:47 +00:00
|
|
|
// Tests optimization of identical sub-expressions
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
main: {
|
2019-09-29 21:13:37 +00:00
|
|
|
.label __3 = 4
|
2019-06-03 10:19:47 +00:00
|
|
|
.label screen = 2
|
|
|
|
lda #<$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z screen
|
2019-06-03 10:19:47 +00:00
|
|
|
lda #>$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z screen+1
|
2019-06-03 10:19:47 +00:00
|
|
|
ldx #0
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-06-03 10:19:47 +00:00
|
|
|
txa
|
|
|
|
asl
|
2019-09-29 21:13:37 +00:00
|
|
|
sta.z __3
|
2019-06-03 10:19:47 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-09-29 21:13:37 +00:00
|
|
|
adc.z __3
|
2019-06-03 10:19:47 +00:00
|
|
|
clc
|
|
|
|
adc #3
|
|
|
|
ldy #0
|
|
|
|
sta (screen),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen
|
2019-06-03 10:19:47 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen+1
|
2019-06-03 10:19:47 +00:00
|
|
|
!:
|
|
|
|
txa
|
|
|
|
clc
|
2019-09-29 21:13:37 +00:00
|
|
|
adc.z __3
|
2019-06-03 10:19:47 +00:00
|
|
|
clc
|
|
|
|
adc #3
|
|
|
|
ldy #0
|
|
|
|
sta (screen),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen
|
2019-06-03 10:19:47 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen+1
|
2019-06-03 10:19:47 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #3
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2019-06-03 10:19:47 +00:00
|
|
|
rts
|
|
|
|
}
|