PAGE ;GBCBIOS5.asm - ; B o o t C P / M f r o m d i s k. ; ; The CBOOT entry point gets control from the cold start ; loader and is responsible for the basic system initial- ; ization. This includes outputting a sign-on message and ; initializing the following page zero locations: ; ; 0 .. 3FF = Interrupt traps ; 380..383 = Irupt 224 for BDOS entry. ; 400..40F = (reserved for debuggers) ; ; Register CL must contain the selected drive, which is ; zero to select the A drive. The exit address is to ; the CCP routine. ; ; The WBOOT entry point gets control when a warm start ; occurs, a ^C from the console, a jump to BDOS (function ; 0), or a jump to location zero. The WBOOT routine does ; only a flush call to the deblocker. ; ; Entry CS= set by far jump. ; 40: (Set by BOOT) Board switch options. ; Exit to CCP or LDCPM ; (0:08) = Banger parameters ; (0:0A) = Board switch options. ; ; If BANG is true (DISK1 bit serial latch is to be ; supported), then board switch option 1 means to ; use the BitBanger for console I/O. ; ; ; Disk layout Definition. ; Cylinder 0 Head 0 ; 0 thru 3 Boot program ; 4 thru 23 Reserved for CBIOS ; 24 Group header of LOADER.CMD ; 25 RESTART code loaded at FFF8:0080 ; ; 256 byte sectors -- Cylinder 1 Head 0: ; 0 thru 3 LDCPM ; 4 thru 17 LDBDOS ; 18 thru 25 **Reserved for CP/M expansion** ; ; 512 byte sectors -- Cylinder 1 Head 0: ; 0 thru 3 CCP ; 4 thru 11 BDOS ; 12 thru 15 **Reserved for CP/M expansion** ; ; 1024 byte sectors -- Cylinder 1 Head 0: ; 0 thru 1 CCP ; 2 thru 5,7 BDOS ; 6 **Reserved for CP/M expansion** space 4 ; WarmStart entry point. ; Called whenever BDOS function 0 is done. WBOOT: CALL HOME ;insure flush & position JMP CCP+6 space 4,10 ; Interrupt trap. ITRAP: CLI ;disable further Irupts MOV AX,CS MOV DS,AX LD BX,#ITRAPM CALL PRINT ITRAP9: HLT ;hard stop JMP ITRAP9 ITRAPM: DB CR,LF,BELCHR DB 'Wild Interrupt!' DB EOS space 4,10 ; Cold Start. CBOOT: proc MOV AX,CS ;Get code segment MOV ES,AX MOV SS,AX LD SP,#STACKP ;top of system space (temp. stack) CLD ;clear direction to forward XOR CX,CX MOV DS,CX LD BL,OPTS ;fetch board option switches MOV DS,AX STO BL,OPT_SW STO AX,DMASEG STO AX,BUFSEG .b IF BANG DEC BL JNZ CBOOT4 ;if BitBanger not selected LD SI,# J.BANG LD DI,# J.CST LD CX,# JLBANG REP MOVSB .ldr IF @LDR CALL BAUD ;get terminal speed PUSH DS LD BX,TICK-1 LD CX,#ZSEG MOV DS,CX STO BX,TICKH ;pass Banger parameters POP DS .ldr else PUSH DS LD CX,#ZSEG MOV DS,CX LD BX,TICKH POP DS STO BX,TICK-1 .ldr endif JMP CBOOTX CBOOT4: .b ENDIF .s IF SMORG LD BL,OPT_SW CMP BL,#2 JNZ CBOOT5 ;If System support not selected LD SI,# J.SMORG LD DI,# J.CST LD CX,# JLSMORG REP MOVSB .ldr IF @LDR CALL STINIT ;Initialize System Support .ldr endif JMP CBOOTX CBOOT5: .s ENDIF .i3 IF INTER3 LD BL,OPT_SW CMP BL,#3 JNZ CBOOT6 ;If Interfacer 3 not selected LD SI,# J.I3ORG LD DI,# J.CST LD CX,# JLI3ORG REP MOVSB LD AX,# I3LST-J.LST-3 STO AX,J.LST+1 .ldr IF @LDR CALL I3INIT ;Initialize Interfacer 3 .ldr endif ; JMP CBOOTX CBOOT6: .i3 ENDIF CBOOTX: .ldr IF @LDR LD CX,#ZSEG MOV DS,CX ;Need to move to absolute low RAM STO #BDOSE,STRAP ;set BIOS interrupt vector MOV AX,CS STO AX,STRPSG ;BDOS code segment same as ours MOV DS,AX ;restore DataSeg LD BX,#SIGNON CALL PRINT ;display signon CALL BCPM ;load LOADER.CMD XOR CX,CX ;default drive JMP CCP+3 .ldr else ;Full BIOS coldstart tasks XOR AX,AX ;AX = 0 STO AL,IOBYTE MOV DS,AX ;Need to move to absolute low RAM MOV ES,AX STO #ITRAP,0 STO CS,2 LD DI,# 4 LD SI,# 0 LD CX,# 2*(256-1) REP ;propagate Trap to all 256 vectors MOVS STO #BDOSE,STRAP ;set BIOS interrupt vector MOV AX,CS MOV DS,AX ;restore segment regs MOV ES,AX XOR CX,CX ;CX = 0 JMP CCP ;Enter Console Command Processor .ldr endif .b IF BANG J.BANG: LOC J.CST JMP KONST JMP KONIN JMP KONOUT LOC *O JLBANG = *-J.BANG .b ENDIF .s IF SMORG J.SMORG: LOC J.CST JMP sCONST JMP sCONIN JMP sCONOUT LOC *O JLSMORG = *-J.SMORG .s ENDIF .i3 IF INTER3 J.I3ORG: LOC J.CST JMP I3CONST JMP I3CONIN JMP I3CONOUT LOC *O JLI3ORG = *-J.I3ORG .i3 ENDIF SPACE 4,10 ; Boot CPM from disk ; ; Exit A = 0, load sucessful. ; Z bit = 1, load successful. .ldr IF @LDR BCPM: proc :0: LD CL,#'A'-'A' ;Select Disk 'A' LD DX,#0 ;Force disk type determination CALL SELDSK TEST BX,BX JZ :E ;If drive not selectable LD AL,SEKTYP ;Get disk type RCR AL ;Remove sided bit DEC AL JS :E ;If invalid boot type MOV CL,AL LD BX,#BSECT ;Boot sector table ADD BX,CX LD AL,[BX] ;Get number of sectors STO AL,NUMSEC STO #CCP,DMAADR ;Set destination address MOV AX,CS ;Set segment address = our CS STO AX,DMASEG LD AL,SEKTYP AND AL,#1 ;Mask sided bit ADD AL,#1 LD BH,#0 MOV BL,AL STO BX,SEKTRK ;Set track LD AL,#0 ;Set boot sector STO AL,SAVSEC CALL SETACT ;Move SEK to ACT LD AL,#F.RDAT+040h ;Read data CALL FINAL JNZ :E ;If read erros LD AL,#1 STO AL,NUMSEC XOR AL,AL ;Clear error indicator RET :E: LD BX,#:M CALL PRINT LD CX,#500 CALL DELAY ;Delay 500 milli-seconds OR AL,#1 ;Set error indicator JMP :0 ;try endlessly :M: DB CR,LF,BELCHR DB 'Can''t read Loader!' DB EOS N$DOSL = high (L$CCP+L$DOS+255) BSECT: DB N$DOSL*256/256 ;MFM 256 byte sectors DB N$DOSL*256/512 ;MFM 512 byte sectors DB N$DOSL*256/1024 ;MFM 1024 byte sectors IF HARD DB N$DOSL*256/256 ;SA 1000 hard disk DB N$DOSL*256/512 ;Memorex 8 inch ENDIF NUMSEC: DB 1 ;xfer length SIGNON: DB CR,LF,LF DB 'CompuPro / Sorcim Systems' DB CR,LF,'CP/M-86 ' DB VERS/10+'0','.',VERS MOD 10 + '0' DB CBIOSV+'@' DB CR,LF, EOS .ldr ENDIF ; Endx GBcbios5