home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / password / raidtrai.asm < prev    next >
Assembly Source File  |  1995-07-28  |  6KB  |  218 lines

  1. ;            ****************************************************
  2. ;            ***                                              ***
  3. ;            ***            Trainer for Raiders               ***
  4. ;            ***                                              ***
  5. ;            ***   (c) 1995 by ABACUS/1994 by DATA Becker     ***
  6. ;            ***                                              ***
  7. ;            ***   Author: Boris Bertelsons                   ***
  8. ;            ***                                              ***
  9. ;            ****************************************************
  10. ;
  11. ;
  12.  
  13. .286
  14.   w equ word ptr
  15.   b equ byte ptr
  16. code segment public
  17. public insthand
  18. public handler9
  19. public reslim
  20. public oldint21
  21. public oldint65
  22. public ID
  23. public IDlen
  24. public check_inst
  25.  
  26. assume cs:code,ds:code
  27. ID: ab 'ABACUS'
  28. oldint21: dd 0
  29. oldint65: dd 0
  30. procedure: dd ?
  31. IDlen equ offset oldint21 - offset ID
  32.  
  33.  
  34. ;  *********************************************************************
  35. ;  ***                                                               ***
  36. ;  ***  The actual Trainer routines are here                         ***
  37. ;  ***                                                               ***
  38. ;  *********************************************************************
  39.  
  40.  
  41. ;  **********************************************************************
  42. ;  ***                                                                ***
  43. ;  ***  The new INT 21h. The procedure checks whether the "in al,60h" command ***
  44. ;  ***  is in the specified location in memory, and if necessary, replaces it  ***
  45. ;  ***  with "int 65h" !                                ***
  46. ;  ***                                                                ***
  47. ;  **********************************************************************
  48. handler9 proc pascal
  49.   pushf
  50.   push bp
  51.   push ds
  52.   push bx
  53.   mov  bp,sp
  54.   mov  bx,[bp+10]  ; cs at time of interrupt to BX, DOS !!!
  55.                    ; IMPORTANT ! In TD [bp+16] !!!
  56.   add  bx,0366h    ; CS of 1st int 21h + 2136h = CS of keyboard routine
  57.   mov  ds,bx       ; cs of keyboard routine to ds
  58.   mov  bx,568Bh    ; 8B56h = mov dx,[bp+06]
  59.   cmp  ds:word ptr [0005h],bx     ; is it in the keyboard routine ?
  60.   jne  not_change
  61.   mov  ds:word ptr [0005h],9090h  ; write in int 65h !
  62.   mov  ds:word ptr [0007h],65CDh  ; write in int 65h !
  63. not_change:
  64.   pop  bx
  65.   pop  ds
  66.   pop  bp
  67.   popf
  68.   jmp dword ptr cs:oldint21       ; call old int 21h
  69. handler21 endp
  70.  
  71. ;  *************************************************************************
  72. ;  ***                                                                   ***
  73. ;  ***  Int 65h procedure. It reads in a character via "in al,60h"  ***
  74. ;  ***  and checks whether the read character was defined as the       ***
  75. ;  ***  Trainer key. If the answer is yes, the allocated memory      ***
  76. ;  ***  changes and procedure calls are executed. Enter your training       ***
  77. ;  ***  variables here !!!                                                                         ***
  78. ;  ***                                                                   ***
  79. ;  *************************************************************************
  80.  
  81. handler65 proc far
  82.   pushf
  83.   push bp
  84.   push ds
  85.   push bx
  86.   mov  bp,sp
  87.   mov  bx,[bp+10]  ; cs at time of interrupt to BX
  88.   in  al,60h       ; read character
  89.   cmp al,63        ; F5 key
  90.   je  Full_Shoots_j
  91.   cmp al,64        ; F6 key
  92.   je  Full_Lives_J
  93.   cmp al,65        ; F7 key
  94.   je Weapon_new_j  ;
  95.   cmp al,66        ; F8 key
  96.   je Weapon_new_j  ;
  97.   cmp al,67        ; F9 key
  98.   je Weapon_new_j  ;
  99.   cmp al,68        ; F10 key
  100.   je  More_Points_J
  101.  
  102. End_Keyb:
  103.   pop bx
  104.   pop ds
  105.   pop bp
  106.   popf
  107.   iret
  108.  
  109. Full_Shoots_j:
  110.   jmp Full_Shoots
  111. Full_Lives_j:
  112.   jmp Full_Lives
  113. More_Points_j:
  114.   jmp More_Points
  115. Weapon_new_j:
  116.   jmp Weapon_new
  117.  
  118. Full_Shoots:
  119.   pushf
  120.   PUSHA
  121.   sub  bx,0    ; since already correct CS
  122.   mov word ptr procedure+2,bx
  123.   mov  bx,1401h    ; es:[bx]  =  14EF:1401
  124.   mov word ptr procedure,bx
  125. ;--------
  126.   mov ds:byte ptr [0DA3h],20h
  127.   mov ax,20h
  128.   push ax
  129.   call dword ptr [procedure]
  130.   POPA
  131.   popf
  132.   jmp End_Keyb
  133.  
  134. Full_Lives:
  135.   pushf
  136.   pusha
  137.   sub  bx,0  ;
  138.   mov word ptr procedure+2,bx
  139.   mov  bx,1317h  ; es:[bx]  =  14EF:1317
  140.   mov word ptr procedure,bx
  141. ;-----------
  142.   mov ds:byte ptr [0DA3h],0009
  143.   mov ax,9
  144.   push ax
  145.   call dword ptr [procedure]
  146.   popa
  147.   popf
  148.   jmp End_Keyb
  149.  
  150. Weapon_new:
  151.   pushf
  152.   pusha
  153.   sub  bx,0  ;
  154.   mov word ptr procedure+2,bx
  155.   mov  bx,1454h  ; es:[bx]  =  14EF:1454
  156.   mov word ptr procedure,bx
  157. ;-----------
  158.   sub al,65
  159.   mov ah,0
  160.   mov ds:byte ptr [0DA2h],al
  161.   push ax
  162.   call dword ptr [procedure]
  163.   popa
  164.   popf
  165.   jmp End_Keyb
  166.  
  167. More_Points:
  168.   pushf
  169.   pusha
  170.   sub  bx,0  ;
  171.   mov word ptr procedure+2,bx
  172.   mov  bx,1BD0h  ; es:[bx]  =  14EF:1BD0
  173.   mov word ptr procedure,bx
  174. ;-----------
  175.   mov ax,1000
  176.   push ax
  177.   call dword ptr [procedure]
  178.   popa
  179.   popf
  180.   jmp End_Keyb
  181.  
  182. handler65 endp
  183.  
  184. insthand proc pascal
  185. reslim label byte
  186.     push ds
  187.   pop ds
  188.     mov ax,3521h                    ; store old INT 21
  189.   int 21h
  190.   mov w oldint21,bx
  191.   mov w oldint21 + 2,es
  192.     mov ax,3565h                    ; store old INT 65h
  193.   int 21h
  194.   mov w oldint65,bx
  195.   mov w oldint65 + 2,es
  196.   mov ax,2521h                    ; bend/deflect INT 21h to custom routine
  197.   lea dx,handler21
  198.   int 21h
  199.   mov ax,2565h                    ; INT 65h to custom keyboard routine
  200.   lea dx,handler65
  201.   int 21h
  202.      ret
  203. insthand endp
  204.  
  205. check_inst proc near
  206.   mov ax,3521h                    ; get interrupt vector
  207.   int 21h
  208.   mov di,bx
  209.   mov si,offset ID
  210.   mov di,si
  211.   mov cx,IDlen
  212.   repe cmpsb                      ; check for ID
  213.     ret
  214. check_inst endp
  215.  
  216. code ends
  217. end
  218.