On Apr 02 10:20, 1997, Sylvain Lauzon wrote:
SL> I need some hint! Inside an interrupt handler i did the following.
SL> sti
SL> mov ah,34h
SL> int 21h
SL> mov dl,es:[bx]
SL> cmp dl,01h
SL> je not_safe
SL> ....
SL> not_safe: ...
SL> The tsr seem to work fine until i type few keys and lock up very hard!
SL> I wonder what wrong i did?
The problem is that you call int 21h from within the handler. This defeats
the entire purpose of checking the INDOS flag! What you need to do is read
the location of the INDOS flag during the *installation* routine and store it
in a variable in the *resident* portion of the program. Then the handler can
check the flag using the stored address and avoid calls to int 21h. Here is
some sample code of how to do this:
_ _ _ O / _ _ C_U_T_ H_E_R_E_ _ _ _
O \
indosloc label dword
indoso dw ? ; offset of indos flag
indoss dw ? ; segment of indos flag
...
Install:
...
mov ah, 34h
int 21h ; segment in es, offset in bx
mov indoss, es ; store segment
mov indoso, bx ; store offset
...
Handler:
...
les bx, indosloc ; load the segment into es and the offset into bx
mov dl, es:[bx] ; load the INDOS flag into dl
...
_ _ _ O / _ _ C_U_T_ H_E_R_E_ _ _ _
O \
James
--- Msged 4.00
---------------
* Origin: Regina, SK (Ask me about Popup Slate) (1:140/234.2)
|