;                **************************************
;                ***                                ***
;                ***   Trainer for   R A I D E R S   ***
;                ***                                ***
;                ***   (c) 1994 by DATA Becker      ***
;                ***                                ***
;                ***   Author: Boris Bertelsons      ***
;                ***                                ***
;                **************************************
;
;

.286
jumps
  w equ word ptr
  b equ byte ptr
code segment public
public insthand
public handler9
public reslim
public oldint9
public id
public idlen
public check_inst

assume cs:code,ds:code
id:  db 'Trainer for DATA BECKER/ABACUS  by  InspirE / TC'
oldint9: dd 0
procedure: dd ?
idlen equ offset oldint9 - offset id


;  *********************************************************************
;  ***                                                               ***
;  ***  From this point on you'll find the actual trainer routines   ***
;  ***                                                               ***
;  *********************************************************************

;  *********************************************************************
;  ***                                                               ***
;  ***  The new INT 9h.  the procedure checks whether a key of the   ***
;  ***  trainer was pressed and may change variables                 ***
;  ***                                                               ***
;  ***                                                               ***
;  *********************************************************************
handler9 proc pascal
  pushf
  push bp
  push ds
  push bx

  in  al,60h       ; Read character

  cmp al,59        ; F1 key
  je  Game_over
  cmp al,63        ; F5 key
  je  Full_life
  cmp al,64        ; F7 key
  je  Add_points
  jmp end_keyb

End_regulaer:

End_keyb:
  pop  bx
  pop  ds
  pop  bp
  popf
  jmp dword ptr cs:oldint9       ; Call old int 9h

Game_over:
  pushf
  pusha
  ; Adjust to your needs !!
  mov ds:byte ptr [0648h],1
  popa
  popf
  jmp End_regulaer

Full_life:
  pushf
  pusha
  ; Adjust to your requirements !!
  mov ds:byte ptr [0648h],255
  POPA
  popf
  jmp End_regulaer

Add_points:
  pushf
  pusha
  ; Adjust to your requirements !!
  mov bx,ds:word ptr [064Ah]
  add bx,1000d
  mov ds:word ptr [064Ah],bx
  POPA
  popf
  jmp End_regulaer

handler9 endp
insthand proc pascal
reslim label byte
  push ds
  pop ds
  mov ax,3509h                    ; Backup old INT 21
  int 21h
  mov w oldint9,bx
  mov w oldint9 + 2,es
  mov ax,2509h                    ; Coerce INT 21h to your own routine
  lea dx,handler9
  int 21h
  ret
insthand endp

check_inst proc near
  mov ax,3509h                    ; Determine interrupt vector
  int 21h
  mov di,bx
  mov si,offset ID
  mov di,si
  mov cx,idlen
  repe cmpsb                      ; Check characteristic
    ret
check_inst endp

code ends
end
