Merge branch '5x5-display'
This commit is contained in:
commit
eaa0597552
|
|
@ -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])}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue