; ; I. FORMAT A DISK ; FMTDSK DB 'Disk to FORMAT:',0 JSR GETDN ;GET DRIVE NUMBER OR NAME JSR DEFPAR ; LDA #HIGH[PAR] STA IBUF+$10+1 LDA #LOW[PAR] STA IBUF+$10 ; LDY #1 LDA (FNPTR),Y STA FMTDVN ; ; MAKE SURE ABOUT DRIVE NUMBER ; JSR PRINT DB '(Press [A] for Enhanced Dns)',$9B DB 'Type [Y] to Format Drive ' FMTDVN DB '0:',0 ; JSR CHRGET CMP #'A' BEQ FMT1050 EOR #'Y' BNE WBX DOFMT STA IAUX+$10 LDA #0 LDX OPT ;REAL FORMAT? CPX #'N' BNE RELFMT ROR A RELFMT STA IAUX+1+$10 ; LDA #FORMAT STA ICMD+$10 LDX #$10 JSR CIOV ;DO FORMAT OF DISK BPL WBX WBERR JMP CIOER1 ;IF ERROR, SAY SO! WBX DEY BEQ ALFMTD JSR ERRXIT DC 'W','A','R','N','I','N','G' DB ': Bad sectors on disk!',$9B,0 ALFMTD JMP MENUSL ; FMT1050 LDA #1 BNE DOFMT ; ; H. WRITE DOS/DUP TO DISK ; DUPFNM DB 'D1:DUP.SYS',$9B WBOOT DB 'Drive to write DOS files to?',0 JSR GETDN LDA DUPSYS+1 PHA LDA #'1' STA DUPSYS+1 STA NMSAV+1 LDY #1 LDA (FNPTR),Y CMP #':' BNE CANWB LDA DEFAULT CANWB STA DOSSYS+1 STA DUPFNM+1 ; DEY ;SET UP INITIAL VALUES OF PARMS. STY OPT LDA #$80 STA STATE ; LDA #LOW[DOSSYS] LDY #HIGH[DOSSYS] JSR DBUF10 LDA #8 ;OPEN OUTPUT=WRITE DOS.SYS STA IAUX+$10 JSR ANYDEN ;OPEN AND WRITE DOS.SYS (ANY DENSITY) JSR CLOS10 PLA STA NMSAV+1 STA DUPSYS+1 ; ; **** WRITE DUP.SYS HERE **** ; LDY #$70 LDA #LOW[DUPBASE] LDX #HIGH[DUPBASE] JSR D2B8A ; LDA #HIGH[DUPFNM] STA IBUF+$10+1 LDA #LOW[DUPFNM] STA IBUF+$10 LDA #HIGH[DUPEND-1] STA HDBUF+3 LDA #LOW[DUPEND-1] STA HDBUF+2 LDA #HIGH[DUPLEN] STA HDBUF+5 LDA #LOW[DUPLEN] STA HDBUF+4 ; LDA #0 STA TEMP ;CLEAR 'RUN' FLAG JMP WRDUP ;WRITE DUP.SYS ; ; J. DUPLICATE A DISK ; DUPDSK DB 'Source, Destination (Sectors)?',$9B,0 JSR GETDN LDY #1 LDA (FNPTR),Y AND #$0F ;GET DRIVE NUMBER STA CSRC STA CDES LDA DELIM ;IF SINGLE DRIVE DUP. CMP #'(' BEQ SETSSZ ;GO SET SECTOR SIZE JSR GETDN2 ;ELSE, GET SECOND DRIVE NAME LDY #1 LDA (FNPTR),Y AND #$0F STA CDES CMP CSRC ;SAME DRIVE? BNE SETSSZ ;YES, SINGLE DRIVE DUP. LDX #$9B STX SWPFLG SETSSZ TAX LDY CSRC LDA SWPFLG ORA #$40 ;SET DUP-DISK FLAG STA SWPFLG BMI DODKDP JSR PRINT DB 'Insert both disks, type ' DC 'R','E','T','U','R','N' DB 0 JSR CHRGET ; DODKDP JSR CWFSD LDA CSRC ;POINT TO SOURCE DRIVE JSR GETDEN ;IDENTIFY DENSITY OF SOURCE DISKETTE LDY CDES ;ELSE, TWO DRIVE DUP. LDX CSRC LDA DKTYPE-1,X CMP DKTYPE-1,Y BEQ SAME STY UNNO JSR SETDEN LDY CDES LDX CSRC LDA DKTYPE-1,X CMP DKTYPE-1,Y BEQ SAME JSR ERRXIT DB 'Drives not compatible!',$9B,0 SAME ASL WARMST LSR A STA SECSIZ+1 ROR A STA SECSIZ ;SET SECTOR SIZE (128 OR 256) STX DUNIT ;READ SOURCE VTOC ; LDA DELIM PHA LDA #$FF TAX INIBMP STA DATA+128,X STA DATA+256,X DEX BNE INIBMP PLA ;BOOT COPY? CMP #'(' BEQ BLDVTOC ;YES, BUILD IMAGINARY VTOC CMP #$9B BEQ RDVTOC ;NO, DOS COPY OOPS JSR ERRXIT ;ELSE, ERROR DB 'Invalid options!',$9B,0 BLDVTOC JSR GETNUM CPY #'-' BNE OOPS STA DATA+3 STX DATA+4 JSR GETNUM CPY #')' BNE OOPS STA DATA+1 STX DATA+2 LDY #0 STY PTR STY DATA+6 STY DATA+5 ; LDA #HIGH[DATA+10] STA BUFAD+1 LDA #LOW[DATA+10] STA BUFAD ; LDA #$FE D26BB LDX DATA+6 CPX DATA+4 BNE D26CB LDX DATA+5 CPX DATA+3 BCS D26D2 D26CB SEC ROL A JSR NXTSCT BNE D26BB ; D26D2 LDX DATA+2 CPX DATA+6 BCC D26EA BNE D26E4 LDX DATA+1 CPX DATA+5 BCC D26EA D26E4 ASL A JSR NXTSCT BNE D26D2 ; D26EA SEC ROL A BCS D26EA STA (BUFAD),Y ; RDVTOC SEC LDA MEMTOP SBC SECSIZ STA BUFLEN LDA MEMTOP+1 SBC SECSIZ+1 STA BUFLEN+1 ; LDA BUFLEN CMP #LOW[DUPEND] LDA BUFLEN+1 SBC #HIGH[DUPEND] BCS ENUF JSR ERRXIT DB 'Not enough memory!',$9B,0 ; NXTSCT BCS D272E STA (BUFAD),Y LDA #$FE INC BUFAD BNE D272E INC BUFAD+1 D272E INC DATA+5 BNE D2736 INC DATA+6 D2736 RTS ; ENUF LDA PTR BEQ SKRDVT ;IF POS, SKIP READING VTOC LDA #LOW[360] LDX #HIGH[360] STA DAUX STX DAUX+1 LDA #LOW[DATA] LDX #HIGH[DATA] STA DBUF STX DBUF+1 JSR RSEC1 BPL NOERFD JMP CIOER1 NOERFD CLC LDA DATA+1 ADC #12 ;ADD IN THE BOOT, MAP AND DIR SECTORS STA DATA+1 BCC CK2BIT ;THEN TAKE CARE OF SECOND BIT MAP IF NEC. INC DATA+2 ;ELSE, BUMP UPPER BYTE CK2BIT LDA DATA CMP #4 BCC SKRDVT ;IF SINGLE SECTOR, SKIP READING SECOND INC DATA+1 CLC LDA DBUF ADC DLEN STA DBUF LDA DBUF+1 ADC DLEN+1 STA DBUF+1 DEC DAUX JSR RSEC1 ; SKRDVT LDA #0 STA DAUX+1 LDA #1 STA DAUX LDA DATA+10 STA CBYTE LDA #8 STA IPTR LDA #HIGH[DATA+10] STA VECTOR+1 LDA #LOW[DATA+10] STA VECTOR ; DORD LDA VECTOR STA PTRSAV LDA VECTOR+1 STA PTR LDA IPTR STA IPSAV LDA CBYTE STA CBSAV LDA DAUX STA SECTOR LDA DAUX+1 STA SECTOR+1 LDA #0 STA CPYTYP ;SET OPERATION TO 'READ' LRS LDA #HIGH[DUPEND] STA DBUF+1 LDA #LOW[DUPEND] STA DBUF LRS1 ASL CBYTE DEC IPTR BNE CBIT INC VECTOR BNE PAGE1 INC VECTOR+1 PAGE1 LDY #0 LDA (VECTOR),Y STA CBYTE LDX #8 STX IPTR CBIT BIT CBYTE BMI ASPT LDA CPYTYP ASL A ;CY=0, READ; CY=1, WRITE LDA CSRC BCC RSECIN ;ACC=DRIVE # LDA CDES RSECIN JSR SECTIO ;READ OR WRITE IOD CLC LDA DBUF ADC SECSIZ STA DBUF LDA DBUF+1 ADC SECSIZ+1 STA DBUF+1 ASPT LDA DAUX CMP DATA+1 LDA DAUX+1 SBC DATA+2 BCC ASPN ; LDA CPYTYP ;END OF DRIVE BPL STDD2 ;IF READ, DO WRITE JMP MENUSL ;IF WRITE, THEN DONE! ; ASPN INC DAUX BNE ASPX INC DAUX+1 ASPX LDA BUFLEN ;ELSE, END OF THE BUFFER? CMP DBUF LDA BUFLEN+1 SBC DBUF+1 BCS LRS1 ;NO, GET NEXT SECTOR ; LDA CPYTYP BPL STDD2 ;IF WRITE, DO NEXT READ JSR CWFSD JMP DORD ; STDD2 BIT SWPFLG BPL CKFORM JSR PRINT IDD DB 'Insert DESTINATION disk, press ' DC 'R','E','T','U','R','N' DB 0 JSR CHRGET CKFORM LDA #'N' CMP OPT BEQ NOFORM STA OPT LDX #$20 ;IF FORMAT REQ., DO IT LDA #LOW[DOSSYS] LDY #HIGH[DOSSYS] JSR DEFBUF LDA #FORMAT STA ICMD+$20 LDA CDES ORA #'0' ;CONVERT DRIVE NO. TO ASCII STA DOSSYS+1 JSR CIOCL NOFORM DEC CPYTYP ;THEN, MAKE A WRITE LDA PTRSAV STA VECTOR LDA PTR STA VECTOR+1 LDA SECTOR STA DAUX LDA SECTOR+1 STA DAUX+1 LDA IPSAV STA IPTR LDA CBSAV STA CBYTE JMP LRS