mirror of
https://github.com/wwarthen/RomWBW.git
synced 2026-02-06 22:43:15 -06:00
XModem Improvements
New **experimental** adaptation of XModem called XMX.COM: - Fixes occasional "stall" at startup (I think) - Reduces HBIOS overhead substantially - Automatically uses the console port no matter what COM port the console is on
This commit is contained in:
@@ -10,13 +10,21 @@ set ZXLIBDIR=%TOOLS%\cpm\lib\
|
||||
set ZXINCDIR=%TOOLS%\cpm\include\
|
||||
|
||||
zx mac xmdm125.asm $PO
|
||||
|
||||
zx slr180 -xmhb/HF
|
||||
rem zx slr180 -xmuf/HF
|
||||
zx mload25 XM=xmdm125,xmhb
|
||||
|
||||
rem zx slr180 -xmuf/HF
|
||||
rem zx mload25 XMUF=xmdm125,xmuf
|
||||
|
||||
zx slr180 -xmx/HF
|
||||
zx mload25 XMX=xmdm125,xmx
|
||||
|
||||
rem set PROMPT=[Build] %PROMPT%
|
||||
rem %comspec%
|
||||
|
||||
copy /Y XM.com ..\..\..\Binary\Apps\
|
||||
rem copy /Y XMUF.com ..\..\..\Binary\Apps\
|
||||
copy /Y XMX.com ..\..\..\Binary\Apps\
|
||||
|
||||
rem pause
|
||||
@@ -1,5 +1,5 @@
|
||||
#OBJECTS = xm.com xmuf.com
|
||||
OBJECTS = xm.com
|
||||
OBJECTS = xm.com xmx.com
|
||||
#OBJECTS += xmuf.com
|
||||
DEST = ../../../Binary/Apps
|
||||
TOOLS = ../../../Tools
|
||||
OTHERS = *.hex
|
||||
@@ -9,5 +9,8 @@ include $(TOOLS)/Makefile.inc
|
||||
xm.com: xmdm125.hex xmhb.hex
|
||||
$(ZXCC) $(CPM)/MLOAD25 XM=xmdm125,xmhb
|
||||
|
||||
#xmuf.com: xmdm125.hex xmuf.hex
|
||||
# $(ZXCC) $(CPM)/MLOAD25 XMUF=xmdm125,xmuf
|
||||
xmuf.com: xmdm125.hex xmuf.hex
|
||||
$(ZXCC) $(CPM)/MLOAD25 XMUF=xmdm125,xmuf
|
||||
|
||||
xmx.com: xmdm125.hex xmx.hex
|
||||
$(ZXCC) $(CPM)/MLOAD25 XMX=xmdm125,xmx
|
||||
|
||||
@@ -2259,7 +2259,7 @@ RCVRPTB:CPI SOH ; 'SOH' for a 128-byte block?
|
||||
RCVSERR:MVI B,1 ; Wait for 1 second
|
||||
CALL RECV ; After last char. received
|
||||
JNC RCVSERR ; Loop until sender done
|
||||
LDA FRSTIM ; Is it the first time?
|
||||
RCVSER1:LDA FRSTIM ; Is it the first time?
|
||||
ORA A
|
||||
MVI A,NAK
|
||||
JNZ RCVSER2 ; If not first time, send NAK
|
||||
@@ -2320,7 +2320,9 @@ DELFILE:LXI D,FCB ; Point to file
|
||||
;
|
||||
; 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
|
||||
RCVSTOT:JMP RCVSER1 ; Bump error count, etc.
|
||||
;
|
||||
; Got SOH or STX - get block number, block number complemented
|
||||
;
|
||||
@@ -5694,7 +5696,8 @@ OLINE: DS 80 ; Temporary buffer to store line
|
||||
ORG ($+127)/128*128
|
||||
;
|
||||
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
|
||||
LOGBUF EQU DBUF+128 ; For use with LOGCAL
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
|
||||
570
Source/Apps/XM/xmx.180
Normal file
570
Source/Apps/XM/xmx.180
Normal file
@@ -0,0 +1,570 @@
|
||||
;=======================================================================
|
||||
;
|
||||
; XMHB.Z80 - XMODEM12 PATCH FILE FOR ROMWBW HBIOS
|
||||
;
|
||||
; Wayne Warthen - wwarthen@gmail.com
|
||||
;
|
||||
; 2020-05-23 WBW Rewrite for HBIOS FastPath(tm)
|
||||
;
|
||||
;=======================================================================
|
||||
;
|
||||
ASEG
|
||||
;
|
||||
BASE EQU 100H ; Start of CP/M normal program area
|
||||
;
|
||||
BDOS EQU 0005H ; BDOS function dispatch vector
|
||||
;
|
||||
;=======================================================================
|
||||
;
|
||||
; Jump table: The jump table must be in exactly the same sequence as the
|
||||
; one in XMODEM. Note the ORG of 103H - This jump table has no jump to
|
||||
; 'BEGIN'.
|
||||
;
|
||||
ORG BASE + 3 ; start after 'JMP BEGIN'
|
||||
;
|
||||
JP CONOUT ; must be 00000h if not used, see below
|
||||
JP MINIT ; initialization routine (if needed)
|
||||
JP UNINIT ; undo whatever 'MINIT' did (or return)
|
||||
JPTBL:
|
||||
JP SENDR ; send character (via pop psw)
|
||||
JP CAROK ; test for carrier
|
||||
JP MDIN ; receive data byte
|
||||
JP GETCHR ; get character from modem
|
||||
JP RCVRDY ; check receive ready
|
||||
JP SNDRDY ; check send ready
|
||||
JP SPEED ; get speed value for file transfer time
|
||||
JP EXTRA1 ; extra for custom routine
|
||||
JP EXTRA2 ; extra for custom routine
|
||||
JP EXTRA3 ; extra for custom routine
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Output character to console
|
||||
;
|
||||
CONOUT EQU 0 ; not used
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Initialize modem
|
||||
;
|
||||
; This procedure has been usurped to dynamically detect the type
|
||||
; of system we are running on and install the *real* jump table
|
||||
; entries as appropriate.
|
||||
;
|
||||
MINIT:
|
||||
; Announce
|
||||
LD DE,TAG ; Tagline
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Identify BIOS (RomWBW HBIOS or UNA UBIOS)
|
||||
CALL IDBIO ; 1=HBIOS, 2=UBIOS
|
||||
LD (BIOID),A ; Save it
|
||||
DEC A ; Test for HBIOS
|
||||
JR Z,HINIT ; Do HBIOS setup
|
||||
DEC A ; Test for UBIOS
|
||||
JR Z,UINIT ; Do UBIOS setup
|
||||
;
|
||||
; Neither UNA nor RomWBW
|
||||
LD DE,ERR_BIO ; BIOS error message
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
JP 0 ; Bail out!
|
||||
;
|
||||
MINIT_RET:
|
||||
PUSH HL ; Save HL (JP table adr)
|
||||
|
||||
; Display port notification string
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Declare experimental
|
||||
LD DE,EXP_LBL ; Declare experimental
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Newline
|
||||
LD C,9 ; BDOS string display function
|
||||
LD DE,CRLF ; Newline
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Copy real vectors into active jump table
|
||||
POP HL ; Recover HL
|
||||
LD DE,JPTBL ; Real jump table is destination
|
||||
LD BC,7 * 3 ; Copy 7 3-byte entries
|
||||
LDIR ; Do the copy
|
||||
;
|
||||
; Return with CPU speed in A
|
||||
LD A,(CPUSPD) ; A := CPU speed in MHz
|
||||
LD HL,(RCVSCL) ; HL := receive scalar
|
||||
RET ; and return
|
||||
;
|
||||
HINIT:
|
||||
; Display RomWBW notification string
|
||||
LD DE,HBTAG ; BIOS notification string
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Get CPU speed from RomWBW HBIOS and save it
|
||||
LD B,0F8H ; HBIOS SYSGET function 0xF8
|
||||
LD C,0F0H ; CPUINFO subfunction 0xF0
|
||||
RST 08 ; Do it, L := CPU speed in MHz
|
||||
LD A,L ; Move it to A
|
||||
LD (CPUSPD),A ; Save it
|
||||
;
|
||||
JP H_INIT ; Otherwise, use HBIOS I/O
|
||||
;
|
||||
UINIT:
|
||||
; Display UNA notification string
|
||||
LD DE,UBTAG ; BIOS notification string
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
;
|
||||
; Get CPU speed from UNA and save it
|
||||
LD C,0F8H ; UNA BIOS Get PHI function
|
||||
RST 08 ; Returns speed in Hz in DE:HL
|
||||
LD B,4 ; Divide MHz in DE:HL by 100000H
|
||||
UINIT1:
|
||||
SRL D ; ... to get approx CPU speed in
|
||||
RR E ; ...MHz. Throw away HL, and
|
||||
DJNZ UINIT1 ; ...right shift DE by 4.
|
||||
INC E ; Fix up for value truncation
|
||||
LD A,E ; Put in A
|
||||
LD (CPUSPD),A ; Save it
|
||||
;
|
||||
JP U_INIT ; UNA BIOS init
|
||||
;
|
||||
HWERR:
|
||||
; Failed to identify target comm hardware
|
||||
LD DE,ERR_HW ; Hardware error message
|
||||
LD C,9 ; BDOS string display function
|
||||
CALL BDOS ; Do it
|
||||
JP 0 ; Bail out!
|
||||
;
|
||||
; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0
|
||||
;
|
||||
IDBIO:
|
||||
;
|
||||
; Check for UNA (UBIOS)
|
||||
LD A,(0FFFDH) ; fixed location of UNA API vector
|
||||
CP 0C3H ; jp instruction?
|
||||
JR NZ,IDBIO1 ; if not, not UNA
|
||||
LD HL,(0FFFEH) ; get jp address
|
||||
LD A,(HL) ; get byte at target address
|
||||
CP 0FDH ; first byte of UNA push ix instruction
|
||||
JR NZ,IDBIO1 ; if not, not UNA
|
||||
INC HL ; point to next byte
|
||||
LD A,(HL) ; get next byte
|
||||
CP 0E5H ; second byte of UNA push ix instruction
|
||||
JR NZ,IDBIO1 ; if not, not UNA, check others
|
||||
LD A,2 ; UNA BIOS id = 2
|
||||
RET ; and done
|
||||
;
|
||||
IDBIO1:
|
||||
; Check for RomWBW (HBIOS)
|
||||
LD HL,(0FFFEH) ; HL := HBIOS ident location
|
||||
LD A,'W' ; First byte of ident
|
||||
CP (HL) ; Compare
|
||||
JR NZ,IDBIO2 ; Not HBIOS
|
||||
INC HL ; Next byte of ident
|
||||
LD A,~'W' ; Second byte of ident
|
||||
CP (HL) ; Compare
|
||||
JR NZ,IDBIO2 ; Not HBIOS
|
||||
LD A,1 ; HBIOS BIOS id = 1
|
||||
RET ; and done
|
||||
;
|
||||
IDBIO2:
|
||||
; No idea what this is
|
||||
XOR A ; Setup return value of 0
|
||||
RET ; and done
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Uninitialize modem
|
||||
;
|
||||
UNINIT:
|
||||
LD A,(BIOID)
|
||||
CP 1 ; Is HBIOS?
|
||||
JR Z,H_UNINIT ; Handle HBIOS
|
||||
CP 2 ; Is UBIOS?
|
||||
JR Z,U_UNINIT ; Handle UBIOS
|
||||
RET ; Just return
|
||||
;
|
||||
H_UNINIT:
|
||||
; HBIOS: Reset character device 0
|
||||
LD B,04H ; HBIOS CIOINIT function 0x04
|
||||
LD C,80H ; Unit = 80 (console)
|
||||
LD DE,-1 ; Reset w/ current settings
|
||||
RST 08 ; Do it
|
||||
RET ; not initialized, so no 'UN-INITIALIZE'
|
||||
;
|
||||
U_UNINIT:
|
||||
; UBIOS: Reset character device 0
|
||||
LD C,10H ; UNA INIT function 0x10
|
||||
LD B,0 ; Unit = 0
|
||||
LD DE,-1 ; Reset w/ current settings
|
||||
RST 08 ; Do it
|
||||
RET ; not initialized, so no 'UN-INITIALIZE'
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; The following are all dummy routines that are unused because MINIT
|
||||
; dynamically installs the real jump table.
|
||||
;
|
||||
SENDR:
|
||||
CAROK:
|
||||
MDIN:
|
||||
GETCHR:
|
||||
RCVRDY:
|
||||
SNDRDY:
|
||||
SPEED:
|
||||
EXTRA1:
|
||||
EXTRA2:
|
||||
EXTRA3:
|
||||
RET
|
||||
;
|
||||
BIOID DB 0 ; BIOS ID, 1=HBIOS, 2=UBIOS
|
||||
CPUSPD DB 10 ; CPU speed in MHz
|
||||
RCVSCL DW 6600 ; RECV loop timeout scalar
|
||||
;
|
||||
TAG DB "RomWBW, 23-May-2020$"
|
||||
;
|
||||
COM_LBL DB ", HBIOS FastPath on COM?:$"
|
||||
EXP_LBL DB 13, 10, 13, 10, "*** Experimental ***$"
|
||||
;
|
||||
UBTAG DB " [UNA]$"
|
||||
HBTAG DB " [WBW]$"
|
||||
;
|
||||
CRLF DB 13, 10, "$"
|
||||
;
|
||||
ERR_BIO DB 13, 10, 13, 10, "++ Unknown BIOS ++", 13, 10, "$"
|
||||
ERR_HW DB 13, 10, 13, 10, "++ Unknown Hardware ++", 13, 10, "$"
|
||||
;
|
||||
;=======================================================================
|
||||
;=======================================================================
|
||||
;
|
||||
; RomWBW HBIOS Interface
|
||||
;
|
||||
;=======================================================================
|
||||
;=======================================================================
|
||||
;
|
||||
; Following jump table is dynamically patched over initial jump
|
||||
; table at program startup. See MINIT above. Note that only a
|
||||
; subset of the jump table is overlaid (SENDR to SPEED).
|
||||
;
|
||||
H_JPTBL:
|
||||
JP H_SENDR ; send character (via pop psw)
|
||||
JP H_CAROK ; test for carrier
|
||||
JP H_MDIN ; receive data byte
|
||||
JP H_GETCHR ; get character from modem
|
||||
JP H_RCVRDY ; check receive ready
|
||||
JP H_SNDRDY ; check send ready
|
||||
JP H_SPEED ; get speed value for file transfer time
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; HBIOS initialization
|
||||
;
|
||||
H_INIT:
|
||||
LD HL,2150 ; Smaller receive loop timeout scalar
|
||||
LD (RCVSCL),HL ; ... to compensate for BIOS overhead
|
||||
;
|
||||
; Get HBIOS bank id
|
||||
LD BC,0F8F2H ; HBIOS SYSGET, Bank Info
|
||||
RST 08 ; do it
|
||||
LD A,D ; BIOS bank id to A
|
||||
LD (H_BNKID),A ; save it
|
||||
;
|
||||
; Patch SENDR w/ FastPath addresses
|
||||
LD BC,0F801H ; Get CIO func/data adr
|
||||
LD D,01H ; Func=CIO OUT
|
||||
LD A,(H_UNIT) ; get desired char unit
|
||||
LD E,A ; and put in E
|
||||
RST 08
|
||||
; handle error?
|
||||
LD (H_SCDAT),DE ; Plug in data adr
|
||||
LD (H_SCFN),HL ; Plug in func adr
|
||||
;
|
||||
; Patch GETCHR/MDIN w/ FastPath addresses
|
||||
LD BC,0F801H ; Get CIO func/data adr
|
||||
LD D,00H ; Func=CIO IN
|
||||
LD A,(H_UNIT) ; get desired char unit
|
||||
LD E,A ; and put in E
|
||||
RST 08
|
||||
; handle error?
|
||||
LD (H_GCDAT),DE ; Plug in data adr
|
||||
LD (H_GCFN),HL ; Plug in func adr
|
||||
;
|
||||
; Patch RCVRDY w/ FastPath addresses
|
||||
LD BC,0F801H ; Get CIO func/data adr
|
||||
LD D,02H ; Func=CIO IST
|
||||
LD A,(H_UNIT) ; get desired char unit
|
||||
LD E,A ; and put in E
|
||||
RST 08
|
||||
; handle error?
|
||||
LD (H_RRDAT),DE ; Plug in data adr
|
||||
LD (H_RRFN),HL ; Plug in func adr
|
||||
;
|
||||
; Patch SNDRDY w/ FastPath addresses
|
||||
LD BC,0F801H ; Get CIO func/data adr
|
||||
LD D,03H ; Func=CIO OST
|
||||
LD A,(H_UNIT) ; get desired char unit
|
||||
LD E,A ; and put in E
|
||||
RST 08
|
||||
; handle error?
|
||||
LD (H_SRDAT),DE ; Plug in data adr
|
||||
LD (H_SRFN),HL ; Plug in func adr
|
||||
;
|
||||
LD HL,H_JPTBL
|
||||
LD DE,COM_LBL
|
||||
JP MINIT_RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Send character on top of stack
|
||||
;
|
||||
H_SENDR:
|
||||
POP AF ; get character to send from stack
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD E,A ; character to E
|
||||
LD IY,0000H
|
||||
H_SCDAT EQU $-2
|
||||
LD A,(H_BNKID) ; call into HBIOS bank
|
||||
LD HL,0000H
|
||||
H_SCFN EQU $-2
|
||||
CALL 0FFF9H ; HBIOS bank call
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test and report carrier status, Z set if carrier present
|
||||
;
|
||||
H_CAROK:
|
||||
XOR A ; not used, always indicate present
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Get a character (assume character ready has already been tested)
|
||||
;
|
||||
; GETCHR must NOT block.
|
||||
;
|
||||
H_GETCHR:
|
||||
CALL H_RCVRDY
|
||||
RET NZ
|
||||
|
||||
H_MDIN:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD IY,0000H
|
||||
H_GCDAT EQU $-2
|
||||
LD A,(H_BNKID) ; call into HBIOS bank
|
||||
LD HL,0000H
|
||||
H_GCFN EQU $-2
|
||||
CALL 0FFF9H ; HBIOS bank call
|
||||
LD A,E ; byte received to A
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test for character ready to receive, Z = ready
|
||||
; Error code returned in A register
|
||||
; *** Error code does not seem to be used ***
|
||||
;
|
||||
H_RCVRDY:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD IY,0000H
|
||||
H_RRDAT EQU $-2
|
||||
LD A,(H_BNKID) ; call into HBIOS bank
|
||||
LD HL,0000H
|
||||
H_RRFN EQU $-2
|
||||
CALL 0FFF9H ; HBIOS bank call
|
||||
SUB 1 ; CF set IFF zero
|
||||
RL A ; CF to bit 0 of A
|
||||
AND 01H ; set Z flag as needed
|
||||
LD A,0 ; report no line errors
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test for ready to send a character, Z = ready
|
||||
;
|
||||
H_SNDRDY:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD IY,0000H
|
||||
H_SRDAT EQU $-2
|
||||
LD A,(H_BNKID) ; call into HBIOS bank
|
||||
LD HL,0000H
|
||||
H_SRFN EQU $-2
|
||||
CALL 0FFF9H ; HBIOS bank call
|
||||
SUB 1 ; CF set IFF zero
|
||||
RL A ; CF to bit 0 of A
|
||||
AND 01H ; set Z flag as needed
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Report baud rate (index into SPTBL returned in register A)
|
||||
;
|
||||
H_SPEED:
|
||||
LD A,8 ; arbitrarily return 9600 baud
|
||||
RET
|
||||
;
|
||||
;
|
||||
;
|
||||
H_BNKID DB 0 ; HBIOS bank id
|
||||
H_UNIT DB 80H ; HBIOS unit id
|
||||
;
|
||||
;
|
||||
;=======================================================================
|
||||
;=======================================================================
|
||||
;
|
||||
; UNA UBIOS Interface
|
||||
;
|
||||
;=======================================================================
|
||||
;=======================================================================
|
||||
;
|
||||
; Following jump table is dynamically patched over initial jump
|
||||
; table at program startup. See MINIT above. Note that only a
|
||||
; subset of the jump table is overlaid (SENDR to SPEED).
|
||||
;
|
||||
U_JPTBL:
|
||||
JP U_SENDR ; send character (via pop psw)
|
||||
JP U_CAROK ; test for carrier
|
||||
JP U_MDIN ; receive data byte
|
||||
JP U_GETCHR ; get character from modem
|
||||
JP U_RCVRDY ; check receive ready
|
||||
JP U_SNDRDY ; check send ready
|
||||
JP U_SPEED ; get speed value for file transfer time
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; UBIOS initialization
|
||||
;
|
||||
U_INIT:
|
||||
;
|
||||
; TODO:
|
||||
; - TEST!!!
|
||||
; - ADJUST RCVSCL?
|
||||
;
|
||||
LD HL,3000 ; Smaller receive loop timeout scalar
|
||||
LD (RCVSCL),HL ; ... to compensate for BIOS overhead
|
||||
;
|
||||
LD HL,U_JPTBL
|
||||
LD DE,COM_LBL
|
||||
JP MINIT_RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Send character on top of stack
|
||||
;
|
||||
U_SENDR:
|
||||
POP AF ; get character to send from stack
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD BC,0012H ; unit 0, func 12h (write char)
|
||||
LD E,A ; character to E
|
||||
RST 08
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test and report carrier status, Z set if carrier present
|
||||
;
|
||||
U_CAROK:
|
||||
XOR A ; not used, always indicate present
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Get a character (assume character ready has already been tested)
|
||||
;
|
||||
; GETCHR must NOT block.
|
||||
;
|
||||
U_GETCHR:
|
||||
CALL U_RCVRDY
|
||||
RET NZ
|
||||
|
||||
U_MDIN:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD BC,0011H ; unit 0, func 12h (write char)
|
||||
RST 08
|
||||
LD A,E ; byte received to A
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test for character ready to receive, Z = ready
|
||||
; Error code returned in A register
|
||||
; *** Error code does not seem to be used ***
|
||||
;
|
||||
U_RCVRDY:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD BC,0013H ; unit 0, func 13h (input stat)
|
||||
LD A,E ; # chars waiting to A
|
||||
SUB 1 ; CF set IFF zero
|
||||
RL A ; CF to bit 0 of A
|
||||
AND 01H ; set Z flag as needed
|
||||
LD A,0 ; report no line errors
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Test for ready to send a character, Z = ready
|
||||
;
|
||||
U_SNDRDY:
|
||||
PUSH BC
|
||||
PUSH DE
|
||||
PUSH HL
|
||||
LD BC,0014H ; unit 0, func 14h (output stat)
|
||||
LD A,E ; # chars space in output buf
|
||||
SUB 1 ; CF set IFF zero
|
||||
RL A ; CF to bit 0 of A
|
||||
AND 01H ; set Z flag as needed
|
||||
POP HL
|
||||
POP DE
|
||||
POP BC
|
||||
RET
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; Report baud rate (index into SPTBL returned in register A)
|
||||
;
|
||||
U_SPEED:
|
||||
LD A,8 ; arbitrarily return 9600 baud
|
||||
RET
|
||||
;
|
||||
END
|
||||
@@ -87,7 +87,7 @@ DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG
|
||||
;
|
||||
UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM)
|
||||
UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ
|
||||
UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART
|
||||
UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART
|
||||
UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART
|
||||
|
||||
@@ -88,7 +88,7 @@ DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG
|
||||
;
|
||||
UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM)
|
||||
UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ
|
||||
UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART
|
||||
UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART
|
||||
UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART
|
||||
|
||||
@@ -86,7 +86,7 @@ DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG
|
||||
;
|
||||
UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM)
|
||||
UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ
|
||||
UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART
|
||||
UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART
|
||||
UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART
|
||||
|
||||
@@ -83,7 +83,7 @@ DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG
|
||||
;
|
||||
UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM)
|
||||
UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ
|
||||
UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS
|
||||
UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART
|
||||
UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART
|
||||
UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART
|
||||
|
||||
@@ -1799,7 +1799,7 @@ HB_DISPATCH:
|
||||
;
|
||||
#IF 0 ; *DEBUG* START
|
||||
;
|
||||
CALL HB_DISPCALL ; DO THE WORK
|
||||
CALL HB_DISPATCH1 ; DO THE WORK
|
||||
;
|
||||
; CHECK STACK INTEGRITY
|
||||
PUSH AF
|
||||
@@ -1810,7 +1810,7 @@ HB_DISPATCH:
|
||||
LD (HB_STACK - HB_STKSIZ + $08),A
|
||||
POP AF
|
||||
RET
|
||||
HB_DISPCALL:
|
||||
HB_DISPATCH1:
|
||||
;
|
||||
#ENDIF ; *DEBUG* END
|
||||
;
|
||||
@@ -1852,7 +1852,7 @@ CIO_DISPATCH:
|
||||
|
||||
PUSH IY ; SAVE INCOMING IY
|
||||
|
||||
LD IY,CIO_TBL ; POINT IY TO START OF DIO TABLE
|
||||
LD IY,CIO_TBL ; POINT IY TO START OF CIO TABLE
|
||||
CALL HB_DISPCALL ; GO TO GENERIC API CALL CODE
|
||||
|
||||
POP IY ; RESTORE IY
|
||||
@@ -2476,27 +2476,37 @@ SYS_FREE:
|
||||
SYS_GET:
|
||||
LD A,C ; GET REQUESTED SUB-FUNCTION
|
||||
CP BF_SYSGET_CIOCNT
|
||||
JR Z,SYS_GETCIOCNT
|
||||
JP Z,SYS_GETCIOCNT
|
||||
CP BF_SYSGET_CIOFN
|
||||
JP Z,SYS_GETCIOFN
|
||||
CP BF_SYSGET_DIOCNT
|
||||
JR Z,SYS_GETDIOCNT
|
||||
JP Z,SYS_GETDIOCNT
|
||||
;CP BF_SYSGET_DIOFN
|
||||
;JP Z,SYS_GETDIOFN
|
||||
CP BF_SYSGET_RTCCNT
|
||||
JR Z,SYS_GETRTCCNT
|
||||
JP Z,SYS_GETRTCCNT
|
||||
;CP BF_SYSGET_RTCFN
|
||||
;JP Z,SYS_GETRTCFN
|
||||
CP BF_SYSGET_VDACNT
|
||||
JP Z,SYS_GETVDACNT
|
||||
;CP BF_SYSGET_VDAFN
|
||||
;JP Z,SYS_GETVDAFN
|
||||
CP BF_SYSGET_SNDCNT
|
||||
JP Z, SYS_GETSNDCNT
|
||||
;CP BF_SYSGET_SNDFN
|
||||
;JP Z,SYS_GETSNDFN
|
||||
CP BF_SYSGET_TIMER
|
||||
JR Z,SYS_GETTIMER
|
||||
JP Z,SYS_GETTIMER
|
||||
CP BF_SYSGET_SECS
|
||||
JR Z,SYS_GETSECS
|
||||
JP Z,SYS_GETSECS
|
||||
CP BF_SYSGET_BOOTINFO
|
||||
JR Z,SYS_GETBOOTINFO
|
||||
JP Z,SYS_GETBOOTINFO
|
||||
CP BF_SYSGET_CPUINFO
|
||||
JR Z,SYS_GETCPUINFO
|
||||
JP Z,SYS_GETCPUINFO
|
||||
CP BF_SYSGET_MEMINFO
|
||||
JR Z,SYS_GETMEMINFO
|
||||
JP Z,SYS_GETMEMINFO
|
||||
CP BF_SYSGET_BNKINFO
|
||||
JR Z,SYS_GETBNKINFO
|
||||
JP Z,SYS_GETBNKINFO
|
||||
CALL SYSCHK
|
||||
LD A,ERR_NOFUNC ; SIGNAL ERROR
|
||||
OR A ; SET FLAGS
|
||||
@@ -2591,6 +2601,27 @@ SYS_GETCIOCNT:
|
||||
XOR A ; SIGNALS SUCCESS
|
||||
RET
|
||||
;
|
||||
; GET SERIAL UNIT API FN ADR AND BLOB ADR
|
||||
;
|
||||
SYS_GETCIOFN:
|
||||
LD A,D ; GET CIO FUNC NUM FROM D
|
||||
LD B,A ; AND PUT IN B
|
||||
LD A,E ; GET CIO UNIT NUM FROM E
|
||||
LD C,A ; AND PUT IN C
|
||||
BIT 7,C ; CHECK FOR SPECIAL UNIT CODE
|
||||
CALL NZ,SYS_GETCIOFN1 ; IF SO, HANDLE IT
|
||||
PUSH IY ; SAVE IY VALUE
|
||||
LD IY,CIO_TBL ; POINT TO UNIT TABLE
|
||||
CALL HB_DISPCALC ; CALC FN ADR & BLOB ADR
|
||||
EX (SP),IY ; RESTORE IY, BLOB ADR -> TOS
|
||||
POP DE ; BLOB ADR -> DE
|
||||
RET ; AF STILL HAS RESULT OF CALC
|
||||
;
|
||||
SYS_GETCIOFN1:
|
||||
LD A,(CB_CONDEV) ; UNIT $80 -> CONSOLE UNIT
|
||||
LD C,A ; REPLACE UNIT VALUE IN C
|
||||
RET ; AND BACK TO REGULAR FLOW
|
||||
;
|
||||
; GET DISK UNIT COUNT
|
||||
;
|
||||
SYS_GETDIOCNT:
|
||||
@@ -2948,14 +2979,27 @@ HB_BADINTCNT .DB 0
|
||||
;
|
||||
; COMMON API FUNCTION DISPATCH CODE
|
||||
;
|
||||
; ON ENTRY C IS UNIT # (INDEX INTO XXX_TBL OF UNITS)
|
||||
; AND IY POINTS TO START OF UNIT TABLE.
|
||||
; ON ENTRY B IS API FUNCTION NUMBER AND C IS UNIT #
|
||||
; (INDEX INTO XXX_TBL OF UNITS) AND IY POINTS TO START OF UNIT TABLE.
|
||||
; USE UNIT # IN C TO LOOKUP XXX_TBL ENTRY. THE XXX_TBL
|
||||
; ENTRY CONTAINS THE START OF THE DRIVER FUNCTION TABLE AND
|
||||
; THE DEVICE SPECIFIC INSTANCE DATA (BLOB). SET IY TO BLOB ADDRESS
|
||||
; AND CALL THE SPECIFIC FUNCTION REQUESTED IN THE DRIVER.
|
||||
;
|
||||
HB_DISPCALL:
|
||||
PUSH HL ; SAVE INCOMING IY VALUE
|
||||
CALL HB_DISPCALC ; IY = BLOB ADR, HL = FN ADR
|
||||
JR NZ,HB_DISPCALL1 ; ABORT ON ERROR
|
||||
EX (SP),HL ; RESTORE HL & FN ADR TO TOS
|
||||
RET ; JUMP TO FN ADR
|
||||
HB_DISPCALL1:
|
||||
POP HL ; RECOVER HL
|
||||
RET ; AND DONE
|
||||
;
|
||||
; ENTRY: BC=FUNC/UNIT, IY=DISPATCH TABLE
|
||||
; EXIT: HL=FUNC ADR, IY=DATA BLOB ADR
|
||||
;
|
||||
HB_DISPCALC:
|
||||
; CHECK INCOMING UNIT INDEX IN C FOR VAILIDITY
|
||||
LD A,C ; A := INCOMING DISK UNIT INDEX
|
||||
CP (IY-1) ; COMPARE TO COUNT
|
||||
@@ -2976,7 +3020,7 @@ HB_DISPCALL:
|
||||
POP BC ; RESTORE BC
|
||||
|
||||
; DERIVE DRIVER FUNC ADR TO CALL
|
||||
PUSH HL ; SAVE INCOMING HL
|
||||
;PUSH HL ; SAVE INCOMING HL
|
||||
LD L,(IY+0) ; COPY DRIVER FUNC TABLE
|
||||
LD H,(IY+1) ; ... START TO HL
|
||||
RLCA ; CONV UNIT (STILL IN A) TO FN ADR OFFSET
|
||||
@@ -2985,15 +3029,17 @@ HB_DISPCALL:
|
||||
INC HL ; ... TO GET
|
||||
LD H,(HL) ; ... ACTUAL
|
||||
LD L,A ; ... TARGET FUNCTION ADDRESS
|
||||
EX (SP),HL ; RESTORE HL, FUNC ADR ON STACK
|
||||
;EX (SP),HL ; RESTORE HL, FUNC ADR ON STACK
|
||||
|
||||
; GET UNIT INSTANCE DATA BLOB ADDRESS TO IY
|
||||
PUSH HL ; SAVE INCOMING HL
|
||||
;PUSH HL ; SAVE INCOMING HL
|
||||
PUSH HL ; SAVE FUNC ADR
|
||||
LD L,(IY+2) ; HL := DATA BLOB ADDRESS
|
||||
LD H,(IY+3) ; ...
|
||||
EX (SP),HL ; RESTORE HL, BLOB ADR ON TOS
|
||||
POP IY ; IY := BLOB ADR
|
||||
|
||||
XOR A ; SIGNAL SUCCESS
|
||||
RET ; JUMP TO DRIVER FUNC ADR ON TOS
|
||||
;
|
||||
HB_FUNCERR:
|
||||
|
||||
@@ -96,10 +96,15 @@ BF_SYSRES_WARM .EQU $01 ; WARM START (RESTART BOOT LOADER)
|
||||
BF_SYSRES_COLD .EQU $02 ; COLD START
|
||||
;
|
||||
BF_SYSGET_CIOCNT .EQU $00 ; GET CHAR UNIT COUNT
|
||||
BF_SYSGET_CIOFN .EQU $01 ; GET CIO UNIT FN/DATA ADR
|
||||
BF_SYSGET_DIOCNT .EQU $10 ; GET DISK UNIT COUNT
|
||||
BF_SYSGET_DIOFN .EQU $11 ; GET DIO UNIT FN/DATA ADR
|
||||
BF_SYSGET_RTCCNT .EQU $20 ; GET RTC UNIT COUNT
|
||||
BF_SYSGET_RTCFN .EQU $21 ; GET RTC UNIT FN/DATA ADR
|
||||
BF_SYSGET_VDACNT .EQU $40 ; GET VDA UNIT COUNT
|
||||
BF_SYSGET_VDAFN .EQU $41 ; GET VDA UNIT FN/DATA ADR
|
||||
BF_SYSGET_SNDCNT .EQU $50 ; GET VDA UNIT COUNT
|
||||
BF_SYSGET_SNDFN .EQU $51 ; GET SND UNIT FN/DATA ADR
|
||||
BF_SYSGET_TIMER .EQU $D0 ; GET CURRENT TIMER VALUE
|
||||
BF_SYSGET_SECS .EQU $D1 ; GET CURRENT SECONDS VALUE
|
||||
BF_SYSGET_BOOTINFO .EQU $E0 ; GET BOOT INFORMATION
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
#DEFINE RMN 1
|
||||
#DEFINE RUP 1
|
||||
#DEFINE RTP 0
|
||||
#DEFINE BIOSVER "3.1.1-pre.14"
|
||||
#DEFINE BIOSVER "3.1.1-pre.15"
|
||||
|
||||
@@ -3,5 +3,5 @@ rmn equ 1
|
||||
rup equ 1
|
||||
rtp equ 0
|
||||
biosver macro
|
||||
db "3.1.1-pre.14"
|
||||
db "3.1.1-pre.15"
|
||||
endm
|
||||
|
||||
Reference in New Issue
Block a user