C0100:
	LD SP,C0100
	XOR A
	LD (W0501),A
	INC A
	LD (V0502),A
	LD DE,(W0006)
	LD HL,(W0001)
	SBC HL,DE
	LD DE,C0DFD
	SBC HL,DE
	LD HL,C0522
	JP NZ,L0390
	LD HL,C0080
	XOR A
	XOR (HL)
	JR Z,L0141
	LD A,5
	CP (HL)
	JP NC,L0211
	INC L
	INC L
	CALL S0218
	LD (V0502),A
	LD A,'='
	XOR (HL)
	JP NZ,L0211
	INC L
	CALL S0218
	LD (W0501),A
L0141:
	LD HL,C055A
	CALL S039A
	LD A,(V0502)
	ADD A,'A'
	CALL S03EF
	LD A,':'
	CALL S03EF
	LD A,'='
	CALL S03EF
	LD A,(W0501)
	ADD A,'A'
	CALL S03EF
	LD HL,C0565
	CALL S039A
	CALL S0232
	LD A,(W0501)
	LD HL,V0502
	XOR (HL)
	JR Z,L0185
	LD HL,C056C
	CALL S039A
	LD HL,W0006
	CALL S03F9
	LD HL,C049F
	CALL S039A
L0185:
	LD HL,(W0520)
	LD (W0503),HL
	LD (W050A),HL
	LD HL,X0000
	LD (W0505),HL
	LD (W050C),HL
	XOR A
	LD (V0507),A
	LD (V050E),A
	LD (W0508),HL
	LD (W050F),HL
L01A4:
	LD HL,C0522
	LD (W0511),HL
	CALL S025A
	CALL S03A4
L01B0:
	LD DE,(W0508)
	LD HL,(W0518)
	AND A
	SBC HL,DE
	JR C,L01CE
	LD DE,(W0001)
	LD HL,(W0511)
	DEC D
	AND A
	SBC HL,DE
	JR NC,L01CE
	CALL S0292
	JR L01B0
L01CE:
	LD HL,C0522
	LD (W0511),HL
	LD HL,C04C6
	CALL S039A
	CALL S0276
	CALL S03AF
L01E0:
	LD DE,(W050F)
	LD HL,(W0518)
	AND A
	SBC HL,DE
	JR C,L020A
	LD DE,(W0001)
	LD HL,(W0511)
	DEC D
	AND A
	SBC HL,DE
	JR NC,L01FE
	CALL S02E1
	JR L01E0
L01FE:
	LD HL,(W0503)
	DEC HL
	CALL S033F
	CALL S036B
	JR L01A4
L020A:
	LD HL,C04EB
	CALL S039A
	RST X0000
L0211:
	LD HL,C0584
	CALL S039A
	RST X0000
S0218:
	LD A,' '
L021A:
	CP (HL)
	INC HL
	JR Z,L021A
	DEC HL
	LD A,0DFH
	AND (HL)
	INC L
	ADD A,0BFH
	CP 10H
	JR NC,L0211
	PUSH AF
	LD A,(HL)
	INC L
	CP ':'
	JR NZ,L0211
	POP AF
	RET
S0232:
	LD A,(W0501)
	CALL S0327
	PUSH HL
	LD A,(V0502)
	CALL S0327
	POP DE
	LD B,0FH
L0242:
	LD A,(DE)
	INC DE
	XOR (HL)
	INC HL
	JR NZ,L0254
	DJNZ L0242
	DEC HL
	LD BC,C000F
	LD DE,C0521
	LDDR
	RET
L0254:
	LD HL,C0545
	JP L0390
S025A:
	LD HL,(W0501)
	LD A,H
	XOR L
	JR NZ,L0270
	LD HL,C0452
	CALL S039A
	CALL S0365
	LD HL,C049F
	CALL S039A
L0270:
	LD A,(W0501)
	JP S0327
S0276:
	LD HL,(W0501)
	LD A,H
	XOR L
	JR NZ,L028C
	LD HL,C0476
	CALL S039A
	CALL S0365
	LD HL,C049F
	CALL S039A
L028C:
	LD A,(V0502)
	JP S0327
S0292:
	LD HL,(W0503)
	CALL S033F
	LD HL,(W0505)
	CALL S0347
	LD HL,(W0511)
	CALL S035D
	CALL S036B
	LD DE,(W0513)
	LD HL,(W0505)
	INC HL
	AND A
	SBC HL,DE
	ADD HL,DE
	JR NZ,L02C2
	LD HL,(W0503)
	INC HL
	LD (W0503),HL
	CALL S03A4
	LD HL,X0000
L02C2:
	LD (W0505),HL
	LD HL,V0507
	INC (HL)
	LD A,(W0516)
	AND (HL)
	JR NZ,L02D6
	LD HL,(W0508)
	INC HL
	LD (W0508),HL
L02D6:
	LD HL,(W0511)
	LD DE,C0080
	ADD HL,DE
	LD (W0511),HL
	RET
S02E1:
	LD HL,(W050A)
	CALL S033F
	LD HL,(W050C)
	CALL S0347
	LD HL,(W0511)
	CALL S035D
	CALL S0378
	LD DE,(W0513)
	LD HL,(W050C)
	INC HL
	AND A
	SBC HL,DE
	ADD HL,DE
	JR NZ,L0311
	LD HL,(W050A)
	INC HL
	LD (W050A),HL
	CALL S03AF
	LD HL,X0000
L0311:
	LD (W050C),HL
	LD HL,V050E
	INC (HL)
	LD A,(W0516)
	AND (HL)
	JR NZ,L02D6
	LD HL,(W050F)
	INC HL
	LD (W050F),HL
	JR L02D6
S0327:
	LD C,A
	LD HL,C0018
	CALL S03F9
	LD A,H
	OR L
	PUSH HL
	POP IY
	LD L,(IY+0AH)
	LD H,(IY+0BH)
	RET NZ
	LD HL,C0534
	JR L0390
S033F:
	LD B,H
	LD C,L
	LD HL,C001B
	JP S03F9
S0347:
	LD B,H
	LD C,L
	LD E,(IY+0)
	LD D,(IY+1)
	LD HL,C002D
	CALL S03F9
	LD B,H
	LD C,L
	LD HL,C001E
	JP S03F9
S035D:
	LD B,H
	LD C,L
	LD HL,C0021
	JP S03F9
S0365:
	LD HL,W0006
	JP S03F9
S036B:
	LD HL,C0024
	CALL S03F9
	AND A
	RET Z
	LD HL,C0401
	JR L0390
S0378:
	LD A,(V050E)
	LD HL,(W0516)
	AND L
	LD A,2
	JR Z,L0384
	XOR A
L0384:
	LD C,A
	LD HL,C0027
	CALL S03F9
	AND A
	RET Z
	LD HL,C041E
L0390:
	CALL S039A
	LD HL,C043F
	CALL S039A
	RST X0000
S039A:
	LD A,(HL)
	INC HL
	CP '$'
	RET Z
	CALL S03EF
	JR S039A
S03A4:
	LD HL,C04CD
	CALL S039A
	LD HL,(W0503)
	JR L03B8
S03AF:
	LD HL,C04DC
	CALL S039A
	LD HL,(W050A)
L03B8:
	DB 0DDH
	LD L,0
	LD DE,C1F40
	CALL S03D2
	LD DE,C0320
	CALL S03D2
	LD DE,C0050
	CALL S03D2
	LD DE,C0008
	DB 0DDH
	INC L
S03D2:
	LD A,0CH
	LD B,4
	AND A
L03D7:
	SBC HL,DE
	JR NC,L03DC
	ADD HL,DE
L03DC:
	RLA
	SRL D
	RR E
	DJNZ L03D7
	CPL
	DB 0DDH
	INC L
	DB 0DDH
	DEC L
	JR NZ,S03EF
	CP '0'
	RET Z
	DB 0DDH
	INC L
S03EF:
	LD C,A
	PUSH HL
	LD HL,C0009
	CALL S03F9
	POP HL
	RET
S03F9:
	PUSH DE
	LD DE,(W0001)
	ADD HL,DE
	POP DE
	JP (HL)
C0401:
	DB 0DH,0AH,0AH,'Bad read '
	DB 'from source disk$'
C041E:
	DB 0DH,0AH,0AH,'Bad write '
	DB 'to destination disk$'
C043F:
	DB ', Copy aborted.',0DH,0AH
	RLCA
	DB '$'
C0452:
	DB 0DH,'Insert Source disk '
	DB '& press a key.'
	RLCA
	DB '$'
C0476:
	DB 0DH,'Insert Destination '
	DB 'disk & press a key.'
	RLCA
	DB '$'
C049F:
	DB 0DH,'                 '
	DB '                     '
C04C6:
	EX AF,AF'
	EX AF,AF'
	EX AF,AF'
	DB '   $'
C04CD:
	DB 0DH,'Read  track: $'
C04DC:
	DB 0DH,'Write track: $'
C04EB:
	DB 0DH,'Copy complete.   '
	DB 0DH,0AH
	RLCA
	DB '$'
W0501:
	DB 0
V0502:
	DB 0
W0503:
	DB 0,0
W0505:
	DB 0,0
V0507:
	DB 0
W0508:
	DB 0,0
W050A:
	DB 0,0
W050C:
	DB 0,0
V050E:
	DB 0
W050F:
	DB 0,0
W0511:
	DB 0,0
W0513:
	DB 0,0,0
W0516:
	DB 0,0
W0518:
	DB 0,0,0,0,0,0,0,0
W0520:
	DB 0
C0521:
	DB 0
C0522:
	DB 'Not enough memory$'
C0534:
	DB 0DH,'Drive not found$'
C0545:
	DB 0DH,'Disks are different$'
C055A:
	DB 0DH,0AH,'Copying $'
C0565:
	DB ':*.*',0DH,0AH,'$'
C056C:
	DB 'Push a key when ready..$'
C0584:
	DB 0DH,0AH,'Copy Disk program '
	DB 'Version 1.1',0DH,0AH,'Copyrigh'
	DB 't (c) 1988 Ji'
	JP NC,L20C9
	LD C,H
	LD H,C
	LD L,L
	LD H,C
	JP L0A0D
	DB 0AH,'Use: CopyDisk Dest_drive=S'
	DB 'ource_drive',0DH,0AH,'$ush '
	DB 'a key when read'
X0000	EQU 0
W0001	EQU 1
W0006	EQU 6
C0008	EQU 8
C0009	EQU 9
C000F	EQU 0FH
C0018	EQU 18H
C001B	EQU 1BH
C001E	EQU 1EH
C0021	EQU 21H
C0024	EQU 24H
C0027	EQU 27H
C002D	EQU 2DH
C0050	EQU 50H
C0080	EQU 80H
C0320	EQU 0320H
L0A0D	EQU 0A0DH
C0DFD	EQU 0DFDH
C1F40	EQU 1F40H
L20C9	EQU 20C9H
	END
