EP1T+NASM;
;UEBERPRUEFT DEN DATENINHALT DES EPROM'S
;MIT DEM EINES RAM-BEREICHES AUF
;GLEICHHEIT
;
COMPARE	LD A,6		;FARBE SW/GE
	LD CO,A
	CALL FA1000
	CALL DA8
	CALL DEABC
	LD HL,1801H
	LD FA,HL
	LD HL,528H
	LD FG,HL
	LD HL,0
	LD CA,HL
	JP BLESEN	;ERMITTLUNG
	;
	;DES EPROMTYP'S UND DER START-
	;ADRESSE DER STEUERCODETABELLE
	;RUECKKEHR ZUR MARKE "CMP"
	;
CMP	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H	;ZK. FUER EIN-
			;SCHWINGZEIT Vcc
	CALL UP
	DEFB 14H	;"wait" UP14
	LD HL,(K18)	;RAM-ANFANGSADR.
	LD DE,(K16)	;ROM-ANFANGSADR.
	LD BC,(K5)	;BYTE-ANZAHL
CP1	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
	LD A,(IY+7)
	OUT P2DB
	CALL IRMA
	IN A,P2DA	;HOLEN EINES
			;BYTE'S
			;AUS DEM ROM
	CP (HL)		;VERGLEICH MIT
			;RAM-INHALT
	JR NZ ERROR	;WENN UNGLEICH
			;FEHLERAUSGABE
	CALL IRME
	LD A,(IY+8)
	OUT P2DB
CP6	LD A,B
	OR C		;LETZTES ZU
			;PRUEFENDES
			;BYTE ?
	JR Z CP3	;WENN JA
;
	INC HL		;WENN NEIN
	INC DE		;TEST DES NAECH-
	DEC BC		;STEN BYTE'S
	JR CP1
	;
	;UNTERPROGRAMM ENDE
	;
CP3	LD A,(IY+8)
	OUT P2DB
	CALL H1
	CALL H4
	CALL H5
	CALL H3
	LD A,6
	LD (K23),A
	CALL DEYN
CP2	CP 59H		;TASTE "Y" ?
	JP Z DEABC2	;WENN JA > MENU
	CP 4EH		;TASTE "N" ?
	JP Z COMPARE	;WENN JA
	CALL DEYN	;EINGABEWIEDERH.
	JR CP2
	;
	;VERGLEICHSFEHLERAUSWERTUNG
	;
ERROR	PUSH HL
	PUSH DE
	PUSH AF
	PUSH HL
	PUSH DE
	CALL IRME
	LD HL,1801H
	LD FA,HL
	LD HL,317H
	LD FG,HL
	LD A,3CH
	LD CO,A
	CALL UP
	DEFB 23H
	DEFB 0CH
	DEFB 11H
	DEFB 0
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'ADR:     RAM:   ROM:   '
	DEFB 0AH
	DEFM 'ERROR'
	DEFB 0
	LD HL,4
	LD CA,HL
	POP DE
	EX DE,HL
	CALL UP
	DEFB 1AH
	LD HL,0DH
	LD CA,HL
	POP HL
	CALL IRMA
	LD A,(HL)
	PUSH AF
	CALL IRME
	POP AF
	CALL UP
	DEFB 1CH
	LD HL,14H
	LD CA,HL
	POP AF
	CALL UP
	DEFB 1CH
	;
	;ABFRAGE ZUR FORTSETZUNG DER
	;UP.-ABARBEITUNG
	;
CP4	LD HL,1F00H
	LD FA,HL
	LD HL,101H
	LD FG,HL
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 4
	CP 0DH		;TASTE "enter" ?
	JP Z CP5	;WENN JA
			;FORTSETZUNG
	;
	CP 3		;TASTE "break" ?
	JP Z CP3	;WENN JA
	JR CP4		;UP.-ABBRUCH
	;
CP5	POP DE
	POP HL
	JP CP6
;
;
;UNTERPROGRAMM "CHECKSUM"
;ERMOEGLICHT DIE BILDUNG EINER PRUEFSUM-
;ME IM RAM -UND EPROMBEREICH
;
CHECKSU LD A,6		;FARBE SW/GE
	LD CO,A
	CALL FA1000
	CALL DA9
	CALL UP
	DEFB 23H
	DEFM 'RAM/ROM:'
	DEFB 0
	;
	;TASTATUREINGABE (RAM ?;ROM ?)
	;
CH1	LD HL,1115H
	LD FA,HL
	LD HL,103H
	LD FG,HL
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 17H	;TASTATUREINGABE
			;UP17
	LD DE,(0B7A0H)
	CALL UP
	DEFB 32H	;ERMITTLUNG DER
			;VRAM ADR. AUS
			;DER AKTUELLEN
			;CURSORPOSITION
	LD A,(HL)
	CP 52H		;TASTENCODE"R" ?
			;WENN NEIN
	JR NZ CH1	;EINGABEWIEDERH.
	;
	;TEST NAECHSTES ZEICHEN
	;
	INC HL
	LD A,(HL)
	LD (K20),A	;CODEUEBERGABE
	CP 41H		;TASTENCODE"A" ?
	JP Z CH3	;WENN JA
	CP 4FH		;TASTENCODE"O" ?
	JP Z CH2	;WENN JA
	JR CH1
	;
	;PRUEFSUMMENBILDUNG IM EPROM
	;
CH2	CALL FA1401
	CALL DA2
	CALL FEROM
	LD HL,(K16)	;EPROMSTARTADR.
	LD (K22),HL	;PARAMETERUEBER-
			;GABE AN
			;UP."DAPRUEF"
	CALL H1
	CALL H6
	CALL H7
	CALL H3
	JP BLESEN	;ERMITTLUNG
	;
	;DES EPROMTYP'S UND DER START-
	;ADRESSE DER STEUERCODETABELLE
	;RUECKKEHR ZUR MARKE "CHSU"
	;
	;
	;PRUEFSUMMENBILDNG
	;
CHSU	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H	;ZK.EINSCHWING-
			;ZEIT Vcc
	CALL UP
	DEFB 14H
	LD BC,(K5)	;BYTE-ANZAHL
	LD HL,(K22)	;STARTADR.
	CALL PRUEF2	;UP.PRUEFS.EPROM
	;
	;UP.-ENDE FUER RAM -UND EPROM-
	;VERSION
	;
CH5	CALL DAPREND
	CALL H1
	CALL H4
	CALL H5
	CALL H3
	LD A,6
	LD (K23),A
	CALL DEYN
CH4	CP 59H		;TASTE "Y" ?
	JP Z DEABC2	;WENN JA > MENU
	CP 4EH		;TASTE "N" ?
	JP Z CHECKSU	;WENN JA
	CALL DEYN
	JR CH4
	;
	;PRUEFSUMMENBILDUNG IM RAM
	;
CH3	CALL FA1401
	CALL DA3
	CALL FERAM
	LD HL,(K16)	;ANFANGSADR. RAM
	LD (K22),HL	;PARAMETERUEBER-
			;GABE
	CALL H1
	CALL H6
	CALL H7
	CALL H3
	LD BC,(K5)	;BYTE-ANZAHL
	LD HL,(K22)	;PARAMETERUEBER-
			;NAHME STARTADR.
	;
	CALL PRUEF1	;UP.PRUFSUM. RAM
	JR CH5
;
;
;UNTERPROGRAMM "CHECK OF BYTECHANGE"
;
;KONTROLLIERT DIE MOEGLICHKEIT DER UBER-
;PROGRAMMIERBARKEIT EINER BEREITS
;BESCHRIEBENEN EPROMZELLE
;
;
CHECK	LD A,5		;FARBE SW/TK
	LD CO,A
	LD HL,0
	LD (K16),HL
	CALL FA1000
	CALL DA6
	CALL LESEIN	;PARAMETEREINGA-
			;BE UND GUELTIG-
			;KEITSTEST
	LD HL,1801H
	LD FA,HL
	LD HL,528H
	LD FG,HL
	LD HL,0
	LD CA,HL
	JP BLESEN	;ERMITTLUNG
	;
	;DES EPROMTYP'S UND DER START-
	;ADRESSE DER STEUERCODETABELLE
	;RUECKKEHR ZUR MARKE "C1"
	;
C1	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H	;ZK.EINSCHWING-
			;ZEIT Vcc
	CALL UP
	DEFB 14H	;"wait" UP14
	LD DE,(K16)	;EPROM-STARTADR.
	LD HL,(K18)	;RAM-STARTADR.
MA39	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
	LD A,(IY+7)
	OUT P2DB
	IN A,P2DA	;EPROM-DATEN
			;1 BYTE LESEN
	;
	;KONTROLLE DER UEBERPROGRAMMIER-
	;BARKEIT DER ADRESSIERTEN
	;EPROM-ZELLE
	;
	LD C,A		;ISTWERT
	PUSH AF
	CALL IRMA
	POP AF
	LD (K4),DE	;<DE> RETTEN
	LD B,(HL)	;SOLLWERT
	AND B
	CP B		;UEBERPROGRAM-
			;MIERBAR ?
	JP NZ MA43	;WENN NEIN
	;
	;
	CALL IRME	;WENN JA
	LD A,(IY+8)
	OUT P2DB
	LD BC,(K5)
	LD A,B
	OR C		;LETZTES BYTE ?
	JR Z MA41	;WENN JA
	DEC BC		;UP.-FORTSETZUNG
	LD (K5),BC
	INC HL
	INC DE
	JR MA39
	;
	;UP.-ENDE
	;
MA41	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'BYTECHANGE IS POSSIBLE'
	DEFB 0
MA40	CALL H1
	CALL H4
	CALL H5
	CALL H3
	LD A,5
	LD (K23),A
	CALL DEYN
MA42	CP 59H		;TASTE "Y" ?
	JP Z DEABC2	;WENN JA > MENU
	CP 4EH		;TASTE "N" ?
	JP Z CHECK	;WENN JA
	CALL DEYN	;WIEDERH.EINGABE
	JR MA42
	;
	;AUSSCHRIFT UEBERPROGRAMMIERBAR-
	;KEIT NICHT MOEGLICH
	;
MA43	CALL IRME
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'BYTECHANGE UNPOSSIBLE'
	DEFB 0
	JR MA40
;
;
;UNTERPROGRAMM "BLANK"
;
;TESTET DEN EPROM AUF GELOESCHTEN (LEER)
;ZUSTAND UND ANZEIGE DER FREIEN	SPEI-
;CHERPLAETZE DURCH BETAETIGEN DER
;"enter" TASTE;ABRUCH UBER "break" TASTE
;
BLANK	LD A,7		;FARBE SW/WS
	LD CO,A
	CALL FA1000
	CALL DA5
	CALL DA2
	CALL FEROM	;PARAMETEREINGA-
			;BE UND GUELTIG-
			;KEITSTEST
	CALL H1
	CALL H6
	CALL H7
	CALL H3
	LD DE,0
	LD HL,1701H
	LD FA,HL
	LD HL,528H
	LD FG,HL
	LD HL,0
	LD CA,HL
 	JP BLESEN	;ERMITTLUNG
	;
	;DES EPROMTYP'S UND DER START-
	;ADRESSE DER STEUERCODETABELLE
	;RUECKKEHR ZUR MARKE "B2"
	;
B2	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H	;ZK.EINSCHWING-
			;ZEIT Vcc
	CALL UP
	DEFB 14H	;"wait" UP14
	LD DE,(K16)	;EPROMSTARTADR.
	LD (K4),DE	;<DE> RETTEN
	LD HL,(K16)	;STARTADR.
	LD BC,(K5)	;BYTE-ANZAHL
MA33	CALL LEP	;LESEN EINES
			;BYTE'S AUS DEM
			;EPROM
	CP  0FFH	;ZELLE LEER ?
	JP NZ MA34	;WENN NEIN
	;
	OUT P2DB
	LD A,B
	OR C		;LETZTES BYTE ?
	JR Z MA36	;WENN JA
	;
	DEC BC		;UP.-FORTS.
	INC HL
	JR MA33
	;
	;UP.-ENDE >EPROM LEER<
	;
MA36	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'BLANK'
	DEFB 0
B3	LD A,07
	LD (K23),A
	CALL H1
	CALL H4
	CALL H5
	CALL H3
	CALL DEYN
MA37	CP 59H		;TASTE "Y" ?
	JP Z DEABC2	;WENN JA > MENU
	CP 4EH		;TASTE "N" ?
	JP Z BLANK	;WENN JA
	CALL DEYN	;WIEDERH.EING.
	JR MA37
	;
	;UP.-ENDE >EPROM BELEGT<
	;
MA34	LD A,(IY+8)
	OUT P2DB
	PUSH HL
	LD HL,0H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'NOT BLANK'
	DEFB 0
	LD HL,200H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'MEMORYFIELD FREE:      - '
	DEFM '     '
	DEFB 0
	LD HL,(K4)	;AKTUELLE ADR.
			;DIE "FF" BEINH.
	LD A,H
	OR L		;ADR "0" ?
	JR Z B7		;WENN JA
	;
	;AUSGABE DER GEFUNDENEN ADR.
	;MIT <FF>
	;
	LD HL,212H
	LD CA,HL
	LD HL,(K4)
	CALL UP
	DEFB 1AH
	LD HL,219H
	LD CA,HL
	POP HL
	DEC HL
	CALL UP
	DEFB 1AH
	INC HL
	JR MA35
B7	POP HL
MA35	LD A,(IY+8)
	OUT P2DB
	LD A,B
	OR C		;LETZTES BYTE ?
	JP Z B3		;WENN JA
	DEC BC
	INC HL
	CALL LEP	;WEITERES BYTE
			;LESEN
	CP 0FFH		;ZELLE LEER ?
	JR NZ MA35	;WENN NEIN
	;
	LD (K4),HL	;AKTUALISIERE
			;LETZTE "FF"ADR.
B5	LD A,B
	OR C		;LETZTES BYTE ?
	JR Z B6		;WENN JA
	DEC BC
	INC HL
	CALL LEP	;WEITERES BYTE
			;LESEN
	CP 0FFH		;<FF> ?
	JR Z B5		;WENN JA
	;
	;ABFRAGE AUF ABBRUCH
	;
	CALL UP
	DEFB 4
	CP 3		;TASTE "break" ?
	JP Z B3		;WENN JA
	JP MA34
	;
B6	CALL UP
	DEFB 4		;WAIT-ZUSTAND
	;
	;BIS EINE TASTE GEDRUECKT WURDE
	;DANACH AUSGABE DES RELATIVEN
	;ADRESSBEREICHES DER MIT "FF"
	;BELEGT IST ODER ABBRUCH DES UP.
	;
	LD HL,212H
	LD CA,HL
	LD HL,(K4)
	CALL UP
	DEFB 1AH
	LD HL,219H
	LD CA,HL
	LD HL,(K17)
	CALL UP
	DEFB 1AH
	JP B3
;
;
;UNTERPROGRAMM "PROGRAMMING"
;
;ERMOEGLICHT DIE PROGRAMMIERUNG ALLER
;ANGEGEBENEN EPROM-TYPEN MIT DEN
;PROGRAMMIERSPANNNGEN (Vpp) 12,5V; 21V
;UND 25V
;
;
SCHREIBEN LD HL,0B6F0H
	LD (K7),HL
	CALL H1
	CALL H4
	CALL H5
	CALL H3
	LD A,3AH
	LD CO,A
	CALL FA1000
	CALL DA7
	CALL FA1000
	CALL DA4
	CALL DA3
SFE	CALL FERAM
	CALL SUBTBA
	CALL FA1601
	CALL DA2
	CALL FA1606
	CALL DA00
	CALL FE1606
	CALL DE1606
	CALL GULC
	CALL DA160DT
	CALL SUBBA
	CALL ADDHLC
	CALL SUBTD
	CALL DA160DD
	LD HL,(K18)	;PF ROM(RAM K16)
	LD (K22),HL
	;
	;EINSPRUNG ZUM DUPLIZIERMODUS
	;
SDUP	CALL H1
	CALL H6
	CALL H7
	CALL H3
MA55	CALL MAO3
	CALL BSCHREIBEN	;ERMITTLUNG
	;
	;DES EPROM-TYP'S; DER PROGRAM-
	;MIERSPANNUNG UND PROGRAMMIERUNG
	;DES EPROM'S
	;
	LD B,5
MA31	LD A,40H
	PUSH BC
	CALL UP
	DEFB 14H
	POP BC
	DJNZ MA31
	LD A,3CH
	LD CO,A
 	CALL DAPRUEF	;PUEFSUMMENBILD.
	;		;IM ROM
	;ENDE UP.
	;
MA51	CALL H1
	CALL H4
	CALL H5
	CALL H3
	LD A,3AH
	LD (K23),A
	CALL DEYN
MA32	CP 59H		;TASTE "Y" ?
	JP Z CLEAR	;WENN JA
	CP 4EH		;TASTE "N" ?
	JP Z CLEAR1	;JA > SCHREIBEN
	PUSH AF
	CALL CLEAR2
	POP AF
	CP 44H
	JR Z SDUP1
	CALL DEYN
	JR MA32
SDUP1	LD HL,0B6F0H
	LD (K7),HL
	JP CLEAR1	;PROGRAMMF.
			;>CLEAR1 >SDUP
BSCHREIBEN LD A,(K8)
	CP 0
	JP Z S2716
	CP 1
	JP Z S2732
	CP 2
	JP Z S2764
	CP 3
	JP Z S27128
	CP 4
	JP Z S27256
	CP 5
	JP Z S27256A
	RET
S2716	LD A,(K11)
	CP 0
	JP Z S2716A
	CP 1
	JP Z S2716B
	CP 2
	JP Z S2716C
	JR S27
S2732	LD A,(K11)
	CP 0
	JP Z S2732A
	CP 1
	JP Z S2732B
	CP 2
	JP Z S2732C
	JR S27
S2764	LD A,(K11)
	CP 0
	JP Z S2764A
	CP 1
	JP Z S2764B
	CP 2
	JP Z S2764C
	JR S27
S27128	LD A,(K11)
	CP 0
	JP Z S27128A
	CP 1
	JP Z S27128B
	CP 2
	JP Z S27128C
	JR S27
S27256	LD A,(K11)
	CP 0
	JP Z S27256NA
	CP 1
	JP Z S27256NB
	CP 2
	JP Z S27256NC
	JR S27
S27256A	LD A,(K11)
	CP 0
	JP Z S27256SA
	CP 1
	JP Z S27256SB
	CP 2
	JP Z S27256SC
S27	LD HL,MA55
	EX (SP),HL
	RET
S2716A	LD IY,TAB16A
	JP S27XX
S2716B	LD IY,TAB16B
	JP S27XX
S2716C	LD IY,TAB16C
	JP S27XX
S2732A	LD IY,TAB32A
	JP S27XX
S2732B	LD IY,TAB32B
	JP S27XX
S2732C	LD IY,TAB32C
	JP S27XX
S2764A	LD IY,TAB64A
	JP S27XX
S2764B	LD IY,TAB64B
	JP S27XX
S2764C	LD IY,TAB64C
	JP S27XX
S27128A	LD IY,TAB128A
	JP S27XX
S27128B	LD IY,TAB128B
	JP S27XX
S27128C	LD IY,TAB128C
	JP S27XX
S27256NA LD IY,TAB256A
	JP S27XX
S27256NB LD IY,TAB256B
	JP S27XX
S27256NC LD IY,TAB256C
	JP S27XX
S27256SA LD IY,TAB256AA
	JP S27XX
S27256SB LD IY,TAB256AB
	JP S27XX
S27256SC LD IY,TAB256AC
	JP S27XX
MAO3	LD HL,617H
	LD FA,HL
	LD HL,610H
	LD FG,HL
	LD A,6
	LD CO,A
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'Vpp POWER SUPPLY'
	DEFB 0
	LD HL,200H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM '1 = 12,5V'
	DEFB 0
	LD HL,300H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM '2 = 21V'
	DEFB 0
	LD HL,400H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM '3 = 25V'
	DEFB 0
	LD HL,500H
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM '4 = EXIT'
	DEFB 0
	LD HL,816H
	LD FA,HL
	LD HL,401H
	LD FG,HL
	LD A,86H
	LD CO,A
	CALL UP
	DEFB 23H
	DEFB 0CH
	DEFB 11H
	DEFB 0
	LD B,0
FSV	CALL UP
	DEFB 04H
	CP 3
	JP Z ANF
	CP 0BH
	JR Z FSV4
	CP 0AH
	JR Z FSV2
	CP 0DH
	JR Z FSV3
	CALL ZKTAST
	JR FSV
FSV2	LD A,B
	CP 3
	JR Z FSV
	CALL UP
	DEFB 23H
	DEFB 0AH
	DEFB 0
	INC B
	CALL ZKTAST
	JR FSV
FSV4	LD A,B
	CP 0
	JR Z FSV
	DEC B
	CALL UP
	DEFB 23H
	DEFB 0BH
	DEFB 0
	CALL ZKTAST
	JR FSV
FSV3	LD A,B
	LD (K11),A
	LD D,A
	LD E,0
	CALL UP
	DEFB 32H
	LD (K7),HL
	LD A,(K11)
	CP 3
	JP Z ORG1
	CALL UP
	DEFB 23H
	DEFM '?'
	DEFB 0BH
	DEFB 0
FSV5	CALL UP
	DEFB 4
	CP 3
	JP Z MAO3
	CP 0DH
	JR Z START
	JR FSV5
START	CALL UP
	DEFB 23H
	DEFM '*'
	DEFB 0
	CALL H1
	CALL H3
	RET
S27XX	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H
	CALL UP
	DEFB 14H
	LD DE,(K18)
	LD HL,(K16)
	LD BC,(K5)
SBCH	PUSH BC
	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
	LD A,(IY+7)
	OUT P2DB
	IN A,P2DA
	LD C,A
	PUSH AF
	CALL IRMA
	POP AF
	LD B,(HL)
	AND B
	CP B
	JR NZ SS5	;ABBRUCH
	POP BC
	CALL IRME
	LD A,(IY+8)
	OUT P2DB
	LD A,B
	OR C
	JR Z S27XXA
	DEC BC
	INC HL
	INC DE
	JR SBCH
SS5	POP BC
	CALL IRME
	LD A,(IY+8)
	OUT P2DB
	LD HL,1C12H
	LD FA,HL
	LD HL,110H
	LD FG,HL
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'EPROM FULL'
	DEFB 0
	LD HL,MA51
	EX (SP),HL
	RET
S27XXA	LD A,(IY)
	OUT P2DB
	LD A,10H	;EINSCHWINGZ.5Ps
	CALL UP
	DEFB 14H
	LD A,0FFH
	OUT P2SA
	LD A,0
	OUT P2SA
	LD HL,(K25)	;ZK 1mS IMPULS
	LD (K24),HL	;>IMPULS
	LD HL,(K16)	;QUELLE
	LD DE,(K18)	;SENKE
	LD BC,(K5)	;BYTE
SNEXT	LD A,(K28)
	CP 0		;TESTMODUS ?
	JR NZ SS2	;WENN JA
	CALL IRMA	;WENN NEIN
	LD A,(HL)
	CP 0FFH
	JP Z SS1
	CALL IRME
SS2	EXX
	LD BC,(K21)	;IMPULSZAEHLER
	EXX
	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
MA46	CALL IMPULS
	EXX
	LD A,B
	OR C
	JP Z MA45
	CALL UP
	DEFB 2AH	;BREAK ? (TEST)
	JP C ANF2
	LD A,(K28)
	CP 2		;PROG.-TEST 2 ?
	JR Z ST1
	DEC BC		;IMPULSZAEHLER
	EXX
	CALL VERIFY
	CP (HL)
	JR NZ MA46
MA50	CALL IRME
	LD A,B
	OR C		;BC=0?
	JR Z MA49
	INC HL
	INC DE
	DEC BC
	JR SNEXT
SS1	CALL IRME
	LD A,B
	OR C
	JR Z MA49
	DEC BC
	INC HL
	INC DE
	JP SNEXT
ST1	EXX		;NUR FUER TEST-
	CALL VERIFY	;ZWECKE
	JR MA46
MA49	LD HL,(K26)	;ZK 2ms IMPULS
	LD (K24),HL	;>IMPULS
	LD HL,(K16)
	LD DE,(K18)
	LD BC,(K5)
MA47	LD A,(K28)
	CP 0
	JR NZ SS3
	CALL IRMA
	LD A,(HL)
	CP 0FFH
	JR Z SS4
	CALL IRME
SS3	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
	CALL IMPULS
	LD A,B
	OR C
	JP Z ENDE
	CALL UP
	DEFB 2AH	;BREAK ? (TEST)
	JP C ANF2
	LD A,(K28)
	CP 3		;PROG.-TEST 3 ?
	JR Z MA47
	CP 4		;PROG.-TEST 4 ?
	JP Z ST3
	INC HL
	INC DE
	DEC BC
	JR MA47
SS4	CALL IRME
	LD A,B
	OR C
	JP Z ENDE
        DEC BC
	INC HL
	INC DE
	JR MA47
MA45	EXX
	CALL VERIFY
	CP (HL)
	JP Z MA50
ST3	CALL IRME
	PUSH HL
	LD HL,(K27)	;ZK 50ms IMPULS
	LD (K24),HL	;>IMPULS
	POP HL
	PUSH BC
	LD BC,5
S1	CALL IMPULS
	LD A,B
	OR C
	JP Z MA48
	CALL UP
	DEFB 2AH
	JP C ANF2
	LD A,(K28)
	CP 4
	JR Z ST2
	DEC BC
	CALL VERIFY
	CP (HL)
	JP NZ S1
	CALL IRME
	POP BC
	PUSH HL
	LD HL,(K25)
	LD (K24),HL	;>IMPULS
	POP HL
	JP MA50
ST2	CALL VERIFY
	JR S1
MA48	POP
	CALL VERIFY
	CP (HL)
	JP Z MA50
	PUSH AF
	CALL IRME
	PUSH HL
	PUSH DE
	LD HL,1801H
	LD FA,HL
	LD HL,319H
	LD FG,HL
	LD A,3CH
	LD CO,A
	CALL UP
	DEFB 23H
	DEFB 0CH
	DEFB 11H
	DEFB 0
	LD HL,0
	LD CA,HL
	CALL UP
	DEFB 23H
	DEFM 'ADR :     SHOULD:   BE:  '
	DEFB 0AH
	DEFM 'ERROR'
	DEFB 0
	LD HL,5
	LD CA,HL
	POP DE
	EX DE,HL
	CALL UP
	DEFB 1AH
	CALL UP
	DEFB 23H
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 0
	POP HL
	CALL IRMA
	LD A,(HL)
	PUSH AF
	CALL IRME
	POP AF
	CALL UP
	DEFB 1CH
	CALL UP
	DEFB 23H
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 9
	DEFB 0
	POP AF
	CALL UP
	DEFB 1CH
	LD HL,MA51
	EX (SP),HL
	RET
ENDE	LD A,0FFH
	OUT P2SA
	OUT P2SA
	LD A,(IY+8)
	OUT P2DB
	LD A,10H
	CALL UP
	DEFB 14H
	LD HL,(K16)
	LD DE,(K18)
	LD BC,(K5)
MA52	LD A,E
	OUT P1DA
	CALL PGME	;PGM EIN?
	OUT P1DB
	LD A,(IY+7)
	OUT P2DB
	CALL IRMA
	IN A,P2DA
	CP (HL)
	JR NZ MA53
	CALL IRME
	LD A,(IY+8)
	OUT P2DB
	LD A,B
	OR C
	JR Z MA70
	CALL UP
	DEFB 2AH	;BREAK ? (TEST)
	JP C ANF2
	LD A,(K28)
	CP 5		;PROG.-TEST 5 ?
	JR Z MA52
	DEC BC
	INC DE
	INC HL
	JR MA52
MA70	LD A,(IY+8)
	OUT P2DB
	RET
MA53	CALL IRME
	LD A,(IY+8)
	OUT P2DB
	LD HL,1801H
	LD FA,HL
	LD HL,30EH
	LD FG,HL
	LD HL,0
	LD CA,HL
	LD A,0BCH
	LD CO,A
	CALL UP
	DEFB 23H
	DEFB 11H
	DEFB 0CH
	DEFB 0AH
	DEFM ' EPROM DEFECT '
	DEFB 0
	LD HL,MA51
	EX (SP),HL
	RET
ÿÿÿÿÿÿ