STICK.I

[Table of Contents]


The STICK.I include file resides on the Kyan Pascal 2.x Utilities Disk 1. It contains two functions:


  • STICK - For reading the joystick on one of the controller ports
  • STRIG - For reading the joystick fire button on one of the controller ports.




FUNCTION Stick(Num: Integer): Integer;
    BEGIN
        STICK:=0;
#A
       LDY #7       ;offset to Num Lo
       LDA (_SP),Y  ;get Num of stick
       TAY
       LDA $278,Y   ;load stick value
       LDY #5       ;offset to STICK
       STA (_SP),Y  ;save in STICK
#
END;(* Stick function *)

FUNCTION Strig(Num: Integer): Boolean;
    VAR
       temp:boolean;
    BEGIN
#A
       LDY #7       ;offset to Num Lo
       LDA (_SP),Y  ;get Num
       TAY
       LDA $27C,Y
       LDY #5       ;offset to temp
       STA (_SP),Y  ;store in temp
#
(*Atari OS says 0 is TRUE, while Kyan
  Pascal thinks otherwise, so we've
  got to reverse the variable.*)
        Strig:=not temp;
END;(* Strig function *)

No comments:

Post a Comment