elixir@m-net.UUCP (Rodney Fulk) (02/20/89)
The following program is a module for Modula 2 which handles Both Carrier
detect and DTR stuff.. Its as far as I have gotten in a bbs project that I am
working on (A student working 12 hours a day doesnt get much time to
program)
I went at the carrier detect the same way you are but I got the codes
for the below routines by porting over C code from Citadel..
You SHOULD be able to do the Ring Detect the same way that the Carrier Detect
is done. If you notice it is a simple peek.. (if you have gulam it is a nice
util to use since you can peek at locations easily)
I had to tweak it until it worked.. The code below WORKS and has been tested
by my callign my computer with a program with this code installed..
Now if I can figure out how to use the system timer I will be well on my way..
Cut here
-------------------------------------------------------------------------------
IMPLEMENTATION MODULE Modem;
FROM XBIOS IMPORT SuperExec,GIOffBit,GIOnBit, FlowFlavor, SerialSpeed,
ConfigureRS232;
FROM Terminal IMPORT Write;
FROM TextIO IMPORT WriteString, WriteCard,ReadAdr, WriteLn;
FROM SYSTEM IMPORT ADDRESS, CODE;
FROM Keyboard IMPORT Status, Read;
IMPORT GEMDOS;
IMPORT M2Conversions;
VAR
Peeker : BITSET;
Mem : ADDRESS;
CH :CHAR;
speed : SerialSpeed;
flow : FlowFlavor;
x:CARDINAL;
Done: BOOLEAN;
(*$P- *)
PROCEDURE Peek;
CONST
RTS = 04E75H;
BEGIN
Peeker := BITSET(Mem^);
CODE(RTS);
END Peek;
PROCEDURE ModemOpen;
BEGIN
GIOffBit(0ffefH);
END ModemOpen;
PROCEDURE ModemClose;
BEGIN
GIOnBit(10H);
END ModemClose;
PROCEDURE carrDetect () : BOOLEAN;
BEGIN
Mem := 16775680;
SuperExec(PROC(Peek));
IF 1 IN Peeker
THEN RETURN FALSE
ELSE RETURN TRUE
END;
END carrDetect;
PROCEDURE ChangeBaud(num : CARDINAL);
BEGIN
flow := VAL(FlowFlavor,0);
speed:=VAL(SerialSpeed,num);
ConfigureRS232(speed,flow,-1,-1,-1,-1);
END ChangeBaud;
PROCEDURE HangUp;
BEGIN
ModemClose;
WHILE carrDetect() DO
END;
END HangUp;
END Modem.
-------------------------------------------------------------------------------
UUCP Mail Address
Try either ...!uunet!m-net!elixir or elixir@m-net.UUCP