6502-OS/system/keyboard.h65
2023-12-27 21:40:14 +01:00

24 lines
1016 B
Plaintext

;;********************************************************************************
;; @module keyboard
;; @type drive
;; @details:
;; Support for a PS2 Keyboard using the shift register of a 6522 VIA
;; Pressing a key causes 11 bits to be sent: 1 start - 8 keycode - 1 parity - 1 stop
;; The VIA is set up to interrupt after 8 bits have been shifted into the shift register
;; from the external clock pulses of the keyboard (additional hardware required to
;; address the hardware bug of the VIA, where bit get lost when the external clock
;; transition happens during falling edge of PHI2). After reading the shift register,
;; the VIAs T2 timer is set to interrupt after the last 3 bits have been shifted in,
;; which takes about ~230ms.
;;********************************************************************************
.ifndef INCLUDE_KEYBOARD
INCLUDE_KEYBOARD = 1
.include "system.h65"
.scope kb
Import kb,init,irq_shift_reg_handler,irq_timer_handler,keycode,key_read
KB_IO = IO1
.endscope
.endif