1000 .OPT NO EJECT 1010 ; 1020 ; ========================= 1030 ; 1040 ; MULTICOPY 2.0 1050 ; 1060 ; (C) 1986 1070 ; by Charles F. Johnson and 1080 ; Little Green Footballs 1090 ; 1100 ; Last revision: 03/29/86 1110 ; 1120 ; ========================= 1130 ; 1140 ; 1150 ; ------------------------ 1160 ; Operating system equates 1170 ; ------------------------ 1180 ; 1190 BOOT? = $09 1200 DOSVEC = $0A 1210 DOSINI = $0C 1220 RTCLOK = $12 1230 LMARGN = $52 1240 ROWCRS = $54 1250 COLCRS = $55 1260 SAVMSC = $58 1270 OLDCHR = $5D 1280 RAMTOP = $6A 1290 SDLSTL = $0230 1300 SDLSTH = $0231 1310 COLDST = $0244 1320 STICK0 = $0278 1330 STRIG0 = $0284 1340 COLOR0 = $02C4 1350 COLOR1 = $02C5 1360 COLOR2 = $02C6 1370 COLOR3 = $02C7 1380 COLOR4 = $02C8 1390 CRSINH = $02F0 1400 CH = $02FC 1410 ICCOM = $0342 1420 ICSTA = $0343 1430 ICBAL = $0344 1440 ICBAH = $0345 1450 ICBLL = $0348 1460 ICBLH = $0349 1470 ICAX1 = $034A 1480 COLPF0 = $D016 1490 COLPF2 = $D018 1500 COLPF3 = $D019 1510 CONSOL = $D01F 1520 AUDF1 = $D200 1530 AUDC1 = $D201 1540 SKCTL = $D20F 1550 DLISTL = $D402 1560 DLISTH = $D403 1570 CIOV = $E456 1580 ; 1590 ; -------------------- 1600 ; IOCB command equates 1610 ; -------------------- 1620 ; 1630 OPEN = $03 1640 CLOSE = $0C 1650 GETREC = $05 1660 GETCHR = $07 1670 PUTREC = $09 1680 PUTCHR = $0B 1690 ; 1700 ; ------------------- 1710 ; Page zero variables 1720 ; ------------------- 1730 ; 1740 SRC = $80 1750 DST = $81 1760 RCNT = $82 1770 WCNT = $83 1780 NUM = $84 1790 FLAG = $85 1800 OPN = $86 1810 PAGE = $87 1820 COUNT = $88 1830 POS = $89 1840 STHOLD = $8A 1850 KBHOLD = $8B 1860 TEMP = $8C 1870 MULT = $8D 1880 PCNT = $8E 1890 TOP = $90 1900 ADDR = $92 1910 FLEN = $94 1920 DIRSCR = $96 1930 PNTR1 = $98 1940 PNTR2 = $9A 1950 ; 1960 ; Screen memory 1970 ; 1980 SCREEN1 = BEGIN 1990 SCREEN2 = SCREEN1+$03C0 2000 ; 2010 ; ------------------------ 2020 ; SYSTEM RESET will vector 2030 ; through here 2040 ; ------------------------ 2050 ; 2060 *= $25C6 2070 ; 2080 RESET 2090 JSR $FFFF ;DOS init 2100 RESET2 2110 LDA # OPTIONS ;instead of 2140 STA DOSVEC+1 ;DOS 2150 RTS 2160 ; 2170 ; ------------- 2180 ; Option screen 2190 ; ------------- 2200 ; 2210 OPTIONS 2220 LDA #0 ;Clear choice 2230 LDX #63 ;array 2240 CLCH 2250 STA CHOICE,X 2260 DEX 2270 BPL CLCH 2280 ; 2290 STA COLDST ;No coldstart 2300 STA PCNT 2310 STA PCNT+1 2320 LDA #1 ;Turn off cursor 2330 STA CRSINH 2340 STA BOOT? 2350 JSR CLSCRN ;Clear screen 2360 JSR SETSC1 ;Set page 1 2370 JSR SETDL ;Colors & D.L. 2380 ; 2390 PROPT 2400 LDA #14 ;Print options 2410 STA COLCRS 2420 LDA #2 2430 STA ROWCRS 2440 LDA # >OPTLEN 2450 STA ICBLH 2460 LDA # OPTMSG 2490 JSR PRINT0 2500 STX ICBLH 2510 ; 2520 GET1 2530 LDA #$FF ;Clear keypress 2540 STA CH 2550 GETOPT 2560 LDA STRIG0 ;Button pressed? 2570 BNE G1.2 ;No, skip 2580 JMP CONT2 ;Yes, continue 2590 G1.2 2600 LDA CH 2610 CMP #$FF ;Key pressed? 2620 BEQ GETOPT ;No, go back 2630 CMP #$0C ;Is it RETURN? 2640 BNE G1.3 ;No, skip 2650 JMP CONT2 ;Yes, continue 2660 G1.3 2670 LDX #3 2680 GET2 2690 CMP DIRKEY,X ;Is it 1,2,3,4? 2700 BNE G2.1 ;No, skip 2710 LDA DIRASC,X ;Get ASC value 2720 BNE G2.2 ;Skip 2730 G2.1 2740 DEX ;Count down 2750 BPL GET2 ;Do more 2760 BMI GET3 ;No match, skip 2770 G2.2 2780 JSR DIREC ;Show directory 2790 JSR SETSC1 ;Reset screen 2800 BNE GET1 ;Go back 2810 GET3 2820 CMP #$3E ;Is it "S"? 2830 BNE GET4 ;No, skip 2840 INC SRC ;SRC=SRC+1 2850 LDA SRC ;If SRC is >3, 2860 CMP #4 ;set to zero 2870 BNE G3.2 2880 LDA #0 2890 G3.2 2900 STA SRC 2910 CLC ;Add value for 2920 ADC #145 ;screen code 2930 STA SM1 ;Set all source 2940 STA SM2 ;numbers in 2950 STA SM3 ;message lines 2960 STA SM4 2970 STA SM5 2980 STA SM6 2990 SEC 3000 SBC #$80 3010 STA SM7 3020 BNE GOGET1 ;Skip to JMP 3030 GET4 3040 CMP #$3A ;Is it "D"? 3050 BNE GET5 ;No, skip 3060 INC DST ;DST=DST+1 3070 LDA DST ;If DST is >3, 3080 CMP #4 ;set to zero 3090 BNE G4.2 3100 LDA #0 3110 G4.2 3120 STA DST 3130 CLC 3140 ADC #145 3150 STA DM1 ;Set all dest 3160 STA DM2 ;numbers in 3170 STA DM3 ;message lines 3180 STA DM5 3190 ADC #$40 3200 STA DM6 3210 SEC 3220 SBC #$C0 3230 STA DM7 3240 BNE GOGET1 ;Skip to JMP 3250 GET5 3260 CMP #$9C ;Is it CTRL-ESC? 3270 BNE GET6 ;No, skip 3280 LDA #$FF ;Cancel key 3290 STA CH 3300 LDX #3 3310 RESDOS 3320 LDA DVSAVE,X ;Restore DOS 3330 STA DOSVEC,X ;vectors 3340 DEX 3350 BPL RESDOS 3360 JMP (DOSVEC) ;Go to DOS 3370 ; 3380 GET6 3390 LDX #3 3400 G6.2 3410 CMP COLKEY-1,X ;Is it one of 3420 BEQ G6.3 ;the color 3430 DEX ;changing keys? 3440 BNE G6.2 3450 BEQ GOGET1 ;No match, skip 3460 G6.3 3470 CPX #3 ;If 3, make it 4 3480 BNE G6.4 3490 INX 3500 G6.4 3510 INC COLOR0,X ;Change color 3520 INC COLOR0,X ;register 3530 INC COLSAV,X 3540 INC COLSAV,X 3550 GOGET1 3560 JMP GET1 ;Back to the top 3570 ; 3580 CONT2 3590 LDA STRIG0 ;Wait until key 3600 BEQ CONT2 ;or button is 3610 LDA SKCTL ;released 3620 CMP #$FB 3630 BEQ CONT2 3640 ; 3650 ; ----------------- 3660 ; Display filenames 3670 ; ----------------- 3680 ; 3690 LDA #$FF ;Cancel keypress 3700 STA CH 3710 LDA SRC ;Set directory 3720 CLC ;filename 3730 ADC #49 3740 STA DIRNAM+1 3750 LDA #0 3760 STA COUNT ;Clear filecount 3770 STA PAGE ;& page index 3780 JSR CLSCRN ;Clear screen 3790 LDA #2 ;Set printing 3800 STA COLCRS ;column & row 3810 LDA #0 3820 STA ROWCRS 3830 LDA SRC ;SRC=DST? 3840 CMP DST 3850 BNE DISPLAY ;No, skip 3860 LDA # SLINE4 3890 STA LINEAD+1 3900 JSR BUTRET 3910 DISPLAY 3920 LDA # FNBUF 3950 STA PNTR1+1 3960 ; 3970 JSR OPDIR ;Open directory 3980 ; 3990 READNAMES 4000 LDX #$10 ;Read names from 4010 LDA #GETREC ;the source disk 4020 STA ICCOM,X 4030 LDA # FNAME 4060 STA ICBAH,X 4070 LDA #17 4080 STA ICBLL,X 4090 JSR CIOV 4100 ; 4110 LDY #2 4120 CKDOS 4130 LDA FNAME,Y ;Is this file 4140 CMP DOSNAM-2,Y ;DOS.SYS? 4150 BNE CKFRE ;No, skip 4160 INY 4170 CPY #13 4180 BNE CKDOS 4190 BEQ READNAMES ;Yes, ignore 4200 ; 4210 CKFRE 4220 LDX #15 4230 LDA FNAME,X ;Is this "FREE 4240 CMP #'S ;SECTORS"? 4250 BNE CKF2 ;No, skip 4260 JMP SELECT ;Yes, continue 4270 CKF2 4280 INC COUNT ;Count files 4290 LDX PAGE ;Also count the 4300 INC PCNT,X ;# per page 4310 LDY #10 4320 TRANSFER 4330 LDA FNAME+2,Y ;Move this 4340 STA (PNTR1),Y ;name to the 4350 DEY ;filename buffer 4360 BPL TRANSFER 4370 ; 4380 CLC ;Increment the 4390 LDA PNTR1 ;pointer to the 4400 ADC #11 ;filename buffer 4410 STA PNTR1 4420 BCC TR2 4430 INC PNTR1+1 4440 TR2 4450 LDA COUNT 4460 CMP #24 ;Done 1 column? 4470 BNE TR3 ;No, skip 4480 LDA #15 ;Print name 4490 LDX # FNAME+2 4510 JSR PRINT0 4520 ; 4530 LDA #23 ;Set to top of 4540 STA LMARGN ;second column 4550 STA COLCRS 4560 LDA #0 4570 STA ROWCRS 4580 JMP READNAMES ;Do the rest 4590 ; 4600 TR3 4610 CMP #48 ;Done 2 columns? 4620 BNE TR4 ;No, skip 4630 LDA #15 4640 LDX # FNAME+2 4660 JSR PRINT0 4670 ; 4680 INC PAGE ;Set page index 4690 LDA # SCREEN2 4730 STA SAVMSC+1 4740 STA SCRNAD+1 4750 LDA #2 ;Set position to 4760 STA LMARGN ;top left 4770 STA COLCRS 4780 LDA #0 4790 STA ROWCRS 4800 JMP READNAMES ;Do the rest 4810 ; 4820 TR4 4830 LDX #0 ;Print filenames 4840 LDA #PUTREC 4850 STA ICCOM 4860 LDA # FNAME+2 4890 STA ICBAH 4900 LDA #15 4910 STA ICBLL 4920 JSR CIOV 4930 JMP READNAMES ;Do the rest 4940 ; 4950 ; -------------------- 4960 ; Select files to copy 4970 ; -------------------- 4980 ; 4990 SELECT 5000 LDX #$10 ;Close ch 1 5010 LDA #CLOSE 5020 STA ICCOM,X 5030 JSR CIOV 5040 LDA #2 ;Set margin 5050 STA LMARGN 5060 LDA COUNT ;More than 5070 CMP #49 ;48 names? 5080 BCC SEL2 ;No, skip 5090 LDA # PAGLIN ;message 5110 BNE SEL3 5120 SEL2 5130 LDA # SLINE2 ;message 5150 SEL3 5160 STA LINEAD 5170 STX LINEAD+1 5180 LDA # SCREEN1 5220 STA SCRNAD+1 5230 STA SAVMSC+1 5240 LDA #0 5250 STA PAGE ;Set page index 5260 STA POS ;& screen pos 5270 PRNT1 5280 LDX #0 5290 STX ROWCRS ;Print pointer 5300 INX ;at top name 5310 STX COLCRS 5320 LDA #13 5330 LDX # POINTR 5350 JSR PRINT0 5360 S1 5370 LDA #$FF ;Clear keypress 5380 STA CH 5390 ; 5400 SLOOP 5410 LDA STRIG0 ;Button pressed? 5420 BEQ CHOSEN ;Yes, skip 5430 LDA CH 5440 CMP #$0C ;RETURN pressed? 5450 BNE S2 ;No, skip 5460 CHOSEN 5470 LDA STRIG0 ;Wait until key 5480 BEQ CHOSEN ;or button is 5490 LDA SKCTL ;released 5500 CMP #$FB 5510 BEQ CHOSEN 5520 ; 5530 JSR INVNAM ;Register choice 5540 CLC ;Force branch 5550 BCC S1 ;Go back 5560 ; 5570 S2 5580 LDA CONSOL 5590 CMP #6 ;START pressed? 5600 BNE S3 ;No, skip 5610 JMP PRECOPY ;Yes, continue 5620 S3 5630 LDA CH ;Get key 5640 CMP #$1C ;Is it ESC? 5650 BNE S4 ;No, skip 5660 JMP OPTIONS ;Restart 5670 S4 5680 LDA STICK0 ;Get stick 5690 STA STHOLD ;Save it 5700 CMP #15 ;Center? 5710 BNE INPUT ;No, skip 5720 LDA CH ;Get key 5730 STA KBHOLD ;Save it 5740 CMP #6 ;If arrows or 5750 BEQ INPUT ;space bar, 5760 CMP #7 ;go ahead 5770 BEQ INPUT 5780 CMP #14 5790 BEQ INPUT 5800 CMP #15 5810 BEQ INPUT 5820 CMP #33 5830 BNE SLOOP ;Not legal key 5840 ; 5850 INPUT 5860 JSR SETPOS 5870 LDA #13 ;Erase old 5880 LDX # BLANK 5900 JSR PRINT0 5910 ; 5920 LDA KBHOLD ;Get key 5930 CMP #33 ;Is it SPACE? 5940 BNE NOTSPC ;No, skip 5950 LDA COUNT ;Get file count 5960 CMP #49 ;More than 48? 5970 BCC NOTSPC ;No, skip 5980 LDA PAGE ;Toggle page 5990 EOR #$01 ;index 6000 STA PAGE 6010 LDA #0 ;Set position to 6020 STA POS ;zero 6030 LDX PAGE 6040 LDA SCLO,X ;Flip screen 6050 STA SAVMSC 6060 STA SCRNAD 6070 LDA SCHI,X 6080 STA SAVMSC+1 6090 STA SCRNAD+1 6100 JMP PRNT1 ;Back to the top 6110 ; 6120 NOTSPC 6130 LDA STHOLD ;Get stick 6140 CMP #13 ;Down? 6150 BEQ INPOS ;Yes, skip 6160 LDA KBHOLD ;Get key 6170 CMP #15 ;Down arrow? 6180 BNE CKUP ;No, skip 6190 INPOS 6200 INC POS ;POS=POS+1 6210 CKUP 6220 LDA STHOLD ;Get stick 6230 CMP #14 ;Up? 6240 BEQ DEPOS ;Yes, skip 6250 LDA KBHOLD ;Get key 6260 CMP #14 ;Up arrow? 6270 BNE CKRT ;No, skip 6280 DEPOS 6290 DEC POS ;POS=POS-1 6300 CKRT 6310 LDA STHOLD ;Get stick 6320 CMP #7 ;Right? 6330 BEQ ADD24 ;Yes, skip 6340 LDA KBHOLD ;Get key 6350 CMP #7 ;Right arrow? 6360 BNE CKLT ;No, skip 6370 ADD24 6380 LDA POS ;Is POS already 6390 CMP #24 ;>23? 6400 BCS CKLT ;Yes, skip 6410 CLC 6420 ADC #24 ;Add 24 6430 LDX PAGE ;More than the 6440 CMP PCNT,X ;# of filenames? 6450 BCS CKLT ;Yes, skip 6460 STA POS ;Set position 6470 CKLT 6480 LDA STHOLD ;Get stick 6490 CMP #11 ;Left? 6500 BEQ SUB24 ;Yes, skip 6510 LDA KBHOLD ;Get key 6520 CMP #6 ;Left arrow? 6530 BNE CKLIM ;No, skip 6540 SUB24 6550 LDA POS ;Is POS already 6560 CMP #24 ;<24? 6570 BCC CKLIM ;Yes, skip 6580 SEC 6590 SBC #24 ;Subtract 24 6600 CMP #0 ;Less than zero? 6610 BCC CKLIM ;Yes, skip 6620 STA POS ;Set position 6630 CKLIM 6640 LDX PAGE 6650 LDA POS ;Is POS <0? 6660 BPL CKL2 ;No, skip 6670 LDA PCNT,X ;Set to last 6680 SEC ;name on page 6690 SBC #1 6700 STA POS 6710 CKL2 6720 LDA POS ;Is POS > last 6730 CMP PCNT,X ;name on page? 6740 BCC PRPNT ;No, skip 6750 LDA #0 ;Set to zero 6760 STA POS 6770 PRPNT 6780 JSR SETPOS ;Set position 6790 LDA #13 ;Print pointer 6800 LDX # POINTR 6820 JSR PRINT0 6830 LDA STHOLD ;Get stick 6840 CMP #15 ;Center? 6850 BEQ GOS1 ;Yes, skip 6860 LDA #5 ;Wait for 5/60 6870 CLC ;second 6880 ADC RTCLOK+2 6890 DELAY 6900 CMP RTCLOK+2 6910 BNE DELAY 6920 GOS1 6930 JMP S1 ;Back to the top 6940 ; 6950 ; ------------- 6960 ; Start copying 6970 ; ------------- 6980 ; 6990 PRECOPY 7000 LDA CONSOL ;Wait til START 7010 CMP #6 ;is released 7020 BEQ PRECOPY 7030 ; 7040 JSR CNVCHC ;Convert CHOICE 7050 LDA NUM ;Files to copy? 7060 BNE PRE2 ;Yes, skip 7070 JMP FINISH ;No, exit 7080 PRE2 7090 LDA # COPYDL 7130 STA SDLSTH 7140 STA DLISTH 7150 LDX #4 7160 PRE2.1 7170 LDA COLOR0,X ;Save colors 7180 STA COLSAV,X 7190 LDA CPYCOL,X ;Set message 7200 STA COLOR0,X ;colors 7210 STA COLPF0,X 7220 DEX 7230 BPL PRE2.1 7240 LDA #0 ;Clear read 7250 STA RCNT ;counter & write 7260 STA WCNT ;counter 7270 STA FLAG ;Clear flags 7280 STA OPN 7290 STA TOP 7300 LDA RAMTOP ;Find end of 7310 SEC ;data buffer 7320 SBC #1 7330 STA TOP+1 7340 CLOOP1 7350 LDA # BUFFER 7380 STA ADDR+1 7390 LDA SRC 7400 CMP DST ;SRC=DST? 7410 BNE C2 ;No, skip 7420 JSR SPROMT ;Show prompt 7430 C2 7440 LDA # CLIN 7470 STA TOPLIN+1 7480 LDX #6 7490 C2.1 7500 LDA RDMSG,X ;Print READING 7510 STA RWLINE,X 7520 DEX 7530 BPL C2.1 7540 LDA #$D6 ;Set character 7550 STA COLOR3 ;colors 7560 STA COLPF3 ;(also set 7570 LDA #$0D ;hardware regs 7580 STA COLOR2 ;cuz I/O can 7590 STA COLPF2 ;delay change) 7600 ; 7610 C3 7620 LDX RCNT ;Save start addr 7630 LDA ADDR ;of file 7640 STA ADLO,X 7650 LDA ADDR+1 7660 STA ADHI,X 7670 SEC 7680 LDA TOP ;Calculate free 7690 SBC ADDR ;memory & use 7700 STA FLEN ;as file length 7710 LDA TOP+1 7720 SBC ADDR+1 7730 STA FLEN+1 7740 BNE C4 ;Not zero, skip 7750 JMP WRITE1 ;Go write 7760 C4 7770 LDA FLAG ;File open? 7780 BEQ C5 ;No, skip 7790 LDX #14 7800 C4.1 7810 LDA N1HOLD,X ;Display open 7820 SEC ;filename 7830 SBC #32 7840 STA NAMLIN,X 7850 DEX 7860 BPL C4.1 7870 JMP DOREAD 7880 ; 7890 C5 7900 JSR CLN2 ;Clear name 7910 LDX RCNT ;Find name & 7920 JSR FINDNM ;convert it 7930 LDA SRC ;Print name 7940 JSR PRNAME 7950 ; 7960 LDX #$10 ;Open file for 7970 LDA #OPEN ;input 7980 STA ICCOM,X 7990 LDA # DNUM 8020 STA ICBAH,X 8030 LDA #4 8040 STA ICAX1,X 8050 JSR CIOV 8060 ; 8070 DOREAD 8080 LDX #$10 ;Read data into 8090 LDA #7 ;buffer 8100 STA ICCOM,X 8110 LDA ADDR 8120 STA ICBAL,X 8130 LDA ADDR+1 8140 STA ICBAH,X 8150 LDA FLEN 8160 STA ICBLL,X 8170 LDA FLEN+1 8180 STA ICBLH,X 8190 JSR CIOV 8200 ; 8210 LDY RCNT 8220 LDA ICBLL,X ;Save length of 8230 STA LLO,Y ;data in table 8240 LDA ICBLH,X 8250 STA LHI,Y 8260 LDA ICSTA,X ;Get status 8270 CMP #136 ;End of file? 8280 BEQ RD2 ;Yes, skip 8290 LDA #1 ;No, set flag 8300 STA FLAG ;and save name 8310 LDY #14 8320 SVN1 8330 LDA DNUM,Y ;Save filename 8340 STA N1HOLD,Y 8350 DEY 8360 BPL SVN1 8370 JMP WRITE1 ;Go write 8380 ; 8390 RD2 8400 LDX #$10 ;Close file 8410 LDA #CLOSE 8420 STA ICCOM,X 8430 JSR CIOV 8440 LDA #0 ;Clear flag 8450 STA FLAG 8460 LDX RCNT 8470 CLC 8480 LDA ADDR ;Calculate 8490 ADC LLO,X ;buffer address 8500 STA ADDR ;for next file 8510 LDA ADDR+1 8520 ADC LHI,X 8530 STA ADDR+1 8540 INC RCNT ;RCNT=RCNT+1 8550 LDA RCNT 8560 CMP NUM ;All files read? 8570 BCS WRITE1 ;Yes, skip 8580 JMP C3 ;Read more 8590 ; 8600 WRITE1 8610 LDA SRC 8620 CMP DST ;SRC=DST? 8630 BNE W2 ;No, skip 8640 JSR DPROMT ;Show prompt 8650 W2 8660 LDA # CLIN 8690 STA TOPLIN+1 8700 LDX #6 8710 WRLP 8720 LDA WRMSG,X ;Print WRITING 8730 STA RWLINE,X 8740 DEX 8750 BPL WRLP 8760 LDA #$D6 ;Set character 8770 STA COLOR2 ;colors 8780 STA COLPF2 8790 LDA #$0D 8800 STA COLOR3 8810 STA COLPF3 8820 ; 8830 LDA OPN ;File open? 8840 BEQ W3 ;No, skip 8850 LDX #14 8860 W2.1 8870 LDA N2HOLD,X ;Display open 8880 SEC ;filename 8890 SBC #32 8900 STA NAMLIN,X 8910 DEX 8920 BPL W2.1 8930 JMP DOWRIT ;Skip ahead 8940 ; 8950 W3 8960 JSR CLN2 ;Clear name 8970 LDX WCNT ;Find name and 8980 JSR FINDNM ;convert it 8990 LDA DST 9000 JSR PRNAME ;Print name 9010 ; 9020 LDX #$20 ;Open file for 9030 LDA #OPEN ;output 9040 STA ICCOM,X 9050 LDA # DNUM 9080 STA ICBAH,X 9090 LDA #8 9100 STA ICAX1,X 9110 JSR CIOV 9120 LDA #1 ;Set flag 9130 STA OPN 9140 ; 9150 DOWRIT 9160 LDX #$20 ;Write data from 9170 LDA #PUTCHR ;buffer 9180 STA ICCOM,X 9190 LDY WCNT ;Get write count 9200 LDA ADLO,Y ;Get address of 9210 STA ICBAL,X ;data from table 9220 LDA ADHI,Y 9230 STA ICBAH,X 9240 LDA LLO,Y ;Get length of 9250 STA ICBLL,X ;data from table 9260 LDA LHI,Y 9270 STA ICBLH,X 9280 JSR CIOV 9290 ; 9300 LDA WCNT ;Written all 9310 CMP RCNT ;that were read? 9320 BNE W7 ;No, skip 9330 LDA FLAG ;Partial read? 9340 BEQ W7 ;No, skip 9350 LDY #14 9360 SVN2 9370 LDA DNUM,Y ;Save name 9380 STA N2HOLD,Y 9390 DEY 9400 BPL SVN2 9410 JMP CLOOP1 ;Back to the top 9420 ; 9430 W7 9440 LDX #$20 ;Close file 9450 LDA #CLOSE 9460 STA ICCOM,X 9470 JSR CIOV 9480 LDA #0 ;Clear flag 9490 STA OPN 9500 INC WCNT ;WCNT=WCNT+1 9510 LDA WCNT ;Written all 9520 CMP RCNT ;that were read? 9530 BCC JW3 ;No, skip 9540 LDA FLAG ;Partial read? 9550 BEQ W8 ;No, skip 9560 JW3 9570 JMP W3 ;Write more 9580 W8 9590 LDA WCNT ;Done copying? 9600 CMP NUM 9610 BCS FINISH ;Yes, exit 9620 JMP CLOOP1 ;No, do the rest 9630 ; 9640 FINISH 9650 JSR CLSCRN ;Clear screen 9660 LDA # SCREEN1 9700 STA SCRNAD+1 9710 STA SAVMSC+1 9720 LDA # FINLIN 9750 STA LINEAD+1 9760 JSR SETDL 9770 ; 9780 LDA #3 9790 STA COLCRS 9800 LDA #8 9810 STA ROWCRS 9820 LDA #33 9830 LDX # RETMSG 9850 JSR PRINT0 9860 JSR BUTRET ;Wait 9870 JMP OPTIONS ;Restart 9880 ; 9890 ; ----------- 9900 ; SUBROUTINES 9910 ; ----------- 9920 ; 9930 CLSCRN 9940 LDA # SCREEN1 9970 STA PNTR1+1 9980 LDX #8 ;Clear the 9990 LDY #0 ;screen area 010000 TYA ;(8 pages) 010010 CLS2 010020 STA (PNTR1),Y 010030 INY 010040 BNE CLS2 010050 INC PNTR1+1 010060 DEX 010070 BNE CLS2 010080 STA OLDCHR 010090 RTS 010100 ; 010110 SETPOS 010120 LDX #1 ;Set the cursor 010130 LDA POS ;position 010140 CMP #24 ;Less than 24? 010150 BCC SETP2 ;Yes, skip 010160 CLC 010170 TXA ;21 + 1 010180 ADC #21 ;Set to 2nd col 010190 TAX ;Set column 010200 SETP2 010210 STX COLCRS 010220 LDA POS ;Get position 010230 CMP #24 ;> 1st column? 010240 BCC SETP3 ;No, skip 010250 SEC 010260 SBC #24 010270 SETP3 010280 STA ROWCRS ;Set row 010290 RTS 010300 ; 010310 PRINT0 010320 STA ICBLL ;Print to E: 010330 STX ICBAL ;A=String length 010340 STY ICBAH ;X=Lo address 010350 LDA #PUTCHR ;Y=Hi address 010360 STA ICCOM 010370 LDX #0 010380 JMP CIOV 010390 ; 010400 SETSC1 010410 LDA # SLINE1 ;line and main 010440 STA LINEAD+1 ;screen area) 010450 LDA # SCREEN1 010490 STA SAVMSC+1 010500 STA SCRNAD+1 010510 RTS 010520 ; 010530 SETDL 010540 LDX #4 010550 SDL2 010560 LDA COLSAV,X ;Set screen 010570 STA COLOR0,X ;colors 010580 DEX 010590 BPL SDL2 010600 LDA # DLIST 010630 STA SDLSTH 010640 RTS 010650 ; 010660 OPDIR 010670 LDX #$10 ;Open IOCB #1 010680 LDA #CLOSE ;for a directory 010690 STA ICCOM,X ;read 010700 JSR CIOV 010710 LDA #OPEN 010720 STA ICCOM,X 010730 LDA # DIRNAM 010760 STA ICBAH,X 010770 LDA #6 010780 STA ICAX1,X 010790 JMP CIOV 010800 ; 010810 DIREC 010820 STA DIRNAM+1 ;Store drv # 010830 CLC ;Convert to 010840 ADC #$60 ;screen code 010850 STA DIRNUM1 ;Display drv # 010860 STA DIRNUM2 010870 LDA DIRSCR ;Flip to 010880 STA SAVMSC ;directory screen 010890 STA SCRNAD ;(original E: 010900 LDA DIRSCR+1 ;screen address) 010910 STA SAVMSC+1 010920 STA SCRNAD+1 010930 LDA # DIRLIN1 010960 STA LINEAD+1 010970 LDA #1 ;Clear the screen 010980 LDX # CLEAR 011000 JSR PRINT0 011010 JSR OPDIR ;Open directory 011020 LDX #$10 ;Set up to input 011030 LDA #GETREC ;filenames from 011040 STA ICCOM,X ;IOCB #1 and 011050 LDA #PUTREC ;print them to 011060 STA ICCOM ;IOCB #0 (E:) 011070 LDA # FNAME 011110 STA ICBAH,X 011120 STA ICBAH 011130 LDA #18 011140 STA ICBLL,X 011150 STA ICBLL 011160 LDA #0 ;Set to top of 011170 STA ROWCRS ;screen 011180 NLOOP 011190 LDA SKCTL ;Key pressed? 011200 CMP #$FB 011210 BEQ NL2 ;No, skip ahead 011220 LDA STRIG0 ;Trigger? 011230 BNE NL3 ;No, skip 011240 NL2 011250 JSR DW2 ;Wait for release 011260 NL3 011270 LDX #$10 ;IOCB #1 011280 JSR CIOV ;Get filename 011290 BMI CDIR ;End, skip 011300 LDA #9 ;Set position 011310 STA COLCRS 011320 LDX #$00 ;IOCB #0 011330 JSR CIOV ;Print name 011340 BPL NLOOP ;Always branch 011350 CDIR 011360 LDA #CLOSE ;Close dir 011370 STA ICCOM,X 011380 JSR CIOV 011390 LDA # DIRLIN2 ;on top line 011420 STA LINEAD+1 011430 DWAIT 011440 LDA SKCTL ;Wait for key 011450 CMP #$FF ;or trigger 011460 BNE DW2 ;press 011470 LDA STRIG0 011480 BNE DWAIT 011490 DW2 011500 LDA SKCTL ;Wait for 011510 CMP #$FB ;release 011520 BEQ DW2 011530 LDA STRIG0 011540 BEQ DW2 011550 RTS 011560 ; 011570 CLN2 011580 LDX #11 ;Clear name 011590 LDA #$20 ;storage area to 011600 CLN2.2 011610 STA N2,X ;spaces 011620 DEX 011630 BPL CLN2.2 011640 RTS 011650 ; 011660 PRNAME 011670 CLC ;Store drive # 011680 ADC #49 011690 STA DNUM+1 011700 LDX #14 011710 PRNAM2 011720 LDA DNUM,X ;Print filename 011730 SEC ;being copied 011740 SBC #32 ;directly to 011750 STA NAMLIN,X ;screen memory 011760 DEX 011770 BPL PRNAM2 011780 RTS 011790 ; 011800 SPROMT 011810 LDA # SRCLIN ;source prompt 011830 BNE PROMP2 ;Skip ahead 011840 DPROMT 011850 LDA # DSTLIN ;dest prompt 011870 PROMP2 011880 STA TOPLIN ;Show prompt 011890 STX TOPLIN+1 011900 LDX #14 011910 PROMP3 011920 LDA RBMSG,X ;Now prompt 011930 STA NAMLIN,X ;for RETURN 011940 DEX ;or button 011950 BPL PROMP3 011960 BUTRET 011970 LDA #$FF ;Clear key 011980 STA CH ;buffer 011990 BR2 012000 LDA STRIG0 ;Get trigger 012010 BEQ BR3 ;Pressed, skip 012020 LDA CH ;Get key 012030 CMP #12 ;RETURN? 012040 BNE BR2 ;No, go back 012050 BR3 012060 LDA STRIG0 ;Wait til 012070 BEQ BR3 ;trigger or key 012080 LDA SKCTL ;is released 012090 CMP #$FB 012100 BEQ BR3 012110 LDA #$FF 012120 STA CH 012130 RTS 012140 ; 012150 INVNAM 012160 LDA POS ;Current position 012170 CMP #24 ;2nd column? 012180 BCC INV2 ;No, skip 012190 SBC #24 012200 INV2 012210 STA TEMP ;Multiply the 012220 LDA #40 ;current row 012230 STA MULT ;by 40 to get 012240 LDA #0 ;the offset 012250 STA PNTR1+1 ;into screen 012260 LDY #8 ;memory 012270 INV3 012280 ASL A 012290 ROL PNTR1+1 012300 ASL MULT 012310 BCC INV4 012320 CLC 012330 ADC TEMP 012340 BCC INV4 012350 INC PNTR1+1 012360 INV4 012370 DEY 012380 BNE INV3 012390 CLC 012400 ADC #2 012410 BCC INV5 012420 INC PNTR1+1 012430 INV5 012440 STA PNTR1 ;Set offset 012450 LDA POS ;to screen area 012460 CMP #24 ;If in 2nd 012470 BCC INV6 ;column, adjust 012480 CLC ;the pointer 012490 LDA PNTR1 012500 ADC #21 012510 STA PNTR1 012520 BCC INV6 012530 INC PNTR1+1 012540 INV6 012550 CLC 012560 LDX PAGE ;Get page index 012570 LDA PNTR1 ;Add the address 012580 ADC SCLO,X ;of the start of 012590 STA PNTR1 ;the current 012600 LDA PNTR1+1 ;page to screen 012610 ADC SCHI,X ;pointer 012620 STA PNTR1+1 012630 LDY #10 ;11 characters 012640 INVLOOP 012650 LDA (PNTR1),Y ;Get char 012660 EOR #$80 ;Invert it 012670 STA (PNTR1),Y ;Put it back 012680 DEY ;Count 'em 012690 BPL INVLOOP ;More to do 012700 LDA PAGE ;Get current pg 012710 BEQ INV7 ;Skip if page 1 012720 LDA #48 ;Add 48 012730 INV7 012740 CLC 012750 ADC POS 012760 TAX ;Use for index 012770 LDA CHOICE,X ;Get choice flag 012780 EOR #$01 ;Toggle bit 0 012790 STA CHOICE,X ;Put it back 012800 LDA #120 012810 STA TEMP 012820 LDA #$A8 012830 STA AUDC1 012840 SOUND 012850 LDA TEMP ;Make a sound 012860 STA AUDF1 ;to register 012870 SEC ;the choice 012880 SBC #20 012890 STA TEMP 012900 BMI SND2 012910 LDA #1 012920 CLC 012930 ADC RTCLOK+2 012940 SNDWAIT 012950 CMP RTCLOK+2 012960 BNE SNDWAIT 012970 BEQ SOUND 012980 SND2 012990 RTS 013000 ; 013010 CNVCHC 013020 LDX #0 013030 STX NUM 013040 CNV2 013050 TXA ;This section 013060 TAY ;converts the 013070 LDA CHOICE,Y ;choice array 013080 BEQ CNV3 ;to sequential 013090 LDY NUM ;form, and also 013100 INC NUM ;counts the 013110 TXA ;chosen files 013120 STA CHOICE,Y 013130 CNV3 013140 INX 013150 CPX #64 013160 BNE CNV2 013170 RTS 013180 ; 013190 ; This routine finds the 013200 ; name of the file being 013210 ; operated on, and converts 013220 ; it to DOS filename format. 013230 ; (Dn:FILENAME.EXT) 013240 ; Enter with X set to 013250 ; current file index. 013260 ; 013270 FINDNM 013280 LDA #0 ;Clear TEMP 013290 STA TEMP 013300 LDA CHOICE,X ;Multiply by 11 013310 CLC 013320 ASL A ;*2 013330 ROL TEMP 013340 ASL A ;*4 013350 ROL TEMP 013360 CLC 013370 ADC CHOICE,X ;*5 013380 BCC FIND2 013390 INC TEMP 013400 FIND2 013410 CLC 013420 ASL A ;*10 013430 ROL TEMP 013440 CLC 013450 ADC CHOICE,X ;*11 013460 BCC FIND3 013470 INC TEMP 013480 FIND3 013490 CLC ;Add start of 013500 ADC # FNBUF 013540 STA PNTR2+1 013550 LDY #10 ;11 characters 013560 FIND4 013570 LDA (PNTR2),Y ;Move name 013580 STA N1,Y ;to buffer 013590 DEY 013600 BPL FIND4 013610 NAME 013620 LDX #0 013630 STX TEMP 013640 NM2 013650 TXA ;Search name 013660 TAY ;field for 013670 LDA N1,Y ;space character 013680 CMP #32 013690 BEQ PERIOD ;Got space, skip 013700 LDY TEMP ;Store char in 013710 STA N2,Y ;name area 013720 INC TEMP ;Count up 013730 INX 013740 CPX #8 ;Done 8? 013750 BNE NM2 ;No, more to do 013760 PERIOD 013770 LDY TEMP ;Get index and 013780 LDA #'. ;store period 013790 STA N2,Y 013800 INC TEMP ;Inc index 013810 LDX #8 013820 NM3 013830 TXA ;Search 013840 TAY ;extension field 013850 LDA N1,Y ;for space char 013860 CMP #32 013870 BEQ NM4 ;Got space, skip 013880 LDY TEMP 013890 STA N2,Y ;Store chars 013900 INC TEMP 013910 INX 013920 CPX #11 ;At end of name? 013930 BNE NM3 ;No, go back 013940 NM4 013950 CPX #8 ;If no extension 013960 BNE NM5 ;erase the 013970 DEC TEMP ;period 013980 LDY TEMP 013990 LDA #32 014000 STA N2,Y 014010 NM5 014020 RTS 014030 ; 014040 ; Data, tables, messages, etc. 014050 ; 014060 DLIST 014070 .BYTE $70,$70,$20 014080 .BYTE $42 014090 LINEAD 014100 .WORD SLINE1 014110 .BYTE $10 014120 .BYTE $42 014130 SCRNAD 014140 .WORD SCREEN1 014150 .BYTE $02,$02,$02,$02 014160 .BYTE $02,$02,$02,$02 014170 .BYTE $02,$02,$02,$02 014180 .BYTE $02,$02,$02,$02 014190 .BYTE $02,$02,$02,$02 014200 .BYTE $02,$02,$02 014210 .BYTE $41 014220 .WORD DLIST 014230 ; 014240 COPYDL 014250 .BYTE $70,$70,$70,$70 014260 .BYTE $47 014270 TOPLIN 014280 .WORD CLIN 014290 .BYTE $70,$30,$47 014300 .WORD NAMLIN 014310 .BYTE $41 014320 .WORD COPYDL 014330 ; 014340 SLINE1 014350 .SBYTE "MULTICOPY|S=D" 014360 SM1 014370 .SBYTE "1|D=D" 014380 DM1 014390 .SBYTE "2|RETURN/button=Begin " 014400 SLINE2 014410 .SBYTE "MULTICOPY|S=D" 014420 SM2 014430 .SBYTE "1|D=D" 014440 DM2 014450 .SBYTE "2|ESC=Exit START=Copy " 014460 FINLIN 014470 .SBYTE "MULTICOPY|S=D" 014480 SM3 014490 .SBYTE "1|D=D" 014500 DM3 014510 .SBYTE "2| " 014520 CPYLIN 014530 .SBYTE " FINISHED! " 014540 SLINE4 014550 .SBYTE "Put SOURCE disk in D" 014560 SM4 014570 .SBYTE "1 - Press RET/button" 014580 PAGLIN 014590 .SBYTE "S=D" 014600 SM5 014610 .SBYTE "1|D=D" 014620 DM5 014630 .SBYTE "2| SPC=Page ESC=Exit" 014635 .SBYTE " START=Copy " 014640 ; 014650 DIRLIN1 014660 .SBYTE " DIRECTORY | D" 014670 DIRNUM1 014680 .SBYTE "1 | Button/any key=" 014685 .SBYTE "pause " 014690 DIRLIN2 014700 .SBYTE " DIRECTORY | D" 014710 DIRNUM2 014720 .SBYTE "1 | Button/key=" 014725 .SBYTE "continue " 014730 ; 014740 CLIN 014750 .SBYTE "S=D" 014760 SM6 014770 .SBYTE "1 d.d" 014780 DM6 014790 .SBYTE ". " 014800 RWLINE 014810 .SBYTE "reading " 014820 ; 014830 NAMLIN 014840 .BYTE 0,0,0,0,0,0,0,0,0,0 014850 .BYTE 0,0,0,0,0,0,0,0,0,0 014860 ; 014870 SRCLIN 014880 .SBYTE "PUT SRC DISK IN D" 014890 SM7 014900 .SBYTE "1 " 014910 DSTLIN 014920 .SBYTE "PUT DST DISK IN D" 014930 DM7 014940 .SBYTE "2 " 014950 ; 014960 RBMSG 014970 .SBYTE "HIT RET/BUTTON " 014980 ; 014990 OPTMSG 015000 .BYTE ".OPTIONS.",$9B,$9B,$9B 015010 .BYTE " .S. Change SOURCE" 015015 .BYTE " drive",$9B,$9B 015020 .BYTE " .D. Change DESTIN" 015025 .BYTE "ATION drive",$9B,$9B 015030 .BYTE " .1.-.4. Disk Dire" 015035 .BYTE "ctory",$9B,$9B 015040 .BYTE " .CTRL-ESC. Exit " 015045 .BYTE "to DOS",$9B,$9B 015050 .BYTE " .CTRL-T. Text Bri" 015055 .BYTE "ghtness",$9B 015060 .BYTE " .CTRL-F. Foregrou" 015065 .BYTE "nd color",$9B 015070 .BYTE " .CTRL-B. Backgrou" 015075 .BYTE "nd color",$9B,$9B,$9B 015080 .BYTE " .Press RETURN or but" 015085 .BYTE "ton to start.." 015090 OPTLEN = *-OPTMSG 015100 ; 015110 RDMSG 015120 .SBYTE "reading" 015130 WRMSG 015140 .SBYTE "writing" 015150 ; 015160 RETMSG 015170 .BYTE "Press RETURN or " 015175 .BYTE "button to restart" 015180 ; 015190 BLANK 015200 .BYTE " ........... " 015210 POINTR 015220 .BYTE ">...........<" 015230 ; 015240 CLEAR 015250 .BYTE $7D 015260 ; 015270 CPYCOL 015280 .BYTE $48,$8A,$D6,$58,$00 015290 ; 015300 DIRKEY 015310 .BYTE $1F,$1E,$1A,$18 015320 DIRASC 015330 .BYTE "1234" 015340 ; 015350 COLKEY 015360 .BYTE $AD,$B8,$95 015370 ; 015380 COLSAV 015390 .BYTE $00,$00,$FA,$00,$F6 015400 ; 015410 DVSAVE 015420 .BYTE 0,0,0,0 015430 ; 015440 FNBUF 015450 64*11 015460 LLO 015470 64 015480 LHI 015490 64 015500 ADLO 015510 64 015520 ADHI 015530 64 015540 CHOICE 015550 64 015560 SCLO 015570 .BYTE SCREEN1, >SCREEN2 015600 DIRNAM 015610 .BYTE "D1:*.*",$9B 015620 DOSNAM 015630 .BYTE "DOS SYS" 015640 FNAME 015650 .BYTE " " 015660 DNUM 015670 .BYTE "D1:" 015680 N2 015690 .BYTE " " 015700 N1 015710 .BYTE " " 015720 N1HOLD 015730 .BYTE " " 015740 N2HOLD 015750 .BYTE " " 015760 ; 015770 BUFFER = * 015780 ; 015790 ; ------------- 015800 ; Program start 015810 ; ------------- 015820 ; 015830 *= *+$1000&$F000 015840 ; 015850 BEGIN 015860 LDA DOSVEC ;Save the DOS 015870 STA DVSAVE ;vectors 015880 LDA DOSVEC+1 015890 STA DVSAVE+1 015900 LDA DOSINI ;Put DOSINI 015910 STA RESET+1 ;vector after 015920 STA DVSAVE+2 ;the JSR in our 015930 LDA DOSINI+1 ;code - also 015940 STA RESET+2 ;save it... 015950 STA DVSAVE+3 015960 LDA # RESET ;DOSINI to 015990 STA DOSINI+1 ;trap RESET 016000 ; 016010 LDA SAVMSC ;Save OS screen 016020 STA DIRSCR ;address for 016030 LDA SAVMSC+1 ;directory 016040 STA DIRSCR+1 ;screen 016050 LDA # TITLDL 016080 STA SDLSTH 016090 LDX #4 016100 SETCOL 016110 LDA COLORS,X ;Set screen 016120 STA COLOR0,X ;colors 016130 DEX 016140 BPL SETCOL 016150 STRTWT 016160 LDA CONSOL ;Get console reg 016170 CMP #7 ;Any key? 016180 BNE CONTIN ;Yes, go ahead 016190 LDA SKCTL ;Check keyboard 016200 CMP #$FF ;Key pressed? 016210 BNE CONTIN ;Yes, continue 016220 LDA STRIG0 ;Get trigger 016230 BEQ CONTIN ;If pressed, skip 016240 BNE STRTWT ;No input... 016250 CONTIN 016260 LDA CONSOL ;Wait for key, 016270 CMP #7 ;button, or 016280 BNE CONTIN ;console to be 016290 LDA SKCTL ;released 016300 CMP #$FF 016310 BNE CONTIN 016320 LDA STRIG0 016330 BEQ CONTIN 016340 ; 016350 LDX #0 ;Init source 016360 STX SRC ;and destination 016370 INX ;drives 016380 STX DST 016390 JMP OPTIONS ;Jump to start 016400 ; 016410 TITLDL 016420 .BYTE $70,$70,$70 016430 .BYTE $47 016440 .WORD TDATA 016450 .BYTE $70,$70,$70,$70,$70 016460 .BYTE $06,$70,$70 016470 .BYTE $06,$70,$06 016480 .BYTE $70,$70,$70 016490 .BYTE $70,$70,$70 016500 .BYTE $70,$70,$70 016510 .BYTE $06 016520 .BYTE $41 016530 .WORD TITLDL 016540 ; 016550 TDATA 016560 .SBYTE " -MULTICOPY- " 016570 .SBYTE " (C) 1985 " 016580 .SBYTE " charles johnson " 016590 .SBYTE " ......... " 016600 .SBYTE " press start " 016610 ; 016620 COLORS 016630 .BYTE $D8,$34,$0A,$88,$00 016640 ; 016650 ; 016660 *= $02E0 016670 .WORD BEGIN 016680 ; 016690 .OPT NO LIST