home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 7992 < prev    next >
Encoding:
Text File  |  1993-01-09  |  2.6 KB  |  93 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!destroyer!gatech!concert!fletcher!snodgras
  3. From: snodgras@cs.unca.edu (Ryan Snodgrass)
  4. Subject: TSR HELP!  ANY INPUT WOULD HELP!
  5. Message-ID: <1993Jan10.003718.16390@cs.unca.edu>
  6. Sender: news@cs.unca.edu (Usenet News Adm)
  7. Organization: University of North Carolina at Asheville
  8. Date: Sun, 10 Jan 1993 00:37:18 GMT
  9. Lines: 82
  10.  
  11. Why isn't this possible to do?   Does anyone know how to have it check
  12. a certain register in the background (i.e. TSR).  Here is what I did so
  13. far, modifiying the KEEP.PAS program in help.  ANY input would REALLY
  14. help.
  15.  
  16.  
  17. Here is basically what I want:  a program that monitors certain interrupts
  18. in the background and does something accordingly.  What I want it to do is
  19. whenever a button is pressed on the joystick for this to clear the screen.
  20. It MUST be a TSR though.
  21.  
  22. Thanks for any input,
  23.  
  24. Ryan Snodgrass
  25. snodgrass@uncavx.unca.edu
  26.  
  27. {------------------------------------------------------------------------}
  28.  
  29. Program TEST;
  30.  
  31. {$M $800,0,0 }   { 2K stack, no heap }
  32. Uses Crt, Dos;
  33.  
  34. Var JoyStkIntVec : Procedure;
  35.  
  36. {------------------------------------------------------------------------}
  37.  
  38. Function ButtonDown : Boolean;
  39. { IS A JOYSTICK BUTTON PRESSED? }
  40.  
  41. Var Regs : Registers;
  42.  
  43. Begin { ButtonDown }
  44.    Regs.Ax := $00;
  45.    Regs.Ah := $84;
  46.    Regs.Dx := $00;
  47.    Intr($15, Regs);
  48.    ButtonDown := Regs.Al <> 240;
  49. End; { ButtonDown }
  50.  
  51. {------------------------------------------------------------------------}
  52.  
  53. {$F+}
  54. Procedure Click; Interrupt;
  55.  
  56. Begin { Click }
  57.    WriteLn(ButtonDown);
  58.    InLine ($9C); { PUSHF -- Push flags }
  59.    { Call old ISR using saved vector }
  60.    JoyStkIntVec;
  61. End; { Click }
  62. {$F-}
  63.  
  64. {------------------------------------------------------------------------}
  65.  
  66. Begin { Test }
  67.    { Insert ISR into keyboard chain }
  68.    GetIntVec($15, @JoyStkIntVec);
  69.    SetIntVec($15, Addr(Click));
  70.    Keep(0); { Terminate, stay resident }
  71. End. { Test }
  72.  
  73. {------------------------------------------------------------------------}
  74.  
  75. INT 15 - BIOS - JOYSTICK SUPPORT (XT after 11/8/82,AT,XT286,PS)
  76.     AH = 84h
  77.     DX = subfunction
  78.         0000h read joystick switches
  79.         Return: AL bits 7-4 = switch settings
  80.         0001h read positions of joysticks
  81.         Return: AX = X position of joystick A
  82.             BX = Y position of joystick A
  83.             CX = X position of joystick B
  84.             DX = Y position of joystick B
  85. Return: CF set on error
  86.         AH = status
  87.         80h invalid command (PC,PCjr)
  88.         86h function not supported (other)
  89.     CF clear if successful
  90. Notes:    if no game port is installed, subfunction 0000h returns AL=00h (all
  91.       switches open) and subfunction 0001h returns AX=BX=CX=DX=0000h
  92.     a 250kOhm joystick typically returns 0000h-01A0h
  93.