mirror of https://github.com/wwarthen/RomWBW.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
449 lines
14 KiB
449 lines
14 KiB
;*****************************************************************************
|
|
; BP-BIOS. Banked, Portable BIOS.
|
|
; Copyright (c) 1989-93 by Cameron W. Cotrill and Harold F. Bower
|
|
;
|
|
; This program is free software; you can redistribute it and/or modify
|
|
; it under the terms of the GNU General Public License as published by
|
|
; the Free Software Foundation; either version 2 of the License, or (at
|
|
; your option) any later version.
|
|
;
|
|
; This program is distributed in the hope that it will be useful, but
|
|
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
; General Public License for more details.
|
|
;
|
|
; You should have received a copy of the GNU General Public License
|
|
; along with this program; if not, write to the Free Software
|
|
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
;
|
|
;----------------------------------------------------------------------------
|
|
; This BIOS is broken into modules that allow it to be ported across a
|
|
; wide variety of Z80 compatible systems. All hardware specific drivers
|
|
; are isolated to separate modules. All hardware independent modules (such
|
|
; as deblocking and IO redirection) are similarly broken out.
|
|
;
|
|
; The BP BIOS supports IOBYTE, but in a unique manner. Four physical devices
|
|
; are defined - COM1, COM2, PIO, and NULL. These are assigned to the CON,
|
|
; AUXIN, AUXOUT, and LST logical devices by the I/O byte. The NULL device is
|
|
; a bit bucket for output, and returns nulls for input.
|
|
;
|
|
; IOBYTE DESCRIPTION: LIST AUXOUT AUXIN CON
|
|
; D7->D0 XX XX XX XX
|
|
;
|
|
; XX: 00=COM1 01=COM2 10=PIO 11=NULL
|
|
;
|
|
;+++++++++++++++++ Retro-Brew HBIOS Version ++++++++++++++++++
|
|
;
|
|
; This configuration of the B/P Bios is for Retro-Brew (formerly
|
|
; called N8VEM) Single board computers with HBIOS. Multifunction
|
|
; chips on the board provide the services needed by a CP/M BIOS.
|
|
; This version of BPBios was derived from the P-112 version.
|
|
; The primary chips and the functions provided are:
|
|
;
|
|
; For Mark IV or N8
|
|
; Zilog Z80182 Z180 Core CPU, MMU, DMA
|
|
; ASCI0, ASCI1 (Serial async, available on header, expansion)
|
|
; CTC1 Optional 'heartbeat' clock, GP timer
|
|
;
|
|
; Dallas DS-1202 Primary Realtime clock
|
|
; Non-volatile battery-backed RAM (config data)
|
|
;
|
|
; 28F512 Flash ROM Boot code, device initialization
|
|
; and ROM disk
|
|
; 512 KB Static RAM On board RAM
|
|
;
|
|
; For SBC V1/2, ZETA or SIMH
|
|
; Zilog Z80 Z80 core at 4 Mhz
|
|
; UART 16650 compatible UART
|
|
; Dallas DS-1202 Primary Real time clock
|
|
; 28F512 Flash ROM Boot code, device initializtion, monitor and
|
|
; ROM disk
|
|
; 512k Static RAM On board RAM
|
|
;
|
|
; Ver Date Revision Description
|
|
; --- --------- -----------------------
|
|
; 1.8 04 Apr 21 - Update for ROMWBW version 3.0.1 LN
|
|
; 1.7 01 Jul 17 - Updated for HBIOS version 2.8.1 WW+LN
|
|
; 1.6 04 Sep 16 - Updated for HBIOS version 2.8 pre 5 WW+LN
|
|
; 1.5 15 May 15 - Updated for new versin of HBIOS WW+LN
|
|
; 1.4 24 Mar 14 - Initial HBIOS test Release WW+LN
|
|
; 1.3 28 Aug 01 - Scrubbed for GPL Release. HFB
|
|
; 1.2 - 30 Aug 97 - Expanded HD CDB length to 12 bytes for CDROM. HFB
|
|
; 1.1 - 11 May 97 - Added IDE Hard Drive, updated files to latest
|
|
; version. HFB
|
|
; 1.0 - 13 Aug 96 - Initial Release for P112 from YASBEC release. HFB
|
|
;*****************************************************************************
|
|
|
|
NAME BPBIO
|
|
|
|
FALSE EQU 0
|
|
TRUE EQU NOT FALSE
|
|
NO EQU FALSE
|
|
YES EQU TRUE
|
|
|
|
; << ****** SYSTEM SPECIFIC ****** >>
|
|
; << Insert ROMWBW definitions here >>
|
|
INCLUDE ROMWBW.LIB ; << for version # in ROM >>
|
|
|
|
; << ****** SYSTEM SPECIFIC ****** >>
|
|
; << Insert DEF-xxxx.LIB definition >>
|
|
INCLUDE DEF-WW.LIB ; << file for your configuration. >>
|
|
|
|
CSEG
|
|
;.....
|
|
; Ascii Character Equates
|
|
|
|
ETX EQU 03H ; End-of-Text
|
|
ACK EQU 06H ; Acknowledge
|
|
BELL EQU 07H ; Bell Character
|
|
CR EQU 0DH
|
|
LF EQU 0AH
|
|
XON EQU 11H ; X-On (Control-Q)
|
|
XOFF EQU 13H ; X-Off (Control-S)
|
|
ESC EQU 1BH
|
|
|
|
; Miscellaneous Equates
|
|
|
|
WRUAL EQU 2 ; DOS code for unallocated write
|
|
|
|
LOCKF EQU LOW [NOT AUTOSL] ;Lock flag for format default
|
|
ALONE EQU FALSE ; Boot code equate
|
|
; Include ENV definitions
|
|
IF Z3
|
|
IF ZSDOS2
|
|
MACLIB Z3BASEF.LIB
|
|
ELSE
|
|
MACLIB Z3BASE.LIB
|
|
ENDIF
|
|
ENDIF
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; BIOS Entry Jump Table - This MUST be in Common Memory
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
CSEG
|
|
|
|
BIOSJT: JP CBOOT ; 00 Cold Boot
|
|
JP WBOOT ; 01 Warm Boot
|
|
JP CONST ; 02 console input status * (IOP+12)
|
|
JP CONIN ; 03 console input * (IOP+15)
|
|
JP CONOUT ; 04 console output * (IOP+18)
|
|
JP LIST ; 05 list output * (IOP+21)
|
|
JP AUXOUT ; 06 aux out (punch) * (IOP+24)
|
|
JP AUXIN ; 07 aux in (reader) * (IOP+27)
|
|
JP HOME ; 08 seek track 0
|
|
JP SELDSK ; 09 select logical drive
|
|
JP SETTRK ; 10 select track
|
|
JP SETSEC ; 11 select sector
|
|
JP SETDMA ; 12 set dma address for disk xfer
|
|
JP READ ; 13 disk read
|
|
JP WRITE ; 14 disk write
|
|
JP LISTST ; 15 list output status * (IOP+30)
|
|
JP SECTRN ; 16 logical -> physical sector xlate
|
|
|
|
; --- <<< End of CP/M 2.2 Vectors >>>
|
|
|
|
JP CONOST ; 17 Console Output Status
|
|
JP AUXIST ; 18 Aux Input Status
|
|
JP AUXOST ; 19 Aux Output Status
|
|
JP DEVTBL ; 20 CP/M 3 Device Table
|
|
JP DEVINI ; 21 Character Device Init (Near CP/M 3)
|
|
JP DRVTBL ; 22 DPH Pointer Table for A-P
|
|
JP 0 ; 23 RESERVED FOR MULTIO
|
|
JP FLUSH ; 24 Flush Deblocker
|
|
JP MOVE ; 25 Perform possible Inter-Bank Move
|
|
IF CLOCK
|
|
JP TIME ; 26 Get/Set RTC (Zsdos params)
|
|
ELSE
|
|
JP ISTRUE ; 26..return 0FFH (No Clock) if No code
|
|
ENDIF ;clock
|
|
JP SELMEM ; 27 Select Alternate Memory Bank
|
|
JP SETBNK ; 28 Select DMA Memory bank
|
|
JP XMOVE ; 29 Set Source/Destination Banks for Move
|
|
|
|
; --- <<< End of CP/M 3 Vectors >>>
|
|
|
|
JP RETBIO ; 30 Return BIOS Addresses
|
|
JP ISTRUE ; 31 Direct Disk I/O - Not implemented
|
|
JP STFARC ; 32 Set Bank for FRJP and FRCALL
|
|
JP FRJP ; 33 Jump to (HL) in Alternate Bank
|
|
JP FRCLR ; 34 Clear Stack switcher from Alt Bank Jumps
|
|
; (used for error exits)
|
|
JP FRGETB ; 35 Load A,(HL) from Alternate Bank
|
|
JP FRGETW ; 36 Load DE,(HL) from Alternate Bank
|
|
JP FRPUTB ; 37 Load (HL),A to Alternate Bank
|
|
JP FRPUTW ; 38 Load (HL),DE to Alternate Bank
|
|
JP RETMEM ; 39 Return Current Active Memory Bank
|
|
|
|
CPR EQU BIOSJT-800H-0E00H
|
|
DOS EQU BIOSJT-0E00H
|
|
|
|
; End of BIOS Jump Table
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; Boot / Banked Routine Linkage
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
IF BANKED
|
|
COMMON /BANK2/
|
|
ROMJT:
|
|
IF INROM
|
|
JP INSYNC
|
|
INSYNC: JP BOOTER ; Cold start loader
|
|
ELSE
|
|
JP 0 ; Reserved
|
|
JP 0
|
|
ENDIF ; Inrom
|
|
JDIRIO: JP ISTRUE ; Low Level HDC/FDC Functions
|
|
JHDCIO: JP ISTRUE ; Low Level HDC Functions (combined w/FDCIO)
|
|
JBREAD: JP BREAD ; BIOS Read
|
|
JBWRT: JP BWRT ; BIOS Write
|
|
JBSTRN: JP BSTRN ; BIOS Sectran
|
|
IF INROM
|
|
INCLUDE BOOTROM.Z80 ; Boot Routines
|
|
ENDIF ; Inrom
|
|
ENDIF ; Banked
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; C o n f i g u r a t i o n A r e a
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; << ****** HARDWARE SPECIFIC ****** >>
|
|
; << Insert ICFG-xxx to initialize >>
|
|
INCLUDE ICFG-WW.Z80 ; << your computer's IO system >>
|
|
PAGE
|
|
; << ****** Hardware Specific ****** >>
|
|
; << Enter Low level Byte I/O driver >>
|
|
INCLUDE IIO-WW.Z80 ; << routines in file IIO-xxxx.Z80 >>
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; Cold Start Code
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
DSEG
|
|
; << ***** Hardware Specific ***** >>
|
|
; << Insert the Cold boot routines >>
|
|
INCLUDE CBOOT-WW.Z80 ; << in file CBOOT-xx.Z80 >>
|
|
|
|
; Deblocking Buffer Allocation
|
|
|
|
IF [BANKED OR INROM]
|
|
COMMON /B2RAM/
|
|
IF INROM
|
|
HSTBUF: DEFS INITCS ; Use a 1k buffer w/below
|
|
ELSE
|
|
HSTBUF EQU CBOOT0 ; Use CBOOT0 code for part of buffer w/below
|
|
ENDIF ;INROM
|
|
ELSE
|
|
DSEG
|
|
HSTBUF EQU CBOOT
|
|
ENDIF ;[BANKED OR INROM]
|
|
DEFS 1024-(INITCS) ; Use a 1 k buffer
|
|
|
|
HSTSIZ EQU HSTBUF+1024 ; Added label for Hard Drive ext. interface
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; Disk Data Structures
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
MXFDIR EQU 255 ; Max number of dir entries-1 for floppy
|
|
|
|
MXFALC EQU 880 ; If High Density or 8" drives can be handled,
|
|
; set this for 880 (1.76 MB), otherwise the
|
|
; value can be reduced to 400 (800 KB), the
|
|
; maximum for 80 track, Double-Sided formats.
|
|
CSEG
|
|
IF BANKED
|
|
COMMON /BANK2/
|
|
ENDIF
|
|
DPB: ; Marker for DPB start
|
|
;.XLIST ; Don't print these due to size
|
|
IF AUTOSL
|
|
INCLUDE DPB.LIB ; Default selection of common DD formats
|
|
IF FLOPYH
|
|
INCLUDE DPB-H.LIB ; If "High-Density" Disk formats desired,
|
|
ENDIF ; FLOPYH
|
|
IF FLOPY8
|
|
INCLUDE DPB-8.LIB ; If 8" or HD Floppy Disks can be handled,
|
|
ENDIF ;FLOPY8 ; add default Autoselect DPB's
|
|
IF MORDPB
|
|
INCLUDE DPB2.LIB ; Additional assignable DPB's (4+4 unused)
|
|
ENDIF ;mordpb
|
|
|
|
ELSE ;Not autosl
|
|
INCLUDE DPBRAM.LIB ; RAM-based DPB's, 1 per physical Format
|
|
ENDIF ; AUTOSL
|
|
|
|
NRDPB EQU [$-DPB]/DPBSIZ ; Calc number of DPB's
|
|
|
|
CSEG ; Hard & Ramdisk DPBs and DPHs go in Code Seg
|
|
;.xlist
|
|
IF HARDDSK
|
|
; << ****** Hardware Specific ****** >>
|
|
; << Insert DPB Info for Hard Disk >>
|
|
INCLUDE DPBHD-WW.LIB ; << Drives as DPBHD-xx.LIB >>
|
|
ENDIF ; HARDDSK
|
|
;.list
|
|
PAGE
|
|
INCLUDE DPH.LIB ; Disk parameter headers
|
|
;.xlist
|
|
IF HARDDSK
|
|
INCLUDE DPHHD.LIB ; Insert DPH Info for Hard Disk Partitions
|
|
ENDIF ;HARDDSK
|
|
;.list
|
|
.LIST
|
|
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; Banked Memory Support Routines
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
; Bank Control Routines. Used only in Banked Systems
|
|
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
IF BANKED ; << ****** HARDWARE SPECIFIC ****** >>
|
|
; << Enter the Inter-Bank Movement >>
|
|
INCLUDE IBMV-WW.Z80 ; << routines in IBMV-xxx.Z80 >>
|
|
|
|
ELSE ; If Not Banked, Use these hooks
|
|
|
|
MOVE: LDIR
|
|
RET
|
|
|
|
SETBNK:
|
|
SELMEM:
|
|
RETMEM:
|
|
XMOVE:
|
|
GOSYSB:
|
|
FRCLR:
|
|
STFARC: RET
|
|
|
|
FRJP: JP (HL)
|
|
|
|
FRGETB: LD A,(HL)
|
|
RET
|
|
|
|
FRGETW: LD E,(HL)
|
|
INC HL
|
|
LD D,(HL)
|
|
DEC HL
|
|
RET
|
|
|
|
FRPUTB: LD (HL),A
|
|
RET
|
|
|
|
FRPUTW: LD (HL),E
|
|
INC HL
|
|
LD (HL),D
|
|
DEC HL
|
|
RET
|
|
|
|
ENDIF ;(not) banked
|
|
PAGE
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
; Core BIOS Code
|
|
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
; Return BIOS Addresses
|
|
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
CSEG
|
|
|
|
RETBIO: LD BC,BIOSJT ; Get address of bios base
|
|
LD DE,CONFIG ; Point to configuration area
|
|
LD HL,DEVCFG ; Point to Char IO Device Table
|
|
LD A,VERS ; Return BIOS Version
|
|
RET
|
|
|
|
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
; Return DPH Table Address
|
|
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
INCLUDE UTIL.Z80
|
|
|
|
DRVTBL: LD HL,DPHTBL ; Point to DPH table
|
|
RET
|
|
|
|
PAGE
|
|
INCLUDE BYTEIO.Z80 ; Con:, aux:, lst: redirection
|
|
PAGE
|
|
INCLUDE SELRWD.Z80 ; Physical driver link for disks
|
|
PAGE
|
|
INCLUDE DEBLOCK.Z80 ; Hstbuf deblocker
|
|
PAGE
|
|
INCLUDE SECTRAN.Z80 ; Sector translation
|
|
PAGE
|
|
IF AUTOSL
|
|
INCLUDE SELFLP2.Z80 ; Floppy disk select
|
|
ELSE
|
|
INCLUDE SELFLP1.Z80
|
|
ENDIF ;AUTOSL
|
|
PAGE
|
|
INCLUDE FLOPPY.Z80 ; Hardware independent floppy routines
|
|
PAGE
|
|
; << ****** Hardware Specific ****** >>
|
|
INCLUDE FDC-WW.Z80 ; << This Driver is for HBIOS >>
|
|
PAGE
|
|
; << ****** Hardware Specific ****** >>
|
|
INCLUDE TIM-WW.Z80 ; << This Driver is for HBIOS >>
|
|
PAGE
|
|
|
|
IF HARDDSK ; << ****** Hardware Specific ****** >>
|
|
INCLUDE HARD-WW.Z80 ; << This Driver is for HBIOS >>
|
|
|
|
PAGE
|
|
ENDIF ;HARDDSK
|
|
|
|
|
|
; << ****** Hardware Specific ****** >>
|
|
; << Enter Warm Boot routines in >>
|
|
INCLUDE WBOOT-WW.Z80 ; << WBOOT-xx.Z80 >>
|
|
|
|
; << ****** Hardware Specific ****** >>
|
|
; << HBIOS interface routines in >>
|
|
INCLUDE HBIOS.Z80 ; << HBIOS.Z80 >>
|
|
;.....
|
|
; Status bytes of general use placed at end of Data area
|
|
|
|
DSEG
|
|
|
|
HDONE: DEFS 1 ; HDC Flag 0=Ready, 1=Busy, 0FFH=Done
|
|
ERFLAG: DEFS 1 ; Disk Operation Error Code
|
|
DEFS 3 ; Reserved
|
|
IF [BANKED AND ZSDOS2]
|
|
COMMON /B2RAM/ ; Put this label in Banked Memory
|
|
ENDIF ;[BANKED AND ZSDOS2] ; ..else in Dseg
|
|
BRAME: DEFS 2 ; Use as dynamic sizing label for Hard Drive
|
|
; ALV buffers, and storage area for sizing.
|
|
; ALV Buffers build up from here in memory
|
|
CSEG
|
|
|
|
; Display warning if we are assembling for MOVCPM integration and the
|
|
; combined CSEG/Initialized DSEG size exceeds 1 or 2 Boot Records
|
|
|
|
PRINTX MACRO %NN
|
|
.printx %NN
|
|
ENDM
|
|
|
|
LIMIT EQU $-BIOSJT+INITCS
|
|
|
|
IF MOVCPM AND LIMIT > 4480
|
|
.printx
|
|
.printx **** BIOS too big (>4480) for Boot Tracks! ****
|
|
PRINTX %LIMIT
|
|
.printx
|
|
ELSE
|
|
IF MOVCPM AND LIMIT > 4352
|
|
.printx
|
|
.printx ++++ BIOS exceeds (>4352) 2-Sector Boot Record ++++
|
|
PRINTX %LIMIT
|
|
.printx
|
|
ENDIF ;IF MOVCPM AND LIMIT > 4352
|
|
ENDIF ;MOVCPM AND LIMIT > 4480
|
|
|
|
NSECTS EQU ($+INITCS-BIOSJT)/128+1
|
|
IF INROM
|
|
INCLUDE BOOTRAM.Z80
|
|
ENDIF ;INROM
|
|
END
|
|
|
|
|