; LAST UPDATED: 29 MAY 83 -- no specific version number for libraries ; REASON FOR UPDATE: Added drivers for the Disk 2 and Disk 3 controllers, ; and modified the 8 inch boot code to conform with an enhanced ; range of acceptable formats. The 8 inch code was also ; modified to permit relatively transparent conversion to ; driving the Disk 1-5 for a range of 5 1/4 formats. aep ; ; PROGRAM NAME: BOOTSCPM.LIB -- small dependent routines to perform ; the cold and warm boot functions in the CP/M environment, ; developed for CompuPro Systems Disk Components. ; ; ========================== Copyright 1983, CompuPro Corporation, ; || || A division of Godbout Electronics. ; || BOOTSCPM.LIB || Oakland Airport, Oakland, CA ; || || ; ========================== ; ; This product is a copyright program product of CompuPro and is ; supplied for use with the CompuPro Computer Systems. ; ; EXTERNALS: CP/M 2.2 CBIOS, CP/M-86 CBIOS, MP/M-86 XIOS, or the ; CompuPro developed propriatary combinations of them. ; ;============================================================================ ; ; 8 Inch Floppy Disk Layout Definition: CP/M-80 ; ; Cylinder 0 Head 0 -- always 128 byte sectors ; 1 thru 2 Boot program, corresponds to new CBIOS locations. ; 3 thru 26 Reserved for CBIOS. ; ; 256 byte sectors -- Cylinder 1 Head 0: ; 1 thru 7 CCP. ; 8 thru 21 BDOS. ; 22 thru 26 **Reserved for CP/M expansion** ; ; 512 byte sectors -- Cylinder 1 Head 0: ; 1 thru 3 CCP. ; 4 thru 11 BDOS. ; 12 thru 15 **Reserved for CP/M expansion** ; ; 1024 byte sectors -- Cylinder 1 Head 0: ; 1 CCP. ; 2 thru 5,7 BDOS. ; 6 **Reserved for CP/M expansion** ; ;=========================================================================== ; ; PURPOSE: Macro library of WARM and COLD BOOT routines for each type of ; CompuPro Disk controller available, it currently supports ; the following hardware: ; ; 1) CompuPro Disk 1, single/double density 8 inch floppy disk controller. ; 2) CompuPro Disk 1-5, similar to the 8 inch, but parts and program ; changes for 5 1/4 inch disks. ; 3) CompuPro Disk 2 hard disk controller, up to 4 drives, maximum data ; transfer rate approx 7.5 megabits/sec. Drives currently range ; from 10 megabytes to 40 megabytes formatted. ;------------------------------- ; ; Single active macro with conditionally activated controller specifics. BOOTCPM MACRO ;;Routines to boot CP/M from various disk drives and types -- LOADCPM CALL HOME ;Force buffer flush, clear Host Active flag MVI C,BDISK-'A' ;Select Boot Disk MVI E,0 ;Force disk type determination CALL SELDSK MOV A,L! ORA H ;Error if drive not selectable, JZ BCPME ; wait and try again ;-------------------------------- if BOOT8X ;8 inch floppy disk boot LXI H,ACTTYP ;Get disk type MOV A,M! RAR ;Remove sided bit DCR A ;Single density won't hold CP/M CPI 3 ;Check for valid 8 inch JNC BCPME ;Error if not MVI B,0! MOV C,A ;Offset for # of sectors to read in "B,C" MOV A,M ;Get disk type again DCX H! DCX H MOV M,B! DCX H ;Upper track # is 0 ANI 1b ;Mask sided bit INR A ;Add to cylinder 1 MOV M,A ;To get track number DCX H! DCX H ;Skip gap length specification MOV M,B! DCX H ;Start at sector 0 XCHG LXI H,BSECT! DAD B ;Boot sector table MOV A,M! XCHG ;Get number of sectors STA NUMSEC ;Saved MOV M,B! DCX H ;Set extended address to 0 (for dual processor) MVI M,(CCP SHR 8) ;Set buffer address DCX H MVI M,(CCP AND 0FFh) CALL RDMFM ;Read data MFM JNZ BCPME ;If read errors MVI A,1! STA NUMSEC ;Set number of sectors to read LDA ACTTYP ;Get type again CPI 6! RC ;Done if not 1024 byte LXI H,CCP+(5*1024)-512 ;Back off so end of sector is end of BDOS SHLD BUFADR MVI A,7! STA ACTSEC ;Skip to last sector for fastest boot CALL RDMFM ;Read data MFM RZ ;Done if read valid endif ;------------------------------- if D2BOOT ; DISK 2 controller performs boot LXI B,1 ;Boot is always from track #1 CALL SETTRK ;and usually thats all thats needed LXI H,CCP ;Start loading at base of CP/M (CCP) LXI B,0 ;Start the sector counter NXTBOOT PUSH H ;Put DMA back on stack PUSH B ;Save sector count on stack CALL SETSEC ;Set the current sector number POP H ;Recover sector count in "H,L" XTHL ;Save it again, and get DMA pointer MOV B,H ! MOV C,L ;Duplicate address in "B,C" LXI H,128 ! DAD B ;Bump by 128 (record lenght) for next read PUSH H ;And save updated address on the stack CALL SETDMA ;Set the current start DMA for a transfer CALL READ ;Read a sector, status in "A" amd status bits POP H ;Recover next DMA again POP B ;Recover sector count from stack JNZ BOOTERR ;Error if not read correctly INR C ! MOV A,C ;Bump the sector count for next read CPI BOOTSEC + 1 ;See if the number of boot records are loaded RZ ;Done if all sectors booted in JMP NXTBOOT ;Get another boot sector if not ; BOOTERR MVI C,'*' ! CALL CO ;Show error with star at console MVI C,07h ! CALL CO ;and ring the bell to indicate system alive ; ; Fall through to the delay routine, followed by another try. endif ; End of Disk 2 boot specific area. ;------------------------------- if CPUSPD > 6 BCPME LXI B,0 ;Absolute maximum if CPU very fast else BCPME LXI B,8930*CPUSPD ;Wait 500 milliseconds endif DELAY XTHL! XTHL ;Small size instructions that eat lots of time DCX B! MOV A,C! ORA B JNZ DELAY ;If not desired count JMP LOADCPM ;And try booting again ; if BOOT8X BSECT DB 22*256/256 ;double 256 byte sectors DB 22*256/512 ;double 512 byte sectors DB 22*256/1024 ;double 1024 byte sectors endif ; Macro code pseudo operand ending this routine. ENDM ; ;============== end of disk warm and cold boot routines ==============