home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!destroyer!gatech!concert!fletcher!snodgras
- From: snodgras@cs.unca.edu (Ryan Snodgrass)
- Subject: TSR HELP! ANY INPUT WOULD HELP!
- Message-ID: <1993Jan10.003718.16390@cs.unca.edu>
- Sender: news@cs.unca.edu (Usenet News Adm)
- Organization: University of North Carolina at Asheville
- Date: Sun, 10 Jan 1993 00:37:18 GMT
- Lines: 82
-
- Why isn't this possible to do? Does anyone know how to have it check
- a certain register in the background (i.e. TSR). Here is what I did so
- far, modifiying the KEEP.PAS program in help. ANY input would REALLY
- help.
-
-
- Here is basically what I want: a program that monitors certain interrupts
- in the background and does something accordingly. What I want it to do is
- whenever a button is pressed on the joystick for this to clear the screen.
- It MUST be a TSR though.
-
- Thanks for any input,
-
- Ryan Snodgrass
- snodgrass@uncavx.unca.edu
-
- {------------------------------------------------------------------------}
-
- Program TEST;
-
- {$M $800,0,0 } { 2K stack, no heap }
- Uses Crt, Dos;
-
- Var JoyStkIntVec : Procedure;
-
- {------------------------------------------------------------------------}
-
- Function ButtonDown : Boolean;
- { IS A JOYSTICK BUTTON PRESSED? }
-
- Var Regs : Registers;
-
- Begin { ButtonDown }
- Regs.Ax := $00;
- Regs.Ah := $84;
- Regs.Dx := $00;
- Intr($15, Regs);
- ButtonDown := Regs.Al <> 240;
- End; { ButtonDown }
-
- {------------------------------------------------------------------------}
-
- {$F+}
- Procedure Click; Interrupt;
-
- Begin { Click }
- WriteLn(ButtonDown);
- InLine ($9C); { PUSHF -- Push flags }
- { Call old ISR using saved vector }
- JoyStkIntVec;
- End; { Click }
- {$F-}
-
- {------------------------------------------------------------------------}
-
- Begin { Test }
- { Insert ISR into keyboard chain }
- GetIntVec($15, @JoyStkIntVec);
- SetIntVec($15, Addr(Click));
- Keep(0); { Terminate, stay resident }
- End. { Test }
-
- {------------------------------------------------------------------------}
-
- INT 15 - BIOS - JOYSTICK SUPPORT (XT after 11/8/82,AT,XT286,PS)
- AH = 84h
- DX = subfunction
- 0000h read joystick switches
- Return: AL bits 7-4 = switch settings
- 0001h read positions of joysticks
- Return: AX = X position of joystick A
- BX = Y position of joystick A
- CX = X position of joystick B
- DX = Y position of joystick B
- Return: CF set on error
- AH = status
- 80h invalid command (PC,PCjr)
- 86h function not supported (other)
- CF clear if successful
- Notes: if no game port is installed, subfunction 0000h returns AL=00h (all
- switches open) and subfunction 0001h returns AX=BX=CX=DX=0000h
- a 250kOhm joystick typically returns 0000h-01A0h
-