Probably not worth the extra gates
Neil
Code: Select all
loop_01:
lda keys
bpl loop_90 ; no key pressed... Code: Select all
...
ldy #0 ; not strictly required... will get there eventually
...
; update the display count; we have eight leds but we only drive six
; to save code space (we don't need to clear them)
iny
cpy #6
bne loop
ldy #0
bra loop
...Code: Select all
ldy #5 ; NB. might actually be required,
; IF using the other two selects for something else
...
; update the display count; we have eight leds but we only drive six
; to save code space (we don't need to clear them)
dey
bpl loop
ldy #5
bra loop
... Code: Select all
VERSION = $00 ; alpha, $01 is first beta release
REVISION = $01 ; 2025-06-07
; 120 bytes, pending bug fixes
; * Main: 99
; * to_leds: 17
; * Reset Vectors: 4
; NB. For hardwired hex to 6digit, 7seg display
; Character bit5 -> decimal pointer
; so DNC Q7 of translation table
; The translation table is:
;LED_CODE db 0b00111111 ;0
; db 0b00000110 ;1
; db 0b01011011 ;2
; db 0b01001111 ;3
; db 0b01100110 ;4
; db 0b01101101 ;5
; db 0b01111101 ;6
; db 0b00000111 ;7
; db 0b01111111 ;8
; db 0b01101111 ;9
; db 0b01011111 ;a
; db 0b00111100 ;b
; db 0b00101000 ;c
; db 0b01011110 ;d
; db 0b01111101 ;e
; db 0b01110001 ;f
leds = $00
data = $07
W = $08
; Paleolithic
led_addr = $0B08 ; guesstimate
keys = $0B00 ; guesstimate
; Neolithic ; 6 digit 14pin LED block
; led_addr = $0880 ; /Y0-/Y5 decode lines
; key = $0886 ; /Y6 decode line
code
org $ff80
start: ; +2
ldy #5 ; Will be required if other 2 selects have different uses.
loop: ; +5
; for each character...
lda leds,y
sta led_addr,y ; display bit pattern
loop_01: ; +5
lda keys
bpl loop_99 ; no key pressed...
; do stuff to sort out the key value
; +20
; if key value = return
cmp #RETURN
bne loop_2
; increment memory address pointer
lda data
sta (W)
inc W
bne +
inc W+1
+ lda (W)
sta data
bra loop_90
; endif
loop_2: ; +7
; if key value = go
cmp #RUN
bne loop_3
; execute the program
jmp (W)
; endif
loop_3: ; +10
; if key value = Hi
cmp #Hi
bne loop_4
LDA data
STA W+1
bra loop_90
; endif
loop_4: ; +10
; if key value = Lo
cmp #Lo
bne loop_4
LDA data
STA W
bra loop_90
; endif
; +14
; else shuffle key value into (W)
and #$0F
asl data
asl data
asl data
asl data
ora data
sta data
; +4
loop_90:
; wait for key to be released
; this will cause display glitch, but...
lda keys
bmi loop_90
loop_99: ; +17
; put W and (W) into leds
; [x][x][x][x][x][x][ ][ ]
; (also provides a short delay for the LED multiplex)
ldx #0
lda W+1
jsr to_leds
lda W
jsr to_leds
lda data
jsr to_leds
; +5
; update the display count; we have eight leds but we only drive six
; to save code space (we don't need to clear them)
dey
bpl loop
bra start
to_leds: ; +17
; unpack byte into two adjacent LED patterns
; x has character position
pha
and #$0f ; low nibble
sta leds+1,x ; and output into the LED array
pla
lsr a
lsr a
lsr a
lsr a ; high nibble
sta leds,x ; this byte goes on the left
inx
inx
rts
org $fffc ; +4
dw start
db VERSION,REVISION
Code: Select all
$0000-$7FFFF RAM
$8000-$8007 LEDs
$8800 Keyboard
$9000-$900F 6522
$A000-A001 6850 UART
$B000 Alternate keyboard? Might simplify things
$C000-FFFF EEPROM
$FF80-FFFF DROM (when enabled)