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
52 call intinit ; setup interrupts and vectors
56 ; ld hl,1000000000000000b ; assign console to AVRCON:
57 ld hl,0010000000000000b ; assign console to ASCI1:
60 ld hl,0000000000000000b ; assign printer to nothing:
62 ld hl,0000000000000000b ; assign AUX to ASCI0:
67 call prt0ini ; init timer
70 call gs_rtc ; get time and date
73 ld (@cbnk),a ; right now in bank 0
75 call pr.inln ; print signon message
76 db 13,10,13,10,'CP/M Version 3.1, Z180-Stamp BIOS v'
79 dc 'Estimated CPU clock [Hz]: '
88 cseg ; boot loading must be done from resident memory
90 ; This version of the boot loader loads the CCP from a file
91 ; called CCP.COM on the system drive (A:).
93 ; First time, load the A:CCP.COM file into TPA
98 ld (ccp$fcb+15),a ; zero extent
100 ld (fcb$nr),hl ; start at beginning of file
102 ld c,open ; open file containing CCP
105 jp z,no$ccp ; error if no file...
107 ld c,setdma ; start of TPA
110 ld c,setmulti ; allow up to 16k bytes
113 ld c,read ; load the thing
114 call bdos ; read records
116 ; now, copy CCP to bank 0 for reloading
118 ld bc,2*256 + tpa$bank ; b: dst$bnk, c: src$bnk
121 ; just copy in the other direction
123 ld bc,tpa$bank*256 + 2 ; b: dst$bnk, c: src$bnk
129 ld bc,ccpsize ; clone 3K, just in case
133 no$ccp: ; here if we couldn't find the file
134 call pr.inln ; report this...
135 dc 13,10,'BIOS Err on A: No CCP.COM file'
137 call ?conin ; get a response
138 jr ?ldccp ; and try again
141 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
148 db (hwini0_e-$)/2 ;count
149 db rcr,CREFSH ;configure DRAM refresh
150 db dcntl,CWAITIO ;wait states
151 db ccr,M_NCD ;No Clock Divide
152 db cmr,PHI_X2 ;X2 Clock Multiplier
153 db omcr,~M_IOC ;Operation Mode Control Register
158 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]