Refactor: Rewrite fill-display:
- make more use of constants - improve comments
This commit is contained in:
parent
934f4c0f3f
commit
2cceaa71f2
|
|
@ -1,27 +1,25 @@
|
||||||
;; Fill display with $FF
|
;; Fill display with $FF
|
||||||
; updated for 5x5 display
|
; updated for 5x5 display
|
||||||
|
|
||||||
=pixelIndex $24
|
=*px $24
|
||||||
=pixelFill $25
|
=fill $25
|
||||||
|
|
||||||
LDA $00 ; Start of display
|
; Initialize variables...
|
||||||
STO =pixelIndex
|
LDA $00 ; (Address for the first px on the display)
|
||||||
|
STO =*px ; Pointer to current px
|
||||||
|
LDA $FF ; ($FF is 'on', $00 is 'off')
|
||||||
|
STO =fill ; Stash value to fill with
|
||||||
|
|
||||||
LDA $FF
|
@paint
|
||||||
STO =pixelFill
|
LDA (=fill) ; (A = mem[fill] = $FF)
|
||||||
|
STO (=*px) ; Paint pixel (mem[mem[*px]] = A = $FF)
|
||||||
|
|
||||||
@copy-to-display
|
LDA (=*px) ; Increment pixel pointer...
|
||||||
LDA ($25) ; A = mem[$25] = $FF
|
|
||||||
STO ($24) ; update pixel ... mem[mem[$24]] = A = $FF
|
|
||||||
|
|
||||||
; increment pixel index
|
|
||||||
LDA ($24)
|
|
||||||
ADD $01
|
ADD $01
|
||||||
STO =pixelIndex
|
STO =*px
|
||||||
|
|
||||||
LDA ($24) ; pixelIndex
|
|
||||||
SUB $19 ; if pixelIndex - $19 == 0, we've reached the end
|
|
||||||
FHP 2 ; Zero flag is #2
|
|
||||||
JMP @copy-to-display
|
|
||||||
|
|
||||||
|
LDA (=*px) ; Test whether to loop or not...
|
||||||
|
SUB $19 ; if *px - $19 == 0, we've reached the end
|
||||||
|
FHP 2 ; (Zero flag is #2)
|
||||||
|
JMP @paint
|
||||||
END
|
END
|
||||||
Loading…
Reference in New Issue