! Feature: Change to a 5x5 display [breaking change]
This commit is contained in:
parent
af12704c36
commit
c415056194
|
|
@ -7,8 +7,8 @@ const { num2hex } = require('./logging.js');
|
|||
**/
|
||||
const printDisplay = (mem) => {
|
||||
const disp = mem[POINTER_TO_START_OF_DISPLAY_MEM];
|
||||
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_START_OF_DISPLAY_MEM];
|
||||
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,11 +1,11 @@
|
|||
module.exports = {
|
||||
"START_OF_DISPLAY_MEM": 0,
|
||||
"POINTER_TO_START_OF_DISPLAY_MEM": 32,
|
||||
"POINTER_TO_START_OF_KEYPAD_MEM": 33,
|
||||
"POINTER_TO_START_OF_DISPLAY_MEM": 33,
|
||||
"POINTER_TO_START_OF_KEYPAD_MEM": 34,
|
||||
"INITIAL_IP_ADDRESS": 48,
|
||||
|
||||
// max number of times to step the CPU,
|
||||
// to stop endless loops
|
||||
// 0 = infinite
|
||||
"CYCLE_LIMIT": 128,
|
||||
"CYCLE_LIMIT": 256,
|
||||
}
|
||||
10
readme.md
10
readme.md
|
|
@ -62,11 +62,11 @@ With verbose debugging output:
|
|||
|
||||
## Memory map / Peripherals
|
||||
|
||||
- `00-0F` - display (4x4)
|
||||
- `10-1F` - keypad? (details TBD)
|
||||
- `20 ` - pointer to display memory
|
||||
- `21 ` - pointer to keypad memory
|
||||
- `22-2F` - reserved for future use / variable storage
|
||||
- `00-19` - display (5x5)
|
||||
- `20 ` - keypad (details TBD)
|
||||
- `21 ` - pointer to display memory
|
||||
- `22 ` - pointer to keypad memory
|
||||
- `23-2F` - reserved for future use / variable storage
|
||||
- `30 ` - initial value for IP
|
||||
- `30-FF` - free
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,27 @@
|
|||
;; Fill display with $FF
|
||||
; updated for 5x5 display
|
||||
|
||||
=pixelIndex $24
|
||||
=pixelFill $25
|
||||
|
||||
LDA $00 ; Start of display
|
||||
STO $21 ; Pixel index
|
||||
STO =pixelIndex
|
||||
|
||||
; store the $FF that we'll use to fill the screen
|
||||
LDA $FF
|
||||
STO $22
|
||||
STO =pixelFill
|
||||
|
||||
@copy-to-display
|
||||
LDA ($22) ; A = mem[$22] = $FF
|
||||
STO ($21) ; mem[mem[$21]] = A = $FF
|
||||
LDA ($25) ; A = mem[$25] = $FF
|
||||
STO ($24) ; update pixel ... mem[mem[$24]] = A = $FF
|
||||
|
||||
; increment pixel index
|
||||
LDA ($21)
|
||||
LDA ($24)
|
||||
ADD $01
|
||||
STO $21
|
||||
STO =pixelIndex
|
||||
|
||||
; if CF is set, then the display is full and we're done
|
||||
FHP 0
|
||||
LDA ($24) ; pixelIndex
|
||||
SUB $19 ; if pixelIndex - $19 == 0, we've reached the end
|
||||
FHP 2 ; Zero flag is #2
|
||||
JMP @copy-to-display
|
||||
|
||||
END
|
||||
Loading…
Reference in New Issue