Article View: net.micro.pc
Article #6240Re: Help on MASM/DOS-interrupt-handler
From: herman
Date: Fri, 11 Apr 1986 20:43
Date: Fri, 11 Apr 1986 20:43
53 lines
2812 bytes
2812 bytes
Off-hand I would say you're destroying the information that the
keyboard I/O function returns for AH=1. The Z-flag normally contains
info on character availability (ZF=1 -> unavailable).
An IRET will not preserve the current status of the Z-flag. In
order to do that, you would normally do a RET 2, i.e. pop the flag
information, without actually restoring the flag.
. . . . . . . . . .
cmp ah,dos_look_keyboard ; check for LOOK function...
je do_translate ; if so, prepare to translate
cmp ah,dos_read_keyboard ; check for READ function...
jne no_translate ; if not, just jump to old interrupt
do_translate:
assume ds:nothing
pushf ; simulate normal Keyboard Interrupt
call old_keyboard_io
pushf ; save clobberable stuff
cmp al,00h ; do we have a "special" keypress?
je return ; if yes, don't screw around with it
push bx
mov bx,offset char_map_tab ; set up for character translate
xlat char_map_tab ; translate character
xchg ah,al ; swap character and scan code
mov bx,offset scan_map_tab ; set up for scan code translate
xlat scan_map_tab ; translate scan code
xchg ah,al ; unswap character and scan code
pop bx ; restore clobbered stuff
return:
popf ; restore return flags
ret 2 ; return to caller
no_translate:
assume ds:nothing
jmp old_keyboard_io ; do normal interrupt, let it return to caller
. . . . . . . . .
This code is still not totally correct, since it always passes the flags
back to the caller, rather than only in case AH=1, but the required changes
should be trivial.
================================================================
*hardcopy* *electr{onic, ic}*
Herman Schuurman ARPA: herman%TI-CSL@CSNET-RELAY.ARPA
POB 225474 M/S 238 CSNET: herman@TI-CSL
Texas Instruments Inc. USENET: {ut-sally,convex!smu,texsun,rice}!ti-csl!herman
Dallas, Texas VOICE: (214) 995-0845
75265
Technical Details
Message-ID:
<10200009@ti-csl>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!ti-csl!hermanReferences:
<523@ucbjade.BERKELEY.EDU>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ti-csl Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!ti-csl!herman From: herman@ti-csl Newsgroups: net.micro.pc Subject: Re: Help on MASM/DOS-interrupt-handler Message-ID: <10200009@ti-csl> Date: Fri, 11-Apr-86 15:43:00 EST Article-I.D.: ti-csl.10200009 Posted: Fri Apr 11 15:43:00 1986 Date-Received: Sat, 19-Apr-86 04:04:26 EST References: <523@ucbjade.BERKELEY.EDU> Lines: 53 Nf-ID: #R:ucbjade.BERKELEY.EDU:523:ti-csl:10200009:000:2124 Nf-From: ti-csl!herman Apr 11 14:43:00 1986