2019-04-08 07:00:48 +00:00
|
|
|
// Tests elimination of plus 0
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
main: {
|
|
|
|
ldx #'a'
|
|
|
|
lda #<$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z fill.screen
|
2019-04-08 07:00:48 +00:00
|
|
|
lda #>$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z fill.screen+1
|
2019-04-08 07:00:48 +00:00
|
|
|
jsr fill
|
|
|
|
ldx #'b'
|
|
|
|
lda #<$2000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z fill.screen
|
2019-04-08 07:00:48 +00:00
|
|
|
lda #>$2000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z fill.screen+1
|
2019-04-08 07:00:48 +00:00
|
|
|
jsr fill
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
// fill(byte* zeropage(2) screen, byte register(X) ch)
|
|
|
|
fill: {
|
|
|
|
.label screen = 2
|
2019-09-29 21:13:37 +00:00
|
|
|
.label __5 = 4
|
|
|
|
.label __7 = 6
|
2019-04-08 07:00:48 +00:00
|
|
|
ldy #0
|
2019-09-29 21:13:37 +00:00
|
|
|
__b2:
|
2019-04-08 07:00:48 +00:00
|
|
|
txa
|
|
|
|
sta (screen),y
|
|
|
|
lda #1*$28
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z screen
|
2019-09-29 21:13:37 +00:00
|
|
|
sta.z __5
|
2019-04-08 07:00:48 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z screen+1
|
2019-09-29 21:13:37 +00:00
|
|
|
sta.z __5+1
|
2019-04-08 07:00:48 +00:00
|
|
|
txa
|
2019-09-29 21:13:37 +00:00
|
|
|
sta (__5),y
|
2019-04-08 07:00:48 +00:00
|
|
|
lda #2*$28
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z screen
|
2019-09-29 21:13:37 +00:00
|
|
|
sta.z __7
|
2019-04-08 07:00:48 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z screen+1
|
2019-09-29 21:13:37 +00:00
|
|
|
sta.z __7+1
|
2019-04-08 07:00:48 +00:00
|
|
|
txa
|
2019-09-29 21:13:37 +00:00
|
|
|
sta (__7),y
|
2019-04-08 07:00:48 +00:00
|
|
|
iny
|
|
|
|
cpy #$28
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b2
|
2019-04-08 07:00:48 +00:00
|
|
|
rts
|
|
|
|
}
|