1 title 'Boot loader module for CP/M 3.0'
5 public hwinit,?init,?ldccp,?rlccp
9 extrn ?boot,?pmsg,?conin
10 extrn ioini1l,msginit,mmuinit,intinit,cpu_frq
11 extrn @civec,@covec,@aivec,@aovec,@lovec
29 dseg ; init done from banked memory
42 call mmuinit ; setup mmu registers
50 ld hl,0100000000000000b ; assign console to ASCI1:
53 ld hl,0000000000000000b ; assign printer to nothing:
55 ld hl,0100000000000000b ; assign AUX to ASCI0:
60 call intinit ; setup interrupts and vectors
63 ld (@cbnk),a ; right now in bank 0
66 call ?pmsg ; print signon message
70 cseg ; boot loading most be done from resident memory
72 ; This version of the boot loader loads the CCP from a file
73 ; called CCP.COM on the system drive (A:).
77 ; First time, load the A:CCP.COM file into TPA
79 ld (ccp$fcb+15),a ; zero extent
81 ld (fcb$nr),hl ; start at beginning of file
83 call open ; open file containing CCP
85 jp z,no$ccp ; error if no file...
87 call setdma ; start of TPA
89 call setmulti ; allow up to 16k bytes
91 call read ; load the thing
93 ; copy CCP to bank 0 for reloading
95 ld bc,ccpsize ; clone 3K, just in case
97 push af ; save current bank
100 call ?bnksl ; select TPA
104 call ?bnksl ; select extra bank
106 ld (hl),a ; save the byte
108 dec bc ; bump pointer, drop count
113 call ?bnksl ; restore original bank
116 no$ccp: ; here if we couldn't find the file
118 call ?pmsg ; report this...
119 call ?conin ; get a response
120 jp ?ldccp ; and try again
125 ld bc,ccpsize ; clone 3K
128 call ?bnksl ; select extra bank
132 call ?bnksl ; select TPA
134 ld (hl),a ; save the byte
136 dec bc ; bump pointer, drop count
143 ; CP/M BDOS Function Interfaces
147 jp bdos ; open file control block
151 jp bdos ; set data transfer address
155 jp bdos ; set record count
159 jp bdos ; read records
163 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0
165 ccp$msg:db 13,10,'BIOS Err on A: No CCP.COM file',0
168 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
175 db (hwini0_e-$)/2 ;count
176 db rcr,CREFSH ;configure DRAM refresh
177 db dcntl,CWAITIO ;wait states
178 db ccr,M_NCD ;No Clock Divide
179 db cmr,PHI_X2 ;X2 Clock Multiplier
180 ;TODO: db omr, ;Operation Mode Control Register
185 f_cpu dw 0,0 ;detected CPU clock frequency [Hz]