TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: FERNANDO ARIEL GONT
date: 1998-03-08 02:03:00
subject: Problem with a TSR

Hullo All , hope you are having a nice day!!
Hi, I've made a little TSR...
How does it work in theory?
Well, when you press the hot key ESC (scan code 01h), it sets an internal
flag... When an int 28h occurs, it checks wheter the internal flag is
activated. If so, it prints a message on the screen, if not, it jumps to
the old int 28h handler...
As I was going to make a bigger TSR, I created other flags (such as for int
13h, int 24h, and some more), but they don't do anything, and aren't worth
at all, since it's not the program I wanted to make (it's only the
"beginning" of it)....
I get segment and offset for each of the interrupts I hool using the XCHG
instruction.... I've tested it, (as I hadn't seen any code using XCHG for
that, before), and it works ok....
What's the matter with my proggy?
Well, I install it in memory (using int 27h, and checking for its previous
presence by means of int 2fh), but tere's something wrong with the
keyboard...
I mean, you can type anything and then press , but no command will
be processed.... Sometimes, after pressing keys many times, you get the
opposite effect: no right command will be processed... I mean, even if you
type "dir" , you'll get an error message saying that the command is
not valid....
I've checked the low-level code for the keyboard, and it seems to be Ok...
So I don't know what could be happening...
Note: the comments are in Spanish, and most labels in English, but anyway,
I think you'll certainly notice what is the code meant for....
If you want me to translate everything to English, just ask me...
/* (HOTK_TSR.ASM)
.model tiny
.code
.startup
jmp realstart
old_ax dw ?
old_dx dw ?
old_ds dw ?
flag_13 db 00h
flag_24 db 00h
activate_f db 00h
inside_f db 00h
proc_id db 192
newint2fh:
        cmp al, 00h
        jnz salold2f
        cmp ah, proc_id
        jnz salold2f
        mov bx, 0F1FAh
        mov al, 0ffh
        iret
salold2f:
         db 0eah
oldoff2f dw ?
oldseg2f dw ?
newint13h:
        mov flag_13, 0ffh
        pushf
        call old13h
        mov flag_13, 00h
        iret
old13h   label dword
oldoff13 dw ?
oldseg13 dw ?
        
newint24h:
        mov flag_24, 0ffh
        pushf
        call old24h
        mov flag_24, 00h
        iret
old24h   label dword
oldoff24 dw ?
oldseg24 dw ?
        
;InDOSf    label dword
;offInDOSf dw ?
;segInDOSf dw ?
        
newint28h:
        cmp inside_f, 0ffh
        jz saltaroldint28h
        mov inside_f, 0ffh
        cmp activate_f, 0ffh
        jnz saltaroldint28h
        cmp flag_13, 0ffh
        jz saltaroldint28h
        cmp flag_24, 0ffh
        jnz working
saltaroldint28h:
        mov inside_f, 00h
        
          db 0eah
oldoff28  dw ?
oldseg28  dw ?
working:
        mov activate_f, 00h
        mov old_ds, ds
        mov old_dx, dx
        mov old_ax, ax
        mov ax, cs
        mov ds, ax
        mov ah, 09h
        mov dx, offset estoy_vivo
        pushf
        call int21h
        mov ds, old_ds
        mov dx, old_dx
        mov ax, old_ax
        
        jmp saltaroldint28h
estoy_vivo db 0dh, 0ah, 'Estoy vivo!!', 0dh, 0ah, '$'
int21h label dword
off21h dw ?
seg21h dw ?
newint09h:
        cli
        mov old_ax, ax
         in al, 60h
        cmp al, 01h
        jz hot_key
        mov ax, old_ax
         sti
saltarold09h:
          db 0eah
oldoff09  dw ?
oldseg09  dw ?
hot_key:
        mov activate_f, 0ffh
        in al, 61h
        or al, 80h
        out 61h, al
        jmp $+2
        and al, 7fh
        out 61h, al
        mov al, 20h
        out 20h, al
        mov ax, old_ax
        sti
        iret
dw ?
final label byte
realstart:
ciclar:
        mov ah, proc_id
        mov al, 00h
        int 2fh
        cmp al, 0ffh
        jnz install
        cmp bx, 0F1FAh
        jz not_install
        inc proc_id
        cmp proc_id, 00h
        jnz ciclar
not_install:
        mov ah, 09h
        mov dx, offset noinst_msg
        int 21h
        mov ax, 4c00h
        int 21h
install:
        xor ax, ax
        mov es, ax
        cli
;Modificar vector int 09h
        mov ax, offset newint09h
        xchg ax, es:[4*9h]
        mov oldoff09, ax
        push cs
        pop ax        
        xchg ax, es:[(4*9h)+2]
        mov oldseg09, ax
; modificar vector int 28h
        mov ax, offset newint28h
        xchg ax, es:[4*28h]
        mov oldoff28, ax
        push cs
        pop ax        
        xchg ax, es:[(4*28h)+2]
        mov oldseg28, ax
; modificar vector int 13h        
        mov ax, offset newint13h
        xchg ax, es:[4*13h]
        mov oldoff13, ax
        push cs
        pop ax        
        xchg ax, es:[(4*13h)+2]
        mov oldseg13, ax
; modificar la int 24h
        mov ax, offset newint24h
        xchg ax, es:[4*24h]
        mov oldoff24, ax
        push cs
        pop ax        
        xchg ax, es:[(4*24h)+2]
        mov oldseg24, ax
; Int 21h
        mov ax, es:[(21h*4)]
        mov off21h, ax
        mov ax, es:[(21h*4)+2]
        mov seg21h, ax
        sti
        push cs
        pop ds
        mov dx, offset instmsg
        mov ah, 09h
        int 21h
        mov dx, offset final
        int 27h
noinst_msg db 'Error: el programa ya estaba instalado en memoria.', 0dh
           db 0ah, '$'
instmsg db "El programa ha sido instalado con ‚xito!", 0dh, 0ah, '$'
end
*/
 -=> Yours sincerely, Fernando Ariel Gont <=-
e-mail: FGont@siscor.bibnal.edu.ar
e-mail "Good Stuff!" _*Magazine*_ : gstuff@siscor.bibnal.edu.ar
FidoNet: 4:900/470.10
Sk-Network (Argentina): Murdock's Point (200:201/300.27)
--- Terminate 5.00 UnReg(145)
---------------
* Origin: This is not my MSX but.... (4:900/470.10)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.