title 'Boot loader module for CP/M 3.0' version equ 10 ;5/22/83 version display ; db 09h ;5/14/83 working version for banked/ccp saved ;verbt db 08h ;3/27/83 add uart initialization maclib cpm3cnfg ;configuration switches public ver$bt ;version string extrn showvr ;show module versions ; public ?init,?ldccp,?rlccp extrn ?pmsg,?conin extrn @civec,@covec,@aivec,@aovec,@lovec extrn @cbnk,?bnksl extrn @banks ;banks for interbank move (xmove) maclib z80 bdos equ 5 if banked ;the system, not the ccp tpa$bank equ 1 else tpa$bank equ 0 endif ccp$bank equ 2 dseg ; init done from banked memory ?init: lxi h,0 shld @banks ;set interbank banks to 0 & 0 ; ; console ; lxi h,08000h shld @civec shld @covec ; assign console to VIOX: ; ; list ; lxi h,01000h shld @lovec ; assign list to CENT (compupro io4 user 0) ; ; auxillary device ; lxi h,04000h shld @aivec shld @aovec ; assign AUX to SS1 ; ; say hello ; lxi h,signon$msg ! call ?pmsg ; print signon message call showvr ;print versions ret ver$bt: db 'boot ', version / 10 + '0', version mod 10 + '0', 0 cseg ; boot loading must be done from resident memory ; This version of the boot loader loads the CCP from a file ; called CCP.COM on the system drive (A:). If ccpbanked is ; true then it gets copied to a spare bank and is copied from ; there on each warm start rather than re-loading from disk ; each time. ?ldccp: if not ccpbanked ?rlccp: ;re-load is same as load for non-banked endif if debug lxi h,atccpm call ?pmsg endif ; First time, load the A:CCP.COM file into TPA xra a ! sta ccp$fcb+15 ; zero extent ; inr a ;set drive 1 ; sta ccp$fcb lxi h,0 ! shld fcb$nr ; start at beginning of file lxi d,ccp$fcb ! call open ; open file containing CCP inr a ! jz no$CCP ; error if no file... if debug lxi h,ccpopen call ?pmsg endif lxi d,0100h ! call setdma ; start of TPA lxi d,128 ! call setmulti ; allow up to 16k bytes lxi d,ccp$fcb ! call read ; load the thing ; now, ; copy CCP to bank 0 for reloading if debug lxi h,loadedm call ?pmsg endif if not ccpbanked ret else lxi h,0100h ! lxi b,0c80h ; clone 3K, just in case lda @cbnk push psw ; save current bank ld$1: mvi a,tpa$bank ! call ?bnksl ; select TPA mov a,m ! push psw ; get a byte mvi a,ccp$bank ! call ?bnksl ; select extra bank pop psw ! mov m,a ; save the byte inx h ! dcx b ; bump pointer, drop count mov a,b ! ora c ; test for done jnz ld$1 if debug lxi h,copiedm call ?pmsg endif pop psw call ?bnksl ; restore original bank ret endif if debug atccpm: db 0ah, 0dh, 'At ?ldccp',0 ccpopen: db 0ah, 0dh, 'CCP open',0 loadedm: db 0ah, 0dh, 'CCP loaded',0 copiedm: db 0ah, 0dh, 'CCP copied to spare bank',0 endif ; ; here if we couldn't find the file ; no$CCP: lxi h,ccp$msg ! call ?pmsg ; report this... call ?conin ; get a response jmp ?ldccp ; and try again if ccpbanked ?rlccp: lxi h,0100h ! lxi b,0c80h ; clone 3K rl$1: mvi a,ccp$bank ! call ?bnksl ; select extra bank mov a,m ! push psw ; get a byte mvi a,tpa$bank ! call ?bnksl ; select TPA pop psw ! mov m,a ; save the byte inx h ! dcx b ; bump pointer, drop count mov a,b ! ora c ; test for done jnz rl$1 ret endif ; CP/M BDOS Function Interfaces open: mvi c,15 ! jmp bdos ; open file control block setdma: mvi c,26 ! jmp bdos ; set data transfer address setmulti: mvi c,44 ! jmp bdos ; set record count read: mvi c,20 ! jmp bdos ; read records signon$msg db 13,10,13,10 db 'CP/M Version 3.0, bios 07',13,10 if banked db 'System Banked', 13,10 endif if ccpbanked db 'CCP banked', 13,10 endif db 0 ;end of text marker ccp$msg db 13,10,'BIOS Err on A: No CCP.COM file',0 ccp$fcb db 1,'CCP ','COM',0,0,0,0 ds 16 fcb$nr db 0,0,0 end