Computer Control for the RX2 Julian Moss G4ILO Program Listing // basic utilities for RX2 control interface unit RX2_Util; interface uses Windows; // set address of game port (default '$201') procedure SetPortAddr(const addr: string); // get current channel number and signal presence procedure GetStatus(var chan: Integer; var signal: Boolean); // push button for t milliseconds procedure PushButton(t: Integer); implementation uses SysUtils; var port_addr: Word; function ReadPort: Byte; begin asm mov dx,port_addr; in al,dx shr al,4 mov result,al end; end; procedure SetPortAddr(const addr: string); begin port_addr := StrToInt(addr); end; procedure GetStatus(var chan: Integer; var signal: Boolean); var data: Byte; const chan_no: array[0..7] of Integer = (0,1,2,3,0,4,0,5); begin data := ReadPort; signal := data > 8; chan := chan_no[data mod 8]; end; procedure PushButton(t: Integer); var start: Integer; begin start := GetTickCount; repeat asm mov dx,port_addr mov al,1 out dx,al end; until (GetTickCount - start) >= t; end; initialization SetPortAddress('$201'); finalization end.