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
31 dseg ; init done from banked memory
44 call mmuinit ; setup mmu registers
52 ld hl,1000000000000000b ; assign console to AVRCON:
55 ld hl,0000000000000000b ; assign printer to nothing:
57 ld hl,0100000000000000b ; assign AUX to ASCI0:
62 call intinit ; setup interrupts and vectors
63 call prt0ini ; init timer
66 call gs_rtc ; get time and date
69 ld (@cbnk),a ; right now in bank 0
71 call pr.inln ; print signon message
72 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0
75 db 'Estimated CPU clock [Hz]: ',0
84 cseg ; boot loading must be done from resident memory
86 ; This version of the boot loader loads the CCP from a file
87 ; called CCP.COM on the system drive (A:).
91 ; First time, load the A:CCP.COM file into TPA
94 ld (ccp$fcb+15),a ; zero extent
96 ld (fcb$nr),hl ; start at beginning of file
98 call open ; open file containing CCP
100 jp z,no$ccp ; error if no file...
102 call setdma ; start of TPA
104 call setmulti ; allow up to 16k bytes
106 call read ; load the thing
108 ; copy CCP to bank 0 for reloading
110 ld bc,ccpsize ; clone 3K, just in case
112 push af ; save current bank
115 call ?bnksl ; select TPA
119 call ?bnksl ; select extra bank
121 ld (hl),a ; save the byte
123 dec bc ; bump pointer, drop count
128 call ?bnksl ; restore original bank
131 no$ccp: ; here if we couldn't find the file
132 call pr.inln ; report this...
133 db 13,10,'BIOS Err on A: No CCP.COM file',0
135 call ?conin ; get a response
136 jp ?ldccp ; and try again
141 ld bc,ccpsize ; clone 3K
144 call ?bnksl ; select extra bank
145 ld a,(hl) ; get a byte
148 call ?bnksl ; select TPA
150 ld (hl),a ; save the byte
151 cpi ; bump pointer, drop count
156 ; CP/M BDOS Function Interfaces
160 jp bdos ; reset disk system
164 jp bdos ; open file control block
168 jp bdos ; set data transfer address
172 jp bdos ; set record count
176 jp bdos ; read records
180 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
187 db (hwini0_e-$)/2 ;count
188 db rcr,CREFSH ;configure DRAM refresh
189 db dcntl,CWAITIO ;wait states
190 db ccr,M_NCD ;No Clock Divide
191 db cmr,PHI_X2 ;X2 Clock Multiplier
192 ;TODO: db omr, ;Operation Mode Control Register
197 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]