! 13 Jul 87   &>>Tandy DCM-5<<
!
! tddcm5.cmd		-	Tandy DCM-5
!
! Terrence R. Lambert
!

PROC call

! Determine Phone Number
if '$1' = ''
  display "Usage:  dcm5dial number
  return 1
endif

! Wake up modem and call number
cdelay 99				! set character delay to 99
xmit "*"				! enter the command mode
xmit "C"				! clear memory (reset modem)
xmit "*"				! re-enter the command mode
xmit "S"				! dialing speed (S)low, (F)ast
xmit "O"				! modem type (O)riginate, (A)nswer
xmit "D"				! enter dialer programming command
xmit "T"				! dial mode (T)one, (R)otary
xmit "$1X"				! dial the number
flush					! get rid of garbage
wait "\006"				! wait for end of dial code (ACK)
display "Number dialed."
flush
cread r,0,1				! read the result code
flush					! throw away crlf
cdelay 0			! reset character delay to 0
if r = '\x15'			! is it hex 15 (NAK)?
  display "Communications failed... aborting"
  abort
endif
if r = '\n'				! is it hex 0a (LF)?
  display "Connected."
  return
endif
display "Error: unrecognized return from dial command... aborting"
abort
ENDPROC

PROC answer
	? "Answer $1 $2 $3 $4: Impossible on Tandy DCM-5 modem.  Sorry."
ENDPROC

PROC hangup
	xmit "^T"
	wait 3
ENDPROC
