Merge branch '5x5-display'

This commit is contained in:
n loewen 2023-08-21 14:38:02 +01:00
commit eaa0597552
2 changed files with 21 additions and 19 deletions

View File

@ -7,8 +7,8 @@ const { num2hex } = require('./logging.js');
**/ **/
const printDisplay = (mem) => { const printDisplay = (mem) => {
const disp = mem[POINTER_TO_DISPLAY]; const disp = mem[POINTER_TO_DISPLAY];
for (let i = disp; i < disp + 16; i += 4) { for (let i = disp; i < disp + 25; i += 5) {
console.log(`${num2hex(mem[i])} ${num2hex(mem[i+1])} ${num2hex(mem[i+2])} ${num2hex(mem[i+3])}`); console.log(`${num2hex(mem[i])} ${num2hex(mem[i+1])} ${num2hex(mem[i+2])} ${num2hex(mem[i+3])} ${num2hex(mem[i+4])}`);
} }
} }
@ -19,8 +19,8 @@ const printDisplay = (mem) => {
const prettyPrintDisplay = (mem) => { const prettyPrintDisplay = (mem) => {
const disp = mem[POINTER_TO_DISPLAY]; const disp = mem[POINTER_TO_DISPLAY];
const num2pic = (n) => n > 0 ? '⚫' : '⚪'; const num2pic = (n) => n > 0 ? '⚫' : '⚪';
for (let i = disp; i < disp + 16; i += 4) { for (let i = disp; i < disp + 25; i += 5) {
console.log(`${num2pic(mem[i])}${num2pic(mem[i+1])}${num2pic(mem[i+2])}${num2pic(mem[i+3])}`); console.log(`${num2pic(mem[i])}${num2pic(mem[i])}${num2pic(mem[i+1])}${num2pic(mem[i+2])}${num2pic(mem[i+4])}`);
} }
} }

View File

@ -1,23 +1,25 @@
;; Fill display with $FF ;; Fill display with $FF
; updated for 5x5 display
LDA $00 ; Start of display =*px $24
STO $21 ; Pixel index =fill $25
; store the $FF that we'll use to fill the screen ; Initialize variables...
LDA $FF LDA $00 ; (Address for the first px on the display)
STO $22 STO =*px ; Pointer to current px
LDA $FF ; ($FF is 'on', $00 is 'off')
STO =fill ; Stash value to fill with
@copy-to-display @paint
LDA ($22) ; A = mem[$22] = $FF LDA (=fill) ; (A = mem[fill] = $FF)
STO ($21) ; mem[mem[$21]] = A = $FF STO (=*px) ; Paint pixel (mem[mem[*px]] = A = $FF)
; increment pixel index LDA (=*px) ; Increment pixel pointer...
LDA ($21)
ADD $01 ADD $01
STO $21 STO =*px
; if CF is set, then the display is full and we're done
FHP 0
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