[net.micro.cpm] MDM716-727 BUG FIX

PLOUFF%mit-mc@sri-unix.UUCP (03/18/84)

From:  Robert L. Plouffe <PLOUFF@mit-mc>

MDM716 through MDM727 has a problem in the new robustness of the
protocol when receiving binary files (.COM, .AQM, e47}c) from a host
on ARPANET/MILNET using a compatible modem protocol such as MMODEM
on ITS.  ASCII file down loading is OK but binary files abort the
transfer if a Control-D is received when searching for SOH.  Since
Control-D is the EOT character, things end abruptly.  So far as I
know, this problem does not occur when transferring binary files
between two micros over a direct phone line connection.  However,
the following change will fix things in all cases.
						Bob Plouffe

REPLACE THE CODE AT "RCVRECD:" WITH THE FOLLOWING:

;***********************************************************************
;
;	    RECEIVE A RECORD FROM SENDING STATION
;
;***********************************************************************
;
; If CRC is in effect, there is a 10-second timeout to the first SOH.  
; It then tries six more times to let the sender know the system is
; capable of receiving a 'CRC' check.  At the end of that time a NAK is
; sent which tells the sender to use CHECKSUM checking instead of CRC.
; This allows automatic compatability with systems implementing CRC -
; (Cyclic Redundancy Checking).  The search for SOH will cycle through
; one record interval and ignore noise or characters sent by the remote
; for any purpose (such as progress reporting).  So extraneous char-
; acters that are sometimes sent by remote-end protocol will be gobbled
; up until the first SOH. EOT is tested only as the first returned
; character after each sector.
;
SRCHSOH	EQU	160	;number of times to loop search for SOH
;
RCVRECD:
	MVI	A,1
	STA	ERRCT	;initialize error count
	MVI	B,10	;10 seconds
;
RCVSQ:	LXI	D,SRCHSOH ;initialize the loop
	CALL	RECV	
	JC	RCVSTOT	;time out if 1rst char not rcvd in 10 secs.
	MOV	C,A	;hold it for awhile
	CPI	EOT	;see if end of transmission
	STC		;set carry
	RZ		;return with carry set
;
SOHLUP:	MVI	A,0FFH
	STA	CHRFLG
	STA	TIMFLG
	MOV	A,E	;get search count down value
	CPI	SRCHSOH	;see if it is first returned character
	MOV	A,C	;get the first character
	JZ	NORECV	;skip RECV routine if it is first char
	MVI	B,1
	CALL	RECV	;get another character in sequence
	MOV	B,A	;store it
	JNC	TSTSOH	;go see if SOH is char received
;
NORECV:	MOV	B,A
	XRA	A	;else set to value that will force timeout
	STA	CHRFLG
;
TSTSOH: MOV	A,B	;get the character
	CPI	SOH	;see if it is SOH
	PUSH	PSW
	XRA	A
	STA	TIMFLG	;restore this flag
	POP	PSW
	JZ	RCVSOH	;got SOH so get the rest of info
			;(sector number and its complement)
	MOV	A,D
	ORA	E	;see if counted down to zero
	DCX	D
	JNZ	SOHLUP	;go around again if not
	LDA	CHRFLG	;see if time out needs to be forced
	ORA	A
	JZ	RCVSTOT	;go do time out and count them
	LDA	QFLG
	ORA	A
	JZ	RCVSERR
;

			****************

Add the line indicated below at routine RCVSER1:

RCVSER1:CALL	SEND		;..the 'NAK' or 'CRC' request
	LDA	ERRCT		;abort if we have reached error limit
	INR	A
	STA	ERRCT		;store for next time
	CPI	ERRLIM		;see if at limit yet
	MVI	B,1		; <<-------------------ADD THIS LINE
	JC	RCVSQ		;if not, keep going
	LDA	ACKNAK		;see if ACKNAK is set
	ORA	A
	JNZ	ABORT		;if 'YES', abort
	JMP	CKQUIT		;if 'NO' check for continued use
;

ADD THE FOLLOWING AT THE PROLOG TO THE FILE:

; 03/12/84  Changed routine at RCVRECD so that downloading of binary
;  MDM727A  files works OK on packet switched networks and host-
;	    cooperating protocols such as MMODEM on ITS machines.
;	    This change simply moved the test for EOT outside the
;	    SOH loop.
;						-Bob Plouffe
;
T
tThis file will also be in AR100:FJW;MDM7XX BUGFIX at MIT-MC.