[net.micro.cpm] pat730 v8asm

PLOUFF@Mit-Mc.ARPA (07/05/84)

From:  Robert L. Plouffe <PLOUFF@Mit-Mc.ARPA>

Here is the PAT730 V8ASM file for those that can't FTP:

;	PAT730V8.ASM   --Bob Plouffe  7/4/1984

;	THE CONDITIONAL ASSEMBLY EQUATES ARE DEFAULTED TO
;	GIVE A PLAIN VANILLA MDM730 AS DISTRIBUTED, EXCEPT
;	FOR CERTAIN CHANGES WHICH ARE CONSIDERED AS BUG FIXES.
;	THESE ARE LISTED UNDER THE 'FIXED' EQUATE WHICH IS NOW
;	ALWAYS TRUE.  THE REMAINDER OF THESE PATCHES ARE OPTIONS.
;  	SET THEM AS YOU WISH FOR THE OPTIONS ALLOWED BELOW.

; V8	Fixed a bug found by Ron Fowler that causes the wrong
;       file to be erased in the directory when overwriting existing
;       files in batch mode. This bug has been in all the MDM series
;	but not prior versions of generic MODEM7    -Bob Plouffe

; V7	Added Hoff fix for alternate long distance dialling
;	and his fix for "DISK-FULL" when in ASCII capture mode.
;	Removed code at CKSMLP that caused endless loop in batch
;	mode with filenames that have checksum of 1AH, 0DH or 0AH.
;						   -Bob Plouffe

; V6    Added FIXFNK option to patch logon send routine to work right 
;               in 'half-duplex' (L) terminal mode
;       Added LOCSTRT option to start terminal mode in 'half-duplex'
;               (L) mode when connection made.  This modification
;               overrides the ONERING and NORING mods.  It rings
;               once, then jumps to local mode.     -Ross Alford
;***********************************************************************
;IMPORTANT:     if FIXFNK is used, SAVE 74 rather than 73 after
;               overlaying the patches
;***********************************************************************

; V5    Added UNDO-J as an option.
;	Corrected bug in SENDFN routine. 
;	Corrected bug in Irv's NORING option.	   - Bob Plouffe

;This patch overlay file will retain the capability to get
;progress reports at a remote-end that answers under BYE and
;when the "Q" switch is not used on the command line.

;Also changes the max-wait times at several locations
;including inside the receive-sector loop.  This SUBSTANTIALLY
;improves performance on networks with packet delays.
;Suggest 16 seconds but not less than 5.

;Just assemble this file as an ASM file and overlay the HEX file
;on MDM730.COM with DDT  and SAVE 73 MDM730.COM.   If you have
;the source code, you should be able to locate the changes at
;the labels shown below.   It is NOT INTENDED to change the
;revision number of MDM730 at this time. Treat this patch file
;as a customization just like when you use one of the patch
;overlays for a specific hardware configuration.

;This file also includes the Hoff patches for BELL and RUB
;and can be conditionally assembled for the way you want it.


TRUE	EQU	0FFH
FALSE	EQU	0


;Setting LOCSTRT to true will make two modifications to MDM730:
;       -it will perform the equivalent of the ONERING modification
;        that appears elsewhere in this file
;       -MDM730 will go into L terminal mode (local echo) rather
;        than T terminal mode when a connection is made by an autodial
;        modem.

LOCSTRT  EQU     FALSE

;Set both of these bytes FALSE if you wish to have console bell
;continuously beep until a keyboard character is hit after doing
;a dial retry and a connection occurs.  Set ONERING to TRUE if
;you want only one beep to occur and NORING to TRUE if you don't
;want any beeps at all.   DON'T set both of these bytes to TRUE.

ONERING	EQU	FALSE
NORING	EQU	FALSE
;
;
RUB2BKSP EQU	TRUE	;want to convert RUB key to BKSPC?
;
;***********************************************************
;
;To get rubout character to go to console set RUBCON to TRUE
;and IGNORCTL to FALSE.  If you wish to have control chars
;filtered, then RUB will be filtered also. You can also set
;both of these to FALSE. TRUE/TRUE will filter control chars
;but will not feed RUB to console.

RUBCON	 EQU	FALSE	;want rubout to go to console?
IGNORCTL EQU	TRUE	;TRUE sets control character filter
;
FIXED EQU	TRUE	;Fix to directory pointer problem
			;Fix to alt long distance dialling.
			;Fix "DISK-FULL" problem in capture mode.
;(ALWAYS TRUE)		;Fix to remove endless loop with some
			;filenames in batch mode.
			;Fix to SENDFN routine so that if remote
			;end is under BYE and 'Q' switch not set
			;on command line, and if a file name begins
			;with a 'C', the next file name is not 
			;aborted.   Also provides a slight format
			;improvement for the "Bad sector # in header"
			;message.  This is no longer a conditional
			;equate and is always true.

UNDO$J	 EQU	FALSE	;Set to TRUE to restore the 'T' option and
			;so that remote end doesn't automatically
			;come up in terminal mode. (Unless remote is
			;using MDM730 with this option set FALSE).

MAXWAIT	 EQU	5	;suggested value is 16 for packet networks
			;which may exhibit excessive packet delays.

FIXFNK   EQU    FALSE   ;patch LOGLP logon transmit routine to echo
                        ;to console in L mode, and not to wait so 
                        ;long between characters in L mode
                        ;***NOTE that if you use this modification the
                        ;size of MDM730.com must be increased to 74 pages
                        ;when you save it***

BELL	 EQU	07H
LF	 EQU	0AH
CR	 EQU	0DH
RUB	 EQU	7FH
TERM	 EQU	1618H
RETURN	 EQU	197EH
EXITTEST EQU	1E79H
SENDRDY  EQU	1E41H
WAITNLP	 EQU	2958H
SENDACK	 EQU	18A4H
GETACK	 EQU	2581H
STAT	 EQU	2B88H
TYPE	 EQU	2B9DH
DIALAD2	 EQU	0803H
DIALEXIT EQU    0799H	
WREXIT	 EQU	2126H
CLOS3	 EQU	476CH
WRERR0	 EQU	0DC5H
LOGLP   EQU     1E5DH           ;send logon message or fnk key
LOGLP1  EQU     1E6DH           ;get echo if T mode
LOCFLG  EQU     499BH           ;set if L mode
MFNAME6 EQU     4A9BH           ;this +12 is start of stack area
SPEED2  EQU     1A57H           ;delay routine

;*************************************************************
;
;This restores the feature that allows the RUBOUT character to
;go to the console if you desire it.  Code was added in MDM730
;that prevented rubout being sent to console in terminal mode.
;
;In the routine TERML
	ORG	1F0FH
	IF	RUBCON
	DB	0,0,0,0,0	;deletes rubout filter
	ENDIF

	IF	NOT RUBCON
	CPI	RUB
	JZ	TERM
	ENDIF

;At the IGNORCTL byte storage location
	;
	IF	IGNORCTL
	ORG	011DH
	DB	0FFH		;sets control character filter
	ENDIF
	
	IF	NOT IGNORCTL
	ORG	011DH
	DB	0
	ENDIF

;
;***********************************************************



;In routine SENDC2
	ORG	1782H
	MVI	E,120	

;In routine SENDFN
	ORG	1BB2H
	DB	0,0
	;
	CALL	GETACK
	CC	SENDACK


;In routine ACKLP
	ORG	1BF3H
	MVI	B,MAXWAIT

;In routine CKSMLP
	ORG	1C0CH
	MVI	B,MAXWAIT

;In routine SCKSER
	ORG	1C56H
	MVI	E,120

;In routine NMLP1:
	ORG	1D03H
	MVI	B,MAXWAIT

;In routine HSNAK
	ORG	1D51H
	MVI	E,180	
	;
;In routine HSNAK1
	ORG	1D5FH
	MVI	B,1		;Yes, a 1



	ORG	1E4AH
;Suggested by Irv Hoff to improve the ability to catch extra
;function key characters. 

SENDNOW CALL	EXITTEST	;see if ready to quit now	
	CALL	SENDRDY		;ready to send a character?
	JNZ	SENDNOW		;if not ready,wait some more
	RET			;exit if ready
 	

;In routine RCVSOH
	ORG	240AH
	MVI	B,MAXWAIT	
	; 
	ORG	2413H
	MVI	B,MAXWAIT	

;At label RCVBSE
	;
	ORG	242AH
			;These 2 bytes replace CR,LF
	DB	80H,80H	;slight format improvement here for:
			;'++ Bad record # in header '

 
;In routine RCVCHR
	ORG	245EH
	MVI	B,MAXWAIT	
	;
	ORG	2477H
	MVI	B,MAXWAIT	

;In routine RCVCRC2
	ORG	2496H
	MVI	B,MAXWAIT	


;In routine WAITNLP
	ORG	2988H
	MVI	B,1		;yes, a 1
;

;***********************************************************
;THIS ONE CONTRIBUTED ANONYMOUSLY AS undo-j.asm AND INCLUDED
;HERE AS AN ADDITIONAL OPTION.
;To undo the 'J' option and restore the 'T' option as it has
;always been. Set UNDO$J to TRUE to enjoy this option.

	ORG	2AFBH
	IF	UNDO$J
	DB	0C2H
	ENDIF
	;
	IF	NOT UNDO$J
	DB	0CAH
	ENDIF

	ORG	4952H
	IF	UNDO$J
	DB	'T'
	ENDIF
	;
	IF	NOT UNDO$J
	DB	'J'
	ENDIF

	ORG	495FH
	IF	UNDO$J
	DB	'T'
	ENDIF
	;
	IF	NOT UNDO$J
	DB	'J'
	ENDIF

;*******************************************************************
;The LOCSTRT patch
;(Starts in L mode after successful dial of phone)
;Overrides the ONERING and NORING patches below:
;  result is equivalent to ONERING
;
        ORG     06EAH           ;Same place as the ONERING mod
;
        IF      LOCSTRT
        PUSH    PSW             ;save A reg
        MVI     A,0FFH          ;load FF into A to
        STA     LOCFLG          ;set LOCFLG for L mode 
        POP     PSW             ;restore A
        JMP     RETURN          ;continue as in ONERING
        ENDIF                   ;LOCSTRT
;
       	IF      NOT LOCSTRT     ;Restores original
        CALL    STAT
        JZ      06F7H           ;?
        CALL    2B93H           ;?
        XRA     A
        ENDIF                   ;NOT LOCSTRT

;*********************************************************************
;This patch removes code at CKSMLP which was intended to provide
;compatibility with older versions of MODEM7 only when used in batch
;mode and only when a remote is under 'BYE' and the 'Q' switch not set.
;Unfortunately, the incompatibility can't be resolved and the only
;penalty is that the 'Q' switch MUST be set at remote-under-BYE in
;batch mode if that end is an older version of MODEM7.  The code
;that is herewith removed caused a problem when (in batch mode) filenames
;had a checksum of 1AH, 0DH or 0AH. It was possible to go into an
;endless loop.  This patch cures that disease.

	ORG	1C11H
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		;27 of them.
		;Removes lines in CKSMLP routine beginning with
		;CPI EOFCHR and ending with MVI A,LF inclusively.	
;**************************************************************************
;The following patches are inserted into the LOGLP routine that 
;sends the LOGON message and programmable function keys.  A call is altered
;to point to the patch, which is located at the bottom of the stack area.
;This should be a fairly safe location in MDM730, which seems to have lots
;of stack space
;
        ORG     LOGLP+9
        IF      FIXFNK
;
        CALL    LPATCH          ;replaces CALL LOGLP1
;
        ORG     MFNAME6+12      ;put the patch at start of stack
LPATCH:	MOV     B,A             ;save A in B
        LDA     LOCFLG          ;flag for L mode
        ORA     A               ;check if set
	JZ      LOGLP1          ;not set-do normal stuff
        MOV     A,B             ;reclaim A
        CALL    TYPE            ;character -> console
        MVI     C,01H           ;delay a short while
        JMP     SPEED2          ;and return
        ENDIF                   ;FIXFNK
;
        IF      NOT FIXFNK
        CALL    LOGLP1
        ENDIF                   ;Not FIXFNK

;*********************************************************************
;
;Options below are by Irv Hoff modified for inclusion in this
;patch overlay file by Bob Plouffe:

;     Some people have mentioned they are annoyed with the bell ringing
;constantly after a connect when auto-dialing with MDM730.  The following
;two small changes will stop that:

;
;1) WILL ONLY RING ONE TIME then go to terminal mode after announcing it
;   has connected:


;At CONMADE2
	ORG	06EAH
        IF      ONERING AND (NOT LOCSTRT)
	JMP	RETURN
	ENDIF
	;
	IF      NOT (ONERING OR LOCSTRT)
	CALL	STAT
	ENDIF
	;

;2) WILL NOT RING AT ALL, but go right to terminal mode after announcing
;   it has connected.

;In routine at CONMADE1
	ORG	06E3H
        IF      NORING AND (NOT LOCSTRT)
	DB	00
	JMP	RETURN
	ENDIF
	;
	IF 	NOT NORING
	DB	BELL,0
	MVI	B,5
	ENDIF
;

;     Several people were having trouble getting normal backspace with
;their rub (delete) key.  MDM730 offers the option of changing rub to
;backspace.

;	1)  Can preset the default option so rub comes up as backspace
;		(or preset the default so it comes up as normal rub)
;	2)  At any time use the menu option to change it temporarily
;		to the opposite configuration.


;     Some mainframes will not accept a normal backspace and require a
;rub (delete) character to provide a type of "forward backspace".  If
;you need this feature and your terminal does not have a rub (delete)
;key, or if inconvenient to use, then set RUB2BKSP to TRUE

;In the routine TERM:
	IF	RUB2BKSP
	ORG	1629H
	CPI     7FH	;RUB
	;	....
	ORG	1635H	
	MVI     B,08H	;BCKSPC
	ENDIF

	IF	NOT RUB2BKSP
	ORG	1629H
	CPI	08H
	;	....
	ORG	1635H
	MVI	B,7FH
	ENDIF

;     (The menu will still indicate you are changing rub to backspace,
;ignore this statment and realize just the opposite is happening with
;this change.)           - Irv Hoff


;-----------------------------------------------------------------------

;     There are two obscure bugs in the MDM730 program.  The first in-
;     volves the alternate long distance dialing system - occasionally
;     the last digit of the billing code would be entered twice, messing
;     up the correct dialing.  The second involves a problem existing
;     since the early MODEM7 days which has never been corrected.  When
;     copying to disk in the terminal mode, if the disk fills, the pro-
;     gram says it is saving as much of the copy as it can.  It then
;     closes the file - only it was closing the file normally used for
;     file transfers.  The following patch corrects both problems.  As
;     they only recently came to my attention, it is obvious the typical
;     user (including me) has never run into either problem.
;					    --	Irv Hoff

;	   THIS IS THE ALTERNATE LONG DISTANCE DIALING CHANGE
;	   FOR 'SPRINT', 'MCI', ETC. USERS.

;in the routine at DIALAD2	
	ORG	806H
	JZ	DIALAD3	;same but DIALAD3 has a new address

	ORG	0DC0H
BRIDGE:	CALL 	TYPE	;patch added at this empty location
	POP	H
	RET

;in DIALAD2
	ORG	819H
	JNZ	DIALAD2
	POP	H
	JMP	DIALEXIT
;
DIALAD3:MVI	A,' '
	MOV	B,A
	JMP	BRIDGE	;out of space here


;	  THIS IS THE CHANGE FOR "DISK-FULL WHEN IN ASCII
;	  CAPTURE MODE.  EVERYBODY NEEDS THIS ONE. 


	ORG	0DC5H
WRERR0:	CALL	CLOS3
	JMP	WREXIT	;WREXIT label is at the call to ERXIT
			;in the routine WRERR

;in the routine at WRTDSK2
	ORG	210CH
	JNZ	WRERR0	;instead of JNZ	WRERR

;in the routine at NOWRITE
	ORG	214EH
	CALL	CLOS3	;instead of CALL CLOSFIL.
			;CLOS3 label is at the line LXI D,FCB3
			;in the WRTFIL1 routine

;This patch fixes a bug found by Ron Fowler that causes the wrong
;file to be erased in the directory when overwriting existing files
;in batch mode.
;in the routine at CKCPM2
	ORG	2238H
	NOP			;These 2 bytes replace 'CPI  0FFH'
	INR	A

	;the
	END