; ; Wing Commander trainer ; (c) 1994 by A. Scotti, personal use only ; ; http://www.walkofmind.com/ ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; JUMPS LOCALS ; ; Offset of variables (in Wing Commander data segment) ; WC_ENERGY EQU 0BE3Ah ; Blaster, shields recharge WC_FORESHIELD EQU 0C430h ; Fore shield, 80 for Rapier WC_BACKSHIELD EQU 0C432h ; Back shield, 75 for Rapier T_TEXT SEGMENT USE16 BYTE PUBLIC 'CODE' ASSUME cs:T_TEXT, ds:NOTHING, es:NOTHING ORG 100h DosEntry: jmp Start fpInt08h LABEL DWORD wInt08hOfs DW ? wInt08hSeg DW ? fpInt21h LABEL DWORD wInt21hOfs DW ? wInt21hSeg DW ? wWingDataSeg DW 0 ; Wing Commander data segment ;--------------------------------------- ; ; Handler for interrupt 21h ; ; WC.EXE starts with the sequence: ; mov dx, SEG _DATA ; mov cs:[????], dx ; mov ah, 30h ; int 21h ; so we grab int 21h just to read DX! ; MyInt21h PROC cmp ah, 30h jne @@Exit cmp [wWingDataSeg], 0 jne @@Exit mov [wWingDataSeg], dx ; Save Wing Commander data segment @@Exit: jmp [fpInt21h] ; Jump to old int 21h MyInt21h ENDP ;--------------------------------------- ; ; Handler for interrupt 08h ; ; Constantly restores shields and energy. ; MyInt08h PROC cmp [wWingDataSeg], 0 ; Found? je @@Exit ; No, exit push ds mov ds, [wWingDataSeg] mov WORD PTR ds:[WC_ENERGY], 100 ; Restore energy mov WORD PTR ds:[WC_FORESHIELD], 80 ; Restore shields mov WORD PTR ds:[WC_BACKSHIELD], 75 pop ds @@Exit: jmp [fpInt08h] MyInt08h ENDP ; ; Usage: ; run TRAINER.COM, then WC.EXE. Do not run any other program after ; TRAINER.COM, reboot on exit from WC!!! This program is not an ; example of good programming, I wrote it in a few minutes just to ; finish the game! ; Start: ; Hook timer interrupt mov ax, 3508h int 21h ; Get interrupt vector mov [wInt08hOfs], bx mov [wInt08hSeg], es push cs pop ds mov dx, OFFSET MyInt08h mov ax, 2508h int 21h ; Set interrupt vector ; Hook DOS interrupt mov ax, 3521h int 21h mov [wInt21hOfs], bx mov [wInt21hSeg], es push cs pop ds mov dx, OFFSET MyInt21h mov ax, 2521h int 21h ; Set interrupt vector ; Stay resident mov dx, OFFSET Start int 27h ; Terminate and stay resident T_TEXT ENDS END DosEntry