Browse Source

XModem Port Specification

- You can now specify an HBIOS Character Unit number on the XM.COM command line.  Currently only available in XMX.COM.
- Add version check in CBIOS to warn user if CBIOS and HBIOS versions do not match.
pull/138/head
Wayne Warthen 6 years ago
parent
commit
717ce95500
  1. 79
      Source/Apps/XM/xmdm125.asm
  2. 20
      Source/Apps/XM/xmx.180
  3. 26
      Source/CBIOS/cbios.asm
  4. 18
      Source/CPM3/boot.z80

79
Source/Apps/XM/xmdm125.asm

@ -71,7 +71,7 @@ STX EQU 02H ; 'Start of header' for 1024 byte blocks
; Conditional equates - change to suit your system, then assemble
;
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
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
@ -758,7 +758,10 @@ RECVOPT:MVI A,'K' ; First off, default to 1K mode
CALL RCVOPC ; Check 4th (or 5th) option
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
MOV A,M ; Get option character HL points to
@ -790,7 +793,7 @@ CHK3RD: CPI 'X' ; Got an "X" for first option?
CHK4TH:
IF MBFMSG ; Allowing "RM" for message uploads?
CPI 'M' ; Got an "M" for message upload?
JNZ CHK5TH ; If not, bad option
JNZ CHK5TH ; Nope, try next
STA MSGFLG ; If "M", set MSGFLG
MVI A,'P' ; Also, set PRVTFL
STA PRVTFL
@ -804,11 +807,21 @@ CHK4TH:
CHK5TH:
IF NDESC ; Allowing "RN" to skip upload descript?
CPI 'N' ; Got an 'N'?
JNZ BADROP ; If nope, is NG..
JNZ CHK6TH ; Nope, try next
STA NDSCFL ; else set flag to skip descript phase
RET
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
JMP OPTERR ; is bad option
;
@ -817,9 +830,10 @@ BADROP: POP PSW ; Restore stack
;
ALLSET: CALL GETCHR
CALL GETCHR
LDA PORT ; [WBW] Pass serial port to driver
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
;
@ -920,7 +934,8 @@ SKSK2: CALL ILPRT
DB 'XMODEM L CAT.LBR CAT.COM send a file from a library'
DB 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 CR,LF
DB 'XMODEM RP HELLO.DOC receive in a private area'
@ -939,7 +954,8 @@ SKSK2: CALL ILPRT
;
IF NOT LUXMOD
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 ' "R" switches from CRC to checksum after 5 retries'
DB CR,LF,LF
@ -2214,13 +2230,13 @@ ILLDU: CALL ERXIT
RCVRECD:XRA A ; Initialize error count to zero
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?
CALL FUNCHK ; Yeah, why not?
@ -2233,7 +2249,7 @@ RCVRPT: IF CONFUN ; Check for function key?
ENDIF
;
;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
JC RCVSTOT ; Timeout
;
@ -2321,7 +2337,7 @@ DELFILE:LXI D,FCB ; Point to file
; Timed out on receive
;
;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.
;
; 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
MVI C,CAN ; Cancel
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
; to fix this.
; CALL RCVSABT ; Kill receive file
; CALL ERXIT ; Exit with msg:
; DB '++ Error writing file ++$'
; WBW: -----
; [WBW] -----
CALL ILPRT ; Dispaly error msg
DB CR,LF,'++ Error writing file ++',CR,LF,0
CALL RCVSABT ; Kill receive file
; WBW END
; [WBW] END
;
; Receive a character - timeout time is in 'B' in seconds. Entry via
@ -3481,11 +3497,11 @@ RECVDG: CALL GETCHR
CALL GETCHR
;
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
LDA CPUMHZ ; Get the clock speed
MOV E,A ; Put speed in E
;WBW END
; [WBW] END
XRA A ; Clear the 'A' reg.
;
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'
;
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
XCHG
LHLD RCVSCL ; Use scalar value from patch
XCHG
;WBW END
; [WBW] END
ENDIF
;
IF BYEBDOS
@ -3578,7 +3594,7 @@ CARCK2: LDA OPTSAV ; Get option
; Delay - 100 millisecond delay.
;
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
; Approx 1024 iter per 100ms per MHz
; 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
MOV B,A ; Use as high byte
MVI C,0 ; Zero low byte, BC now has MHz * 1024
; WBW END
; [WBW] END
DELAY2: DCX B ; Update count
MOV A,B ; Get MSP byte
ORA C ; Count = zero?
@ -3978,7 +3994,7 @@ INPUT: PUSH H ; Save current values
PUSH D
PUSH B
;
; WBW BEGIN: Use dynamic CPU speed
; [WBW] BEGIN: Use dynamic CPU speed
;INPUT1: LXI D,1200 ; Outer loop count (about 2 minutes)
;;
;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
MOV B,A ; Put in B
MVI C,0 ; Zero C, BC is now CPU MHz * 256, ~256ms
; WBW END
; [WBW] END
;
INPUT3: PUSH D ; Save the outer 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
TOTERR: DW 0 ; Total errors for transmission attempt
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)
EOFCTR: DB 0 ; EOF send counter
@ -5697,7 +5714,7 @@ OLINE: DS 80 ; Temporary buffer to store line
;
DBUF EQU $ ; 16-record disk buffer
;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
;
;-----------------------------------------------------------------------

20
Source/Apps/XM/xmx.180

@ -52,6 +52,8 @@ CONOUT EQU 0 ; not used
; entries as appropriate.
;
MINIT:
LD (UNIT),A ; Save port specified
; Announce
LD DE,TAG ; Tagline
LD C,9 ; BDOS string display function
@ -88,6 +90,10 @@ MINIT_HB:
JP NZ,APIERR ; handle API error
LD A,D ; BIOS bank id to A
LD (BIOSBID),A ; save it
;
LD A,(UNIT) ; get current unit specified
CP 0FFH ; check for undefined
JR NZ,MINIT_HB1 ; if not undefined, go ahead
;
; Lookup current console to use as default for transfer
LD B,0FAH ; HBIOS PEEK
@ -96,16 +102,18 @@ MINIT_HB:
LD HL,100H + 12H ; HCB console unit address
RST 08 ; E := value
LD A,E ; put in A
LD (UNIT),A ; save it
LD (UNIT),A ; replace UNIT with console UNIT
;
; Get HBIOS character 0 device type
LD B,006H ; HBIOS DEVICE function 0x06
LD C,000H ; HBIOS char 0 device
MINIT_HB1:
; Get HBIOS device type
LD B,06H ; HBIOS DEVICE function 0x06
LD A,(UNIT) ; Get xfer unit
LD C,A ; Put in C
RST 08 ; Do it, D=device type
LD A,D ; Put result in A
CP 000H ; UART?
CP 00H ; UART?
JP Z,UA_INIT ; If so, do UART H/W init
CP 080H ; USB-FIFO?
CP 80H ; USB-FIFO?
JP Z,UF_INIT ; If so, do USB-FIFO H/W init
JP HB_INIT ; Otherwise, use BIOS I/O
;

26
Source/CBIOS/cbios.asm

@ -2091,6 +2091,26 @@ INIT:
LD DE,STR_BANNER ; POINT TO BANNER
CALL WRITESTR ; DISPLAY IT
#IFDEF PLTWBW
; CHECK FPR HBIOS/CBIOS VERSION MISMATCH
LD B,BF_SYSVER ; HBIOS VERSION
RST 08 ; DO IT, DE=MAJ/MIN/UP/PAT
LD A,D ; A := MAJ/MIN
CP ((RMJ << 4) | RMN) ; MATCH?
JR NZ,INIT1 ; HANDLE VER MISMATCH
LD A,E ; A := OS UP/PAT
AND $F0 ; PAT NOT INCLUDED IN MATCH
CP (RUP << 4) ; MATCH?
JR NZ,INIT1 ; HANDLE VER MISMATCH
JR INIT2 ; ALL GOOD, CONTINUE
INIT1:
; DISPLAY VERSION MISMATCH
CALL NEWLINE2 ; FORMATTING
LD DE,STR_VERMIS ; VERSION MISMATCH
CALL WRITESTR ; DISPLAY IT
INIT2:
#ENDIF
;
#IFDEF PLTUNA
; SAVE COMMAND PROCESSOR IMAGE TO MALLOCED CACHE IN UNA BIOS PAGE
LD C,$F7 ; UNA MALLOC
@ -2172,9 +2192,9 @@ INIT:
LD DE,STR_CPM ; DEFAULT TO CP/M LABEL
LD A,(BDOS_LOC) ; GET FIRST BYTE OF BDOS
CP 'Z' ; IS IT A 'Z' (FOR ZSDOS)?
JR NZ,INIT2 ; NOPE, CP/M IS RIGHT
JR NZ,INIT3 ; NOPE, CP/M IS RIGHT
LD DE,STR_ZSDOS ; SWITCH TO ZSDOS LABEL
INIT2:
INIT3:
CALL WRITESTR ; DISPLAY OS LABEL
LD DE,STR_TPA1 ; TPA PREFIX
CALL WRITESTR
@ -2186,6 +2206,7 @@ INIT2:
LD DE,STR_TPA2 ; AND TPA SUFFIX
CALL WRITESTR
CALL NEWLINE ; FORMATTING
;
RET ; DONE
;
;
@ -3215,6 +3236,7 @@ STR_LDR .DB "\r\n $"
STR_DPHINIT .DB "Configuring Drives...$"
STR_HEAPOVF .DB " *** Insufficient Memory ***$"
STR_INVMED .DB " *** Invalid Device ID ***$"
STR_VERMIS .DB 7,"*** WARNING: HBIOS/CBIOS Version Mismatch ***$"
STR_MEMFREE .DB " Disk Buffer Bytes Free$"
STR_CPM .DB "CP/M-80 v2.2$"
STR_ZSDOS .DB "ZSDOS v1.1$"

18
Source/CPM3/boot.z80

@ -62,6 +62,23 @@ init$2:
ld hl,signon$msg ; signon message
call ?pmsg ; print it
; Check for HBIOS/CBIOS mismatch
ld b,0F1h ; hbios version
rst 08 ; do it, de=maj/min/up/pat
ld a,d ; a := maj/min
cp ((rmj << 4) | rmn) ; match?
jr nz,init$3 ; handle ver mismatch
ld a,e ; a := os up/pat
and 0F0h ; pat not included in match
cp (rup << 4) ; match?
jr nz,init$3 ; handle ver mismatch
jr init$4 ; all good, continue
init$3:
; display version mismatch
ld hl,vermis$msg ; version mismatch
call ?pmsg ; display it
init$4:
; Get boot disk unit and save it
ld bc,0F8E0h ; HBIOS func: get boot info
rst 08 ; do it, D := boot unit, E: := boot slice
@ -674,6 +691,7 @@ read:
clrflg db 0 ; RAM disk cleared flag
clr$msg db 'RAM Disk Initialized',13,10,13,10,0
vermis$msg db 7,'*** WARNING: HBIOS/CBIOS Version Mismatch ***',13,10,13,10,0
if zpm

Loading…
Cancel
Save