From: Mike DeWeese					Date: 09/26/85
      7841 Maria st.
      Westminster, Co.
      (303) 428-0917

	I propose the fllowing changes to BYE501 to be considered as an
    update and version change.

(1) Found that Prometheus modems had an echo error on set-up after ATZ
    command.  Changed loop time at CHECK1: to 450 ms instead of 400ms.

(2)    Added call back routine using the smart capabilities and sub-routines
    already in BYE501. 
       This routine is activated after first ring is detected.	Then will loop
    for 5.1 seconds looking at MDISNT for characters or time out.  If a ring
    is detected (voice call) it will fall to a 45 second loop, as not to return
    and setup modem while phone is ringing.  After 5.1 second time out, it then
    falls to a 30 second loop to look for a ring (computer call) or time out.
    When a ring is detected, we return and answer the phone.  If a time out
    occures we return, update call counters, and setup modem.

	a) Equated as follows under General Options section.

CALLBAK EQU	YES             ; Call back routine for those of us that only
;				; have one phone line.
;				; B5IM must be true also.


	b) Added CALL at end of IMRING: label and just before MRIN1: label, as 
	   follows.
;
	 IF	CALLBAK AND B5IM
	CALL	CALBAK
	 ENDIF
;
	 IF	B5IM AND (NOT NOATA)
MRIN1:	MVI	B,22		; Must let the phone quit ringing first



	c) Added the following subroutine below the comment ";END OF B5IM CODE".
	   and before the IMDONE: label.

;------------------------------------------------------------------------
; Call Back subroutine

	 IF	CALLBAK AND B5IM
CALBAK:	LXI	H,CALMSG1
	CALL	PRINTL		; Notify where we are

	LXI	B,5100		; Look for 5.1 seconds for voice call
CBK:	CALL	MDINST		; Any chars available
	JZ      CBK1		; No, go count down
	CALL    MDINP		; Get char
	ANI	7FH		; Strip parity
	CALL   	RCDISP 		; Show code on screen
	CPI	'2'		; 
	JZ	CBKA  		; Had ring, must be a voice call
	JMP	CBK		; Had invalid char, go try again
	
CBKA:	LXI	H,CALMSG3
	CALL	PRINTL 
        LXI	B,450		; Come here on a voice call and time out,
CBKB:	CALL	DELAY		; some people let the phone ring a long time.
	DCX	B		; best to not set up the modem while phone
	MOV	A,B		; ringing.  Delay 45 seconds and return
	ORA	C
	JNZ	CBKB
	JMP	REDOIT

CBK1:	CALL	KDELAY
	DCX	B
	MOV	A,C
	ORA	B
	JNZ	CBK		; No time out, go count some more

CBK2:	LXI	H,CALMSG2
	CALL	PRINTL

	LXI	B,30000 	; Wait up to 30 secs for call back
CBK3:	CALL    MDINST		; Any chars ready?
	JZ  	CBK4  		; No, go count down
	CALL	MDINP		; Go fetch char 
	ANI	7FH		; Strip parity
	CALL	RCDISP		; Display char 
  	CPI	'2' 		; Ring, go answer
	CZ  	IMINT3		; Print lf and clear register
        RZ
	JMP	REDOIT		; Got somthing other than a 2, go start over

CBK4:  	CALL	KDELAY
	DCX	B
	MOV	A,C
	ORA	B
	JNZ	CBK3  
	JMP	REDOIT		; Had no call in 30 sec time limit-go setup

CALMSG1:DB	'Now checking for Voice or Computer call...',CR,LF
	DB	0
CALMSG2:DB	'Waiting 30 seconds for Computer call...',CR,LF		
	DB	0
CALMSG3:DB	CR,LF,'Timming out from voice call...',CR,LF
	DB	0
	 ENDIF			; Call back

;  END CALL BACK CODE
;
;--------------------------------------------------------------------------



