TITLE 'CP/M plus boot loader of 4-12-83' ; ; copyright (c) 1983 Tarbell Electronics ; tarbell electronics cp/m plus coldstart loader ; ;************************************************ ; change notices * ; modified for tarbell cpu card - 7-3-80. * ; modified for deblock - 3-21-81 * ; modified for head loaded check - 4-8-81 * ; modified for cp/m boot operation- 5-4-81 * ; added masking off of intrp bits - 8-19-81 * ; added clear function for extended latch * ; g.w.mulchin tarbell electronics * ; ; setup to work with all tarbell formats 4-12-83* ; Edwin E. Smith * ;************************************************ ; ; this program is loaded at location zero by the ; bootstrap program, and executed. its purpose ; is to load and execute the cp/m plus loader. ; FALSE EQU 0000H TRUE EQU NOT FALSE ;define value of true. ; ;********* this is the area to make changes in *********** ;********* for different system configurations *********** ; ** DBLK EQU TRUE ;true if using deblocked disk ** DUBSID EQU TRUE ;true for double sided systems. ** DUBDEN EQU TRUE ;true for double density disks. ** BASE EQU 00H ;tarbell i/o ports (00 or10 hex)** SPT EQU 26 ;number of sectors on track 0. ** IF DBLK ;deblocked disk ** DDS EQU 7 ; 512 byte sectors trk 1 ** ELSE ;non-deblocked disk ** DDS EQU 26 ; 128 byte sectors trk 1 ** ENDIF ; ** DISK EQU 0F8H ;disk port base address. ** ; ** ;********************************************************* ; ; IO EQU BASE ;i/o ports on tarbell cpu. MMENB EQU IO+10 ;memory management enable port. MEMMAG EQU BASE+32 ;memory management port. ADR0 EQU 0E0H ;dma address port. WCT0 EQU 0E1H ;dma word count port. CMND EQU 0E8H ;dma command port. DCOM EQU DISK ;command port. DSTAT EQU DISK ;status port. TRACK EQU DISK+1 ;track port. SECT EQU DISK+2 ;sector port. DATA EQU DISK+3 ;data port. WAIT EQU DISK+4 ;wait port. DCONT EQU DISK+4 ;control port. DMACHK EQU DISK+5 ;dma check port. EXTMEM EQU DISK+5 ;extended memory latch port PANEL EQU 0FFH ;front panel machines. BOOTE EQU 0100H ;cp/m loader entry point. SDS EQU 25 ;always 25 sectors to read in trk 1. NSECTS EQU SDS + DDS ;sectors of cp/m. RTCNT EQU 10 ;number of retrys. ; ORG 0 ;start of loader. ; BOOT: MVI A,7EH ;mask off intrps OUT BASE+9 ;set the latch on cpu board ; XRA A ;clear reg a OUT EXTMEM ;clear latch on disk board LXI D,NSECTS SHL 8 OR RTCNT BLOOP: LXI SP,100H ;set stack pointer. LXI H,BOOTE ;cp/m loader starts here. MVI C,2 ;sector number. RNSEC: CALL READ ;read first sector. DCR D ;if done, JZ BOOTE ;go to cp/m. INR C ;increment sector count. MOV A,C ;done with CPI SPT+1 ;this track? JRC RNSEC ;if not, read next sector. ; IF DUBSID AND (DBLK OR DUBDEN) MVI A,48H ;set doub dens & side select command. OUT WAIT ENDIF IF DUBSID AND NOT (DBLK OR DUBDEN) MVI A,40H ;set side select bit OUT WAIT ENDIF IF (DBLK OR DUBDEN) AND NOT DUBSID MVI A,8H ;set doub dens code OUT WAIT ;set latch for d.density ENDIF IF NOT DUBSID MVI A,5BH ;step command. OUT DCOM ;issue it. IN WAIT ;wait until done. ENDIF ; MVI C,1 ;sector number. JMP RNSEC ;read next track. ; READ: MOV A,C ;sector in a. OUT SECT ;set sector register. MVI B,80H ;command for read. IN DSTAT ;check head loaded ANI 20H ;mask for head bit MVI A,0 JRZ HDLD ;head not loaded MVI A,4 HDLD: ORA B ;get head load bit. OUT DCOM ;issue command. RLOOP: IN WAIT ;wait for drq. ORA A ;set flags. JP CHECK ;jump if done. IN DATA ;read data. MOV M,A ;put in memory. INX H ;increment pointer. JMP RLOOP ;loop until done. ; CHECK: IN DSTAT ;read status. ANI 9DH ;look at error bits. RZ ;ok if zero. DCR E ;decrement retry count. JRNZ BLOOP ;try again if not zero. HERE: JMPR HERE ;loop. ; ORG 7DH ;put jump here. RST 0 ;jump to loc. 0 ; IF DBLK AND NOT DUBSID DB 0DEH ENDIF IF DBLK AND DUBSID DB 0DCH ENDIF IF DUBDEN AND NOT (DBLK OR DUBSID) DB 0DDH ENDIF IF DUBDEN AND DUBSID AND NOT DBLK DB 0DFH ENDIF IF DUBSID AND NOT (DBLK OR DUBDEN) DB 0E7H ENDIF IF NOT (DBLK OR DUBDEN OR DUBSID) DB 0E5H ENDIF DB 0 END BOOT ;end of boot.