Dear Brian,
here comes the sniplet of QB45 code I use to directly access com port status
lines and the other serial registers from a DOS-Box under Win98 and ME. The
trick is that somehow Windows decides to give you the HW resources if you
read the modem status register more than once, which I found out only by
chance.
Good luck es 73
Markus, DF6NM
=========================================
' RTS/DTR routines for Windows DOS BOX
' from morse1jm.bas by Markus Vester, DF6NM
cp& = &H3F8 'COM1
cp& = &H2F8 'COM2
prepcom:
i% = INP(cp& + 6): i% = INP(cp& + 6) ' works in Win98 DOS Box
i% = INP(cp& + 6): OUT cp& + 4, 0 ' necessary for WinME
IF i% = 255 THEN cp& = 0: PRINT "tx com port not available"
' read modem status twice to notify windows from dos box !
' Windows ME needs 2 times read status
' 3rd read status is different from 255
' and bit 4 (selftest) in modem control has to be reset!
' com port: rts=key, dtr=ptt, gnd
' DSUB9 Pin: 7 4 5
' DSUB25 Pin: 4 20 7
RETURN
rtshi:
IF cp& THEN OUT cp& + 4, INP(cp& + 4) OR 2
RETURN
rtslo:
IF cp& THEN OUT cp& + 4, INP(cp& + 4) AND 253
RETURN
dtrhi:
IF cp& THEN OUT cp& + 4, INP(cp& + 4) OR 1
RETURN
dtrlo:
IF cp& THEN OUT cp& + 4, INP(cp& + 4) AND 254
RETURN
|