* this code loads and runs a system binary from a 7906 drive * adapted from 1/10/04 7900ldr, last mod 6/15/05 (prev) * mod 3/5/21 change STC 6 to STC 6,C * entry: IRQ/DMS off, parms in locations... (octal) * 246 - block address (high block not supported) * 250 - drive number, 0-7 removeable 8-15 (oct 10-17) fixed * DC EQU 16B BLOCK EQU 246B DRVNM EQU 250B ORG 77500B * LDA BLOCK GET BLOCK ADDRESS TO BOOT FROM STA BLADR STORE IN BLOCK ADDRESS VARIABLE LDA DRVNM AND C7 STA DRIVE Bits 0-2 of highlev DRV = drive# 0-7 LDA DRVNM AND C8 CLB SZA LDB CB9 STB PLATT Set bit 9 of PLATT if DRV bit 3 set * DRV values 0-7 refer to removeable, 8-15 refer to fixed platts of 0-7 KLOOP JSB LSEEK MOVE HEAD TO DESIRED BLOCK ADDRESS CLC DC CLF DC LDA CW1A OTA 6 SEND DMA CTRL WORD CLC 2 LDA CW2B OTA 2 SEND MEM ADDR STC 2 LDA CW3A OTA 2 SEND LEN (-1KW) LDA RDCMD IOR DRIVE STC 6,C START DMA (fix 3/5/21) OTA DC,C START DISK READ SFS DC JMP *-1 ISZ CSLEN YES. CHECK FOR NEXT SECTOR. JMP NXTSE MORE. JUMP TO NEXT SECTOR. CLF 6 DMA OFF JMP *+1,I FAR JUMP TO RUN ADDRESS OCT 2 start at location 2 NXTSE JSB INCSE CALL SUB TO SET UP FOR NEXT SECTOR JMP KLOOP LOOP TO LOAD NEXT SECTOR * INCSE NOP SUB ENTRY LDA CW2B GET DMA ADDRESS ADA SESIZ ADD 2000, 1K "SECTOR" STA CW2B WRITE IT BACK ISZ BLADR NEXT BLOCK ADDRESS JMP INCSE,I RETURN * LSEEK NOP * each cylinder contains 96 sectors, 48 on the top * and 48 on the bottom. Head is indicated by bit 8 * of HDSEC, bits 0-5 are sector, 0-47. Each 1K logical * sector = 8 real sectors. Formulas... * Cylinder = int(BlockAddress / 12) * HeadSector = (BlockAddress MOD 12) * 8 * If HeadSector >= 48 Then * HeadSector = HeadSector - 48 * Set bit 8 to indicate head 1 LDA BLADR CLB * DIV OCT 100400 DEF C12 STA CYLNO cyl=block / 12 LDA 1 get remainder * MPY OCT 100200 DEF C8 STA HDSEC hdsec = block mod 12 * 8 ADA CM48 A = hdsec - 48 SSA skip if sign clear (hdsec>=48) JMP SEEK ready to seek IOR CB8 set bit 8 STA HDSEC hdsec = hdsec - 48 with bit 8 set SEEK LDA SKCMD IOR DRIVE CLC DC CLF DC OTA DC send seek cmd SFS DC JMP *-1 LDA CYLNO STF DC OTA DC send cylinder SFS DC JMP *-1 LDA HDSEC IOR PLATT adjust hdsec for platter STF DC OTA DC send head/sector SFS DC JMP *-1 JMP LSEEK,I return from sub * CW1A OCT 120016 DMA PROGRAM CONTROL WORD (DC=16) CW3A OCT 176000 DMA LENGTH -1024 DEC RDCMD OCT 002400 READ COMMAND SKCMD OCT 001200 SEEK COMMAND C7 OCT 7 C8 DEC 8 C3 OCT 3 MASK FOR BITS 0,1 C12 DEC 12 CM48 DEC -48 CB8 OCT 000400 CB9 OCT 001000 SESIZ OCT 2000 BLOCK SIZE CSLEN DEC -31 COMPLEMENTARY #BLOCKS CW2B OCT 100002 DMA STARTING ADDRESS CYLNO OCT 0 CYLINDER NUMBER HDSEC OCT 0 HEAD/SECTOR * HDSEC bits 8,9 = head, bits 0-5 = sector BLADR OCT 0 BLOCK ADDRESS DRIVE OCT 0 PLATT OCT 0 *