;**** Get the normal keys save them at INBUFF until enter DEF_KEYBOARD_PULSE_A .equ 0B9h DEF_KEYBOARD_PULSE_B .equ 0BAh DEF_KEYBOARD_READ .equ 0E8h GET_KEY_ALL_CHECK: Conin: ; jmp Conin GET_KEY_ALL: in DEF_KEYBOARD_PULSE_B ; get what PB is ori 01H ; make PB0 HIGH out DEF_KEYBOARD_PULSE_B ; out A to PB mvi B, 8 xra a stc lxi h,KEY_SCAN_ROW mov m,a GET_KEY_ALL1: mov a,m ral mov m,a cma out DEF_KEYBOARD_PULSE_A ; set Col ; call delay ; lxi h,KEY_SCAN_ROW in DEF_KEYBOARD_READ ; get Col data cma ; invert ora a jz GET_KEY_ALL2 ; No key pressed call GET_KEY_ALL_GET_MATRIX mov a,d ora a jz GET_KEY_ALL2 lda LAST_TYPED_KEY cmp d jz GET_KEY_ALL mov a,d sta LAST_TYPED_KEY lxi h,KEY_SCAN_ROW ret GET_KEY_ALL2: dcr B jz GET_KEY_ALL_CHECK jmp GET_KEY_ALL1 return ;jmp return mvi A,0FFh out DEF_KEYBOARD_PULSE_A ret delay: mvi h,0ffh delay1: dcr h jnz delay1 ret GET_KEY_ALL_GET_MATRIX: mvi E,0 GET_KEY_ALL_GET_MATRIXA: rar jc GET_KEY_ALL_GET_MATRIX0 inr E jmp GET_KEY_ALL_GET_MATRIXA GET_KEY_ALL_GET_MATRIX0: mov a,e push PSW push B lxi H,NS_KEY_TABLE mvi E,08h mvi D,0 mov C,A mov A,B GET_KEY_ALL_GET_MATRIX1: cpi 08h jz GET_KEY_ALL_GET_MATRIX2 dad D inr A jmp GET_KEY_ALL_GET_MATRIX1 GET_KEY_ALL_GET_MATRIX2: mvi B,0 dad B mov D,M ; get Key from Table pop B pop PSW ret ;**** Returns special keys in A ( BREAK, X, CAPS, NUM, CODE, GRAPH, CTRL, SHIFT ) GET_KEY_SPECIAL_KEYS: mvi A,0FFh out DEF_KEYBOARD_PULSE_A in DEF_KEYBOARD_PULSE_B ; get what PB is ani 0FEH ; make PB0 low mov B,A ; move A to B out DEF_KEYBOARD_PULSE_B ; out A to PB in DEF_KEYBOARD_READ ; get keys on BREAK, CAPS,.. line push PSW mov A,B inr A out DEF_KEYBOARD_PULSE_B pop PSW cma ; invert sta SPECIAL_KEYS ret NS_KEY_TABLE: .db 'z','x','c','v','b','n','m','l' .db 'a','s','d','f','g','h','j','k' .db 'q','w','e','r','t','y','u','i' .db 'o','p','[' .db ':' .db '"' .db '<','>','?' .db '1','2','3','4','5','6','7','9' .db '9','0','-','=',0,0,0,0 ; last 4 = arrows .db ' ',8h,9h,01Bh,0,0,0,0ah ; three zero for PASTE LABLE PRINT .db 0,0,0,0,0,0,0,0 .db 0,0,0,0,0,0,0,0 S_KEY_TABLE: .db 'Z','X','C','V','B','N','M','L' .db 'A','S','D','F','G','H','J','K' .db 'Q','W','E','R','T','Y','U','I' .db 'O','P','[' .db ':','"' .db '<','>','?' .db '!','@','#','$','%','^','&','*' .db '(',')',' ',' ',0,0,0,0 ; last 4 = arrows .db ' ',8h,9h,01Bh,0,0,0,0dh ; three zero for PASTE LABLE PRINT .db 0,0,0,0,0,0,0,0 .db 0,0,0,0,0,0,0,0