diff --git a/display.js b/display.js index 5ae6999..c330741 100644 --- a/display.js +++ b/display.js @@ -7,8 +7,8 @@ const { num2hex } = require('./logging.js'); **/ const printDisplay = (mem) => { const disp = mem[POINTER_TO_DISPLAY]; - for (let i = disp; i < disp + 16; i += 4) { - console.log(`${num2hex(mem[i])} ${num2hex(mem[i+1])} ${num2hex(mem[i+2])} ${num2hex(mem[i+3])}`); + 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])} ${num2hex(mem[i+4])}`); } } @@ -19,8 +19,8 @@ const printDisplay = (mem) => { const prettyPrintDisplay = (mem) => { const disp = mem[POINTER_TO_DISPLAY]; const num2pic = (n) => n > 0 ? '⚫' : '⚪'; - for (let i = disp; i < disp + 16; i += 4) { - console.log(`${num2pic(mem[i])}${num2pic(mem[i+1])}${num2pic(mem[i+2])}${num2pic(mem[i+3])}`); + for (let i = disp; i < disp + 25; i += 5) { + console.log(`${num2pic(mem[i])}${num2pic(mem[i])}${num2pic(mem[i+1])}${num2pic(mem[i+2])}${num2pic(mem[i+4])}`); } } diff --git a/test-programs/fill-display.asm b/test-programs/fill-display.asm index aa09e53..a9b92a7 100644 --- a/test-programs/fill-display.asm +++ b/test-programs/fill-display.asm @@ -1,23 +1,25 @@ ;; Fill display with $FF +; updated for 5x5 display -LDA $00 ; Start of display -STO $21 ; Pixel index +=*px $24 +=fill $25 -; store the $FF that we'll use to fill the screen -LDA $FF -STO $22 + ; 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 -@copy-to-display - LDA ($22) ; A = mem[$22] = $FF - STO ($21) ; mem[mem[$21]] = A = $FF +@paint + LDA (=fill) ; (A = mem[fill] = $FF) + STO (=*px) ; Paint pixel (mem[mem[*px]] = A = $FF) -; increment pixel index -LDA ($21) +LDA (=*px) ; Increment pixel pointer... ADD $01 -STO $21 - -; if CF is set, then the display is full and we're done -FHP 0 - 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 \ No newline at end of file