From e698cd9a4a2738ef61264c10b60c90ffc218fefa Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Tue, 21 Dec 2021 14:44:07 -0800 Subject: [PATCH] Keyboard Utilities - Added KBDINFO which dumps low level info about keyboards. - Updated KBDTEST and VDCTEST to put the keyboard controller into translation mode which is what these programs were intended to use. --- Source/Apps/Test/Build.cmd | 1 + Source/Apps/Test/Clean.cmd | 1 + Source/Apps/Test/Makefile | 2 +- Source/Apps/Test/kbdinfo/Build.cmd | 10 + Source/Apps/Test/kbdinfo/Clean.cmd | 6 + Source/Apps/Test/kbdinfo/Makefile | 7 + Source/Apps/Test/kbdinfo/kbdinfo.asm | 699 +++++++++++++++++++++++++++ Source/Apps/Test/kbdtest/kbdtest.asm | 109 +++-- Source/Apps/Test/vdctest/vdctest.asm | 75 +-- Source/ver.inc | 2 +- Source/ver.lib | 2 +- 11 files changed, 835 insertions(+), 79 deletions(-) create mode 100644 Source/Apps/Test/kbdinfo/Build.cmd create mode 100644 Source/Apps/Test/kbdinfo/Clean.cmd create mode 100644 Source/Apps/Test/kbdinfo/Makefile create mode 100644 Source/Apps/Test/kbdinfo/kbdinfo.asm diff --git a/Source/Apps/Test/Build.cmd b/Source/Apps/Test/Build.cmd index 5b703591..139ea0c9 100644 --- a/Source/Apps/Test/Build.cmd +++ b/Source/Apps/Test/Build.cmd @@ -21,6 +21,7 @@ pushd I2C && call Build || exit /b & popd pushd rzsz && call Build || exit /b & popd pushd vdctest && call Build || exit /b & popd pushd kbdtest && call Build || exit /b & popd +pushd kbdinfo && call Build || exit /b & popd goto :eof diff --git a/Source/Apps/Test/Clean.cmd b/Source/Apps/Test/Clean.cmd index ba1eb940..3cb2cdfa 100644 --- a/Source/Apps/Test/Clean.cmd +++ b/Source/Apps/Test/Clean.cmd @@ -16,3 +16,4 @@ pushd I2C && call Clean || exit /b 1 & popd pushd rzsz && call Clean || exit /b 1 & popd pushd vdctest && call Clean || exit /b 1 & popd pushd kbdtest && call Clean || exit /b 1 & popd +pushd kbdinfo && call Clean || exit /b 1 & popd diff --git a/Source/Apps/Test/Makefile b/Source/Apps/Test/Makefile index ad967e08..3c844c01 100644 --- a/Source/Apps/Test/Makefile +++ b/Source/Apps/Test/Makefile @@ -1,5 +1,5 @@ OBJECTS = -SUBDIRS = DMAmon I2C inttest ppidetst ramtest tstdskng rzsz kbdtest vdctest +SUBDIRS = DMAmon I2C inttest ppidetst ramtest tstdskng rzsz vdctest kbdtest kbdinfo DEST = ../../../Binary/Apps/Test TOOLS =../../../Tools diff --git a/Source/Apps/Test/kbdinfo/Build.cmd b/Source/Apps/Test/kbdinfo/Build.cmd new file mode 100644 index 00000000..1f9866d6 --- /dev/null +++ b/Source/Apps/Test/kbdinfo/Build.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF kbdinfo.asm kbdinfo.com kbdinfo.lst || exit /b + +copy /Y kbdinfo.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/kbdinfo/Clean.cmd b/Source/Apps/Test/kbdinfo/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/kbdinfo/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/kbdinfo/Makefile b/Source/Apps/Test/kbdinfo/Makefile new file mode 100644 index 00000000..3525056d --- /dev/null +++ b/Source/Apps/Test/kbdinfo/Makefile @@ -0,0 +1,7 @@ +OBJECTS = kbdinfo.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/kbdinfo/kbdinfo.asm b/Source/Apps/Test/kbdinfo/kbdinfo.asm new file mode 100644 index 00000000..fc6701c0 --- /dev/null +++ b/Source/Apps/Test/kbdinfo/kbdinfo.asm @@ -0,0 +1,699 @@ +; +;======================================================================= +; Keyboard Information Utility (KBDINFO) +;======================================================================= +; +; Simple utility that attempts to determine the type of keyboard you +; have attached to an 8242 keyboard controller. +; +;======================================================================= +; +; Keyboard controller port addresses (adjust as needed) +; +iocmd .equ $E3 ; keyboard controller command port address +iodat .equ $E2 ; keyboard controller data port address +; +; General operational equates (should not requre adjustment) +; +stksiz .equ $40 ; Working stack size +; +timeout .equ $00 ; Controller timeout constant +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +;======================================================================= +; + .org $100 ; standard CP/M executable +; +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + call crlf + ld de,str_banner ; banner + call prtstr +; + call main ; do the real work +; +exit: + call crlf2 + ld de,str_exit + call prtstr + ;call crlf + + ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart +; +; +;======================================================================= +; Main Program +;======================================================================= +; +main: +; +; Display active keyboard controller port addresses +; + call crlf2 + ld de,str_cmdport + call prtstr + ld a,iocmd + call prthex + call crlf + ld de,str_dataport + call prtstr + ld a,iodat + call prthex +; +; Attempt self-test command on keyboard controller +; +; Keyboard controller should respond with an 0x55 on data port +; after being sent a 0xAA on the command port. +; + call crlf2 + ld de,str_ctrl_test + call prtstr + ld a,$aa ; self-test command + call put_cmd_dbg + jp c,err_ctlr_io ; handle controller error + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $55 ; expected value? + jp nz,err_ctlr_test ; handle self-test error + call crlf + ld de,str_ctrl_test_ok + call prtstr +; +; Disable translation on keyboard controller to get raw scan codes! +; + call crlf2 + ld de,str_trans_off + call prtstr + ld a,$60 ; write to command register 0 + call put_cmd_dbg + jp c,err_ctlr_io ; handle controller error + ld a,$20 ; xlat disabled, mouse disabled, no ints + call put_data_dbg + jp c,err_ctlr_io ; handle controller error +; +; +; + call test2 +; +; Enable translation on keyboard controller +; + call crlf2 + ld de,str_trans_on + call prtstr + ld a,$60 ; write to command register 0 + call put_cmd_dbg + jp c,err_ctlr_io ; handle controller error + ld a,$60 ; xlat disabled, mouse disabled, no ints + call put_data_dbg + jp c,err_ctlr_io ; handle controller error +; + ; fall thru +; +test2: +; +; Perform a keyboard reset +; + call crlf2 + ld de,str_kbd_reset + call prtstr + ld a,$ff ; Keyboard reset + call put_data_dbg + jp c,err_ctlr_io ; handle controller error + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_reset + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $AA ; Success? + jp nz,err_kbd_reset + call crlf + ld de,str_kbd_reset_ok + call prtstr +; +; Identify keyboard +; + call crlf2 + ld de,str_kbd_ident + call prtstr + ld a,$f2 ; Identify keyboard command + call put_data_dbg + jp c,err_ctlr_io ; handle controller error + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_ident + ; Now we need to receive 0-2 bytes. There is no way to know + ; how many are coming, so we receive bytes until there is a + ; timeout error. + ld ix,workbuf + ld iy,workbuf_len + xor a + ld (iy),a +ident_loop: + call get_data_dbg + jr c,ident_done + ld (ix),a + inc ix + inc (iy) + jr ident_loop +ident_done: + call crlf + ld de,str_kbd_ident_disp + call prtstr + ld a,'[' + call prtchr + ld ix,workbuf + ld b,(iy) + xor a + cp b + jr z,ident_done2 +ident_done1: + ld a,(ix) + call prthex + inc ix + djnz ident_done1 +ident_done2: + ld a,']' + call prtchr +; +; Get active scan code set being used +; + call crlf2 + ld de,str_kbd_getsc + call prtstr + ld a,$f0 ; Keyboard get/set scan code + call put_data_dbg + jp c,err_ctlr_io ; handle controller error + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_getsc + ld a,$00 ; Get active scan code set + call put_data_dbg + jp c,err_ctlr_io ; handle controller error + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_getsc + call get_data_dbg + jp c,err_ctlr_io ; handle controller error + push af + call crlf + ld de,str_kbd_dispsc + call prtstr + pop af + call prtdecb +;;;; +;;;; Set active scan code set to 2 +;;;; +;;; call crlf2 +;;; ld de,str_kbd_setsc +;;; call prtstr +;;; ld a,$f0 ; Keyboard get/set scan code +;;; call put_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; call get_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; cp $FA ; Is it an ack as expected? +;;; jp nz,err_kbd_getsc +;;; ld a,$02 ; Set scan code set to 2 +;;; call put_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; call get_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; cp $FA ; Is it an ack as expected? +;;; jp nz,err_kbd_getsc +;;;; +;;;; Get active scan code set being used +;;;; +;;; call crlf2 +;;; ld de,str_kbd_getsc +;;; call prtstr +;;; ld a,$f0 ; Keyboard get/set scan code +;;; call put_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; call get_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; cp $FA ; Is it an ack as expected? +;;; jp nz,err_kbd_getsc +;;; ld a,$00 ; Get active scan code set +;;; call put_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; call get_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; cp $FA ; Is it an ack as expected? +;;; jp nz,err_kbd_getsc +;;; call get_data_dbg +;;; jp c,err_ctlr_io ; handle controller error +;;; push af +;;; call crlf +;;; ld de,str_kbd_dispsc +;;; call prtstr +;;; pop af +;;; and $0f +;;; call prtdecb +; +; Read and display raw scan codes +; + call crlf2 + ld de,str_disp_scan_codes + call prtstr +read_loop: + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp $1B ; Escape key? + jp z,done + call check_read + jr nz,read_loop + call get_data + jp c,err_ctlr_io ; handle controller error + push af + ld a,' ' + call prtchr + ld a,'[' + call prtchr + pop af + call prthex + ld a,']' + call prtchr + jr read_loop + +done: + ret +; +;======================================================================= +; Keyboard Controller I/O Routines +;======================================================================= +; +wait_write: +; +; Wait for keyboard controller to be ready for a write +; A=0 indicates success (ZF set) +; + ld b,timeout ; setup timeout constant +wait_write1: + in a,(iocmd) ; get status + ld c,a ; save status + and $02 ; isolate input buf status bit + ret z ; 0 means ready, all done + call delay ; wait a bit + djnz wait_write1 ; loop until counter exhausted + ld de,str_timeout_write ; write timeout message + call crlf + call prtstr + ld a,c ; recover last status value + call prthex + or $ff ; signal error + ret +; +wait_read: +; +; Wait for keyboard controller to be ready to read a byte +; A=0 indicates success (ZF set) +; + ld b,timeout ; setup timeout constant +wait_read1: + in a,(iocmd) ; get status + ld c,a ; save status + and $01 ; isolate input buf status bit + xor $01 ; invert so 0 means ready + ret z ; if 0, all done + call delay ; wait a bit + djnz wait_read1 ; loop until counter exhausted + ld de,str_timeout_read ; write timeout message + call crlf + call prtstr + ld a,c ; recover last status value + call prthex + or $ff ; signal error + ret +; +check_read: +; +; Check for data ready to read +; A=0 indicates data available (ZF set) +; + in a,(iocmd) ; get status + and $01 ; isolate input buf status bit + xor $01 ; invert so 0 means ready + ret +; +put_cmd: +; +; Put a cmd byte from A to the keyboard interface with timeout +; CF set indicates timeout error +; + ld e,a ; save incoming value + call wait_write ; wait for controller ready + jr z,put_cmd1 ; if ready, move on + scf ; else, signal timeout error + ret ; and bail out +put_cmd1: + ld a,e ; recover value to write + out (iocmd),a ; write it + or a ; clear CF for success + ret +; +put_cmd_dbg: + call put_cmd + ret c + push af + call crlf + ld de,str_put_cmd + call prtstr + call prthex + pop af + ret +; +put_data: +; +; Put a data byte from A to the keyboard interface with timeout +; CF set indicates timeout error +; + ld e,a ; save incoming value + call wait_write ; wait for controller ready + jr z,put_data1 ; if ready, move on + scf ; else, signal timeout error + ret ; and bail out +put_data1: + ld a,e ; recover value to write + out (iodat),a ; write it + or a ; clear CF for success + ret +; +put_data_dbg: + call put_data + ret c + push af + call crlf + ld de,str_put_data + call prtstr + call prthex + pop af + ret + +; +; Get a data byte from the keyboard interface to A with timeout +; CF set indicates timeout error +; +get_data: + call wait_read ; wait for byte to be ready + jr z,get_data1 ; if readym, move on + scf ; else signal timeout error + ret ; and bail out +get_data1: + in a,(iodat) ; get data byte + or a ; clear CF for success + ret +; +get_data_dbg: + call get_data + ret c + push af + call crlf + ld de,str_get_data + call prtstr + call prthex + pop af + ret +; +; Error Handlers +; +err_ctlr_io: + ld de,str_err_ctrl_io + jr err_ret +; +err_ctlr_test: + ld de,str_err_ctrl_test + jr err_ret +; +err_kbd_reset: + ld de,str_err_kbd_reset + jr err_ret +; +err_kbd_getsc: + ld de,str_err_kbd_getsc + jr err_ret +; +err_kbd_setsc: + ld de,str_err_kbd_setsc + jr err_ret +; +err_kbd_ident: + ld de,str_err_kbd_ident + jr err_ret +; +err_ret: + call crlf2 + call prtstr + or $ff ; signal error + ret +; +;======================================================================= +; Utility Routines +;======================================================================= +; +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (de) without destroying any registers +; +prtstr: + push af + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + pop af + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in hl +; +prthexword: + push af + ld a,h + call prthex + ld a,l + call prthex + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Brief delay +; +delay: + push bc + ld b,0 +delay1: + ex (sp),hl + ex (sp),hl + ex (sp),hl + ex (sp),hl + ex (sp),hl + ex (sp),hl + ex (sp),hl + ex (sp),hl + djnz delay1 + pop bc + ret +; +;======================================================================= +; Constants +;======================================================================= +; +str_banner .db "Keyboard Information, v0.1",0 +str_exit .db "Done, Thank you for using KBDINFO!",0 +str_cmdport .db "Keyboard Controller Command Port: 0x",0 +str_dataport .db "Keyboard Controller Data Port: 0x",0 +str_timeout_write .db "Keyboard Controller Write Timeout, Status: 0x",0 +str_timeout_read .db "Keyboard Controller Read Timeout, Status: 0x",0 +str_err_ctrl_io .db "Keyboard Controller I/O Failure",0 +str_err_ctrl_test .db "Keyboard Controller Self-Test Failed",0 +str_put_cmd .db "Sent Command 0x",0 +str_put_data .db "Sent Data 0x",0 +str_get_data .db "Got Data 0x",0 +str_ctrl_test .db "Attempting Controller Self-Test",0 +str_ctrl_test_ok .db "Controller Self-Test OK",0 +str_trans_off .db "Disabling Controller Translation",0 +str_trans_on .db "Enabling Controller Translation",0 +str_kbd_reset .db "Attempting Keyboard Reset",0 +str_kbd_reset_ok .db "Keyboard Reset OK",0 +str_err_kbd_reset .db "Keyboard Reset Failed",0 + +str_kbd_getsc .db "Requesting Active Scan Code Set from Keyboard",0 +str_kbd_dispsc .db "Active Keyboard Scan Code Set is ",0 +str_err_kbd_getsc .db "Error getting active keyboard scan code set",0 +str_kbd_setsc .db "Setting Active Keyboard Scan Code Set",0 +str_err_kbd_setsc .db "Error setting keyboard scan code set",0 +str_kbd_ident .db "Keyboard Identification",0 +str_kbd_ident_disp .db "Keyboard Identify: ",0 +str_err_kbd_ident .db "Error performing Keyboard Identification",0 +str_disp_scan_codes .db "Displaying Raw Scan Codes",13,10 + .db " Press keys on keyboard to display scan codes",13,10 + .db " Press on CP/M console to end",13,10,13,10,0 +; +;======================================================================= +; Working data +;======================================================================= +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +workbuf .fill 8 +workbuf_len .db 0 +; +;======================================================================= +; + .end \ No newline at end of file diff --git a/Source/Apps/Test/kbdtest/kbdtest.asm b/Source/Apps/Test/kbdtest/kbdtest.asm index 06fd1594..84f43664 100644 --- a/Source/Apps/Test/kbdtest/kbdtest.asm +++ b/Source/Apps/Test/kbdtest/kbdtest.asm @@ -34,14 +34,23 @@ START: CALL PRINT_STRING LD C,0AAH ;Test PS/2 Controller - CALL KEY_OUT + CALL CMD_OUT CHK1: CALL KEY_IN_STATUS ;wait for feedback JR Z,CHK1 IN A,(KEY_DATA) CP 055H ;If not 55H then error - JR Z,DONE_INIT - LD HL,INIT_ERR ;Say error + JR NZ,INIT_ERR + LD C,060H ; Set keyboard controller cmd byte + CALL CMD_OUT + LD C,$60 ; XLAT ENABLED, MOUSE DISABLED, NO INTS + CALL KEY_OUT + LD C,0AEH ;Enable 1st PS/2 port + CALL CMD_OUT ;Send it + JR DONE_INIT + +INIT_ERR: + LD HL,INIT_ERR_STR ;Say error CALL PRINT_STRING HALT ;Just Halt! @@ -49,9 +58,6 @@ DONE_INIT: LD HL,INIT_OK ;Say all OK CALL PRINT_STRING - LD C,0AEH ;Enable 1st PS/2 port - CALL KEY_OUT ;Send it - LOOP: CALL KEY_IN_STATUS ;See if keyboard key available JR Z,LOOP @@ -62,8 +68,9 @@ LOOP: CALL A_HEXOUT ;Display Hex value of typed character + two spaces - CP 0F0H ;Is it an UP key - JR NZ,DOWNKY ;Must be a down key stroke + ;CP 0F0H ;Is it an UP key + AND 080H ;Is it an UP key + JR Z,DOWNKY ;Must be a down key stroke LD HL,UPKEY_MSG ;Say Up Key CALL PRINT_STRING CALL ZCRLF @@ -148,14 +155,22 @@ KEY_IN_STATUS: ;Ret NZ if character is available AND 1 RET ;Ret NZ if character available -KEY_OUT: ;Send a byte (in [C]) to Control port +CMD_OUT: ;Send a byte (in [C]) to Control port IN A,(KEY_CTRL) AND 2 - JR NZ,KEY_OUT ;Chip is not ready yet to receive character + JR NZ,CMD_OUT ;Chip is not ready yet to receive character LD A,C OUT (KEY_CTRL),A RET +KEY_OUT: ;Send a byte (in [C]) to Data port + IN A,(KEY_CTRL) + AND 2 + JR NZ,KEY_OUT ;Chip is not ready yet to receive character + LD A,C + OUT (KEY_DATA),A + RET + ; A_HEXOUT ;output the 2 hex digits in [A] A_HEXOUT: ;No registers altered @@ -243,7 +258,7 @@ SIGNON: .DB CR,LF,LF .DB "Test VT82C42 PC Keyboard & Mouse controller chip on Z80 KBDMSE Board." .DB CR,LF,"$" -INIT_ERR: +INIT_ERR_STR: .DB CR,LF,BELL .DB "Error: The 0xAA Test of Controller did nor return 0x55. Program Halted." .DB CR,LF,"$" @@ -272,78 +287,78 @@ IBM2_MSG: IBM1TBL: ;The "Normal" table ;00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f - .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H -; .DB 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F +; .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H + .DB 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F ;10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f - .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 -; .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F +; .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 + .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F ;20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f - .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 -; .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F +; .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 + .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F ;30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f - .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 -; .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F +; .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 + .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F ;40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f - .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F +; .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F ;50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f - .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F +; .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F ;60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f - .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F ;70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f - .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F ;80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f - .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F IBM2TBL: ;If the SHIFT key or CAPS lock key is on ;00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f - .DB 0, "*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"~",00H -; .DB 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 ;00-0F +; .DB 0, "*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"~",00H + .DB 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 ;00-0F ;10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f - .DB 0, 0, 0, 0, 0,"Q","!", 0, 0, 0,"Z","S","A","W","@",0 -; .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" ;10-1F +; .DB 0, 0, 0, 0, 0,"Q","!", 0, 0, 0,"Z","S","A","W","@",0 + .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" ;10-1F ;20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f - .DB 0,"C","X","D","E","$","#", 0, 0," ","V","F","T","R","%",0 -; .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" ;20-2F +; .DB 0,"C","X","D","E","$","#", 0, 0," ","V","F","T","R","%",0 + .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" ;20-2F ;30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f - .DB 0,"N","B","H","G","Y","^", 0, 0, 0,"M","J","U","&","*",0 -; .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 ;30-3F +; .DB 0,"N","B","H","G","Y","^", 0, 0, 0,"M","J","U","&","*",0 + .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 ;30-3F ;40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f - .DB 0,"<","K","I","O",29H,"(", 0, 0,">","?","L",":","P", "_",0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F +; .DB 0,"<","K","I","O",29H,"(", 0, 0,">","?","L",":","P", "_",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F ;50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f - .DB 0, 0,22H, 0,"{","+", 0, 0, 0, 0,0DH,"}", 0,"|", 0,0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F +; .DB 0, 0,22H, 0,"{","+", 0, 0, 0, 0,0DH,"}", 0,"|", 0,0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F ;60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f - .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F ;70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f - .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F ;80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f - .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F .FILL 040H,000H diff --git a/Source/Apps/Test/vdctest/vdctest.asm b/Source/Apps/Test/vdctest/vdctest.asm index b3bbd949..60eb8564 100644 --- a/Source/Apps/Test/vdctest/vdctest.asm +++ b/Source/Apps/Test/vdctest/vdctest.asm @@ -692,12 +692,16 @@ VDU_LOADFONT_LOOP_1: ; ; INIT KEYBOARD CONTROLLER ;__________________________________________________________________________________________________ -KB_INITIALIZE: - LD C,0a7H ; +KB_INITIALIZE: + LD C,0aaH ; SELF TEST CALL I8242CommandPut ; - LD C,0aeH ; + LD C,060H ; SET COMMAND REGISTER CALL I8242CommandPut ; - LD C,0aaH ; + LD C,$60 ; XLAT ENABLED, MOUSE DISABLED, NO INTS + CALL I8242DataPut ; + LD C,0a7H ; DISABLE MOUSE + CALL I8242CommandPut ; + LD C,0aeH ; ENABLE KEYBOARD CALL I8242CommandPut ; LD A,0 ; EMPTY KB QUEUE LD (KB_QUEUE_PTR),A ; @@ -716,6 +720,19 @@ I8242CommandPut: OUT (I8242Command),A ; select register RET +;__I8242DataPut____________________________________________________________________________________ +; +; WRITE VALUE IN A TO 8242 +; C: VALUE TO WRITE +;__________________________________________________________________________________________________ +I8242DataPut: + IN A,(I8242Status) ; read status register + BIT 1,A ; if bit 1 = 1 + JR NZ,I8242DataPut ; wait for ready + LD A,C ; + OUT (I8242Data),A ; select register + RET + ;__WAIT_KBHIT______________________________________________________________________________________ ; ; WAIT FOR A KEY PRESS @@ -998,33 +1015,33 @@ KB_ENQUEUE_AB: normalkeys: ; The TI character codes, offset from label by keyboard scan code -; .db 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F -; .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F -; .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F -; .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F -; .db 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 -; .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" -; .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" -; .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 -; .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 -; .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F + .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F + .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F + .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F + .db 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 + .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" + .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" + .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 - .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H - .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 - .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 - .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 - .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 - .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 - .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 - .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 - .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +; .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H +; .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 +; .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 +; .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 +; .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 +; .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .include "font.asm" diff --git a/Source/ver.inc b/Source/ver.inc index ceed10a9..f14ca9b3 100644 --- a/Source/ver.inc +++ b/Source/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 1 #DEFINE RUP 1 #DEFINE RTP 0 -#DEFINE BIOSVER "3.1.1-pre.145" +#DEFINE BIOSVER "3.1.1-pre.146" diff --git a/Source/ver.lib b/Source/ver.lib index b732a155..a22e049f 100644 --- a/Source/ver.lib +++ b/Source/ver.lib @@ -3,5 +3,5 @@ rmn equ 1 rup equ 1 rtp equ 0 biosver macro - db "3.1.1-pre.145" + db "3.1.1-pre.146" endm