Fix black screen, text rendering, and keyboard input issues

This commit is contained in:
2025-12-01 22:13:06 +01:00
parent 965e10f6b2
commit a1150081e9
6 changed files with 100 additions and 46 deletions

50
input.s
View File

@@ -13,10 +13,54 @@
; Returns: d0 = Raw Keycode (or 0 if no key)
; Preserves: d1-a6
ReadInput:
moveq #0,d0 ; Default: no key
movem.l d1-d2/a0,-(sp)
; Simple approach: just return 0 for now (disable keyboard)
; This prevents crashes from keyboard input
; Check if LastKey is still pending (not yet processed)
move.b LastKey,d0
cmp.b #0,d0
bne.s .done ; Still has unprocessed key, don't read new one
; Simple keyboard matrix scan for keys '1' and '2'
; Key '1' = Row 0, Column 1 (raw code $01)
; Key '2' = Row 0, Column 2 (raw code $02)
lea $bfe001,a0 ; CIAA base
; Set all rows to output, columns to input
move.b #$ff,$bfe201 ; CIAA DDRA (all output)
move.b #$00,$bfe301 ; CIAA DDRB (all input)
; Scan Row 0 (contains keys 1 and 2)
move.b #$fe,$bfe001 ; Set row 0 low (active), others high
nop
nop ; Small delay for signal to settle
move.b $bfe101,d1 ; Read columns from Port B
not.b d1 ; Invert (pressed = 1)
; Check column 1 (key '1')
btst #1,d1
bne.s .key1
; Check column 2 (key '2')
btst #2,d1
bne.s .key2
; No key pressed
moveq #0,d0
bra.s .done
.key1:
move.b #$01,d0
move.b d0,LastKey
bra.s .done
.key2:
move.b #$02,d0
move.b d0,LastKey
.done:
movem.l (sp)+,d1-d2/a0
rts
; TODO: Implement proper keyboard reading later