On 07/01/2013 11:43 PM, Jim Brain wrote:
Anyone know of a DOS util that would report what key
is being pressed
(for the esoteric ones, like print screen and pause break) or some other
way to test the tougher ones?
Just write a little TSR that hooks Int 9; suck the code in and display
it, then pass the interrupt on. Here's one from the dusty realms of my
archive that I wrote. It should work:
page ,132
title Testkey - Test keyboard strokes
pkdata equ 60h ; keyboard data port
cseg segment para public
assume cs:cseg
org 100h
Entry:
jmp Start
Revec label dword ; saved vector
dw (0)
dw (0)
Start:
push ds
xor ax,ax
mov ds,ax
mov bx,ds:[9*4]
mov dx,ds:[9*4+2]
mov word ptr cs:Revec,bx
mov word ptr cs:Revec+2,dx
cli
mov ds:[9*4],offset Serve
mov ds:[9*4+2],cs
sti
pop ds
lea dx,Endmem
int 27h
Serve:
push ax
push bx
push cx
push dx
push si
push di
push bp
in al,pkdata
test al,al
js Serve8 ; if release
; change it to hex.
push ax
shr al,1
shr al,1
shr al,1
shr al,1
call dnib ; display a nibble
pop ax
call dnib ; ditto
mov al,' '
call dchar
Serve8:
pop bp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
jmp cs:Revec ; to the real servicer
dnib:
and al,15
add al,'0'
cmp al,'9'
jbe dchar
add al,'a'-'9' -1 ; correct
dchar:
mov ah,0eh ; output tty
mov bh,7
int 10h ; show the byte
ret
Endmem label byte
cseg ends
end Entry
--Chuck