10 ;SAVE#D3:ARC:ARC2.M65
20 ;
30 EOUT  STY PRINTEMP
40       STX PRINTEMP+1
50       JSR EOUTCH
60       LDY PRINTEMP
70       LDX PRINTEMP+1
80       RTS 
90 ;
0100 ERETURN LDA #$9B
0110 ;
0120 EOUTCH PHA 
0130     JSR EOUTCH2
0140     PLA 
0150     RTS 
0160 ;
0170 EOUTCH2 TAY 
0180 EMD1 LDA #0
0190     PHA 
0200 EMD2 LDA #0
0210     PHA 
0220     TYA 
0230     LDX #0
0240     RTS 
0250 ;
0260 KGETCH JSR KGET2
0270     CPY #128
0280     BCS KGETCH
0290     RTS 
0300 ;
0310 KGET2 LDX #$30
0320     LDA #7
0330     STA $0342,X
0340     LDA #0
0350     STA $0348,X
0360     STA $0349,X
0370     JMP $E456
0380 ;
0390 PRINT STX $FE
0400     STY $FF
0410 PR1 LDY #0
0420     LDA ($FE),Y
0430     BEQ PR2
0440 PR3 JSR EOUTCH
0450     CPY #128
0460     BCS PR3
0470     INC $FE
0480     BNE PR1
0490     INC $FF
0500     BNE PR1
0510 PR2 RTS 
0520 ;
0530 CLOSE0 LDX #0
0540     .BYTE $2C
0550 CLOSE1 LDX #$10
0560     .BYTE $2C
0570 CLOSE2 LDX #$20
0580     .BYTE $2C
0590 CLOSE3 LDX #$30
0600     .BYTE $2C
0610 CLOSE4 LDX #$40
0620     .BYTE $2C
0630 CLOSE6 LDX #$60
0640     LDA #$0C
0650     STA $0342,X
0660     JMP $E456
0670 ;
0680 ERRORTRAP CPY #128
0690     BCS ERT1
0700     RTS 
0710 ERT1 STY $D4
0720     LDA #0
0730     STA $D5
0740     STX OFFSET
0750     JSR SCREENON
0760     LDX OFFSET
0770     CPX #$20    ;WRITE ERR?
0780     BEQ ERT11
0790     LDX #DISKER&255
0800     LDY #DISKER/256
0810     BNE ERT12
0820 ERT11 LDX #DISKERW&255
0830     LDY #DISKERW/256
0840 ERT12 JSR PRINT
0850     JSR PRTNUM
0860     PLA 
0870     PLA 
0880 ERT2 JSR CLOSE1
0890     LDA $0360
0900     CMP #$FF
0910     BEQ ?F1
0920     JSR DODEST
0930     JSR CLOSE2
0940 ?F1 JSR CLOSE6
0950     JSR SCREENON
0960     JSR ERETURN
0970     LDA #$FF
0980     STA 764
0990     LDA BATCHFLG
1000     BEQ ERT2Z
1010     JMP DUMPOUT
1020 ERT2Z LDX #PRESR&255
1030     LDY #PRESR/256
1040     JSR PRINT
1050     JSR KGETCH
1060     JMP MAIN
1070 DISKER .BYTE 155,"Disk Read Error #}",0
1080 DISKERW .BYTE 155,"Disk Write Error #}",0
1090 PRESR .BYTE 155,"Press RETURN to continue...",0
1100 ;
1110 PRTNUM
1120     JSR $D9AA
1130     JSR $D8E6
1140     LDY #0
1150 PNM1 LDA ($F3),Y
1160     PHA 
1170     AND #$7F
1180     JSR EOUT
1190     INY 
1200     PLA 
1210     BPL PNM1
1220     RTS 
1230 ;
1240 ;
1250 GET1 LDA SBZLEN
1260     BNE GET1D
1270     ORA SBZLEN+1
1280     BNE GET1AA
1290     LDA #7      ;load buffer up
1300     STA $0352
1310     LDA SBUFF
1320     STA $0354
1330     STA GET1C+1
1340     LDA SBUFF+1
1350     STA $0355
1360     STA GET1C+2
1370     LDA EOFFLG
1380     BNE GET1B1
1390     JSR DOSOUR
1400     LDX #$10
1410     LDA SBLEN
1420     STA $0348,X
1430     LDA SBLEN+1
1440     STA $0349,X
1450     INC MOREPASS
1460     JSR $E456
1470     CPY #128
1480     BCC GET1B
1490     CPY #136
1500     BEQ GET1B2
1510     JMP ERRORTRAP
1520 GET1B2 INC EOFFLG
1530 GET1B LDA $0348,X
1540     STA SBZLEN
1550     STA MOREPASS+1
1560     LDA $0349,X
1570     STA SBZLEN+1
1580     STA MOREPASS+2
1590     ORA SBZLEN
1600     BNE GET1A
1610 GET1B1 SEC      ;eof status
1620     RTS 
1630 GET1A LDA SBZLEN
1640     BNE GET1D
1650 GET1AA DEC SBZLEN+1
1660 GET1D DEC SBZLEN
1670 GET1C LDA $FFFF
1680     INC SRCLEN
1690     BNE GET1F
1700     INC SRCLEN+1
1710     BNE GET1F
1720     INC SRCLEN+2
1730 GET1F INC GET1C+1
1740     BNE GET1E
1750     INC GET1C+2
1760 GET1E TAX 
1770     EOR CRC
1780     TAY         ;do ARC CRC
1790     LDA CRCLO,Y
1800     EOR CRC+1
1810     STA CRC
1820     LDA CRCHI,Y
1830     STA CRC+1
1840     TXA 
1850     CLC 
1860     RTS 
1870 ;
1880 PUT2 LDY PASSLOC
1890     BEQ PUT22
1900     EOR PASSWORD-1,Y
1910     INY 
1920     CPY PASSLEN
1930     BCC PUT2N
1940     LDY #1
1950 PUT2N STY PASSLOC
1960 PUT22 STA $FFFF ;store byte
1970     INC PUT22+1
1980     BNE PUT2L
1990     INC PUT22+2
2000 PUT2L LDA DBZLEN
2010     BNE PUT2B
2020     DEC DBZLEN+1
2030 PUT2B DEC DBZLEN
2040     BEQ PUT2BB
2050     RTS 
2060 PUT2BB LDA DBZLEN+1
2070     BEQ PUT2D
2080 ;
2090 PUT2C RTS 
2100 ;
2110 PUT2D STX TEMP2
2120     JSR DODEST
2130     JSR DOOPEN
2140     LDA #$0B
2150     LDX #$20
2160     STA $0342,X
2170     LDA DBUFF
2180     STA $0344,X
2190     STA PUT22+1
2200     LDA DBUFF+1
2210     STA $0345,X
2220     STA PUT22+2
2230     LDA DBLEN
2240     STA $0348,X
2250     STA DBZLEN
2260     LDA DBLEN+1
2270     STA $0349,X
2280     STA DBZLEN+1
2290     JSR $E456
2300     BPL ?FIX2
2310     JMP ERRORTRAP
2320 ?FIX2 LDX TEMP2
2330     JMP PUT2C
2340 ;
2350 FINISHED LDA PUT2+1
2360     CMP DBUFF
2370     BNE FINI1
2380     LDA PUT2+2  ;ANYTHING IN BUFFER?
2390     CMP DBUFF+1
2400     BEQ FIN2
2410 FINI1 JSR DODEST
2420     JSR DOOPEN
2430     LDA #$0B
2440     LDX #$20
2450     STA $0342,X
2460     LDA DBUFF
2470     STA $0344,X
2480     STA PUT22+1
2490     LDA DBUFF+1
2500     STA $0345,X
2510     STA PUT22+2
2520     SEC 
2530     LDA DBLEN
2540     SBC DBZLEN
2550     STA $0348,X
2560     LDA DBLEN+1
2570     SBC DBZLEN+1
2580     STA $0349,X
2590     LDA DBLEN
2600     STA DBZLEN
2610     LDA DBLEN+1
2620     STA DBZLEN+1
2630     LDX #$20
2640     JSR $E456
2650     BPL FIN2
2660     JMP ERRORTRAP
2670 FIN2 RTS 
2680 ;
2690 DOOPEN LDX #$20
2700     LDA $0340,X ;IS IOCB CLOSED?
2710     CMP #$FF    ;(1 FILE, MYDOS BUG)
2720     BEQ DOOP1
2730     RTS 
2740 DOOP1 JSR DODEST
2750     JSR DOIO
2760     .BYTE $20,3 ;open #2,9,0
2770     .WORD SFNAME,0,9
2780     JSR ERRORTRAP
2790     RTS 
2800 ;
2810 ;THE CRC TABLE (LOW BYTES FIRST)
2820 ;
2830 CRCLO
2840     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2850     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2860     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2870     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2880     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2890     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2900     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2910     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2920     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2930     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2940     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2950     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2960     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
2970     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2980     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
2990     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3000     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3010     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3020     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3030     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3040     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3050     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3060     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3070     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3080     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3090     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3100     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3110     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3120     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3130     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3140     .BYTE $00,$C1,$81,$40,$01,$C0,$80,$41
3150     .BYTE $01,$C0,$80,$41,$00,$C1,$81,$40
3160 ;
3170 CRCHI
3180     .BYTE $00,$C0,$C1,$01,$C3,$03,$02,$C2
3190     .BYTE $C6,$06,$07,$C7,$05,$C5,$C4,$04
3200     .BYTE $CC,$0C,$0D,$CD,$0F,$CF,$CE,$0E
3210     .BYTE $0A,$CA,$CB,$0B,$C9,$09,$08,$C8
3220     .BYTE $D8,$18,$19,$D9,$1B,$DB,$DA,$1A
3230     .BYTE $1E,$DE,$DF,$1F,$DD,$1D,$1C,$DC
3240     .BYTE $14,$D4,$D5,$15,$D7,$17,$16,$D6
3250     .BYTE $D2,$12,$13,$D3,$11,$D1,$D0,$10
3260     .BYTE $F0,$30,$31,$F1,$33,$F3,$F2,$32
3270     .BYTE $36,$F6,$F7,$37,$F5,$35,$34,$F4
3280     .BYTE $3C,$FC,$FD,$3D,$FF,$3F,$3E,$FE
3290     .BYTE $FA,$3A,$3B,$FB,$39,$F9,$F8,$38
3300     .BYTE $28,$E8,$E9,$29,$EB,$2B,$2A,$EA
3310     .BYTE $EE,$2E,$2F,$EF,$2D,$ED,$EC,$2C
3320     .BYTE $E4,$24,$25,$E5,$27,$E7,$E6,$26
3330     .BYTE $22,$E2,$E3,$23,$E1,$21,$20,$E0
3340     .BYTE $A0,$60,$61,$A1,$63,$A3,$A2,$62
3350     .BYTE $66,$A6,$A7,$67,$A5,$65,$64,$A4
3360     .BYTE $6C,$AC,$AD,$6D,$AF,$6F,$6E,$AE
3370     .BYTE $AA,$6A,$6B,$AB,$69,$A9,$A8,$68
3380     .BYTE $78,$B8,$B9,$79,$BB,$7B,$7A,$BA
3390     .BYTE $BE,$7E,$7F,$BF,$7D,$BD,$BC,$7C
3400     .BYTE $B4,$74,$75,$B5,$77,$B7,$B6,$76
3410     .BYTE $72,$B2,$B3,$73,$B1,$71,$70,$B0
3420     .BYTE $50,$90,$91,$51,$93,$53,$52,$92
3430     .BYTE $96,$56,$57,$97,$55,$95,$94,$54
3440     .BYTE $9C,$5C,$5D,$9D,$5F,$9F,$9E,$5E
3450     .BYTE $5A,$9A,$9B,$5B,$99,$59,$58,$98
3460     .BYTE $88,$48,$49,$89,$4B,$8B,$8A,$4A
3470     .BYTE $4E,$8E,$8F,$4F,$8D,$4D,$4C,$8C
3480     .BYTE $44,$84,$85,$45,$87,$47,$46,$86
3490     .BYTE $82,$42,$43,$83,$41,$81,$80,$40
3500 ;
3510 ARCTEMP .BYTE "ARCTEMP.ARC"
3520 ADDERM .BYTE 155,"Error: File cannot be appended.",0
3530 ;
3540 TITLE .BYTE 125
3550     .BYTE 155,"Enter complete destination filename:",155,0
3560 DSTPN .BYTE 155,"Source Filemask (drive # for dir):",155,0
3570 INVP .BYTE 155,"Invalid Pathname!",155
3580     .BYTE "Examples: D1:TEST.BAS, or D2:DIR>*.*",155,0
3590 UNARM .BYTE 155,"[ESC] to quit, [P]athname, [1-9] dirs",155,"Crunch ",0
3600 ;
3610 INSRC .BYTE 155,"Insert SOURCE disk, press RETURN",155,0
3620 INDES .BYTE 155,"Insert DESTINATION Disk, press RETURN",155,0
3630 CHGPARM .BYTE 155,155,"Use , RETURN - toggle, ESC - exit",155,0
3640 ;
3650 TITLEM .BYTE $20,$7D
3660     .BYTE "�����������������������������������Ŀ",155
3670     .BYTE "�Screen Off:Yes  Password Encrpt:No!�",155
3680     .BYTE "�Disk Swaps:No!  Use Crunch only:No!�",155
3690     .BYTE "�        Compact w/query:No!        �",155
3700     .BYTE "