COPY4   ASM;---------------------------------------
;
;	Listing zu COPY4.KCC
;
;	(Kopierprogramm von WORDPRO4)
;
;			` ml 23.05.91
;---------------------------------------
MENU	EQU	0BE24H
ARGC	EQU	0B780H
ARGN	EQU	0B781H
ARG1	EQU	ARGN+1
ARG2	EQU	ARG1+2
ARG3	EQU	ARG2+2
ARG6	EQU	0B78CH
WINON	EQU	0B79CH
WINLG	EQU	0B79EH
CURSO	EQU	0B7A0H
COLOR	EQU	0B7A3H
RESET	EQU	0E000H
PV1	EQU	0F003H
KBDZ	EQU	0EH
WAIT	EQU	14H
INLIN	EQU	17H
ERRM	EQU	19H
AHEX	EQU	1CH
OSTR	EQU	23H
SAVE	EQU	36H
MBOUT	EQU	38H
;-------
	ORG	3000H
START	LD	HL,0200H
	LD	DE,0BAC4H
	LD	BC,11H	;Grundeinst.-
	LDIR		;Tabelle kop.
	CALL	MENU
	LD	A,38H
	LD	(COLOR),A
	LD	HL,01A02H
	LD	(CURSO),HL
	CALL	PV1
	DB	OSTR
	DEFM	'Saving  '
	DEFM	'(Disk or Tape ?)'
	NOP
L3036:	CALL	PV1
	DB	KBDZ
	JR	NC,L3036
	CP 	060H
	JR	C,L3042
	SUB	020H	;klein‰gro~
L3042:	CP 	'D'
	JR	NZ,L3056
	LD	BC,0FC80H
	IN	A,(C)
	CP 	0A7H		;Floppy
	JP 	NZ,RESET
	XOR	A
	LD	(0BD70H),A	;DISK
	JR	L3080
L3056:	CP 	'T'
	JR	NZ,L3036 ;wiederholen
	LD	A,1		;TAPE
	LD	(0BD70H),A
	LD	IY,013DH
	LD	A,0DH
	LD	(ARGC),A
	LD	HL,0F01EH
	LD	(0B7C9H),HL
	LD	HL,1E02H
	LD	(CURSO),HL
	CALL	PV1
	DB	OSTR
	DEFM	'Block #'
	NOP
L3080:	LD	HL,1C02H
	LD	(CURSO),HL
	CALL	PV1
	DB	OSTR
	DEFM	'Version '
	NOP
	CALL	PV1
	DB	INLIN
	LD	HL,10
	ADD	HL,DE
	PUSH	HL
	LD	HL,1E09H
	LD	(WINON),HL
	LD	HL,011FH
	LD	(WINLG),HL
	LD	HL,0
	LD	(CURSO),HL
	LD	HL,0BD70H	;Aadr
	LD	(ARG1),HL
	LD	HL,0C000H	;Eadr
	LD	(ARG2),HL
	LD	HL,0BEA9H	;Sadr
	LD	(ARG3),HL
	LD	A,3		;3 Adr
	LD	(ARGN),A
	LD	HL,COM	;Dateiname .COM
	CALL	U3166	;Save Vorblock
	XOR	A
	LD	(ARGN),A
	LD	(IX+5),0
	LD	(IX+6),0B7H
	LD	HL,OVR	;Dateiname .OVR
	LD	D,8
	CALL	U31D2	;open
	LD	HL,(0020EH) ;Ende Main
	LD	DE,00330H   ;Beginn
	OR	A
	SBC	HL,DE
	LD	(ARG6),HL ;L{nge Main
	LD	A,L
	LD	D,0
	CALL	U31D2
	LD	A,(ARG6+1)
	LD	D,0
	CALL	U31D2
	POP	HL
	LD	BC,8
	CALL	U313F	;Version
	LD	HL,0330H
	LD	BC,(ARG6)
	CALL	U313F	;Save Main
	LD	HL,(0B7E2H)
	LD	BC,8
	CALL	U313F	;8 Byte V.24-Tab
	LD	HL,0B7E1H
	LD	BC,1
	CALL	U313F	;1 Byte HCPZ
	LD	HL,0A820H
	LD	BC,0380H
	CALL	U313F	;Zeichentab.
	LD	HL,0BA00H
	LD	BC,0370H
	CALL	U313F	;Statuszeile...
	LD	HL,0230H
	LD	BC,0100H
	CALL	U313F	;Tastaturtab.
	LD	D,040H
	CALL	U31D2	;close
	JP 	RESET
U313F:	DEC	BC
	LD	A,(HL)
	INC	HL
	PUSH	HL
	PUSH	BC
	LD	D,0
	CALL	U31D2
	POP	BC
	POP	HL
	LD	A,B
	OR	C
	JR	NZ,U313F
	RET
COM:	DEFM 'WORDPRO4COM'
OVR:	DEFM 'WORDPRO4OVR'
U3166:	LD	A,(0BD70H)
	AND	A
	JR	Z,U3171
	CALL	PV1
	DB	SAVE
	RET
U3171:	CALL	U31FD
	LD	HL,ARGN
	LD	DE,0B0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