Refactor: Rewrite fill-display:

- make more use of constants
- improve comments
This commit is contained in:
n loewen 2023-08-15 20:53:51 +01:00
parent 934f4c0f3f
commit 2cceaa71f2
1 changed files with 16 additions and 18 deletions

View File

@ -1,27 +1,25 @@
;; Fill display with $FF
; updated for 5x5 display
=pixelIndex $24
=pixelFill $25
=*px $24
=fill $25
LDA $00 ; Start of display
STO =pixelIndex
; Initialize variables...
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
STO =pixelFill
@paint
LDA (=fill) ; (A = mem[fill] = $FF)
STO (=*px) ; Paint pixel (mem[mem[*px]] = A = $FF)
@copy-to-display
LDA ($25) ; A = mem[$25] = $FF
STO ($24) ; update pixel ... mem[mem[$24]] = A = $FF
; increment pixel index
LDA ($24)
LDA (=*px) ; Increment pixel pointer...
ADD $01
STO =pixelIndex
LDA ($24) ; pixelIndex
SUB $19 ; if pixelIndex - $19 == 0, we've reached the end
FHP 2 ; Zero flag is #2
JMP @copy-to-display
STO =*px
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