1 title 'Boot loader module for CP/M 3.0'
5 public hwinit,?init,?ldccp,?rlccp
9 extrn pr.inln,pr.crlf,pr.dec,pr.decl
10 extrn ioini1l,msginit,mmuinit,intinit,cpu_frq
12 extrn @civec,@covec,@aivec,@aovec,@lovec
13 extrn @cbnk,?move,?xmove
22 ; CP/M BDOS Function Interfaces
39 dseg ; init done from banked memory
56 call intinit ; setup interrupts and vectors
60 ; ld hl,1000000000000000b ; assign console to AVRCON:
61 ld hl,0010000000000000b ; assign console to ASCI1:
64 ld hl,0000000000000000b ; assign printer to nothing:
66 ld hl,0100000000000000b ; assign AUX to ASCI0:
71 call prt0ini ; init timer
74 call gs_rtc ; get time and date
77 ld (@cbnk),a ; right now in bank 0
79 call pr.inln ; print signon message
80 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS v'
83 db 'Estimated CPU clock [Hz]: ',0
92 cseg ; boot loading must be done from resident memory
94 ; This version of the boot loader loads the CCP from a file
95 ; called CCP.COM on the system drive (A:).
97 ; First time, load the A:CCP.COM file into TPA
102 ld (ccp$fcb+15),a ; zero extent
104 ld (fcb$nr),hl ; start at beginning of file
106 ld c,open ; open file containing CCP
109 jp z,no$ccp ; error if no file...
111 ld c,setdma ; start of TPA
114 ld c,setmulti ; allow up to 16k bytes
117 ld c,read ; load the thing
118 call bdos ; read records
120 ; now, copy CCP to bank 0 for reloading
122 ld bc,2*256 + tpa$bank ; c: src$bnk, b: dst$bnk
125 ; just copy in the other direction
127 ld bc,tpa$bank*256 + 2 ; c: src$bnk, b: dst$bnk
133 ld bc,ccpsize ; clone 3K, just in case
137 no$ccp: ; here if we couldn't find the file
138 call pr.inln ; report this...
139 db 13,10,'BIOS Err on A: No CCP.COM file',0
141 call ?conin ; get a response
142 jr ?ldccp ; and try again
145 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
152 db (hwini0_e-$)/2 ;count
153 db rcr,CREFSH ;configure DRAM refresh
154 db dcntl,CWAITIO ;wait states
155 db ccr,M_NCD ;No Clock Divide
156 db cmr,PHI_X2 ;X2 Clock Multiplier
157 db omcr,~M_IOC ;Operation Mode Control Register
162 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]