home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1988 / 05 / amiga / m2amiga.2 < prev    next >
Encoding:
Modula Definition  |  1988-02-17  |  2.1 KB  |  73 lines

  1. DEFINITION MODULE RightControlPortIO; (* M2Amiga *)
  2.  
  3. (* gestattet IO ueber rechten ControlPort und initialisiert
  4.    PotGoResource.
  5.  
  6.    PIN:    VERWENDUNG:
  7.        R1  joystick switch, active low, input only (forward)  
  8.        R2  joystick switch, active low, input only (back)  
  9.        R3  joystick switch, active low, input only (left)  
  10.        R4  joystick switch, active low, input only (right)
  11.  
  12.        R5  PotGo IO, biderectional, als input active low, 300 micros
  13.        R9  PotGo IO, biderectional, als input active low, 300 micros
  14.  
  15.        R6     fast biderectional IO, fire button
  16. *)
  17.  
  18. TYPE   PotPinNumbers  = (R5, R9);
  19.        JoyPinNumbers  = (R1, R2, R3, R4);
  20.        Level          = (Low, High);
  21.  
  22. VAR    RightPotgoOpen : BOOLEAN;
  23.  
  24.  
  25. (* Bidirectinal PotGoIO ******************************************)
  26.  
  27. PROCEDURE WriteToPotPin(Pin : PotPinNumbers; Value : Level);
  28.  
  29. (* Ausgabe ueber PotPins 5 oder 9. Level liegt in ca. 300 micros an
  30. *)
  31.  
  32. PROCEDURE ReadFromPotPin(Pin : PotPinNumbers) : Level;
  33.  
  34. (* Eingaben von R5 oder R9 lesen 
  35. *)
  36.  
  37. PROCEDURE EnablePotGoAccess;
  38.  
  39. (* Oeffnen der PotGoResource und Anlegen der Datenstruktur, um Pins     
  40.    5 und 9 nutzen zu koennen. Prozedur wird nach dem Laden des Mo-      
  41.    duls selbstaendig aufgerufen. Sie kann auch aufgerufen werden,     
  42.    nachdem "CancelPotGoAccess"   benutzt wurde. Ergebnis des Aufrufs   
  43.    enthaelt Variable "RightPotgoOpen".
  44. *)
  45.  
  46. PROCEDURE CancelPotGoAccess;
  47.  
  48. (* Aufgeben der PotGoResource, damit der Zugriffsmoeglichkeit auf       
  49.    Pin 5   und 9. Prozedur sollte immer aufgerufen werden, wenn Pin 5   
  50.    und 9 nicht benutzt werden.
  51. *)
  52.  
  53. (* Input from Joystick switches R1, R2, R3 und R4  ****************)
  54.  
  55. PROCEDURE ReadJoystick(Pin : JoyPinNumbers):Level;
  56.  
  57. (* Individuelles Lesen der vier Joystick-Schalter. Normalerweise       
  58.    sind die   Schalter offen, der Level somit High. 
  59.    Es gilt somit :   active low
  60. *)
  61.  
  62. (*Bidirectional IO ueber Pin 6 ************************************)
  63.  
  64. PROCEDURE WriteToPin6 (Input : Level);
  65.  
  66. PROCEDURE ReadFromPin6() : Level;
  67.  
  68.    
  69. END RightControlPortIO.
  70.  
  71.  
  72. Listing 2
  73.