TITLE 'CompuPro ColdStart Boot for DISK1.' ;GBCBOOT.a86 ColdStart Boot load for CompuPro DISK1 controller. ; ; +-----------------------+ ; | | ; | D i s k | ; | B O O T | ; | | ; +-----------------------+ ; Copyright 1981, CompuPro Corp. ; ; This product is a copyright program product of ; CompuPro and is supplied for use with the GBC 171 ; series controllers. ; ; CompuPro G and G Engineering ; Oakland, CA San Leandro, CA ; ; ; Version number: 2.2 or 1.0 ; Level F 81-03-31 ; G 81-04-17 support CPm-86 ; H 81-05-04 Load CPm-86 per Group heading ; J 81-10-31 Initialize stack pointer ; K 81-12-14 Pure CP/M-86 boot ; ; The following code is supplied to customers who ; purchase a hard/floppy disk system from CompuPro. ; The following code is written onto track 0 sector 0 ; of the disk. This routine is read into memory ; at location 100h by the user's PROM. This routine then ; loads the rest of the system into memory. ; ; ; The format of the Floppy Disk Boot sectors are as follows: ; ; Routine ; T Sector Name ; ; 0 1 thru 4 Boot program (this routine) ; ; 5 thru 24 BIOS-80 | LdBios86 ; 25 | Group Header ; 26 | ReStart88 ; ; 1 1 thru 8 CCP | 0 .. 3 LdCpm86 ; 9 thru 22 BDOS-80 | 4 .. 18 = LdBDOS 86 ; ; 23 thru 26 reserved LEVEL: EQU 10 ;Revision level K: EQU 1024 OPTS: EQU 40H ;Option selections byte N$TRK: EQU 26 ;sectors in Track 0 N$BOOT: EQU 4 ;sectors for Boot SPACE 4,10 ; CPm-86 location symbols. VERS: EQU 10 ;Version = CPm-86 v1.0 LDRBIO: EQU 1200H ;LdBios offset I#JMPL: EQU 0EAH ; Assembly Constants FDPORT EQU 0C0H ;Base port address for Controller FDCS EQU FDPORT ;Status register FDCD EQU FDPORT+1 ;Data register DMA EQU FDPORT+2 ;Dma address (when write) INTS EQU FDPORT+2 ;Status Register (when read) ; Input on port disables boot rom. SER EQU FDPORT+3 ;Serial port MMGR: EQU 0FDH ;IN on this swaps processors DELCNT EQU 6*1000 ;Delay count for 6 MHz processor ; Controller function definitions ; Specify (00) command NSEC EQU 0 ;Sect verify number F.RTK EQU 02 ;Read track F.SPEC EQU 03 ;Specify F.DSTS EQU 04 ;Drive status F.RDAT EQU 06 ;Read data F.RECA EQU 07 ;recalibrate F.RSTS EQU 08 ;Read status F.SEEK EQU 0FH ;Seek SRT EQU 16-8 ;= Shuggart 800s ; 16-3 ;= Shuggart 850s ; 16-3 ;= Remex HUT: EQU 240/16 ;Head unload = 240 ms HLT: EQU (35+1)/2 ;Head load = 35 ms ND: EQU 00 ;Set DMA mode SPACE 4,10 ; Bootstrap load. ; Do not change any addresses from here to START: ; Entry CL= Board switches from ROM (0 .. 3) ORG 100H BOOT: JMP START ;invariance DS 10 STACK: SPACE 4,10 ; Function data for controller to boot DATA DB 0 ;Extended ENTRY: dw 0 LDMA EQU *-DATA READ: DB F.RDAT DB 0 ;hds,ds1,ds0 DB 0 ;C = sector ID info DB 0 ;Head DB N$BOOT+1 ;Record (sector) of BIOS DB 0 ;N DB N$TRK-2 ;Read most of track DB 7 ;GPL DB 128 ;DTL LREAD EQU *-READ ; Read CPm86 Group Header. RGHDR: VFD 8\0, 16\ RGBUF DB F.RDAT DB 0 ;hds,ds1,ds0 DB 0 ;C = sector ID info DB 0 ;Head DB N$TRK-1 ;Record (sector) of Group DB 0 ;N DB N$TRK-1 ;EOT DB 7 ;GPL DB 128 ;DTL ; Disk setup command strings. SPEC DB F.SPEC VFD 4\SRT,4\HUT VFD 7\HLT,1\ND LSPEC EQU *-SPEC RECAL DB F.RECA,0 LRECAL EQU *-RECAL SPACE 4,10 ; Start of Boot code. ; Save board option value. ; Load bios. START: xor ax,ax mov ss,ax mov ds,ax LD SP,#STACK sto cl,opts ;save board options RETRY: ; Load Specify Command LD bx,#SPEC LD CH,#LSPEC CALL DFCN ;direct function ; Recalibrate drive LD CH,#LRECAL CALL DFCN ;Recalibrate RCAL2: INB INTS OR AL,AL JNS RCAL2 ;If not complete LD AL,#F.RSTS OUTB FDCD LD CX,#250 ;Leave lite on for 1/4 second CALL DELAY RCAL3: INB FDCS OR AL,AL JNS RCAL3 INB FDCD SUB AL,#20H MOV CL,AL RCAL4: INB FDCS OR AL,AL JNS RCAL4 INB FDCD OR AL,CL jnz ERROR ;if error in recalibrate ; Now set-up read command & DMA address. LD bx,#RGHDR CALL DREAD ;read header jnz ERROR ;if problems LD AL,#I#JMPL STO AL,XFER LD BX,#LDRBIO ;set up Far Jump to bios STO BX,XFER+1 LD BX,RGBUF+3 STO BX,XFER+3 LD CX,#LDRBIO / 16 ADD BX,CX ;HL-> fwa bios (paragraphs) MOV AL,BL AND AL,#0FH RCL AL RCL AL RCL AL RCL AL STO AL,DATA+2 MOV AL,BH AND AL,#0F0H RCR AL RCR AL RCR AL RCR AL STO AL,DATA+0 ADD BX,BX ADD BX,BX ;shift by 4 ADD BX,BX ADD BX,BX MOV AL,BH STO AL,DATA+1 LD bx,#DATA READB: CALL DREAD ;direct read jnz ERROR ;if problems xfer: jmp 0,0 SPACE 4,10 ; Disk error handler. ERROR: LD CX,#2000 ;wait 2 seconds CALL DELAY JMP RETRY SPACE 4,10 ; Function drive. ; Entry bx-> Command bytes. ; B= length of command. ; Exit bx-> Lwa+1 of command. DFCN: DFCN1: INB FDCS OR AL,AL JNS DFCN1 ;if no master ready bit LD AL,[BX] ;load command byte OUTB FDCD ;to controller INC bx DEC CH JNZ DFCN1 ;if more bytes RET SPACE 4,10 ; Disk Read. ; Entry bx-> (3)DMA, (9)Command ; Exit bx-> Lwa+1 of Command. ; Zbit=> successful read DREAD: PROC LD CH,#LDMA :ADR: LD AL,[BX] OUTB DMA ;set DMA INC bx DEC CH JNZ :ADR ;if NOT all 3 bytes LD CH,#LREAD :1: INB FDCS OR AL,AL JNS :1 ;if no master ready bit LD AL,[BX] ;load command byte OUTB FDCD ;to controller INC bx DEC CH JNZ :1 ;if more bytes :2: INB INTS OR AL,AL JNS :2 ;If not complete :3: INB FDCS OR AL,AL JNS :3 INB FDCD SUB AL,#40H MOV BL,AL :4: INB FDCS OR AL,AL JNS :4 INB FDCD SUB AL,#80H MOV BH,AL LD CH,#7-2 :5: INB FDCS OR AL,AL JNS :5 ;if not ready INB FDCD ;read status DEC CH JNZ :5 ;wait until all done MOV AL,BL OR AL,BH RET SPACE 4,10 ; Delay process. ; Entry cx= delay count (nominal milliseconds). ; Uses al DELAY: LD AL,#DELCNT/26 DELY1: INC CX DEC CX DEC AL JNZ DELY1 ;if not one millisecond DEC CX MOV AL,CH OR AL,CL JNZ DELAY ;if not requested time RET RGBUF: EQU BOOT + N$BOOT*128 END