;D:KCOM1030.ACT ;All the communications stuff: ; ;Opening, closing and dialing for ;the ATARI 1030 modem ; ; KERMIT protocol ; for Atari Home Computers ; version 1.1 ; (C) 1983 John Howard Palevich ; to be distributed free of charge ; ;Started NOVEMBER 5, 1983 ;Print a string which will identify, ;to the user, what hardware this ;COM file supports PROC MODEMINIT() PRINTE("for the Atari 1030 modem") RETURN ;Return number of character in the ;input buffer CARD FUNC NCIB() BYTE INCNT = $400 RETURN(INCNT) ;Put a character out the modem PROC PUTR(BYTE DATA) PUTD(2, DATA) RETURN ;Put out a byte as a modem command PROC PUTCMD(BYTE CMD) BYTE CMCMD = $0007 CMCMD = $FF PUTD(2, 27) PUTD(2, CMD) CMCMD = 0 RETURN ;Temporarily Suspend Communications ;so that file I/O can take place PROC StopR() PUTCMD('Z) RETURN ;Close down the modem channel PROC CloseR() PUTCMD('Y) CLOSE(2) RETURN ;Initialize communications BYTE FUNC OpenR() STRING fname = "##:" BYTE T Close(2) fname(1) = 'T fname(2) = '1 t = 12 Open(2, fname, t, 0) T = MSTATUS(2) IF T >= 128 THEN PRINTF("Can't open %S, error %B%E", fname, T) CLOSE(2) RETURN(T) FI RETURN(0) PROC StartR() PUTCMD('Y) ;Resume operation PUTCMD('A) PUTR($20) PUTR('?) ;No Translation PUTCMD('C) PUTR(PARITY) RETURN ;SubEQ(S, I, SS) ; ; Check if SS is = S(I..I+Len(SS)-1) BYTE FUNC SUBEQ(STRING S BYTE I STRING SS) INT J IF S(0)-I+1 < SS(0) THEN RETURN(0) FI FOR J = 1 TO SS(0) DO IF S(I+J-1) <> SS(J) THEN RETURN(0) FI OD RETURN(1) ;Dial the number in string P ;return 0 if failure, 1 if OK BYTE FUNC AutoDial(STRING P) BYTE I, NN, C, DVSTAT1 = $2EB NN = P(0) ;LENGTH OF STRING ;This modem ignores baud rate FOR C = 1 TO NN DO IF P(C) = '# THEN DO C ==+ 1 UNTIL C > NN OR P(C) > 32 OD EXIT FI OD IF C > NN THEN PRINTE("No phone number in this entry!") RETURN(0) FI PRINTE("Dialing...press any key to abort") ERRORNUM = 0 STARTR() IF dial = 0 THEN PUTCMD('N) ELSE PUTCMD('O) FI PUTCMD('K) FOR I = C TO NN DO PutR(P(I)) OD PutR($9B) ;Wait for carrier WHILE CH = $FF DO MDEVSTAT(2) IF (DVSTAT1 & $80) <> 0 THEN RETURN(1) FI OD PRINTE("User abort") PUTCMD('M) ;Go on-hook STOPR() RETURN(0) ;Hang up the phone line PROC HANGUP() STARTR() PUTCMD('M) ;Go on-hook STOPR() RETURN ; --- END OF D:KCOM1030.ACT ---