Board index » delphi » needed: joystick support in TP7

needed: joystick support in TP7

Hi all,

I'm looking for joystick support routines for Turbo Pascal 7. I found
some in SWAG archives, tested two of them but results were
disappointing. With the same joystick position, they were giving
different X,Y coords. Also, as I was slowly moving the handle in
one directions, coords returned in a loop were changing chaotically.
Same loop, with the "fire" button constantly pressed, returned
"no button" in about 20% of cases.

The machine is AMD K6 233MHz, i tried that both in plain DOS 6.2 and
in DOS-under-WIN95.

Could somebody recommend me a reliable joystick library?

Thanks in advance,

regards, Michal.

--

  Michal Szymanski (m...@sirius.astrouw.edu.pl)
  Warsaw University Observatory
  Al. Ujazdowskie 4, 00-478 Warszawa, POLAND
  FAX: 48-22-6294967

 

Re:needed: joystick support in TP7


Quote
Michal Szymanski wrote:
> I'm looking for joystick support routines for Turbo Pascal 7.

--snip--

On my web site you will find Pascal source code for a unit that handles
the joysticks.  It "talks" directly to the hardware, instead of going
through the Int $15 interface, which I have found to be unreliable on
most machines, and nonexistant on many.  Also, in the assembler section,
you will find source code for a replacement Int $15 joystick interface
as a TSR, for those commercial programs (i.e. games) that actually use
the Int $15 interface instead of accessing the hardware directly.

--
Will <nospam.wdeco...@geocities.com.nospam>
(If you are a human, then you can figure out my real address.)

Come see me at my web site:
http://www.geocities.com/SiliconValley/Pines/9447

Re:needed: joystick support in TP7


I don't have a routine for TP7 but this code reads the joystick directly
in assembler so should work for any version of TP. Try it and let me know?

program joystick;

uses crt,dos;
var
 button,xaxis,yaxis,origmode,X,Y :integer;
 regs :registers;

begin
      clrscr;
      writeln('Press any key to exit');
      writeln;
      writeln('L button pressed     = 224');
      writeln('R button pressed     = 208');
      writeln('Both buttons pressed = 192');
      writeln('No buttons pressed   = 240');
      repeat
            regs.ah :=132;               {assembler to read buttons}
            regs.dx := 0000;
            Intr ($15,regs);
            button := regs.al;

            gotoXY(35,7);write('button = ',button);

            regs.ah :=132;               {assembler to read stick position}
            regs.dx := 0001;
            Intr ($15,regs);
            xaxis := regs.ax;
            yaxis := regs.bx;

            gotoXY(35,09);write('X axis =    ');
            gotoXY(35,10);write('Y axis =    ');
            gotoXY(44,09);write('',xaxis);
            gotoXY(44,10);write('',yaxis);

            delay(100);
      until Keypressed;
End.

Bob

Michal Szymanski <m...@alkor.astrouw.edu.pl> wrote in article
<slrn70mhi3.fah....@alkor.astrouw.edu.pl>...

Quote

> Hi all,

> I'm looking for joystick support routines for Turbo Pascal 7. I found
> some in SWAG archives, tested two of them but results were
> disappointing. With the same joystick position, they were giving
> different X,Y coords. Also, as I was slowly moving the handle in
> one directions, coords returned in a loop were changing chaotically.
> Same loop, with the "fire" button constantly pressed, returned
> "no button" in about 20% of cases.

> The machine is AMD K6 233MHz, i tried that both in plain DOS 6.2 and
> in DOS-under-WIN95.

> Could somebody recommend me a reliable joystick library?

> Thanks in advance,

> regards, Michal.

> --

>   Michal Szymanski (m...@sirius.astrouw.edu.pl)
>   Warsaw University Observatory
>   Al. Ujazdowskie 4, 00-478 Warszawa, POLAND
>   FAX: 48-22-6294967

Other Threads