1 title 'Boot loader module for CP/M 3.0'
5 public hwinit,?init,?ldccp,?rlccp
10 extrn pr.inln,pr.crlf,pr.dec,pr.decl
11 extrn ioini1l,msginit,mmuinit,intinit,cpu_frq
13 extrn @civec,@covec,@aivec,@aovec,@lovec
14 extrn @cbnk,?move,?xmove
23 ; CP/M BDOS Function Interfaces
40 dseg ; init done from banked memory
57 call intinit ; setup interrupts and vectors
61 ; ld hl,1000000000000000b ; assign console to AVRCON:
62 ld hl,0010000000000000b ; assign console to ASCI1:
65 ld hl,0000000000000000b ; assign printer to nothing:
67 ld hl,0100000000000000b ; assign AUX to ASCI0:
72 call prt0ini ; init timer
75 call gs_rtc ; get time and date
78 ld (@cbnk),a ; right now in bank 0
80 call pr.inln ; print signon message
81 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS v'
84 db 'Estimated CPU clock [Hz]: ',0
93 cseg ; boot loading must be done from resident memory
95 ; This version of the boot loader loads the CCP from a file
96 ; called CCP.COM on the system drive (A:).
98 ; First time, load the A:CCP.COM file into TPA
103 ld (ccp$fcb+15),a ; zero extent
105 ld (fcb$nr),hl ; start at beginning of file
107 ld c,open ; open file containing CCP
110 jp z,no$ccp ; error if no file...
112 ld c,setdma ; start of TPA
115 ld c,setmulti ; allow up to 16k bytes
118 ld c,read ; load the thing
119 call bdos ; read records
121 ; now, copy CCP to bank 0 for reloading
123 ld bc,2*256 + tpa$bank ; c: src$bnk, b: dst$bnk
126 ; just copy in the other direction
128 ld bc,tpa$bank*256 + 2 ; c: src$bnk, b: dst$bnk
134 ld bc,ccpsize ; clone 3K, just in case
138 no$ccp: ; here if we couldn't find the file
139 call pr.inln ; report this...
140 db 13,10,'BIOS Err on A: No CCP.COM file',0
142 call ?conin ; get a response
143 jr ?ldccp ; and try again
146 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
153 db (hwini0_e-$)/2 ;count
154 db rcr,CREFSH ;configure DRAM refresh
155 db dcntl,CWAITIO ;wait states
156 db ccr,M_NCD ;No Clock Divide
157 db cmr,PHI_X2 ;X2 Clock Multiplier
158 db omcr,~M_IOC ;Operation Mode Control Register
163 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]