; NSWP VERS 2.05.26 as of 03/02/86
; BY DISZILOG 12/03/85 (VER .21,.22 LOST)
;
.Z80
;
CR	EQU	0DH
LF	EQU	0AH
;
BDOS	EQU	5
RSTDSK	EQU	13		; RESET DISK SYSTEM (HERE: RESET DMA)
SELDSK	EQU	14		; SELECT DISK
FOPEN	EQU	15		; OPEN FILE
FCLOSE	EQU	16		; CLOSE FILE
SFIRST	EQU	17		; SEARCH FOR FIRST
SNEXT	EQU	18		; SEARCH FOR NEXT
FDELT	EQU	19		; FILE DELETE
FREAD	EQU	20		; FILE READ
FWRIT	EQU	21		; FILE WRITE
FMAKE	EQU	22		; MAKE FILE
FRENAM	EQU	23		; RENAME FILE
GETDRV	EQU	25		; GET DRIVE
SETDMA	EQU	26		; SET DMA ADDRESS
SETATT	EQU	30		; SET ATTRIBUTE
GSUSER	EQU	32		; GET/SET USER
;
TDOS	EQU	50H
SABORT	EQU	8		; SET ABORT ADDRESS
GETSER	EQU	12		; GET SERIAL NUMBER / PRIVILEGE STATUS
COMPAT	EQU	13		; SET COMPATIBILITY FLAGS
SNDCL	EQU	18		; SEND COMMAND LINE
;
DFCB	EQU	5CH
DBUF	EQU	80H
STACK	EQU	3C00H
;
	CSEG
;
START:	JP	BEGIN
;
MAXLIN::DB	24
;
REVON::	DS	7
REVOF::	DS	7
	DB	'NSWP (c) 1983 by Dave Rand'
;
BEGIN:	LD	SP,STACK		; SET UP LOCAL STACK
	LD	A,(TDOS)		; CHECK IF RUNNING TURBODOS
	CP	0C3H
	JR	Z,ISTURB		; SKIP IF TD...
	CALL	ILPRT			;   ELSE BARF
	DB	CR,LF,7
	'ERROR: TurboDOS ver 1.3 and up only!',CR,LF,0
	RST	0
;
ISTURB:	LD	C,GETSER		; CHECK PRIV STATUS
	CALL	TDOS
	BIT	7,B
	JR	NZ,..ISP
	CALL	ILPRT
	DB	CR,LF,7
	'NON-PRIVILEGED USER',CR,LF,0
	RST	0
;
..ISP:	LD	C,COMPAT
	LD	E,0F8H			; SET COMPAT FLAGS
	CALL	TDOS
	LD	C,SABORT
	LD	DE,LOOP			; SET ABORT ADDRESS
	CALL	TDOS
	LD	HL,(BDOS+1)		; GET BDOS ENTRY POINT
	DEC	H			; PROTECT ZONE
	LD	L,0			; MAKE EVEN PAGE
	LD	(RAMTOP),HL		; STORE AS END OF TPA
	LD	C,GETDRV		; GET CURRENT DRIVE
	CALL	BDOS
	LD	(DRIVE1),A		; STORE IT AWAY
	LD	(DRIVE2),A
	LD	C,GSUSER		; GET CURRENT USER
	LD	E,0FFH
	CALL	BDOS
	LD	(USER1),A		; STORE IT AWAY, TOO
	LD	(USER2),A
	LD	HL,DFCB+1		; MOVE DEFAULT FCB...
	LD	DE,FCB1+1		;   INTO INTERNAL FCB
	LD	B,11			; (11 BYTES)
	CALL	MOVHDB
	LD	A,'?'			; SET EXTENT BYTES
	LD	(DE),A			;   TO WILDCARD
	INC	DE
	LD	(DE),A
	INC	DE
	LD	(DE),A
	INC	DE
	LD	(DE),A
	LD	HL,-1			; INITIALIZE FILECOUNT
	LD	(NMBFLS),HL		;   AND FILE POINTER
	LD	(FILNMB),HL
	CALL	PRCMDL			; PROCESS COMMAND LINE
	CALL	CRCRCT			; SET UP CRC LOOKUP TABLE
RELOG:	LD	C,RSTDSK		; SET DMA TO 80H
	CALL	BDOS
	CALL	DSPBNR			; DISPLAY BANNER
	CALL	GTBKSZ			; GET DRIVE'S BLOCK SIZE
	CALL	ILPRT			; PRINT INFO
	DB	'Drive ',0
	LD	A,(USER2)		; GET USER
	INC	A			; IF USER<>0FFH...
	JR	NZ,.NALL		;   THEN DISPLAY USER NUMBER
	LD	A,'*'			;     ELSE DISPLAY A "*"
	CALL	PUTCH
	LD	A,'?'			;     BE SURE FCB BYTE 1 IS "?"
	JR	.ALLU
;
.NALL:	DEC	A
	PUSH	AF
	LD	E,A
	CALL	LOGUSR
	POP	AF
	LD	L,A
	LD	H,0
	CALL	HXDCNX
	XOR	A
.ALLU:	LD	(FCB1),A		; SET DRIVE FIELD
	LD	A,(DRIVE2)
	ADD	A,'A'
	CALL	PUTCH
	CALL	ILPRT
	DB	':  ',0
	LD	HL,-1
	LD	(NMBFLS),HL		; INITIALIZE # OF FILES
	INC	HL
	LD	(FREEK),HL		; INITIALIZE FREESPACE
	LD	(TOTALK),HL		;   AND TOTAL FILESIZE
	CALL	CALCFS			; CALCULATE FREE SPACE
	LD	HL,STACK		; HL = BUFFER
	LD	DE,FCB1			; DE = FILENAME MATCH
	CALL	WILDEX			; EXPAND WILDCARD INTO BUFFER
	LD	A,L			; CHECK IF ANY FILES
	OR	H
	DEC	HL
	JR	Z,.NFLSF		; NO FILES FOUND
	INC	HL			; ELSE INCREMENT COUNT
	LD	(NMBFLS),HL		;   AND STORE
	CALL	PRPBUF			; PRE-PROCESS BUFFER
	CALL	SORTBF			; SORT FILENAME BUFFER
	CALL	UNDUPE			; REMOVE DUPLICATES
	LD	HL,(Y2C15)
	DEC	HL
	LD	(NMBFLS),HL
.NFLSF:	PUSH	HL
	CALL	PSTATS
	POP	HL
	INC	HL
	CALL	CLCFPT
	LD	(FILPTR),HL
	LD	HL,0
	LD	(FILNMB),HL
	LD	(TAGTOT),HL
	LD	(TAGTO1),HL
;
; MAIN LOOP. COME HERE AFTER EVERY COMMAND.
;
LOOP:	LD	SP,STACK		; RESET STACK
	LD	A,(USER2)		; GET REQUESTED USER
	LD	(USER3),A		; SAVE IT
	CALL	LOGDUE			; LOG IT IN
	LD	HL,(NMBFLS)		; CHECK NUMBER OF FILES
	INC	HL
	LD	A,L			; HAVE ANY?
	OR	H
	JR	NZ,HAVEFL		;   YES, SKIP TO MAIN COMMAND ENTRY
	CALL	ILPRT			;     ELSE DISPLAY MESSAGE
	DB	CR,LF,CR,LF
	DB	'No files.',0
	CALL	CIN			; ACCEPT ONLY L,S,X,Z COMMANDS
	CP	'X'
	JP	Z,0			; QUIT
	CP	'L'
	JP	Z,LOGNEW
	CP	'S'
	JP	Z,FREESP
	CP	'Z'
	JP	Z,CHANGE
	LD	A,7
	CALL	PUTCH
	JR	LOOP
;
; COME HERE FOR MAIN COMMAND ACCEPTOR
;
HAVEFL:	CALL	CRLF			; NEW LINE
	LD	HL,(FILNMB)		; GET CURRNT FILE NUMBER
	CALL	CLCFPT			; POINT TO FILENAME
	CALL	DSPCFN			; DISPLAY IT WITH SIZE/STATUS
	CALL	CIN			; GET A CHARACTER
	LD	B,A			; MOVE CHAR INTO B
	LD	HL,LOOP			; SET UP RETURN STACK
	PUSH	HL
	LD	HL,CMDTBL		; POINT TO COMMAND TABLE
SRHCMD:	LD	A,(HL)			; GET COMMAND BYTE
	OR	A			; IF ZERO
	JR	Z,..ERR			;   THEN COMMAND NOT FOUND
	CP	B			; CHECK IF FOUND
	INC	HL			; POINT TO ADDRESS
	JR	Z,FNDCMD		; BRANCH IF FOUND
	INC	HL			; ELSE POINT TO
	INC	HL			;   NEXT CHARACTER
	JR	SRHCMD			;   AND REPEAT
;
FNDCMD:	LD	E,(HL)			; GET COMMAND ROUTINE ADDRESS
	INC	HL
	LD	D,(HL)
	PUSH	DE			; GO TO COMMAND ROUTINE
	RET
;
..ERR:	LD	A,7			; SOUND BELL IF ERROR
	JP	PUTCH
;
; PRINT STATS
;
PSTATS:	PUSH	HL
	CALL	CLCTLK
	LD	HL,(TOTALK)
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	'K in ',0
	POP	HL
	INC	HL
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	' files.  ',0
	LD	HL,(FREEK)
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	'K free.',0
	RET
;
; COMMAND TABLE - LETTER FOLLOWED BY ADDRESS
;
CMDTBL:	DB	' '
	DW	FORWRD
	DB	CR
	DW	FORWRD
	DB	'B'
	DW	BAKWRD
	DB	'X'
	DW	0			; QUIT
	DB	'S'
	DW	FREESP
	DB	'D'
	DW	DELETE
	DB	'T'
	DW	TAGFLE
	DB	'U'
	DW	UNTAGF
	DB	'V'
	DW	VIEWFL
	DB	'P'
	DW	PRINTF
	DB	'E'
	DW	ERASEF
	DB	'L'
	DW	LOGNEW
	DB	'C'
	DW	COPYFL
	DB	'M'
	DW	MASSCP
	DB	'A'
	DW	TAGAGN
	DB	'R'
	DW	RENAME
	DB	'F'
	DW	FINDFL
	DB	'W'
	DW	MASSTG
	DB	'Y'
	DW	SETATR
	DB	'?'
	DW	HELPME
	DB	'Q'
	DW	SQZUSQ
	DB	'Z'
	DW	CHANGE
	DB	'G'
	DW	GOEXEC
	DB	0
;
; EXECUTE A COMMAND
;
GOEXEC:	LD	HL,(FILNMB)
	CALL	CLCFPT			; HL=FILENAME POINTER
	PUSH	HL			; SAVE
	LD	DE,8
	ADD	HL,DE			; POINT TO TYPE
	LD	A,(HL)
	AND	7FH
	CP	'C'
	JR	NZ,NOCOMF
	INC	HL
	LD	A,(HL)
	AND	7FH
	CP	'O'
	JR	NZ,NOCOMF
	INC	HL
	LD	A,(HL)
	AND	7FH
	CP	'M'
	JR	NZ,NOCOMF
	LD	HL,80H
	LD	(HL),'\'
	INC	HL
	POP	DE			; GET FP
	LD	B,8			; 8 CHARS MAX
.CCL:	LD	A,(DE)			; GET A CHAR
	CP	' '			; BLANK?
	JR	Z,.CCE			;   YES
	LD	(HL),A
	INC	HL
	INC	DE
	DJNZ	.CCL
.CCE:	XOR	A
	LD	(HL),A
	LD	E,0FFH
	LD	C,47
	CALL	5
;
NOCOMF:	CALL	ILPRT
	DB	' not a .COM file',7,0
	JP	LOOP
;
; FORWARD A FILE
;
FORWRD:	LD	HL,(FILNMB)
	INC	HL
A0346:	LD	(FILNMB),HL
	EX	DE,HL
	LD	HL,(NMBFLS)
	CALL	CPHLDE
	JP	NC,LOOP
	LD	HL,0
	LD	(FILNMB),HL
	CALL	CRLF
	JP	LOOP
;
; BACKWARD A FILE
;
BAKWRD:	LD	HL,(FILNMB)
	LD	A,H
	OR	L
	DEC	HL
	LD	(FILNMB),HL
	JP	NZ,LOOP
	CALL	CRLF
	LD	HL,(NMBFLS)
	LD	(FILNMB),HL
	JP	LOOP
;
; CHANGE DRIVE
;
CHANGE:	CALL	GETDR
	SUB	41H
	LD	E,A
	PUSH	DE
	LD	C,26
	LD	D,DBUF
	CALL	TDOS
	POP	DE
	LD	C,25
	LD	D,-1
	PUSH	DE
	CALL	TDOS
	OR	A
	JR	Z,LOKOK
	CALL	ILPRT
	DB	CR,LF
	DB	'-- DRIVE IN USE --',7,0
	JP	LOOP
;
LOKOK:	CALL	ILPRT
	DB	CR,LF
	DB	'Change disk, press RETURN to continue:',0
..R?.:	LD	C,3
	CALL	BDOS
	CP	CR
	LD	A,7
	JR	Z,..RT.
	CALL	PUTCH
	JR	..R?.
;
..RT.:	LD	C,25
	POP	DE
	INC	D
	CALL	TDOS
	JP	LOOP
;
GETDR:	CALL	ILPRT
	DB	'  Which drive? ',0
	CALL	INPLN
	LD	A,(LINET)
	CP	'A'
	JP	C,LOOP
	CP	'P'+1
	JP	NC,LOOP
	RET
;
; DISPLAY FREE SPACE
;
FREESP:	CALL	GETDR
	PUSH	AF
	LD	C,RSTDSK
	CALL	BDOS
	LD	A,(DRIVE2)
	LD	B,A
	POP	AF
	SUB	41H
	LD	(DRIVE2),A
	PUSH	BC
	PUSH	AF
	CALL	CRLF
	CALL	GTBKSZ
	CALL	CALCFS
	CALL	CRLF
	LD	HL,(FREEK)
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	'K remaining on drive ',0
	POP	AF
	ADD	A,'A'
	CALL	PUTCH
	LD	A,':'
	CALL	PUTCH
	CALL	CRLF
	POP	BC
	LD	A,B
	LD	(DRIVE2),A
	CALL	GTBKSZ
	JP	LOOP
;
; SET ATTRIBUTES
;
SETATR:	CALL	ILPRT
	DB	'  Which attributes (2-4,R,G,A)? ',0
	CALL	INPLN
	LD	HL,DSTFCB+1
	LD	B,11
A0419:	LD	(HL),0
	INC	HL
	DJNZ	A0419
	LD	HL,LINEC
	LD	A,(HL)
	OR	A
	JP	Z,LOOP
	INC	HL
	LD	(Y2C3D),HL
A042C:	LD	HL,(Y2C3D)
	EX	DE,HL
	CALL	SKNBL
	EX	DE,HL
	INC	HL
	LD	(Y2C3D),HL
	OR	A
	JR	Z,A0457
	LD	HL,ATTRS
	LD	DE,DSTFCB+1
	LD	B,11
A0444:	CP	(HL)
	JR	Z,A0451
	INC	HL
	INC	DE
	DJNZ	A0444
	JR	A042C
;
A0451:	LD	A,80H
	LD	(DE),A
	JR	A042C
;
A0457:	LD	A,2
	JP	A098F
;
ATTRS:	DB	'z234zzzzRGA'
;
; DELETE A FILE
;
DELETE:	CALL	ILPRT
	DB	'  Delete file? ',0
	CALL	CIN
	CP	'Y'
	JP	NZ,LOOP
	LD	HL,(FILNMB)
	CALL	DELFHL
	JP	LOOP
;
; DELETE FILE # IN HL
;
DELFHL:	CALL	CLCFPT
	PUSH	HL
	CALL	SUBUP
	POP	HL
	PUSH	HL
	LD	DE,DFCB+1
	XOR	A
	LD	(DFCB),A
	LD	B,11
	CALL	MOVHDB
	PUSH	HL
	PUSH	DE
	POP	HL
	INC	DE
	LD	B,22
	LD	(HL),0
	CALL	MOVHDB
	LD	E,0FFH
	CALL	LOGUSR
	LD	E,A
	POP	HL
	PUSH	DE
	LD	E,(HL)
	CALL	LOGUSR
	LD	A,(DFCB+9)
	AND	80H
	JR	Z,NOTRDO
	CALL	ILPRT
	DB	'  R/O. Delete? ',7,0
	CALL	CIN
	CP	'Y'
	JR	Z,DELRDO
	POP	DE
	POP	HL
	RET
;
; DELETE R/O FILE
;
DELRDO:	LD	A,(DFCB+9)
	AND	7FH
	LD	(DFCB+9),A
	LD	DE,DFCB
	CALL	SATTRB
NOTRDO:	LD	DE,DFCB
	CALL	DELDE
	JR	NZ,DLTD
NTDLT:	CALL	ILPRT
	DB	' Can''t delete file',7,0
	JP	LOOP
;
DLTD:	POP	DE
	CALL	LOGUSR
	LD	HL,(NMBFLS)
	LD	DE,(FILNMB)
	OR	A
	SBC	HL,DE
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	PUSH	HL
	POP	BC
	POP	HL
	PUSH	HL
	LD	DE,10H
	ADD	HL,DE
	POP	DE
	LD	A,B
	OR	C
	JR	Z,A0523
A0519:	LD	A,(HL)
	LD	(DE),A
	INC	HL
	INC	DE
	DEC	BC
	LD	A,B
	OR	C
	JR	NZ,A0519
A0523:	LD	HL,(NMBFLS)
	DEC	HL
	LD	(NMBFLS),HL
	EX	DE,HL
	LD	HL,(FILNMB)
	CALL	CPHLDE
	RET	C
	RET	Z
	DEC	HL
	LD	(FILNMB),HL
	RET
;
; ERASE FILE
;
ERASEF:	CALL	ILPRT
	DB	CR,LF
	DB	'Erase Tagged or Untagged files (T/U)? ',0
	CALL	CIN
	CP	'T'
	JR	Z,A0571
	CP	'U'
	JP	NZ,LOOP
A0571:	CP	'T'
	LD	A,1
	JR	Z,A0579
	XOR	A
A0579:	LD	(Y2C0C),A
A057C:	CALL	ILPRT
	DB	CR,LF
	DB	'Do you wish to be prompted (Y/N/A)? ',0
	CALL	CIN
	CP	3
	JP	Z,LOOP
	CP	'A'
	JP	Z,LOOP
	CP	'N'
	JR	Z,A05C2
	CP	'Y'
	LD	A,1
	JR	NZ,A057C
	JR	A05C3
;
A05C2:	XOR	A
A05C3:	LD	(Y2C33),A
	LD	HL,0
A05C9:	PUSH	HL
	LD	(FILNMB),HL
	CALL	CLCFPT
	PUSH	HL
	CALL	ADDH12
	LD	A,(HL)
	AND	1
	LD	B,A
	LD	A,(Y2C0C)
	CP	B
	POP	HL
	JR	NZ,A0633
	PUSH	HL
	CALL	ILPRT
	DB	CR,LF
	DB	'Deleting  ---> ',0
	POP	HL
	CALL	A13DA
	LD	A,(Y2C33)
	OR	A
	JR	Z,A0624
	CALL	ILPRT
	DB	'  Delete (Y/N/A)? ',0
	CALL	CIN
	CP	'A'
	JR	Z,A0647
	CP	'Y'
	JR	NZ,A0633
A0624:	CALL	A1598
	JR	Z,A0650
	POP	HL
	PUSH	HL
	CALL	DELFHL
	POP	HL
	JR	A0635
;
A0633:	POP	HL
	INC	HL
A0635:	EX	DE,HL
	LD	HL,(NMBFLS)
	INC	HL
	LD	A,L
	OR	H
	JR	Z,A0647
	DEC	HL
	CALL	CPHLDE
	EX	DE,HL
	JP	NC,A05C9
A0647:	LD	HL,0
	LD	(FILNMB),HL
	JP	LOOP
;
A0650:	LD	HL,0
	LD	(FILNMB),HL
	JP	A0B55
;
; ADD UP TAGGED FILES AND DISPLAY
;
ADDUP:	LD	A,(HL)			; GET TAG FLAG
	LD	(HL),1			; SET TO TAGGED
	CP	1			; IF ALREADY TAGGED
	JR	Z,.TALRY		;   THEN SKIP
	INC	HL
	CALL	CLCFSZ			; CALC FILE SIZE
	PUSH	HL
	LD	HL,(TAGTO1)		; ACCUMULATE 1K SIZE TOTAL
	ADD	HL,DE
	LD	(TAGTO1),HL
	POP	HL
	EX	DE,HL
	LD	HL,(TAGTOT)		; ACCUMULATE CUR BLK TOTAL
	ADD	HL,DE
	LD	(TAGTOT),HL
.TALRY:	LD	HL,(TAGTOT)
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	'K (',0
	LD	HL,(TAGTO1)
	LD	C,4
	CALL	HEXDEC
	CALL	ILPRT
	DB	'K).',0
	RET
;
; TAG FILE
;
TAGFLE:	CALL	.MTGDF
	LD	HL,(FILNMB)
	CALL	CLCFPT
	CALL	ADDH12
	CALL	ADDUP
	JP	FORWRD
;
.MTGDF:	CALL	ILPRT
	DB	'  Tagged files = ',0
	RET
;
; UNTAG FILE
;
UNTAGF:	CALL	.MTGDF			; DISPLAY MESSAGE
	LD	HL,(FILNMB)
	CALL	CLCFPT
	CALL	SUBUP			; SUBTRACT FILESIZE FROM TOTAL
	CALL	.TALRY
	JP	FORWRD
;
SUBUP:	CALL	ADDH12
	LD	A,(HL)
	LD	(HL),0
	CP	1
	RET	NZ
	PUSH	HL
	INC	HL
	CALL	CLCFSZ
	PUSH	HL
	LD	HL,(TAGTO1)
	OR	A
	SBC	HL,DE
	LD	(TAGTO1),HL
	POP	HL
	EX	DE,HL
	LD	HL,(TAGTOT)
	OR	A
	SBC	HL,DE
	LD	(TAGTOT),HL
	POP	HL
	RET
;
; LOG INTO NEW DRIVE, USER OR FILEMATCH
;
LOGNEW:	LD	C,GETDRV		; GET DRIVE
	CALL	BDOS
	LD	E,A			; DRIVE TO E
	LD	C,26			; FLUSH
	LD	D,80H			; UNCONDITIONAL
	CALL	TDOS
	CALL	ILPRT
	DB	'  New drive/user/mask? ',0
	CALL	INPLN
	LD	HL,LINEC
	LD	A,(HL)
	OR	A
	JP	Z,LOOP
	INC	HL
	LD	(Y2C3D),HL
	CALL	PARSDF
	LD	A,(DFCB)
	OR	A
	JR	NZ,A072C
	LD	A,(DRIVE2)
	INC	A
A072C:	DEC	A
	LD	(DRIVE2),A
	LD	A,(Y2C3A)
	CP	0FFH
	JR	NZ,A0745
	LD	A,(LINET+1)
	CP	'*'
	LD	A,0FFH
	JR	Z,A0745
	LD	A,(USER2)
A0745:	LD	(USER2),A
	LD	A,(DFCB+1)
	CP	' '
	JR	NZ,A075D
	LD	HL,DFCB+1
	LD	DE,DFCB+2
	LD	B,10
	LD	(HL),'?'
	CALL	MOVHDB
A075D:	LD	HL,DFCB
	LD	DE,FCB1
	LD	B,12
	CALL	MOVHDB
	CALL	CRLF
	CALL	CRLF
	JP	RELOG
;
A0771:	PUSH	HL
	XOR	A
	LD	(CRCFLG),A
A0776:	LD	A,(HL)
	OR	A
	JR	Z,A0784
	CP	'V'
	INC	HL
	JR	NZ,A0776
	LD	(CRCFLG),A
A0784:	POP	HL
	RET
;
A0786:	CALL	ILPRT
	DB	CR,LF
	DB	'Illegal drive code.',0
	JP	LOOP
;
A07A2:	CALL	A0771
	LD	A,(USER2)
	LD	(Y2C3A),A
	LD	A,(DRIVE2)
	LD	(Y2C38),A
	LD	A,(HL)
	CP	'0'
	JR	C,A0786
	CP	'9'+1
	JR	C,A07D2
	CP	'A'
	JR	C,A0786
	CP	'P'+1
	JR	NC,A0786
	SUB	'A'
	LD	(Y2C38),A
	INC	HL
	LD	A,(HL)
	CP	':'
	RET	Z
	OR	A
	RET	Z
;
; FOLLOWING CODE CALCULATES USER #
;
A07D2:	CP	'*'
	JR	Z,A0806
	CP	'0'
	RET	C
	CP	'9'+1
	RET	NC
	AND	0FH
	LD	C,A
	CALL	USRPAT			; MULTIPLY
	LD	B,A
	INC	HL
	LD	A,(HL)
	CP	':'
	JR	Z,A07FF
	OR	A
	JR	Z,A07FF
	CP	'0'
	JR	C,A07FF
	CP	'9'+1
	JR	NC,A07FF
	SUB	'0'
	ADD	A,B
	CP	32
	RET	NC
	LD	(Y2C3A),A
	RET
;
A07FF:	LD	A,C
	LD	(Y2C3A),A
	RET
;
A0806:	LD	A,0FFH
	LD	(Y2C3A),A
	RET
;
; GET TAGGED/UNTAGGED RESPONSE AND SET A
;
GTUR.:	CALL	ILPRT
	DB	CR,LF
	DB	'Tagged or Untagged files (T/U)? ',0
	CALL	CIN
	CP	'T'
	JR	Z,.GTURT
	CP	'U'
	JP	NZ,LOOP
	XOR	A
	JR	.GTURS
;
.GTURT:	LD	A,1
.GTURS:	LD	(.TOTU.),A
	RET
;
; LINE INPUT
;
INPLN:	LD	DE,LINE
	LD	C,10
	CALL	BDOS
	LD	HL,LINEC
	PUSH	HL
	LD	E,(HL)
	INC	HL
	LD	D,0
	ADD	HL,DE
	LD	(HL),0
	INC	HL
	LD	(HL),B
	POP	HL
A0822:	INC	HL
	LD	A,(HL)
	OR	A
	RET	Z
	CALL	CAPS
	LD	(HL),A
	JR	A0822
;
A082D:	CALL	ILPRT
	DB	'  Copy to drive/user? ',0
	CALL	INPLN
	LD	HL,LINEC
	LD	A,(HL)
	OR	A
	JP	Z,LOOP
	PUSH	HL
	LD	C,RSTDSK
	CALL	BDOS
	CALL	GTBKSZ
	POP	HL
	INC	HL
	CALL	A07A2
	LD	A,(Y2C43)
	OR	A
	RET	NZ
A0865:	LD	A,(USER3)
	LD	B,A
	LD	A,(Y2C3A)
	CP	0FFH
	JR	Z,A0873
	CP	B
	RET	NZ
A0873:	LD	A,(Y2C38)
	LD	B,A
	LD	A,(DRIVE2)
	CP	B
	RET	NZ
	CALL	ILPRT
	DB	CR,LF
	DB	'Can''t copy to same drive and user.',0
	JP	LOOP
;
; COPY A FILE
;
COPYFL:	LD	HL,(FILNMB)
	CALL	CLCFPT
	PUSH	HL
	XOR	A
	LD	(SRCFCB),A
	LD	DE,SRCFCB+1
	LD	B,11
	CALL	MOVHDB
	LD	A,(HL)
	LD	(USER3),A
	CALL	ILPRT
	DB	'  Copy to (filespec)? ',0
	CALL	INPLN
	LD	HL,LINEC
	LD	A,(HL)
	OR	A
	JP	Z,LOOP
	INC	HL
	LD	(Y2C3D),HL
	CALL	PARSDF
	LD	HL,(Y2C3D)
	CALL	A0771
	LD	A,(DFCB+1)
	CP	' '
	JR	NZ,A090A
	LD	HL,SRCFCB+1
	LD	DE,DFCB+1
	LD	B,11
A0900:	LD	A,(HL)
	AND	7FH
	LD	(DE),A
	INC	HL
	INC	DE
	DJNZ	A0900
A090A:	LD	A,(DFCB)
	DEC	A
	LD	(Y2C38),A
	LD	HL,SRCFCB+1
	LD	DE,DFCB+1
	CALL	A100E
	JR	NZ,A0920
	CALL	A0865
A0920:	LD	HL,DFCB+1
	LD	DE,SRCFCB+1
	LD	B,11
A0928:	LD	A,(DE)
	AND	80H
	OR	(HL)
	LD	(HL),A
	INC	HL
	INC	DE
	DJNZ	A0928
	LD	HL,DFCB
	LD	DE,DSTFCB
	LD	B,12
	CALL	MOVHDB
	LD	A,1
	LD	(.CPFL),A
	POP	HL
	CALL	A0DB4
	JP	LOOP
;
; SQ/USQ ENTRY POINT
;
SQZUSQ:	CALL	ILPRT
	DB	CR,LF
	DB	'  Squeeze, Unsqueeze or Reverse (S,U,R)? ',0
	CALL	CIN
	LD	(Y2C00),A
	CP	'S'
	JR	Z,A0989
	CP	'U'
	JR	Z,A0989
	CP	'R'
	JP	NZ,LOOP
A0989:	LD	A,1
	JR	A098F
;
; MOVE FILES
;
MASSCP:	XOR	A
A098F:	LD	(Y2C43),A
	PUSH	AF
	CALL	GTUR.			; ASK TAG/UNTAG
	CALL	CRLF
	LD	A,(USER2)
	LD	(USER3),A
	POP	AF
	CP	2
	JR	Z,A09A5
	CALL	A082D
A09A5:	LD	HL,0
A09A8:	PUSH	HL
	CALL	CLCFPT
	PUSH	HL
	CALL	ADDH12
	LD	A,(HL)
	AND	1
	CP	1
.TOTU.	EQU	$-1			; T/U FLAG
	DEC	HL
	LD	B,(HL)
	POP	HL
	JP	NZ,.NTTGD		; SKIP IF NOT TAGGED
	PUSH	HL
	LD	A,B
	LD	(USER3),A
	LD	A,(Y2C43)
	OR	A
	JR	NZ,A0A08
	LD	A,(DRIVE2)
	LD	B,A
	LD	A,(Y2C38)
	CP	B
	JR	NZ,A0A08
	LD	A,(USER3)
	LD	B,A
	LD	A,(Y2C3A)
	CP	B
	JR	NZ,A0A08
	CALL	ILPRT
	DB	CR,LF
	DB	'Skipping, same drive & user --> ',0
	POP	HL
	CALL	A13DA
	JP	.NTTGD
;
A0A08:	LD	A,(Y2C43)
	CP	1
	JR	Z,A0A2C
	CP	2
	JR	Z,A0A43
	CALL	ILPRT
	DB	CR,LF
	DB	'Copying  --> ',0
	JR	A0A57
;
A0A2C:	CALL	ILPRT
	DB	CR,LF
	DB	'SQ/USQ   --> ',0
	JR	A0A57
;
A0A43:	CALL	ILPRT
	DB	CR,LF
	DB	'Setting  --> ',0
A0A57:	POP	HL
	PUSH	HL
	CALL	A13DA
	CALL	ILPRT
	DB	' to ',0
A0A64:	LD	A,(Y2C43)
	CP	2
	JR	NZ,A0AE2
	LD	HL,DSTFCB+1
	LD	DE,T0AC2
	LD	B,4
A0A74:	LD	A,(HL)
	OR	A
	CALL	NZ,A0AA3
	INC	HL
	INC	DE
	INC	DE
	INC	DE
	DEC	B
	DJNZ	A0A74
	LD	HL,DSTFCT
	LD	DE,T0ACE
	LD	A,(HL)
	OR	A
	CALL	Z,A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C,A0ED5
	JR	A0DF5
;
A0E1E:	CALL	A0ED5
	CALL	CLSDST
	CALL	A16C0
	LD	A,(CRCFLG)
	OR	A
	RET	Z
	LD	HL,.CPFL
	LD	A,(HL)
	LD	(HL),0
	OR	A
	CALL	NZ,CRLF
	CALL	ILPRT
	DB	'  Verifying... ',0
	CALL	A1604
	LD	HL,Y2C76
	LD	DE,Y2C77
	LD	B,21
	LD	(HL),0
	CALL	MOVHDB
	LD	DE,DSTFCB
	LD	C,FOPEN
	CALL	BDOS
	INC	A
	JR	NZ,A0E74
	CALL	ILPRT
	DB	' Can''t open file!',0
	JP	LOOP
;
A0E74:	LD	DE,80H
	LD	C,SETDMA
	CALL	BDOS
	LD	HL,(CRCACC)
	LD	(SRCCRC),HL
	LD	HL,0
	LD	(CRCACC),HL
.VFYLP:	LD	C,FREAD
	LD	DE,DSTFCB
	CALL	BDOS
	OR	A
	JR	NZ,VFYDUN
	LD	HL,DBUF
	LD	DE,100H
	CALL	CRCBLK
	JR	.VFYLP
;
VFYDUN:	CALL	CLSDST			; CLOSE DESTINATION FILE
	LD	DE,(SRCCRC)
	LD	HL,(CRCACC)
	CALL	CPHLDE
	JR	Z,.VFYOK
	CALL	ILPRT
	DB	'verify error',7,0
	JP	LOOP
;
.VFYOK:	CALL	ILPRT
	DB	'file ok.',0
	RET
;
A0ED5:	LD	DE,(Y2C34)
	LD	HL,(FILPTR)
	CALL	CPHLDE
	RET	Z
	CALL	CRCBLK
	CALL	A1604
	LD	HL,(FILPTR)
A0EE9:	PUSH	HL
	EX	DE,HL
	LD	C,SETDMA
	CALL	BDOS
	LD	DE,DSTFCB
	LD	C,FWRIT
	CALL	BDOS
	POP	HL
	OR	A
	JR	NZ,A0F16
	LD	DE,80H
	ADD	HL,DE
	LD	DE,(Y2C34)
	CALL	CPHLDE
	JR	NZ,A0EE9
	CALL	LOGDUE
	LD	HL,(FILPTR)
	LD	(Y2C34),HL
	RET
;
A0F16:	LD	C,GETDRV		; GET DRIVE
	CALL	BDOS
	LD	E,A			; DRIVE TO E
	LD	C,26			; FLUSH
	LD	D,80H			; UNCONDITIONAL
	CALL	TDOS
	CALL	ILPRT
	DB	CR,LF
	DB	'Destination disk full.',0
	CALL	CLSDST
	CALL	A16C0
	CALL	A16E7
	JP	LOOP
;
FINDFL:	CALL	ILPRT
	DB	'  Find what? ',0
	CALL	INPLN
	LD	HL,LINET
	LD	(Y2C3D),HL
	CALL	A1B9C
	LD	HL,DFCB+1
	LD	A,(HL)
	CP	' '
	JP	Z,LOOP
	LD	B,11
A0F6D:	LD	A,(HL)
	CP	' '
	JR	NZ,A0F75
	LD	(HL),'?'
A0F75:	INC	HL
	DJNZ	A0F6D
	CALL	ILPRT
	DB	CR,LF,0
	LD	HL,-1
	CALL	A0FEF
	JP	NZ,LOOP
	LD	(FILNMB),HL
	JP	LOOP
;
MASSTG:	CALL	ILPRT
	DB	'  Tag what? ',0
	CALL	INPLN
	LD	HL,LINET
	LD	(Y2C3D),HL
	CALL	A1B9C
	LD	HL,DFCB+1
	LD	A,(HL)
	CP	' '
	JP	Z,LOOP
	CALL	ILPRT
	DB	CR,LF,0
	LD	HL,-1
A0FBD:	CALL	A0FEF
	JP	NZ,LOOP
	PUSH	HL
	CALL	ILPRT
	DB	CR,LF
	DB	'Tagging --> ',0
	POP	HL
	PUSH	HL
	CALL	CLCFPT
	PUSH	HL
	CALL	A13DA
	LD	A,' '
	CALL	PUTCH
	POP	HL
	CALL	ADDH12
	CALL	ADDUP
	POP	HL
	JR	A0FBD
;
A0FEF:	INC	HL
	EX	DE,HL
	LD	HL,(NMBFLS)
	CALL	CPHLDE
	JR	C,A100A
	EX	DE,HL
	PUSH	HL
	CALL	CLCFPT
	LD	DE,5DH
	CALL	A100E
	POP	HL
	RET	Z
	JR	A0FEF
;
A100A:	LD	A,1
	OR	A
	RET
;
A100E:	LD	B,11
	EX	DE,HL
A1011:	LD	A,(HL)
	CP	'?'
	JR	Z,A101C
	LD	A,(DE)
	AND	7FH
	CP	(HL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(USER3)
	JR	NZ,A1106
	LD	E,A
A1106:	CALL	LOGUSR
	LD	HL,6DH
	LD	DE,SRCFCB+1
	LD	B,0BH
	CALL	MOVHDB
	XOR	A
	LD	(SRCFCB),A
	CALL	A15AB
	LD	DE,SRCFCB
	LD	HL,(FILPTR)
	CALL	WILDEX
	LD	A,L
	OR	H
	JR	Z,A1152
	CALL	ILPRT
	DB	CR,LF
	DB	'Destination file exists!',0
	LD	C,RSTDSK
	CALL	BDOS
	CALL	GTBKSZ
	JP	LOOP
;
A1152:	LD	A,(Y2C3A)
	CP	0FFH
	JR	Z,A1162
	LD	B,A
	LD	A,(USER3)
	CP	B
	JR	NZ,DIF.US
A1162:	LD	A,(USER3)
	LD	E,A
	CALL	LOGUSR
	LD	E,0FFH
	CALL	LOGUSR
	PUSH	AF
	LD	DE,DFCB
	LD	C,FRENAM
	CALL	BDOS
	POP	AF
	LD	E,A
	CALL	LOGUSR
	XOR	A
A117D:	POP	DE
	PUSH	AF
	LD	HL,6DH
	LD	B,12
	CALL	MOVHDB
	POP	AF
	CP	A
	RET
;
DIF.US:	CALL	ILPRT
	DB	CR,LF,LF,7
	DB	'ERROR: Cannot rename file to different user'
	DB	CR,LF,0
	JP	LOOP
;
WILDEX:	PUSH	HL
	PUSH	DE
	LD	C,SETDMA
	LD	DE,DBUF
	CALL	BDOS
	POP	DE
	PUSH	DE
	LD	C,SFIRST
	CALL	BDOS
	INC	A
	POP	DE
	POP	HL
	LD	BC,0
	JR	NZ,GETFLN
	LD	HL,0
	RET
;
GETFLN:	PUSH	DE
	PUSH	BC
	PUSH	HL
	DEC	A
	ADD	A,A
	ADD	A,A
	ADD	A,A
	ADD	A,A
	ADD	A,A
	LD	HL,DBUF
	ADD	A,L
	LD	L,A
	POP	DE
	LD	B,32
	CALL	MOVHDB
	PUSH	DE
	INC	D
	LD	HL,(RAMTOP)
	CALL	CPHLDE
	JR	NC,NOTOM
	CALL	ILPRT
	DB	CR,LF
	DB	'OUT OF MEMORY?',0
	RST	0
;
NOTOM:	POP	DE
	PUSH	DE
	POP	HL
	POP	BC
	INC	BC
	POP	DE
	PUSH	DE
	PUSH	BC
	PUSH	HL
	LD	C,SNEXT
	CALL	BDOS
	INC	A
	POP	HL
	POP	BC
	POP	DE
	JR	NZ,GETFLN
	LD	L,C
	LD	H,B
	RET
;
; WILDCARD RENAME
;
RENWIL:	CALL	ILPRT
	DB	CR,LF,CR,LF
	DB	'Old name? ',0
	CALL	INPLN
	LD	HL,LINET
	LD	(Y2C3D),HL
	LD	HL,FCB0
	CALL	PARSFN
	LD	A,(FCB0+1)
	CP	' '
	JP	Z,LOOP
	LD	A,(Y2C3A)
	LD	(Y2C0C),A
	CALL	ILPRT
	DB	CR,LF
	DB	'New name? ',0
	CALL	INPLN
	LD	HL,LINET
	LD	(Y2C3D),HL
	LD	HL,DSTFCB
	CALL	PARSFN
	LD	A,(DSTFCB+1)
	CP	' '
	JP	Z,LOOP
	CALL	CRLF
	LD	HL,0
A1312:	PUSH	HL
	CALL	CLCFPT
	PUSH	HL
	LD	DE,FCB0+1
	CALL	A1385
	JR	NZ,A1362
	CALL	ILPRT
	DB	CR,LF
	DB	'Renaming --> ',0
	POP	HL
	PUSH	HL
	CALL	A13DA
	POP	HL
	PUSH	HL
	LD	DE,11
	ADD	HL,DE
	LD	A,(HL)
	LD	(USER3),A
	CALL	ILPRT
	DB	' to ',0
	POP	HL
	PUSH	HL
	CALL	A13B2
	LD	HL,6DH
	CALL	A13DA
	POP	HL
	CALL	A10B9
	LD	B,A
	LD	A,(D1374)
	OR	B
	LD	(D1374),A
	PUSH	HL
A1362:	POP	HL
	POP	HL
	INC	HL
	EX	DE,HL
	LD	HL,(NMBFLS)
	CALL	CPHLDE
	EX	DE,HL
	JR	NC,A1312
	CALL	CRLF
	LD	A,0
D1374	EQU	$-1
	CP	'.'
	JP	NZ,A108D
	LD	C,RSTDSK
	CALL	BDOS
	CALL	GTBKSZ
	JP	A108D
;
A1385:	LD	A,(HL)
	CP	0E5H
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	ILPRT
	DB	'K :',0
	POP	AF
	OR	A
	LD	C,' '
	JR	Z,A145B
	CP	1
	LD	C,'*'
	JR	Z,A145B
	LD	C,'#'
A145B:	LD	A,C
	JP	PUTCH
;
A1460:	PUSH	BC
	PUSH	HL
	LD	A,(HL)
	CALL	PUTCH
	POP	HL
	POP	BC
	INC	HL
	DJNZ	A1460
	RET
;
PRINTF:	CALL	CRLF
	LD	A,5
	LD	(Y2C3C),A
	JR	A14C9
;
VIEWFL:	CALL	CRLF
	XOR	A
	LD	(Y2C3C),A
	INC	A
	LD	(Y2C32),A
A1484:	CALL	ILPRT
	DB	'Press ^X to abort, L to advance a line, cr to advance '
	DB	'a page.',CR,LF,0
	LD	A,2
A14C9:	LD	(Y2C3B),A
	LD	HL,(FILNMB)
	CALL	CLCFPT
	CALL	A15B8
	CALL	A0D7B
	LD	DE,0FF76H
	CALL	CPHLDE
	LD	HL,A1773
	JR	NZ,A14FD
	LD	HL,(FILPTR)
	LD	(Y2C21),HL
	LD	HL,Y2EED
	CALL	A0BFD
	OR	A
	JR	NZ,A14FD
	CALL	CRLF
	LD	HL,A20BA
	JR	A1505
;
A14FD:	PUSH	HL
	LD	HL,(FILPTR)
	LD	(Y2C21),HL
	POP	HL
A1505:	LD	(D151B),HL
A1508:	CALL	A15A4
	CP	'X'-40H
	JR	Z,A1575
	CP	3
	JR	Z,A1575
	CP	'S'-40H
	JR	Z,A157B
	CALL	A1773
D151B	EQU	$-2
	JR	NZ,A1575
	CP	'Z'-40H
	JR	Z,A1575
	AND	7FH
	LD	E,A
	CP	CR
	JR	NZ,A1534
	LD	A,(Y2C32)
	INC	A
	LD	(Y2C32),A
A1534:	LD	A,(Y2C3B)
	LD	C,A
	CALL	BDOS
	LD	A,(Y2C3C)
	OR	A
	JR	NZ,A1508
	LD	A,(Y2C32)
	LD	B,A
	LD	A,(MAXLIN)
	CP	B
	JR	NZ,A1508
	CALL	A1590
	CP	04CH
	JR	Z,A156B
	CP	06CH
	JR	Z,A156B
	CP	018H
	JR	Z,A1575
	CP	03H
	JR	Z,A1575
	XOR	A
	LD	(Y2C32),A
	JR	A1508
;
A156B:	LD	A,(Y2C32)
	DEC	A
	LD	(Y2C32),A
	JR	A1508
;
A1575:	CALL	A16C0
	LD	A,(Y2C3C)		; GET FLAG
	CP	5			; PRINTER?
	JP	NZ,LOOP			;   NO, GO BACK
	LD	C,28			; ELSE SIGNAL EOP
	CALL	TDOS
	JP	LOOP
;
A157B:	CALL	A1590
	JR	A1508
;
CONDIN:	LD	C,11
	CALL	BDOS
	OR	A
	RET	Z
CIN:	LD	C,1
	CALL	BDOS
	JP	CAPS
;
A1590:	CALL	A15A4
	OR	A
	JR	Z,A1590
	RET
;
A1598:	CALL	CONDIN
	CP	3
	RET	Z
	CALL	CAPS
	CP	58H
	RET
;
A15A4:	LD	E,0FFH
	LD	C,6
	JP	BDOS
;
A15AB:	LD	HL,Y2C50
	LD	DE,Y2C51
	LD	B,20
	LD	(HL),0
	JP	MOVHDB
;
A15B8:	LD	DE,SRCFCB
	XOR	A
	LD	(SRCFCB),A
	INC	DE
	LD	B,11
	CALL	MOVHDB
	LD	A,(HL)
	PUSH	AF
	CALL	A15AB
	POP	AF
	LD	(USER3),A
	CALL	LOGDUE
	LD	HL,(FILPTR)
	LD	(Y2C21),HL
	LD	(Y2C1F),HL
	LD	DE,SRCFCB
	LD	C,FOPEN
	CALL	BDOS
	INC	A
	RET	NZ
	CALL	ILPRT
	DB	CR,LF
	DB	'Can''t open file!',0
	JP	LOOP
;
A1604:	LD	A,(Y2C38)
	LD	E,A
	LD	C,SELDSK
	CALL	BDOS
	LD	A,(Y2C3A)
LOGUSA:	LD	E,A
LOGUSR:	LD	C,GSUSER
	JP	BDOS
;
; LOG INTO ENTRY DU:
;
LOGDUE:	LD	A,(DRIVE2)
	LD	E,A
	LD	C,SELDSK
	CALL	BDOS
	LD	A,(USER3)
	JR	LOGUSA
;
A1625:	LD	HL,(FILPTR)
	LD	DE,1400H
	ADD	HL,DE
	LD	(Y2C25),HL
	LD	(Y2C23),HL
	LD	DE,1000H
	ADD	HL,DE
	LD	(Y2C27),HL
	CALL	A1604
	LD	DE,DSTFCB
	PUSH	DE
	LD	A,(DSTFCT)
	AND	7FH
	LD	(DSTFCT),A
	CALL	A16B2
	POP	DE
	PUSH	DE
	LD	C,FOPEN
	CALL	BDOS
	INC	A
	JR	Z,A167E
	POP	DE
	PUSH	DE
	LD	C,FCLOSE
	CALL	BDOS
	LD	A,(DSTFCT)
	AND	80H
	JR	Z,A1677
	LD	A,(DSTFCT)
	AND	7FH
	LD	(DSTFCT),A
	CALL	A16B2
	POP	DE
	PUSH	DE
	CALL	SATTRB
A1677:	POP	DE
	PUSH	DE
	CALL	DELDE
	JP	Z,NTDLT
	CP	4
	JR	Z,A167E
	LD	HL,.CPFL
	LD	A,(HL)
	LD	(HL),0
	OR	A
	CALL	NZ,CRLF
	CALL	ILPRT
	DB	'  (D)',0
A167E:	CALL	A16B2
	POP	DE
	LD	C,FMAKE
	CALL	BDOS
	INC	A
	RET	NZ
	CALL	ILPRT
	DB	CR,LF
	DB	'Destination disk directory full.',0
	JP	LOOP
;
A16B2:	LD	HL,Y2C76
	LD	DE,Y2C77
	LD	B,22
	LD	(HL),0
	JP	MOVHDB
;
A16C0:	CALL	LOGDUE
	LD	DE,SRCFCB
	LD	C,FCLOSE
	CALL	BDOS
	INC	A
	RET	NZ
A16CD:	CALL	ILPRT
	DB	CR,LF
	DB	'Can''t close file!',0
	JP	LOOP
;
A16E7:	CALL	A1604
	CALL	A16B2
	LD	DE,DSTFCB
	CALL	DELDE
	RET	NZ
	JP	NTDLT
;
CLSDST:	CALL	A1604
	LD	DE,DSTFCB
	LD	C,FCLOSE
	CALL	BDOS
	INC	A
	JR	Z,A16CD
	LD	HL,DSTFCT
	LD	A,(SRCFCT)
	AND	80H
	JR	Z,.CGLO
	SET	7,(HL)
.CGLO:	LD	A,(SRCFCT+1)
	AND	80H
	JR	Z,.DSET
	INC	HL
	SET	7,(HL)
.DSET:	LD	DE,DSTFCB
SATTRB:	LD	C,SETATT		; ATTEMPT TO SET ATTRIBUTE
	CALL	BDOS
	OR	A
	RET	Z			; OK
	CALL	ILPRT			;   ELSE REPORT ERROR
	DB	' -- unable to set attributes --',7,0
	RET
;
A171C:	LD	DE,(Y2C27)
	LD	HL,(Y2C23)
	LD	B,A
	CALL	CPHLDE
	LD	A,B
	JR	Z,A1731
	LD	(HL),A
	INC	HL
	LD	(Y2C23),HL
	RET
;
A1731:	PUSH	AF
	CALL	A1739
	POP	AF
	JR	A171C
;
A1739:	LD	DE,(Y2C23)
	LD	HL,(Y2C25)
	CALL	CPHLDE
	RET	Z
	PUSH	HL
	CALL	A1604
	POP	HL
A1749:	PUSH	HL
	EX	DE,HL
	LD	C,SETDMA
	CALL	BDOS
	LD	DE,DSTFCB
	LD	C,FWRIT
	CALL	BDOS
	OR	A
	JP	NZ,A0F16
	POP	HL
	LD	DE,80H
	ADD	HL,DE
	EX	DE,HL
	LD	HL,(Y2C23)
	EX	DE,HL
	CALL	CPHLDE
	JR	C,A1749
	LD	HL,(Y2C25)
	LD	(Y2C23),HL
	RET
;
A1773:	LD	DE,(Y2C1F)
	LD	HL,(Y2C21)
	CALL	CPHLDE
	JR	Z,A1787
	LD	A,(HL)
	INC	HL
	LD	(Y2C21),HL
	CP	A
	RET
;
A1787:	CALL	LOGDUE
	LD	HL,(FILPTR)
	LD	(Y2C21),HL
	LD	(Y2C1F),HL
	LD	B,20H
A1795:	PUSH	BC
	EX	DE,HL
	LD	C,SETDMA
	CALL	BDOS
	LD	DE,SRCFCB
	LD	C,FREAD
	CALL	BDOS
	POP	BC
	OR	A
	JR	NZ,A17BA
	LD	HL,(Y2C1F)
	LD	DE,80H
	ADD	HL,DE
	LD	(Y2C1F),HL
	DJNZ	A1795
	JR	A1773
;
A17BA:	LD	DE,(Y2C21)
	LD	HL,(Y2C1F)
	CALL	CPHLDE
	JR	NZ,A1773
	XOR	A
	DEC	A
	RET
;
A17CA:	LD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USH	BC
	PUSH	DE
	LD	C,2
	CALL	HEXDEC
	LD	A,'/'
	CALL	PUTCH
	POP	HL
	LD	C,1
	CALL	HEXDEC
	LD	C,12
	CALL	5
	PUSH	DE
	LD	DE,BANN1
	CALL	PRINTM
	POP	HL
	LD	C,1
	CALL	HEXDEC
	LD	DE,BANN2
	CALL	PRINTM
	POP	HL
	CALL	PVERS
	LD	DE,BANN3
	CALL	PRINTM
	LD	C,12
	CALL	5
	CALL	PVERS
	LD	DE,BANN4
	JP	PRINTM
;
PVERS:	LD	A,L
	AND	0F0H
	RRA
	RRA
	RRA
	RRA
	OR	30H
	PUSH	HL
	CALL	PUTCH
	LD	A,'.'
	CALL	PUTCH
	POP	HL
	LD	A,L
	AND	0FH
	OR	30H
	JP	PUTCH
;
A1B9C:	LD	HL,(Y2C3D)
	EX	DE,HL
	CALL	SKNBL
	LD	HL,DFCB
	XOR	A
	LD	(HL),A
	DEC	A
	JP	A1C26
;
; PARSE TO DEFAULT FCB
;
PARSDF:	LD	HL,DFCB
;
; PARSE FILE NAME
; 
;
PARSFN:	LD	DE,(Y2C3D)	; GET SOURCE
	CALL	SKNBL		; ADVANCE DE TO FIRST NONBLANK
	LD	A,(DRIVE2)	; GET DEFAULT DRIVE
	INC	A		; MAKE 1..16
	LD	B,A		; SAVE IT
	LD	C,0FFH		; SET USER TO NONE
	LD	A,(DE)		; GET CHAR
	OR	A		; IF EOL
	JR	Z,A1C07		;   THEN DONE PARSING
	PUSH	DE		; SAVE POINTER
	CP	'0'		; IF NON-NUMBERIC
	JR	C,A1BCF		;   THEN SKIP
	CP	'9'+1		; IF NUMERIC
	JR	C,A1BE2		;   THEN PROCESS USER NUMBER
A1BCF:	SBC	A,40H		; MAY BE A DRIVESPEC - SAVE AS SUCH
	LD	B,A
	INC	DE
	LD	A,(DE)		; GET NECT CHAR
	CP	':'		; DRIVE/USER TERMINATOR?
	JR	Z,A1C11		;   YES
	OR	A		; EOL?
	JR	Z,A1C11		;   YES
	CP	'*'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	CALL	PUTCH
	JR	ILPRT
;
PRINTM:	LD	C,9
	JP	BDOS
;
PUTCH:	BIT	7,A
	JR	Z,OUTCHR
	PUSH	AF
	CALL	A1D46
	POP	AF
	CALL	OUTCHR
	JR	A1D4C
;
OUTCHR:	AND	7FH
	LD	E,A
	LD	C,2
	JP	BDOS
;
A1D46:	LD	HL,REVON
	JR	A1D4F
;
A1D4C:	LD	HL,REVOF
A1D4F:	LD	A,(HL)
	INC	HL
	OR	A
	RET	Z
	LD	B,A
A1D54:	PUSH	HL
	PUSH	BC
	LD	A,(HL)
	CALL	OUTCHR
	POP	BC
	POP	HL
	INC	HL
	DJNZ	A1D54
	RET
;
; CALCULATE FILE POINTER
;
CLCFPT:	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	ADD	HL,HL
	LD	DE,STACK
	ADD	HL,DE
	RET
;
USRPAT:	PUSH	BC
	XOR	A
	LD	B,10
DC10LP:	ADD	A,B
	DEC	C
	JR	NZ,DC10LP
	POP	BC
	RET
;
; DELETE FILE (FCB IN DE), RETURN Z=ERROR
;
DELDE:	PUSH	DE
	LD	C,SFIRST			; SEE IF EXISTS
	CALL	BDOS
	INC	A
	LD	A,3
	JR	Z,.XDL			; EXIT IF NOT THERE
	POP	DE
	PUSH	DE
	LD	C,FDELT			; WIPE IT OUT
	CALL	BDOS
	INC	A
	JR	NZ,.XDL			; OK TO EXIT
	POP	DE
	RET
;
.XDL:	POP	DE
	INC	A
	RET
;
BANNER:
CLS::	DB	'    '
	DB	CR,LF
	DB	'NSWP Version 2.05.26 for TurboDOS',CR,LF
	DB	'Original (c) Dave Rand, 1983,1984',CR,LF
	DB	'Serial number $'
BANN1:	DB	'  Network CPU : $'
BANN2:	DB	CR,LF,'TurboDOS version : $'
BANN3:	DB	'  CP/M version : $'
BANN4:	DB	CR,LF,CR,LF,'$'
;
HLPMSG:	DB	CR,LF
	DB	9,'A - Retag files       | Q - Squeeze/Unsqueeze files'
	DB	CR,LF
	DB	9,'B - Back one file     | R - Rename file(s)'
	DB	CR,LF
	DB	9,'C - Copy file         | S - Check remaining space'
	DB	CR,LF
	DB	9,'D - Delete file       | T - Tag file for transfer'
	DB	CR,LF
	DB	9,'E - Erase T/U files   | U - Untag file'
	DB	CR,LF
	DB	9,'F - Find file         | V - View file'
	DB	CR,LF
	DB	9,'G - Go execute file   | W - Wildcard tag of files'
	DB	CR,LF
	DB	9,'L - Log new disk/user | Y - Set file status.'
	DB	CR,LF
	DB	9,'M - Mass file copy    | Z - Change disk'
	DB	CR,LF
	DB	9,'P - Print file        | ? - Display this help'
	DB	CR,LF
	DB	9,'X - Exit to TurboDOS  | cr, sp - Forward one file'
	DB	CR,LF,CR,LF,'$'
;
; INPUT LINE
;
LINE:	DB	18
LINEC:	DB	2
LINET:	DB	'23'
	DS	18
;
A1FED:	LD	DE,16
	LD	(D2156),HL
	ADD	HL,DE
	LD	(D2158),HL
	LD	HL,0
	ADD	HL,SP
	LD	(A206A+1),HL
	CALL	A2141
	LD	DE,0FF76H
	CALL	CMPHD
	LD	A,1
	RET	NZ
	XOR	A
	LD	(D2152),A
	LD	(D2155),A
	CALL	A2141
	LD	(D215C),HL
	LD	HL,(D2156)
A201A:	PUSH	HL
	CALL	A1773
	POP	HL
	PUSH	AF
D2020:	CALL	CAPS
	LD	B,A
	POP	AF
	LD	(HL),B
	INC	HL
	JR	NZ,A206A
	OR	A
	JR	NZ,A201A
	CALL	A2141
	LD	(D215E),HL
	LD	DE,102H
	CALL	CMPHD
	JR	C,A2041
	LD	A,2
	OR	A
	RET
;
A2041:	LD	DE,(D2158)
A2046:	LD	(D215A),HL
	LD	A,H
	OR	L
	JR	Z,A2071
	PUSH	DE
	CALL	A2141
	POP	DE
	EX	DE,HL
	LD	(HL),E
	INC	HL
	LD	(HL),D
	INC	HL
	PUSH	HL
	CALL	A2141
	EX	DE,HL
	POP	HL
	LD	(HL),E
	INC	HL
	LD	(HL),D
	INC	HL
	EX	DE,HL
	LD	HL,(D215A)
	DEC	HL
	JR	A2046
;
A206A:	LD	SP,0			; FILLED LATER
	LD	A,3
	OR	A
	RET
;
A2071:	LD	HL,(D2156)
	LD	DE,(D215C)
	XOR	A
	RET
;
	DB	'USQ SECTION (C) DAVE RAND'
;
A20BA:	LD	HL,0
	ADD	HL,SP
	LD	(A206A+1),HL
	LD	A,(D2155)
	OR	A
	JR	Z,A20D1
	DEC	A
	LD	(D2155),A
	LD	A,(D2154)
	CP	A
	RET
;
A20D1:	CALL	A20F3
	CP	90H
	JR	NZ,A20EE
	CALL	A20F3
	OR	A
	JR	NZ,A20E4
	LD	A,90H
	CP	A
	RET
;
A20E4:	DEC	A
	DEC	A
	LD	(D2155),A
	LD	A,(D2154)
	CP	A
	RET
;
A20EE:	LD	(D2154),A
	CP	A
	RET
;
A20F3:	LD	DE,0
	LD	A,(D2153)
	LD	C,A
A20FA:	LD	A,(D2152)
	OR	A
	JR	NZ,A210C
	PUSH	DE
	CALL	A1773
	JP	NZ,A206A
	POP	DE
	LD	C,A
	LD	A,8
A210C:	DEC	A
	LD	(D2152),A
	LD	A,C
	RRCA
	LD	C,A
	LD	HL,(D2158)
	JR	NC,A211B
	INC	HL
	INC	HL
A211B:	ADD	HL,DE
	ADD	HL,DE
	ADD	HL,DE
	ADD	HL,DE
	LD	E,(HL)
	INC	HL
	LD	D,(HL)
	LD	A,D
	AND	80H
	JR	Z,A20FA
	LD	A,C
	LD	(D2153),A
	LD	A,D
	CP	0FEH
	LD	A,1AH
	JR	Z,A2138
	LD	A,E
	CPL
	CP	A
	RET
;
A2138:	POP	HL
	OR	A
	RET
;
CMPHD:	LD	A,H
	CP	D
	RET	NZ
	LD	A,L
	CP	E
	RET
;
A2141:	CALL	A1773
	JP	NZ,A206A
	PUSH	AF
	CALL	A1773
	JP	NZ,A206A
	LD	H,A
	POP	AF
	LD	L,A
	RET
;
D2152:	DB	0
D2153:	DB	0
D2154:	DB	0
D2155:	DB	0
D2156:	DW	0
D2158:	DW	0
D215A:	DW	0
D215C:	DW	0
D215E:	DW	0
;
A2160:	LD	A,0FFH
	LD	(D29C6),A
	LD	(D2A20),HL
	LD	HL,0
	ADD	HL,SP
	LD	(D2A60),HL
	LD	SP,D2A60
	LD	HL,(D2A20)
	LD	A,L
	AND	0FCH
	LD	L,A
	LD	A,4
	CALL	A296B
	LD	(D29C7),HL
	LD	DE,1024
	ADD	HL,DE
	LD	(D2A1C),HL
	LD	DE,1024
	ADD	HL,DE
	LD	(D2A1E),HL
	CALL	A2904
	XOR	A
	LD	(D29CC),A
	CALL	A2935
	JR	NZ,A21A1
	LD	A,2
	JP	A256E
;
A21A1:	LD	DE,0FF76H
	CALL	CMPHD
	JR	NZ,A21AF
	LD	A,1
	JP	A256E
;
A21AF:	LD	A,L
	LD	(D29CB),A
	PUSH	HL
	CALL	A28E6
	POP	HL
	LD	A,H
	JR	A21C2
;
A21BC:	CALL	A2941
	JP	Z,A221D
A21C2:	LD	HL,D29CB
	CP	(HL)
	JR	Z,A21F7
	INC	HL
	INC	(HL)
	DEC	(HL)
	JR	Z,A2214
	PUSH	AF
	LD	A,(HL)
	LD	(HL),0
	CP	3
	JR	NC,A21E8
	LD	B,A
	DEC	HL
	LD	A,(HL)
A21DB:	PUSH	AF
	CALL	A28E6
	POP	AF
	DJNZ	A21DB
	POP	AF
	JR	A2214
;
A21E8:	PUSH	AF
	LD	A,90H
	CALL	A28EF
	POP	AF
	INC	A
	CALL	A28EF
	POP	AF
	JR	A2214
;
A21F7:	CP	90H
	JR	Z,A2214
	INC	HL
	INC	(HL)
	LD	A,(HL)
	CP	0FFH
	JR	NZ,A21BC
	PUSH	HL
	LD	A,90H
	CALL	A28EF
	POP	HL
	LD	A,(HL)
	LD	(HL),0
	CALL	A28EF
	LD	A,(D29CB)
A2214:	LD	(D29CB),A
	CALL	A28E6
	JR	A21BC
;
A221D:	LD	A,(D29CC)
	OR	A
	JR	Z,A222F
	PUSH	AF
	LD	A,90H
	CALL	A28EF
	POP	AF
	INC	A
	CALL	A28EF
A222F:	LD	B,0
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
	LD	B,7
	OR	A
	JR	Z,A22F3
A22E1:	INC	(HL)
	DEC	(HL)
	JR	NZ,A22EA
	CP	(HL)
	JR	NZ,A22EE
A22EA:	CP	(HL)
	JR	NC,A22F3
A22EE:	INC	HL
	DJNZ	A22E1
A22F3:	INC	B
	INC	B
	INC	B
	LD	HL,D285F
	LD	(HL),B
	XOR	A
	LD	(D2A15),A
	LD	(D2A16),A
A2301:	CALL	A284A
	XOR	A
	LD	H,A
	LD	(D29CC),A
	LD	(D29D8),A
	INC	A
	LD	L,A
	LD	(D29CB),A
	LD	(D29D6),HL
	INC	A
	LD	(D29D2),A
	LD	HL,(D29C7)
	LD	(D29D4),HL
	LD	HL,0
	LD	(D29E9),HL
	LD	(D29EB),HL
	LD	HL,T2A02
	LD	DE,T2A03
	LD	BC,10H
	LD	(HL),0
	CALL	A29AA
	LD	A,(D2A15)
	OR	A
	JR	NZ,A236B
A233C:	CALL	A2832
	JP	Z,A2432
	CALL	A2883
	JR	Z,A23A3
	LD	B,A
	LD	A,(D29CB)
	CP	C
	JR	Z,A2358
A2350:	CALL	A26EB
	INC	A
	CP	C
	JR	NZ,A2350
A2358:	LD	A,(D29D2)
	CP	1
	JR	Z,A23A8
	LD	HL,D29CC
	INC	(HL)
	LD	A,B
	CALL	A2771
	JR	A233C
;
A236B:	CALL	A2832
	JP	Z,A2432
	LD	B,A
A2372:	LD	HL,D29CB
	LD	A,(D285F)
	CP	(HL)
	JR	C,A23A4
	LD	A,(HL)
	LD	HL,T29F1
	CALL	A296B
	LD	A,(D29CC)
	CP	(HL)
	JR	NZ,A2390
	CALL	A26EB
	JR	A2372
;
A2390:	LD	A,(D29D2)
	CP	1
	JR	Z,A23A8
	LD	HL,D29CC
	INC	(HL)
	LD	A,B
	CALL	A2771
	JR	A236B
;
A23A3:	LD	B,A
A23A4:	PUSH	BC
	JR	A23AC
;
A23A8:	PUSH	BC
A23A9:	CALL	A26EB
A23AC:	LD	HL,D29CE
	LD	A,(HL)
	CP	0FEH
	JR	C,A23C0
	LD	A,(D29CB)
	CP	7
	LD	A,(HL)
	JR	NC,A23C0
	LD	A,0FDH
A23C0:	INC	A
	INC	A
	LD	B,A
	LD	A,(D29D2)
	ADD	A,A
	SUB	B
	JR	NC,A2400
	LD	A,(D29D2)
	OR	A
	RLA
	JR	NC,A23D8
	RRA
	RRA
	JR	A23E0
;
A23D8:	RRA
	CALL	A28CB
	OR	A
	JR	Z,A23A9
A23E0:	LD	(D29D3),A
	POP	BC
	JR	A23EE
;
A23E7:	CALL	A2832
	JR	Z,A2432
	LD	B,A
A23EE:	LD	HL,D29CC
	INC	(HL)
	LD	A,(D29D3)
	CP	(HL)
	JR	C,A23A8
	LD	A,B
	CALL	A2771
	JR	A23E7
;
A2400:	LD	(D29D3),A
	POP	BC
	JR	A240E
;
A2407:	CALL	A2832
	JR	Z,A2432
	LD	B,A
A240E:	LD	HL,D29CC
	INC	(HL)
	LD	A,(D29D3)
	CP	(HL)
	LD	A,B
	JR	C,A2420
	CALL	A2771
	JR	A2407
;
A2420:	CALL	A26EB
	JR	A242C
;
A2426:	CALL	A2832
	JR	Z,A2432
A242C:	CALL	A2771
	JR	A2426
;
A2432:	LD	A,(D2A16)
	OR	A
	PUSH	AF
	CALL	NZ,A2817
	POP	AF
	JP	NZ,A250D
	LD	A,(D2A15)
	OR	A
	JR	NZ,A246F
	LD	HL,D29E9
	LD	DE,T29ED
	LD	BC,4
	CALL	A29AA
	LD	HL,T2A02
	LD	DE,T29F1
	LD	BC,11H
	CALL	A29AA
	LD	A,(D29C0)
	DEC	A
	LD	(D2A13),A
	LD	A,0FFH
	LD	(D2A15),A
	LD	(D2A17),A
	JR	A24E7
;
A246F:	LD	A,0FFH
	LD	(D2A17),A
	LD	HL,D29E9
	LD	DE,T29ED
	LD	B,4
	CALL	A2999
	JR	C,A24B0
A2482:	XOR	A
	LD	(D2A17),A
A2486:	LD	HL,T29F1
	LD	A,(D2A13)
	CALL	A296B
	LD	A,(D2A18)
	LD	C,(HL)
	LD	(HL),A
	LD	A,(D2A14)
	CPL
	INC	A
	CP	0FFH
	JR	Z,A24E7
	LD	B,A
	LD	A,(D2A19)
	SUB	C
	CP	02H
	JR	NC,A24E7
	INC	(HL)
	LD	A,B
	LD	(D2A14),A
	JR	A24D1
;
A24B0:	LD	HL,T2A02
	LD	DE,T29F1
	LD	BC,11H
	CALL	A29AA
A24BC:	LD	HL,T29F1
	LD	A,(D2A13)
	CALL	A296B
	LD	A,(HL)
	LD	(D2A18),A
	LD	A,(D2A14)
	ADD	A,(HL)
	JP	M,A2486
	LD	(HL),A
A24D1:	LD	A,(D2A17)
	OR	A
	JP	Z,A2301
	LD	HL,D29E9
	LD	DE,T29ED
	LD	BC,4
	CALL	A29AA
	JP	A2301
;
A24E7:	LD	A,0FFH
	LD	(D2A14),A
	LD	A,(D285F)
	LD	HL,D2A13
	INC	(HL)
	CP	(HL)
	JR	NC,A24FF
	LD	A,0FFH
	LD	(D2A16),A
	JP	A2301
;
A24FF:	LD	A,(HL)
	LD	HL,T29F1
	CALL	A296B
	LD	A,(HL)
	LD	(D2A19),A
	JR	A24BC
;
A250D:	LD	HL,D29E9
	LD	BC,1027
	CALL	A2A62
	XOR	A
	LD	(D29C6),A
	LD	HL,(D29D6)
	ADD	HL,HL
	ADD	HL,HL
	LD	A,0FH
	CALL	A296B
	LD	DE,D29E9
	LD	(D29E0),HL
	LD	HL,0
	LD	(D29E2),HL
	LD	HL,D29E0
	LD	B,4
	CALL	A2970
	EX	DE,HL
	LD	A,(HL)
	OR	7FH
	LD	(HL),A
	EX	DE,HL
	LD	(HL),1
	PUSH	HL
	INC	HL
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	POP	HL
	LD	B,4
	CALL	A2970
	EX	DE,HL
	LD	BC,1031
	CALL	A2A62
	LD	HL,D29DD
	LD	BC,307H
	CALL	A2A62
	LD	HL,(D29DD)
	EX	DE,HL
	LD	HL,(D29E9)
	CALL	CMPHD
	LD	A,3
	JR	NC,A256E
	XOR	A
A256E:	LD	HL,(D2A60)
	LD	SP,HL
	LD	HL,(D29E9)
	RET
;
A2576:	LD	A,(D29C6)
	OR	A
	JR	Z,A257F
	XOR	A
	RET
;
A257F:	LD	(D2A22),HL
	LD	HL,0
	ADD	HL,SP
	LD	(D2A60),HL
	LD	SP,D2A60
	LD	HL,0FF76H
	CALL	A26DC
	LD	HL,(D29DB)
	CALL	A26DC
	EX	DE,HL
	LD	HL,0
	OR	A
	SBC	HL,DE
	LD	(D29DB),HL
	LD	HL,(D2A22)
	INC	HL
	LD	B,8
A25A8:	LD	A,(HL)
	CP	' '
	JR	Z,A25B6
	CALL	A26E1
	INC	HL
	DJNZ	A25A8
A25B6:	LD	A,'.'
	CALL	A26E1
	LD	A,B
	CALL	A296B
	LD	B,3
A25C1:	LD	A,(HL)
	CP	' '
	JR	Z,A25CF
	CALL	A26E1
	INC	HL
	DJNZ	A25C1
A25CF:	XOR	A
	CALL	A26E1
	LD	HL,(D29D6)
	CALL	A26DC
	ADD	HL,HL
	ADD	HL,HL
	EX	DE,HL
	LD	HL,(D29C7)
A25DF:	LD	A,(HL)
	CALL	A26E1
	INC	HL
	DEC	DE
	LD	A,D
	OR	E
	JR	NZ,A25DF
	XOR	A
	LD	(D29CA),A
	LD	(D29CC),A
	LD	A,8
	LD	(D29C9),A
	CALL	A2941
	JR	A2654
;
A25FC:	CALL	A2941
	JR	Z,A265D
	LD	HL,D29CB
	CP	(HL)
	JR	Z,A2637
	INC	HL
	INC	(HL)
	DEC	(HL)
	JR	Z,A2654
	PUSH	AF
	LD	A,(HL)
	LD	(HL),0
	CP	3
	JR	NC,A2628
	LD	B,A
	DEC	HL
	LD	A,(HL)
A261B:	PUSH	AF
	CALL	A26A3
	POP	AF
	DJNZ	A261B
	POP	AF
	JR	A2654
;
A2628:	PUSH	AF
	LD	A,90H
	CALL	A26AC
	POP	AF
	INC	A
	CALL	A26AC
	POP	AF
	JR	A2654
;
A2637:	CP	90H
	JR	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(D29D6)
	EX	DE,HL
	LD	HL,(D29D4)
	LD	B,A
	LD	A,(D29D8)
	LD	C,A
A2703:	LD	(HL),E
	INC	HL
	LD	(HL),D
	INC	HL
	LD	A,L
	AND	2
	JR	NZ,A270E
	INC	C
A270E:	INC	DE
	LD	A,D
	OR	A
	JR	Z,A2718
	CP	E
	JR	Z,A273E
A2718:	DJNZ	A2703
	LD	(D29D4),HL
	EX	DE,HL
	LD	(D29D6),HL
	LD	A,C
	LD	(D29D8),A
A2727:	LD	HL,D29CB
	INC	(HL)
	LD	A,(HL)
	CP	11H
	JR	NC,A273E
	XOR	A
	LD	(D29CC),A
	LD	HL,D29D2
	LD	A,(HL)
	ADD	A,A
	LD	(HL),A
	POP	BC
	POP	AF
	RET
;
A273E:	POP	BC
	POP	AF
	POP	HL
	LD	A,(D285F)
	DEC	A
	LD	B,A
	JR	NZ,A274E
	LD	A,4
	JP	P,A256E
A274E:	LD	A,(D2A16)
	OR	A
	JR	NZ,A275C
	LD	A,(D2A15)
	OR	A
	JP	NZ,A2482
A275C:	LD	HL,D285F
	LD	(HL),B
	LD	A,(D2A16)
	OR	A
	JP	Z,A2301
	XOR	A
	LD	(D2A16),A
	LD	(D2A15),A
	JP	A2301
;
A2771:	PUSH	AF
	CALL	A295F
A2775:	LD	A,(D29CB)
	LD	(HL),A
	INC	HL
	PUSH	HL
	LD	HL,(D29D0)
	DEC	HL
	LD	(D29E5),A
	LD	DE,T29E3
	LD	BC,3
	XOR	A
	LD	(DE),A
	DEC	DE
	CALL	A29B5
	LD	HL,0
	LD	(D29E6),HL
	LD	(D29E7),HL
	LD	B,4
	LD	DE,D29E5
	LD	HL,D29E0
	CALL	A2B43
	LD	DE,D29E9
	LD	HL,D29E0
	LD	B,4
	CALL	A2970
	LD	A,(D29CB)
	LD	HL,T2A02
	CALL	A296B
	INC	(HL)
	LD	HL,D29D2
	DEC	(HL)
	LD	A,(D2A16)
	OR	A
	JR	NZ,A27C5
	POP	HL
	POP	AF
	RET
;
A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