@ -71,7 +71,7 @@ STX EQU 02H ; 'Start of header' for 1024 byte blocks
; Conditional equates - change to suit your system, then assemble
; Conditional equates - change to suit your system, then assemble
;
;
MHZ EQU 10 ; Clock speed, use integer (2,4,5,8, etc.)
MHZ EQU 10 ; Clock speed, use integer (2,4,5,8, etc.)
SCL EQU 6600 ; WBW: Receive loop timeout scalar
SCL EQU 6600 ; [WBW] Receive loop timeout scalar
CPM3 EQU NO ; Yes, if operating in CP/M v3.0 environment
CPM3 EQU NO ; Yes, if operating in CP/M v3.0 environment
STOPBIT EQU NO ; No, if using 1 stop bit, yes if using 2
STOPBIT EQU NO ; No, if using 1 stop bit, yes if using 2
BYEBDOS EQU NO ; Yes, if using BYE338-up, BYE501-up, or NUBYE
BYEBDOS EQU NO ; Yes, if using BYE338-up, BYE501-up, or NUBYE
@ -758,7 +758,10 @@ RECVOPT:MVI A,'K' ; First off, default to 1K mode
CALL RCVOPC ; Check 4th (or 5th) option
CALL RCVOPC ; Check 4th (or 5th) option
ENDIF
ENDIF
;
;
JMP OPTERR ; If 5th or 6th option, whoops!
; [WBW] Added to support port number
CALL RCVOPC ; Check 5th (or 6th) option
;
JMP OPTERR ; If 7th or 8th option, whoops!
;
;
RCVOPC: INX H ; Increment pointer to next character
RCVOPC: INX H ; Increment pointer to next character
MOV A , M ; Get option character HL points to
MOV A , M ; Get option character HL points to
@ -790,7 +793,7 @@ CHK3RD: CPI 'X' ; Got an "X" for first option?
CHK4TH:
CHK4TH:
IF MBFMSG ; Allowing "RM" for message uploads?
IF MBFMSG ; Allowing "RM" for message uploads?
CPI 'M' ; Got an "M" for message upload?
CPI 'M' ; Got an "M" for message upload?
JNZ CH K5TH ; If not, bad option
JNZ CH K5TH ; Nope, try next
STA MSGFLG ; If "M", set MSGFLG
STA MSGFLG ; If "M", set MSGFLG
MVI A , 'P' ; Also, set PRVTFL
MVI A , 'P' ; Also, set PRVTFL
STA PRVTFL
STA PRVTFL
@ -804,11 +807,21 @@ CHK4TH:
CHK5TH:
CHK5TH:
IF NDESC ; Allowing "RN" to skip upload descript?
IF NDESC ; Allowing "RN" to skip upload descript?
CPI 'N' ; Got an 'N'?
CPI 'N' ; Got an 'N'?
JNZ BADROP ; If nope, is NG..
JNZ CH K6TH ; Nope, try next
STA NDSCFL ; else set flag to skip descript phase
STA NDSCFL ; else set flag to skip descript phase
RET
RET
ENDIF
ENDIF
;
;
CHK6TH:
; [WBW] Get target serial port (0-9 supported)
CPI '0'
JC BADROP ; If < 0, out of range
CPI '9' + 1
JNC BADROP ; If > 9, out of range
SUI '0' ; Make binary
STA PORT
RET
;
BADROP: POP PSW ; Restore stack
BADROP: POP PSW ; Restore stack
JMP OPTERR ; is bad option
JMP OPTERR ; is bad option
;
;
@ -817,9 +830,10 @@ BADROP: POP PSW ; Restore stack
;
;
ALLSET: CALL GETCHR
ALLSET: CALL GETCHR
CALL GETCHR
CALL GETCHR
LDA PORT ; [WBW] Pass serial port to driver
CALL MINIT
CALL MINIT
STA CPUMHZ ; WBW: Save CPU speed from MINIT
SHLD RCVSCL ; WBW: Save rcv loop scalar from MINIT
STA CPUMHZ ; [WBW] Save CPU speed from MINIT
SHLD RCVSCL ; [WBW] Save rcv loop scalar from MINIT
;
;
; Jump to appropriate function
; Jump to appropriate function
;
;
@ -920,7 +934,8 @@ SKSK2: CALL ILPRT
DB 'XMODEM L CAT.LBR CAT.COM send a file from a library'
DB 'XMODEM L CAT.LBR CAT.COM send a file from a library'
DB CR , LF
DB CR , LF
DB 'XMODEM LK CAT.LBR CAT.COM send in 1k blocks' , CR , LF
DB 'XMODEM LK CAT.LBR CAT.COM send in 1k blocks' , CR , LF
DB ' The ".LBR" file extension may be omitted' , CR , LF , LF
DB ' The ".LBR" file extension may be omitted' , CR , LF
DB ' Add "0"-"9" to specify serial port' , CR , LF , LF
DB 'XMODEM R HELLO.DOC receive a file from you'
DB 'XMODEM R HELLO.DOC receive a file from you'
DB CR , LF
DB CR , LF
DB 'XMODEM RP HELLO.DOC receive in a private area'
DB 'XMODEM RP HELLO.DOC receive in a private area'
@ -939,7 +954,8 @@ SKSK2: CALL ILPRT
;
;
IF NOT LUXMOD
IF NOT LUXMOD
DB ' Add "C" for forced checksum ("RC" "RPC")' , CR , LF
DB ' Add "C" for forced checksum ("RC" "RPC")' , CR , LF
DB ' Add "X" for forced 128 byte protocol ("RX" "RPX")'
DB ' Add "X" for forced 128 byte protocol ("RX" "RPX")' , CR , LF
DB ' Add "0"-"9" to specify serial port'
DB CR , LF
DB CR , LF
DB ' "R" switches from CRC to checksum after 5 retries'
DB ' "R" switches from CRC to checksum after 5 retries'
DB CR , LF , LF
DB CR , LF , LF
@ -2214,13 +2230,13 @@ ILLDU: CALL ERXIT
RCVRECD: XRA A ; Initialize error count to zero
RCVRECD: XRA A ; Initialize error count to zero
STA ERRCT
STA ERRCT
;
;
;WBW BEGIN: Be more patient waiting for host to start sending file
LDA FRSTIM ; WBW: Get first time flag
ORA A ; WBW: Set CPU flags
JNZ RCVRPT ; WBW: If not first time, bypass
MVI A , - 10 ; WBW: Else increase error limit
STA ERRCT ; WBW: Save error new limit
;WBW END
; [ WBW] BEGIN: Be more patient waiting for host to start sending file
LDA FRSTIM ; Get first time flag
ORA A ; Set CPU flags
JNZ RCVRPT ; If not first time, bypass
MVI A , - 10 ; Else increase error limit
STA ERRCT ; Save error new limit
; [ WBW] END
;
;
RCVRPT: IF CONFUN ; Check for function key?
RCVRPT: IF CONFUN ; Check for function key?
CALL FUNCHK ; Yeah, why not?
CALL FUNCHK ; Yeah, why not?
@ -2233,7 +2249,7 @@ RCVRPT: IF CONFUN ; Check for function key?
ENDIF
ENDIF
;
;
;MVI B,10-1 ; 10-second timeout
;MVI B,10-1 ; 10-second timeout
MVI B , 5 - 1 ; WBW: 5-second timeout
MVI B , 5 - 1 ; [WBW] 5-second timeout
CALL RECV ; Get any character received
CALL RECV ; Get any character received
JC RCVSTOT ; Timeout
JC RCVSTOT ; Timeout
;
;
@ -2321,7 +2337,7 @@ DELFILE:LXI D,FCB ; Point to file
; Timed out on receive
; Timed out on receive
;
;
;RCVSTOT:JMP RCVSERR ; Bump error count, etc.
;RCVSTOT:JMP RCVSERR ; Bump error count, etc.
; WBW: Bypass line flush if error is timeout
; [WBW] Bypass line flush if error is timeout
RCVSTOT: JMP RCVSER1 ; Bump error count, etc.
RCVSTOT: JMP RCVSER1 ; Bump error count, etc.
;
;
; Got SOH or STX - get block number, block number complemented
; Got SOH or STX - get block number, block number complemented
@ -3459,17 +3475,17 @@ RSDMA: LXI D,TBUF ; Reset DMA address
WRERR: CALL RSDMA ; Reset DMA to normal
WRERR: CALL RSDMA ; Reset DMA to normal
MVI C , CAN ; Cancel
MVI C , CAN ; Cancel
CALL SEND ; Sender
CALL SEND ; Sender
; WBW BEGIN: RCVSABT does not return, so file write error
; [ WBW] BEGIN: RCVSABT does not return, so file write error
; message was never being displayed. Swapped things around
; message was never being displayed. Swapped things around
; to fix this.
; to fix this.
; CALL RCVSABT ; Kill receive file
; CALL RCVSABT ; Kill receive file
; CALL ERXIT ; Exit with msg:
; CALL ERXIT ; Exit with msg:
; DB '++ Error writing file ++$'
; DB '++ Error writing file ++$'
; WBW: -----
; [WBW] -----
CALL ILPRT ; Dispaly error msg
CALL ILPRT ; Dispaly error msg
DB CR , LF , '++ Error writing file ++' , CR , LF , 0
DB CR , LF , '++ Error writing file ++' , CR , LF , 0
CALL RCVSABT ; Kill receive file
CALL RCVSABT ; Kill receive file
; WBW END
; [ WBW] END
;
;
; Receive a character - timeout time is in 'B' in seconds. Entry via
; Receive a character - timeout time is in 'B' in seconds. Entry via
@ -3481,11 +3497,11 @@ RECVDG: CALL GETCHR
CALL GETCHR
CALL GETCHR
;
;
RECV: PUSH D ; Save 'DE' regs.
RECV: PUSH D ; Save 'DE' regs.
;WBW BEGIN: Use dynamic CPU speed
; [ WBW] BEGIN: Use dynamic CPU speed
; MVI E,MHZ ; Get the clock speed
; MVI E,MHZ ; Get the clock speed
LDA CPUMHZ ; Get the clock speed
LDA CPUMHZ ; Get the clock speed
MOV E , A ; Put speed in E
MOV E , A ; Put speed in E
;WBW END
; [ WBW] END
XRA A ; Clear the 'A' reg.
XRA A ; Clear the 'A' reg.
;
;
MSLOOP: ADD B ; Number of seconds
MSLOOP: ADD B ; Number of seconds
@ -3494,12 +3510,12 @@ MSLOOP: ADD B ; Number of seconds
MOV B , A ; Put total value back into 'B'
MOV B , A ; Put total value back into 'B'
;
;
MSEC: IF NOT BYEBDOS
MSEC: IF NOT BYEBDOS
;WBW BEGIN: Use scalar passed in by patch
; [ WBW] BEGIN: Use scalar passed in by patch
;LXI D,6600 ; 1 second DCR count
;LXI D,6600 ; 1 second DCR count
XCHG
XCHG
LHLD RCVSCL ; Use scalar value from patch
LHLD RCVSCL ; Use scalar value from patch
XCHG
XCHG
;WBW END
; [ WBW] END
ENDIF
ENDIF
;
;
IF BYEBDOS
IF BYEBDOS
@ -3578,7 +3594,7 @@ CARCK2: LDA OPTSAV ; Get option
; Delay - 100 millisecond delay.
; Delay - 100 millisecond delay.
;
;
DELAY: PUSH B ; Save 'BC'
DELAY: PUSH B ; Save 'BC'
; WBW BEGIN: Use dynamic CPU speed
; [ WBW] BEGIN: Use dynamic CPU speed
; Loop below is 105TS on Z80 and 96TS on Z180
; Loop below is 105TS on Z80 and 96TS on Z180
; Approx 1024 iter per 100ms per MHz
; Approx 1024 iter per 100ms per MHz
; Loop time below extended to accommodate CPU speeds up to 64MHz
; Loop time below extended to accommodate CPU speeds up to 64MHz
@ -3589,7 +3605,7 @@ DELAY: PUSH B ; Save 'BC'
RLC ; * 2, A now has MHz * 4
RLC ; * 2, A now has MHz * 4
MOV B , A ; Use as high byte
MOV B , A ; Use as high byte
MVI C , 0 ; Zero low byte, BC now has MHz * 1024
MVI C , 0 ; Zero low byte, BC now has MHz * 1024
; WBW END
; [ WBW] END
DELAY2: DCX B ; Update count
DELAY2: DCX B ; Update count
MOV A , B ; Get MSP byte
MOV A , B ; Get MSP byte
ORA C ; Count = zero?
ORA C ; Count = zero?
@ -3978,7 +3994,7 @@ INPUT: PUSH H ; Save current values
PUSH D
PUSH D
PUSH B
PUSH B
;
;
; WBW BEGIN: Use dynamic CPU speed
; [ WBW] BEGIN: Use dynamic CPU speed
;INPUT1: LXI D,1200 ; Outer loop count (about 2 minutes)
;INPUT1: LXI D,1200 ; Outer loop count (about 2 minutes)
;;
;;
;INPUT2: LXI B,MHZ*100 ; Roughly 100 ms.
;INPUT2: LXI B,MHZ*100 ; Roughly 100 ms.
@ -3987,7 +4003,7 @@ INPUT1: LXI D,468 ; Outer loop count (about 2 minutes)
INPUT2: LDA CPUMHZ ; CPU MHz to A
INPUT2: LDA CPUMHZ ; CPU MHz to A
MOV B , A ; Put in B
MOV B , A ; Put in B
MVI C , 0 ; Zero C, BC is now CPU MHz * 256, ~256ms
MVI C , 0 ; Zero C, BC is now CPU MHz * 256, ~256ms
; WBW END
; [ WBW] END
;
;
INPUT3: PUSH D ; Save the outer delay count
INPUT3: PUSH D ; Save the outer delay count
PUSH B ; Save the inner delay count
PUSH B ; Save the inner delay count
@ -5666,8 +5682,9 @@ MSGFLG: DB 0 ; Message upload flag
SAVEHL: DW 0 ; Saves TBUF command line address
SAVEHL: DW 0 ; Saves TBUF command line address
TOTERR: DW 0 ; Total errors for transmission attempt
TOTERR: DW 0 ; Total errors for transmission attempt
VRECNO: DW 0 ; Virtual record # in 128 byte records
VRECNO: DW 0 ; Virtual record # in 128 byte records
CPUMHZ: DB MHZ ; WBW: CPU speed in MHz
RCVSCL: DW SCL ; WBW: Recv loop scalar
CPUMHZ: DB MHZ ; [WBW] CPU speed in MHz
RCVSCL: DW SCL ; [WBW] Recv loop scalar
PORT: DB 0FFH ; [WBW] Target serial port, FFH=not specified
;
;
EOFLG: DB 0 ; 'EOF' flag (1=yes)
EOFLG: DB 0 ; 'EOF' flag (1=yes)
EOFCTR: DB 0 ; EOF send counter
EOFCTR: DB 0 ; EOF send counter
@ -5697,7 +5714,7 @@ OLINE: DS 80 ; Temporary buffer to store line
;
;
DBUF EQU $ ; 16-record disk buffer
DBUF EQU $ ; 16-record disk buffer
;STACK EQU DBUF-2 ; Save original stack address
;STACK EQU DBUF-2 ; Save original stack address
STACK EQU 0B000H ; WBW
STACK EQU 0B000H ; [ WBW] Above 8000h for HBIOS Fastpath
LOGBUF EQU DBUF + 128 ; For use with LOGCAL
LOGBUF EQU DBUF + 128 ; For use with LOGCAL
;
;
;-----------------------------------------------------------------------
;-----------------------------------------------------------------------