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
82 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS v'
85 db 'Estimated CPU clock [Hz]: ',0
94 cseg ; boot loading must be done from resident memory
96 ; This version of the boot loader loads the CCP from a file
97 ; called CCP.COM on the system drive (A:).
99 ; First time, load the A:CCP.COM file into TPA
104 ld (ccp$fcb+15),a ; zero extent
106 ld (fcb$nr),hl ; start at beginning of file
108 ld c,open ; open file containing CCP
111 jp z,no$ccp ; error if no file...
113 ld c,setdma ; start of TPA
116 ld c,setmulti ; allow up to 16k bytes
119 ld c,read ; load the thing
120 call bdos ; read records
122 ; now, copy CCP to bank 0 for reloading
124 ld bc,2*256 + tpa$bank ; c: src$bnk, b: dst$bnk
127 ; just copy in the other direction
129 ld bc,tpa$bank*256 + 2 ; c: src$bnk, b: dst$bnk
135 ld bc,ccpsize ; clone 3K, just in case
139 no$ccp: ; here if we couldn't find the file
140 call pr.inln ; report this...
141 db 13,10,'BIOS Err on A: No CCP.COM file',0
143 call ?conin ; get a response
144 jr ?ldccp ; and try again
147 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
154 db (hwini0_e-$)/2 ;count
155 db rcr,CREFSH ;configure DRAM refresh
156 db dcntl,CWAITIO ;wait states
157 db ccr,M_NCD ;No Clock Divide
158 db cmr,PHI_X2 ;X2 Clock Multiplier
159 db omcr,~M_IOC ;Operation Mode Control Register
164 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]