If you wish to use an Apple Modem from within an Applesoft BASIC program,
you must write your own software to do so; you must be prepared to read
each character you send, though, since the Apple Modem echoes each character
sent through it.
Following is an example routine for dialing a number. NOTE: this routine
is only meant to illustrate how to read each character after sending it.
The routine does dial a number, but this routine cannot stand alone: notice
how it ends without completely flushing the input from the modem.
10 D$ = CHR$(4)
20 S$ = "AT D123-4567"
30 PRINT D$;"PR#2"
40 PRINT D$;"IN#2"
50 FOR I = 1 TO LEN(S$)
60 PRINT MID$(S$,I,1);
70 GET X$
80 NEXT I
90 PRINT
100 PRINT D$;"PR#0"
110 PRINT D$;"IN#0"
WARNING: When trying to access the modem from the program, if you use
PRINT CHR$(4);"PR#2" and/or PRINT CHR$(4);"IN#2", followed by CTRL-A T, the
computer hangs and BASIC program control is lost. That's because once you send
a CTRL-A T, the firmware takes over and is in control until you type CTRL-A Q.
To send AT commands to the modem, send only the "PR#2"; then, using a PRINT
statement, you may send whatever you wish. For example:
10 D$ = CHR$ (4)
20 PRINT D$; "PR#2"
30 PRINT "ATDT1231234"
40 END
will dial 123-1234. You could also replace line 40 with
40 PRINT D$; "IN#2" and add,
50 PRINT CHR$ (1); "T"
and you'd be in terminal mode.