home *** CD-ROM | disk | FTP | other *** search
- ; *** ***
- ; *** Entraîneur pour ******* ***
- ; *** ***
- ; *** (c) 1994 by DATA Becker ***
- ; *** ***
- ; *** Auteur: Boris Bertelsons ***
- ; *** ***
- ; **************************************
- ;
- ;
-
- .286
- w equ word ptr
- b equ byte ptr
- code segment public
- public insthand
- public handler21
- public reslim
- public oldint21
- public oldint65
- public signature
- public siglong
- public check_inst
-
- assume cs:code,ds:code
- signature: db 'MICRO APPLICATION'
- oldint21: dd 0
- oldint65: dd 0
- proced: dd ?
- siglong equ offset oldint21 - offset signature
-
-
- ; *********************************************************************
- ; *** ***
- ; *** Ici commencent les routines proprement dites de l'entraîneur ***
- ; *** ***
- ; *********************************************************************
-
- ; **********************************************************************
- ; *** ***
- ; *** Nouvelle interruption 21h. La procédure teste si à l'endroit ***
- ; *** indiqué de la mémoire se trouve l'instruction "in al,60h", ***
- ; *** et la remplace le cas échéant par "int 65h" ! ***
- ; *** ***
- ; **********************************************************************
- handler21 proc pascal
- pushf
- push bp
- push ds
- push bx
- mov bp,sp
- mov bx,[bp+10] ; cs au moment de l'interruption en BX, DOS !!!
- ; ATTENTION ! Dans TD [bp+16] !!!
- add bx,0366h ; CS de la 1ère INT 21h + 2136h = CS de la routine du clavier
- mov ds,bx ; cs de la routine du clavier en ds
- mov bx,568Bh ; 8B56h = mov dx,[bp+06]
- cmp ds:word ptr [0005h],bx ; motif présent dans la routine ?
- jne pas_changer
- mov ds:word ptr [0005h],9090h ; écrire Int 65h !
- mov ds:word ptr [0007h],65CDh ; écrire Int 65h!
- pas_changer:
- pop bx
- pop ds
- pop bp
- popf
- jmp dword ptr cs:oldint21 ; appelle l'ancienne Int 21h
- handler21 endp
-
-
- ; *************************************************************************
- ; *** ***
- ; *** L'interruption 65h - Procédure, lit un caractère par "in al,60h" ***
- ; *** et teste si la touche correspondante a été définie dans ***
- ; *** l'entraîneur. Si oui, les modifications de mémoire et les appels ***
- ; *** de procédure indiqués sont effectués. Vous devrez reporter ici ***
- ; *** vos variables d'entraînement ***
- ; *** ***
- ; *************************************************************************
-
- handler65 proc far
- pushf
- push bp
- push ds
- push bx
- mov bp,sp
- mov bx,[bp+10] ; cs au moment de l'interruption en BX
- in al,60h ; lit un caractère
- cmp al,63 ; touche F5
- je Full_Shoots_j
- cmp al,64 ; touche F6
- je Full_Lives_J
- cmp al,65 ; touche F7
- je Weapon_new_j ;
- cmp al,66 ; touche F6
- je Weapon_new_j ;
- cmp al,67 ; touche F9
- je Weapon_new_j ;
- cmp al,68 ; touche F10
- je More_Points_J
-
- Fin_keyb:
- pop bx
- pop ds
- pop bp
- popf
- iret
-
- Full_Shoots_j:
- jmp Full_Shoots
- Full_Lives_j:
- jmp Full_Lives
- More_Points_j:
- jmp More_Points
- Weapon_new_j:
- jmp Weapon_new
-
- Full_Shoots:
- pushf
- PUSHA
- sub bx,0 ; CS déjà OK
- mov word ptr proced+2,bx
- mov bx,1401h ; es:[bx] = 14EF:1401
- mov word ptr proced,bx
- ;--------
- mov ds:byte ptr [0DA3h],20h
- mov ax,20h
- push ax
- call dword ptr [proced]
- POPA
- popf
- jmp Fin_keyb
-
- Full_Lives:
- pushf
- pusha
- sub bx,0 ;
- mov word ptr proced+2,bx
- mov bx,1317h ; es:[bx] = 14EF:1317
- mov word ptr proced,bx
- ;-----------
- mov ds:byte ptr [0DA3h],0009
- mov ax,9
- push ax
- call dword ptr [proced]
- popa
- popf
- jmp Fin_keyb
-
- Weapon_new:
- pushf
- pusha
- sub bx,0
- mov word ptr proced+2,bx
- mov bx,1454h ; es:[bx] = 14EF:1454
- mov word ptr proced,bx
- ;-----------
- sub al,65
- mov ah,0
- mov ds:byte ptr [0DA2h],al
- push ax
- call dword ptr [proced]
- popa
- popf
- jmp Fin_keyb
-
- More_Points:
- pushf
- pusha
- sub bx,0
- mov word ptr proced+2,bx
- mov bx,1BD0h ; es:[bx] = 14EF:1BD0
- mov word ptr proced,bx
- ;-----------
- mov ax,1000
- push ax
- call dword ptr [proced]
- popa
- popf
- jmp Fin_keyb
-
- handler65 endp
-
- insthand proc pascal
- reslim label byte
- push ds
- pop ds
- mov ax,3521h ; sauve l'ancienne INT 21
- int 21h
- mov w oldint21,bx
- mov w oldint21 + 2,es
- mov ax,3565h ; sauve l'ancienne INT 65h
- int 21h
- mov w oldint65,bx
- mov w oldint65 + 2,es
- mov ax,2521h ; détournement de l'INT 21h
- lea dx,handler21
- int 21h
- mov ax,2565h ; INT 65h sur routine de clavier personnelle
- lea dx,handler65
- int 21h
- ret
- insthand endp
-
- check_inst proc near
- mov ax,3521h ; lit le vecteur d'interruption
- int 21h
- mov di,bx
- mov si,offset signature
- mov di,si
- mov cx,siglong
- repe cmpsb ; teste la signature
- ret
- check_inst endp
-
- code ends
- end
-