boot:
DI ; Disable interrupts.
LD (save$stack),SP ; Save the current stack
LD SP,boot$stack ; Set SP to internal stack
; Set up the memory map as follows:
; Area 0 - Bank 0 (RAM)
; Area 1 - Bank 1 (RAM)
; Area 2 - Bank 2 (RAM)
; Area 3 - Bank 3 (RAM)
; Bank 0 mapping
LD A,$00
OUT (MMU_IO),A ; Set Area 0 to Bank 0
LD A,$11 ;
OUT (MMU_IO),A ; Set Area 1 to Bank 1
LD A,$22 ;
OUT (MMU_IO),A ; Set Area 2 to Bank 2
LD A,$33 ;
OUT (MMU_IO),A ; Set Area 3 to Bank 3
; Set up Page Zero
CALL init_pg0
; Interrupt vector relocated to safe memory
LD HL,INTVEC
LD A,H ; high byte of INTVEC
LD I,A
LD A,L
LD (sioBi+$07),A ; Set the interrupt low-byte vector in sioBi data block
; Initialise SIO
LD A,(CLKSPD) ; Get clock from 2.2 BIOS loc
CP '8' ; 8 MHz clock - set baud at half default
JP Z,baud_8
baud_4:
LD A,$84 ; CLK/32, 1 stop bit, no parity
JP baudXt ; Jump to set baud rate
baud_8:
LD A,$C4 ; CLK/64, 1 stop bit, no parity
baudXt:
LD (sioAb),A
LD HL,sioAi
LD C,SIOA_C
LD B,sioAz
OTIR
LD HL,sioBi
LD C,SIOB_C
LD B,sioBz
OTIR
CALL printInline
.DB FF
.TEXT "Z80 MINICOM II CP/M Plus BIOS 1.0.0 by J.Nock 2017"
.DB CR,LF
.DB CR,LF
.TEXT "CP/M Plus "
.TEXT "Copyright"
.TEXT " 1982 (c) by Digital Research"
.DB CR,LF,0
CALL cfWait
LD A,CF_8BIT ; Set IDE to be 8-bit
OUT (CF_FEATURES),A
LD A,CF_SET_FEAT
OUT (CF_COMMAND),A
CALL cfWait
LD A,CF_NOCACHE ; No write cache
OUT (CF_FEATURES),A
LD A,CF_SET_FEAT
OUT (CF_COMMAND),A
; Set up input channel buffers
XOR A
LD (serABufUsed),A
LD (serBBufUsed),A
LD HL,serABuf
LD (serAInPtr),HL
LD (serARdPtr),HL
LD HL,serBBuf
LD (serBInPtr),HL
LD (serBRdPtr),HL
IM 2
EI ; Enable interrupts
JP ld_ccp
wboot:
LD (save$stack),SP ; Save the current stack
LD SP,boot$stack ; Set SP to internal stack
; Make certain Page Zero is initialized in all banks.
CALL init_pg0
IM 2
EI ; Enable interrupts
ld_ccp:
; DEBUG
CALL printInline
.TEXT "Loading CCP..."
.DB CR,LF,0
; Load CCP.COM into bank 1 and jump to it.
LD A,1
CALL SELMEM ; Switch to Bank 1
; DEBUG
CALL printInline
.TEXT "Bank 1 selected..."
.DB CR,LF,0
XOR A ; Zero extent
LD (ccp$fcb+15),A
LD HL,0 ; Start at beginning of file
LD (fcb$nr),HL
LD C,open$func ; Open the CCP.COM file
LD DE,ccp$fcb
CALL bdose ; BDOS will return to this CALL, not bdose as it uses a JP
; DEBUG
CALL printInline
.TEXT "First bdose call completed..."
.DB CR,LF,0
INC A
JP Z,no$CCP ; If A is zero, CCP wasn't loaded successfully
LD DE,ccp
LD C,26 ; Set DMA address
CALL bdose
; DEBUG
CALL printInline
.TEXT "Second bdose call completed..."
.DB CR,LF,0
LD DE,128 ; Read up to 128 records (up to 16K)
LD C,44 ; Set multi-sector count
CALL bdose
; DEBUG
CALL printInline
.TEXT "Third bdose call completed..."
.DB CR,LF,0
LD DE,ccp$fcb ; Load it
LD C,20 ; Read record(s)
CALL bdose
; DEBUG
CALL printInline
.TEXT "CCP loaded..."
.DB CR,LF,0
; Pass execution to CCP
JP ccp