summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-09-09 08:21:13 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2003-09-09 08:21:13 (GMT)
commitc71c4cfbea3b323af79811d10e73ed6a59c4513e (patch)
treec9aa8f4d6fc252943ce50a56e3f1e05146cdb906
parentbaedd03c8dcf0673faf8e59e7a987158051a46c7 (diff)
downloadkeyboard-c71c4cfbea3b323af79811d10e73ed6a59c4513e.zip
keyboard-c71c4cfbea3b323af79811d10e73ed6a59c4513e.tar.gz
keyboard-c71c4cfbea3b323af79811d10e73ed6a59c4513e.tar.bz2
keyboard-c71c4cfbea3b323af79811d10e73ed6a59c4513e.tar.xz
It works!
-rw-r--r--data/keyboard.asm49
1 files changed, 21 insertions, 28 deletions
diff --git a/data/keyboard.asm b/data/keyboard.asm
index a893bd5..1a50f70 100644
--- a/data/keyboard.asm
+++ b/data/keyboard.asm
@@ -277,16 +277,17 @@ kt_reset
call (send_with_ack)
ld a,#0xf8 ; Set all keys Make/Break
call (send_with_ack)
+ jp (set_status) ; Compute status byte
+ ;
+ ; Keyboard main loop - read a char, decode, and emit
+ ;
main_loop_clear
kt_ignore
; Clear the break flag
xor a
ld (break_flag),a
- ;
- ; Keyboard main loop - read a char, decode, and emit
- ;
main_loop
call (read_byte)
call (printhex)
@@ -310,7 +311,7 @@ main_loop
jp (hl)
;
; Entry condititions:
-; A = keysym
+; A = keynum
; B = status_byte
; C = break_flag
; D = 0
@@ -372,9 +373,10 @@ set_status
jp (main_loop_clear)
kt_symbol
- jr nz,kts_break
+ jr nz,ktas_break
ld (down_key),a
ld a,b ; status_byte
+ktas_common
and #0x03
ld e,a
; D=0
@@ -382,41 +384,32 @@ kt_symbol
ld a,(ix+0)
out (#2),a
ld a,b ; status_byte
- or #0x80
+ and #0x7F
+ out (#3),a ; make sure strobe is pulsed
+ or #0x80 ; strobe
ld (status_byte),a
out (#3),a
jp (main_loop_clear)
-kts_break
+ktas_break
cp (iy+5) ; down_key
jp nz,(main_loop_clear)
ld a,b ; status_byte
- and #0x7F
+ and #0x7F ; strobe
ld (status_byte),a
out (#3),a
jp (main_loop_clear)
kt_alpha
- jr nz,kts_break
+ jr nz,ktas_break
ld (down_key),a
ld a,b ; status_byte
- and #0x42
- cp #0x40
+ and #0x42 ; CapsLock+Ctrl
+ cp #0x40 ; CapsLock on, Ctrl off
ld a,b ; status_byte
- jr nz,kta_nocaps
+ jr nz,ktas_common
xor #0x01 ; Invert sense of shift
-kta_nocaps
- and #0x03
- ld e,a
- ; D=0
- add ix,de
- ld a,(ix+0)
- out (#2),a
- ld a,b ; status_byte
- or #0x80
- ld (status_byte),a
- out (#3),a
- jp (main_loop_clear)
+ jr ktas_common
;
; Handlers for the various entries
@@ -469,7 +462,7 @@ keytype_table
byte 0,6,6,6,6,6,5,0, 0,3,6,6,6,5,5,0 ; 0x30
byte 0,5,6,6,6,5,5,0, 0,5,5,6,6,6,5,0 ; 0x40
byte 0,0,6,5,6,6,0,0, 3,3,5,6,0,0,0,4 ; 0x50
- byte 0,5,0,0,0,0,0,0, 0,0,5,5,5,0,0,0 ; 0x60
+ byte 0,5,0,0,0,0,5,0, 0,5,5,5,5,0,5,0 ; 0x60
byte 5,5,5,5,5,5,4,5, 0,5,5,0,5,5,5,0 ; 0x70
byte 0,0,0,0,5,0,0,0, 0,0,0,3,3,0,0,0 ; 0x80
byte 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 ; 0x90
@@ -583,7 +576,7 @@ keydata_table
byte "{" ,"[" ,0x1B,0x0B ; 0x52
byte "'" ,"*" ,"'" ,"*" ; 0x53
byte "}" ,"]" ,0x1D,0x0D ; 0x54
- byte "@" ,"`" ,0x00,0x10 ; 0x55
+ byte "`", "@" ,0x00,0x10 ; 0x55
byte 0x00,0x00,0x00,0x00 ; 0x56
byte 0x00,0x00,0x00,0x00 ; 0x57
byte 0x00,0x02,0xFF,0xFD ; 0x58
@@ -600,10 +593,10 @@ keydata_table
byte 0x00,0x00,0x00,0x00 ; 0x63
byte 0x00,0x00,0x00,0x00 ; 0x64
byte 0x00,0x00,0x00,0x00 ; 0x65
- byte 0x00,0x00,0x00,0x00 ; 0x66
+ byte 0x08,0x08,0x08,0x08 ; 0x66
byte 0x00,0x00,0x00,0x00 ; 0x67
byte 0x00,0x00,0x00,0x00 ; 0x68
- byte 0x00,0x00,0x00,0x00 ; 0x69
+ byte "1" ,"1" ,"1" ,"1" ; 0x69
byte 0x09,0x09,0x09,0x09 ; 0x6A
byte "4" ,"4" ,"4" ,"4" ; 0x6B
byte "7" ,"7" ,"7" ,"7" ; 0x6C