3000 3aad 0000 S ... CRC-DISP.A
	PN	CRC-DISPLAY
;
	ORG	08000H
PFL:	EQU	052H
PDR:	EQU	050H
;
START:	LD	A,0
	OUT	4
	LD	(FLAG),A
	RST	020H
	DB	2,13
	DB	'Anfangs'
	DB	'adresse:'
	DB	0A0H
	RST	020H
	DB	16
	LD	DE,(016H)
	RST	020H
	DB	3
	LD	(ANF),HL
	RST	020H
	DB	2
	DB	'Endadre'
	DB	'sse    :'
	DB	0A0H
	RST	020H
	DB	16
	LD	DE,(016H)
	RST	020H
	DB	3
	LD	(END),HL
	RST	020H
	DB	2
	DB	'Bytes pro'
	DB	' Zeile :'
	DB	0A0H
	RST	020H
	DB	16
	LD	DE,(016H)
	RST	020H
	DB	3
	LD	A,L
	OR	A
	JRNZ	EBYT-#
	LD	A,16
EBYT:	LD	(BPZ),A
	RST	020H
	DB	2
	DB	'(A)SC oder'
	DB	'(C)RC '
	DB	0BFH
	RST	020H
	DB	1
	LD	HL,FLAG
	CMP	'A'
	JRNZ	NOASC-#
	SET	1,M
NOASC:	RST	020H
	DB	2,13
	DB	'Printer'
	DB	' (J)/N ?'
	DB	0A0H
	RST	020H
	DB	1
	LD	HL,FLAG
	CMP	'J'
	JRNZ	NOPR-#
	SET	0,M
NOPR:	RST	020H
	DB	2,08CH
	LD	A,080H
	OUT	4
	LD	HL,0
	LD	(SUM),HL
	LD	(TSUM),HL
	EXX
LOOP:	LD	HL,(ANF)
	LD	C,0
NZEI:	LD	A,(BPZ)
	LD	B,A
	LD	(PUFF),HL
	LD	DE,(02BH)
	LD	(BPA),DE
	RST	020H
	DB	7
	RST	020H
	DB	14
	RST	020H
	DB	14
GLZ:	LD	A,M
	INC	HL
	LD	D,0
	LD	E,A
	PUSH	DE
	RST	020H
	DB	6
	RST	020H
	DB	14
	LD	A,B
	CMP	9
	JRNZ	NHAL-#
	RST	020H
	DB	14
NHAL:	EXX
	POP	DE
	ADD	HL,DE
	EXX
	DJNZ	GLZ-#	
	RST	020H
	DB	14
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