1 title 'Boot loader module for CP/M 3.0'
5 public hwinit,?init,?ldccp,?rlccp
7 extrn ?boot,?pmsg,?conin
8 extrn ioini1l,msginit,mmuinit,intinit
9 extrn @civec,@covec,@aivec,@aovec,@lovec
27 dseg ; init done from banked memory
40 call mmuinit ; setup mmu registers
45 ld hl,0100000000000000b ; assign console to ASCI1:
48 ld hl,0000000000000000b ; assign printer to nothing:
50 ld hl,0100000000000000b ; assign AUX to ASCI0:
55 call intinit ; setup interrupts and vectors
58 ld (@cbnk),a ; right now in bank 0
61 call ?pmsg ; print signon message
65 cseg ; boot loading most be done from resident memory
67 ; This version of the boot loader loads the CCP from a file
68 ; called CCP.COM on the system drive (A:).
72 ; First time, load the A:CCP.COM file into TPA
74 ld (ccp$fcb+15),a ; zero extent
76 ld (fcb$nr),hl ; start at beginning of file
78 call open ; open file containing CCP
80 jp z,no$ccp ; error if no file...
82 call setdma ; start of TPA
84 call setmulti ; allow up to 16k bytes
86 call read ; load the thing
88 ; copy CCP to bank 0 for reloading
90 ld bc,ccpsize ; clone 3K, just in case
92 push af ; save current bank
95 call ?bnksl ; select TPA
99 call ?bnksl ; select extra bank
101 ld (hl),a ; save the byte
103 dec bc ; bump pointer, drop count
108 call ?bnksl ; restore original bank
111 no$ccp: ; here if we couldn't find the file
113 call ?pmsg ; report this...
114 call ?conin ; get a response
115 jp ?ldccp ; and try again
120 ld bc,ccpsize ; clone 3K
123 call ?bnksl ; select extra bank
127 call ?bnksl ; select TPA
129 ld (hl),a ; save the byte
131 dec bc ; bump pointer, drop count
138 ; CP/M BDOS Function Interfaces
142 jp bdos ; open file control block
146 jp bdos ; set data transfer address
150 jp bdos ; set record count
154 jp bdos ; read records
158 db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0
160 ccp$msg:db 13,10,'BIOS Err on A: No CCP.COM file',0
163 ccp$fcb:db 1,'CCP ','COM',0,0,0,0
169 db (hwini0_e-$)/2 ;count
170 db rcr,CREFSH ;configure DRAM refresh
171 db dcntl,CWAITIO ;wait states
172 db ccr,M_NCD ;No Clock Divide
173 db cmr,PHI_X2 ;X2 Clock Multiplier
174 ;TODO: db omr, ;Operation Mode Control Register