Here are some code snippets you may find usefull
For really good info on parallel port, goto Beyondlogic.com. They have documented just about anything you would need to program for the port in any mode.
SUB LptPortFind (BaseAdd%)
'Find out which LPT ports are equipped and get their base addresses'
DEF SEG = 0 'Set memory segment offset to absolute "0" for subsequent PEEK'
'Read BIOS storage locations for LPT port assignments'
LPT1 = PEEK(&H408) + (256 * PEEK(&H409)) 'returns the decimal address of the port'
LPT2 = PEEK(&H40A) + (256 * PEEK(&H40B))
LPT3 = PEEK(&H40C) + (256 * PEEK(&H40C))
[bios will set above addresses = to the base address of each equipped port]
[unassigned ports will return "0" as address}
[insert some decision code here to determine which port to use]
DEF SEG 'Return memory offset to basic'
END SUB
SUB SetLptPortMode (BaseAdd%, PortType$)
[how to set an ECP defined port to any mode of operation]
SELECT CASE PortType$
CASE IS = "ECP+EPP", "ECP"
'Test for presence of ECP extended control register
s% = INP(BaseAdd% + &H402)
IF s% <= 254 THEN 'anything but all 1's indicates register current value'
'Test the ECP port ECR for EPP operation mode setting, Set to EPP mode if needed'
' Test ECR bits 7-5 <> 100 for EPP mode [001 for bi-dir mode if desired]
IF (&HE0 AND s%) <> &H80 THEN
'Set bits 7-5=100 (add d'128 to value in bits 4-0) if test fails'
OUT (BaseAdd% + &H402), ((&H1F AND s%) + &H80) 'Combine mode bits 7-5=100 with existing bits 4-0 value'
END IF
END IF
CASE IS=[other operation mode]
[code here to setup for desired parallel port operation mode]
END SELECT
END SUB
SUB TimeOut (BaseAdd%, TimeOutFlag%)
[how to manipulate an EPP port timeout register bit]
'Read and reset if necessary EPP timeout bit at baseadd+1; bit 0'
IF (1 AND INP((BaseAdd% + 1))) = 1 THEN 'Timeout bit is set'
Tries% = 0: TimeOutFlag% = 1 'Set flag if timeout was set on entry'
DO
'set direction foreward for write'
OUT BaseAdd% + 2, 4
' Clear the bit by writing a "1" to the status port..that's correct..write a "1 to clear bit'
OUT BaseAdd% + 1, 1
' Execute Data Read to check unit response)'
b% = INP(BaseAdd% + 4): Tries% = Tries% + 1
LOOP WHILE Tries% <= 10 AND ((1 AND INP((BaseAdd% + 1))) = 1)
ELSE
TimeOutFlag% = 0' Clear flag if no timeout was set on entry'
END IF
IF Tries% >= 10 THEN
CLS
PRINT " Unit is not responding... 10 consecutive timeout errors detected."
END 'Stop program execution, unit is dead'
END IF
END SUB
Dialtone