🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #319

Re: HELP! My TSR won't activate in many games!

#319
From: Jon K. Salmon
Date: Sat, 08 Aug 1992 08:25
72 lines
3803 bytes
Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins) writes:

> I'm writing a small TSR
> program that hooks interrupt 9 for activation.  Whenever you press
> a key, my program checks to see if it should activate...if so, it
> does...or so I thought.  The program works fine in DOS and most
> text mode programs but it won't work in all games. (It does work in
> some, however)  I suppose the games it won't work with completely
> take over INT 9 but does any one have an idea for a solution to
> this??  There must be some way to allow it to activate in every (or
> a least most) games...

frisk@complex.is (Fridrik Skulason) writes:

>> Well, if you *absolutely* have to do this, then you should:
>>
>>  intercept the timer tick
>>  have it check if your INT9 handler is in control.
>>  if not, rehook INT 9.
>>
>> of course you have to intercept several INT 21H fuctions, and this will
>> cause some horrible crashed (for example if somebody else writes a  program
>> that does exactly the same thing, but it can be done...

Eek!  Several potential problems here.  Among them:

 1. VERY BAD THINGS may happen when the game ends and attempts to
    unhook ITSELF from the Int 09h chain, assuming YOUR handler is
    atop ITS handler.

 2. Depending upon your hotkey and the handler of the game, even this
    may not work.  For example, let's say you are checking for ALT-H.
    You might check for the scan code for the H key (23h), and check
    the shift status for ALT depressed.  Given that the game's handler
    is not passing control to the previous Int 09h handler in the
    chain, which it clearly is not else your program would be gaining
    control (which is isn't), the shift status (a byte in the BIOS
    data area) will NEVER be updated when the Alt key is pressed,
    because the code which processes such keys and updates the byte
    is never executed.

>> I don't recommend it though...

I agree completely.

If it MUST be activated via hotkey, well, then, I dunno.  If you just
need to be ABLE to activate it, you could try hooking other interrupts.
For example:

 1. Serial port.  Activated upon receiving an incoming byte.  USING this
    method would require something like a 2nd computer and a null-modem
    cable to send the activating byte.  Other methods of sending the
    character could also used here.

 2. Mouse.  Use the mouse "event" function to call your code when, say,
    the right button is pressed.  Of course, if the game REQUIRES the
    mouse, then this idea is RIGHT OUT.  On the other hand, if it does
    NOT require the mouse, this is a possibility.  If you do this,
    you will most likely have to take over Int 33h, in addition to
    making the "event" call.  Reason: if the game auto-detects the
    mouse, it will likely cancel out your event-handler request.
    Thus, you must provide an Int 33h handler which disables the two
    mouse functions (if memory serves) which could be used to detect
    and/or reset the mouse.  I used this technique, along with several
    other "tricks" to capture the animation in Access Software's
    _Crime Wave_.  Worked quite nicely for its limited applicability.

Many factors could eliminate these suggestions from your list of
FEASIBLE solutions, of course.

-- Jon
Technical Details
Message-ID: <1992Aug8.082523.14913@news.ysu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!news.ysu.edu!do-not-reply-to-path

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!usenet.ins.cwru.edu!news.ysu.edu!do-not-reply-to-path
From: af458@yfn.ysu.edu (Jon K. Salmon)
Subject: Re: HELP! My TSR won't activate in many games!
Message-ID: <1992Aug8.082523.14913@news.ysu.edu>
Sender: news@news.ysu.edu (Usenet News Admin)
Nntp-Posting-Host: yfn
Organization: Youngstown State University/Youngstown Free-Net
Date: Sat, 8 Aug 1992 08:25:23 GMT
Lines: 72