home *** CD-ROM | disk | FTP | other *** search
/ Brotikasten / BROTCD01.iso / cpm / mouse.lbr / JOYSTICK.INC < prev    next >
Text File  |  1995-08-31  |  768b  |  32 lines

  1. {
  2. SG Tools Pro (C) 1992 Steve Goldsmith
  3.  
  4. The Joystick module allows you to read joystick 2
  5. }
  6.  
  7. const
  8.  
  9.   cia1DataPortRegA = $dc00;
  10.   cia1DataDirRegA  = $dc02;
  11.  
  12. {joystick direction masks}
  13.  
  14.   joyNone      = $1f; joyFire      = $10;
  15.   joyUp        = $01; joyDown      = $02;
  16.   joyLeft      = $04; joyRight     = $08;
  17.   joyUpLeft    = $05; joyUpRight   = $09;
  18.   joyDownLeft  = $06; joyDownRight = $0a;
  19.  
  20. function ReadJoy2 : byte;
  21.  
  22. var
  23.  
  24.   RegSave : byte;
  25.  
  26. begin
  27.   RegSave := PortIn (cia1DataDirRegA); {save ddr}
  28.   PortOut (cia1DataDirRegA,$0);        {set ddr to all inputs}
  29.   ReadJoy2 := PortIn (cia1DataPortRegA) and $1f; {read joystick 2}
  30.   PortOut (cia1DataDirRegA,RegSave)    {restore ddr}
  31. end;
  32.