,SPEED	LD	BC,6ÄQû;FAST	BER	4	EX	(SP),HL	EX	(SP),HLSLOW	PUSH	BC	LD	B,0	DJNZ	#	POP	BC;gFû;;;	*************************;	*			*;	*      Testmonitor	*;	*    Version 29.5.88	*;	*			*;	*************************;;		(C) F.Klemm '87/'88 Gera;;******** Konstanten ************;MENAN	EQU	0E800HMENLG	EQU	  800HANFANG	EQU	0E800H;OFFS	EQU	0B7FCHCMODE	EQU	0B7FEHDMODE	EQU	0B7FFH;; Arbeitszellen; =============;HBASE	EQU	2BASE	EQU	200H;	ORG	BASERAF	DEFS	2RBC	DEFS	2RDE	DEFS	2RHL	DEFS	2RIX	DEFS	2RIY	DEFS	2ZAF	DEFS	2ZBC	DEFS	2ZDE	DEFS	2ZHL	DEFS	2RSP	DEFS	2RTS	DEFS	2PCO	DEFS	2PCN	DEFS	2;SBRK	DEFS	2BREAK	DEFS	2STAT	DEFS	1LINEST	DEFS	1	;Bit 0..6 Zeilen	;Bit 7=0 in HomepositionMODE	DEFS	1	;0: STEPbetrieb ohne Anzeige	;1:	"	mit	"   ,GO	;2:	"	"	"	;   bei Spr}ngenWINDOW	DEFS	1	;Zwischenspeicher f}r Windownr.;;*__*__*__*__*__*__*__*__*__*__*__*__*__;	ORG	ANFANG	DEFW	HEAD	DEFM	'TEMO'	DEFB	11H	XOR	A	;Register l|schn	LD	HL,RAF	LD	B,LINEST-RAFTEMO1	LD	M,A	INC	HL	DJNZ	TEMO1	LD	M,2	;Lines=2	LD	A,IWORK	LD	H,A	LD	L,60H	LD	(RSP),HL;Anwender-SP	LD	L,0D2H	;setzen	LD	(SYSP),HL;System "	LD	SP,HL	CALL	SIXD	JR	MENU;	DEFW	HEAD	DEFM	'RETEMO'	DEFB	11H	JR	MENU;	DEFW	PROLOG	DEFM	'MENU'	DEFB	1FHMENU	POP	HL	CALL	PRS	;Men}aufbau	DEFB	CLS	DEFM	'* TESTMONITOR *'	DEFB	0	LD	HL,MENAN	LD	BC,MENLGMEN2	CALL	CRLFMEN3	CALL	PRS	DEFB	CR	DEFM	'>'	DEFB	0	CALL	BRKT	JR	C,PAR1	LD	A,PROLOGMEN1	CPIR	JP	PO,PAR1	CPI	JR	NZ,MEN1MEN4	LD	A,M	CP	' '	JR	C,MEN2	CP	'0'	JR	C,MEN3	CP	60H	JR	NC,MEN3	CALL	ROUT	INC	HL	DEC	BC	JR	MEN4;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Monitor-Loop;PRR	CALL	ERRMPRSE	CALL	PRS	DEFM	'>'	DEFB	0;; Vektoren setzen;PAR1	LD	A,I	LD	D,A	LD	E,0E6H	LD	HL,TITAB	LD	BC,4	;PIO-Int-Vektor	LDIR		;CTC-	""	LD	A,0C3H	;JP ....	LD	HL,RST38	LD	(38H),A	LD	(39H),HL;RST 38;	CALL	INLN	INC	DE	LD	A,(DE)	CP	' '	JR	Z,PRSE	AND	A	JR	Z,PRSE	CP	'0'	JR	Z,ASM	;Assembler	LD	HL,REGL	LD	BC,REGLE-REGLLBL0	LD	A,(DE)	;Suche nach	CPI		;Registernamen	JR	Z,LBL1	;1.Buchstabe	CPI		;stimmtLBL2	JP	PE,LBL0	LD	A,PROLOG	LD	HL,MENAN	LD	BC,MENLG	CALL	ZSUC2	CALL	INLOOP+13	JR	PRSE;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Inline-Assembler; Aufruf: 0addr Befehl;ASM	CALL	NUMPRRX	JP	C,PRR	LD	IY,(NUMYX)	EX	DE,HL	XOR	A	;HL=Zeiger auf	LD	(ERR),A	LD	A,0C0H	LD	(OPT),A	;2.Pass/Object	LD	A,M	;Text	CALL	ASMLN	;M0C8B	LD	A,(ERR)	SUB	'0'	JR	C,ASM1	CP	10	JR	C,ASM0	SUB	7ASM0	CALL	MSGPASM1	CALL	PRS	DEFM	'>0'	DEFB	0	PUSH	IY	POP	HL	CALL	HLHX	JP	PAR1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Register modifizieren;LBL1	INC	DE	LD	A,(DE)	CP	60H	;zu Ende ?	DEC	BC	JR	C,LBL3	INC	BC	CPI	DEC	DE	JR	NZ,LBL2	;zweiter Buchst.	INC	DE	;falsch	INC	DE	LD	A,(DE)LBL3	CP	27H	;folgt ' ?	JR	NZ,LBL4	INC	DE	SET	0,B	;BIT 0,B=1 => ZLBL4	CALL	NUM	;folgende Zahl	JR	C,PRRX	;lesen, Fehler ?	LD	DE,(NUMYX); holen	LD	H,HBASE	LD	A,REGLE-REGL-2	SUB	C	BIT	5,A	JR	NZ,DOPP	;Doppelregister	RRCA	BIT	3,A	JR	Z,REGI	;Einfachregister	LD	L,RAF	;Flags	BIT	0,B	JR	Z,FL1	LD	L,ZAFFL1	ADD	PTAB-8	LD	C,A	LD	B,PTAB/100H	LD	A,(BC)	;Maske geholt	BIT	0,E	JR	Z,RESF	OR	MFL2	LD	M,APARS9	JP	PRSE;RESF	CPL	AND	M	JR	FL2;REGI	BIT	0,B	JR	Z,REGI1	ADD	12REGI1	LD	L,A	LD	M,E	JR	PARS9;DOPP	RES	5,A	;	LD	L,RIY	;Sonderbearb.	CP	8	;f}r IY,SP,PC	JR	Z,REGI3	LD	L,RSP	CP	10	JR	Z,REGI3	LD	L,PCN	CP	12	JR	Z,REGI3	;	BIT	0,B	JR	Z,REGI2	ADD	12REGI2	LD	L,AREGI3	LD	M,E	INC	HL	LD	M,D	JR	PARS9;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Liste der Registernamen und Flagnamen;REGL	DEFM	'f a c b e d l h '	DEFM	's z   hy  p n cy'	DEFM	'afbcdehliysppc'REGLE	;FLAGL	DEFM	'SZ.H.PNC';; Interrupttabelle;TITAB	DEFW	KEYB	DEFW	INTR;; Tastaturinterruptroutine mit DI;KEYB	CALL	ITAST+1	EI	RET;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Stackmodifizieren;	DEFW	PROLOG	DEFM	'.'	DEFB	1FH	LD	HL,(RSP);Stack-Listing	LD	C,2	JP	MOD1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Verlassen des Testmonitors;	DEFW	PROLOG	DEFM	'QUIT'	DEFB	1FHQUIT	LD	(IX+9),HEAD	JP	PARSE;;*__*__*__*__*__*__*__*__*__*__*__*__*__;;	DEFW	PROLOG	DEFM	'SBRK'	DEFB	13H	XOR	A	LD	(MODE),A	LD	(SBRK),HL	RET;	DEFW	PROLOG	DEFM	'BREAK'	DEFB	13H	LD	(BREAK),HL	RET;	DEFW	PROLOG	DEFM	'CHSUM'	DEFB	15H	CALL	FORM	CALL	CHSUM	EX	DE,HL	CALL	HLHX	JP	CRLF;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Unterprogramm zur Pr}fsummen-; berechnung;; HL: Anfang; BC: L{nge;   DE: Pr}fsumme; VR: AF,BC,DE,HL;CHSUM	LD	DE,-1CH1	LD	A,M	XOR	D	LD	D,A	RRCA	RRCA	RRCA	RRCA	AND	0FH	XOR	D	LD	D,A	RRCA	RRCA	RRCA	PUSH	AF	AND	1FH	XOR	E	LD	E,A	POP	AF	PUSH	AF	RRCA	AND	0F0H	XOR	E	LD	E,A	POP	AF	AND	0E0H	XOR	D	LD	D,E	LD	E,A	CPI	JP	PE,CH1	RET;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Unterprogramm zur Bestimmung der; L{nge eines Befehls;; HL: Anfang Befehl;   B: L{nge;   Z: PC-ver{ndernder Befehl;   CY: Relativsprung; VR: AF,B,HL;LEN	LD	B,1LEN0	LD	A,M	CP	0CBH	JR	Z,BIT	;Bitbefehl ?LEN1	CP	0EDH	JR	Z,TRANS ;Sondertransport	RES	5,A	CP	0DDH	JR	Z,INDEX ;IX,IY-Befehle	LD	A,M	CP	40H	JR	C ,BLK1	CP	0C0H	JR	NC,BLK4	AND	A	RET;INDEX	INC	HL	INC	B	LD	A,M	CP	0CBH	JR	Z,RE11	;Bitbefehle	CP	36H	JR	Z,RE11	;LD (I+d),n	CP	40H	JR	C,LEN1	CP	0C0H	JR	NC,LEN1	AND	7	;Block 2,3	CP	6	JR	NZ,IND1	INC	B	;LD r,(I+n)IND1	LD	A,M	AND	0F8H	CP	70H	JR	NZ,IND2	INC	BIND2	JR	LEN0;TRANS	INC	HL	INC	B	LD	A,M	AND	0C7H	CP	43H	RET NZ	JR	RE11	;LD rr,(nn)...;BLK1	AND	7	;Befehle 00...3F	JR	Z,REL	;Relativspr}nge	CP	1	JR	Z,RE1	;1.Reihe	CP	2	JR	Z,RE2	;2. "	CP	6	JR	NZ,BLK2	INC	B	;LD r,nBLK2	AND	A	RET;REL	LD	A,M	ADD	0F7H	RET NC		;Relativspr.			;NOP,EX AF	INC	B	XOR	A	SCF	RET;RE1	BIT	3,M	RET	NZ	;ADD HL,rrRE11	INC	B	;LD rr,nnRE12	;BIT	INC	B	RET;RE2	BIT	5,M	JR	Z,BLK2	;LD A,(BC)...	JR	RE11	;LD HL,(nn)...;BLK4	CP	0E3H	RET Z		;JP (HL)	INC	B	INC	B	CP	0CDH	JR	Z,SKIP	;CALL	CP	0C3H	RET Z		;JP	AND	7	CP	2	RET Z		;JP cc	CP 	4	RET Z		;CALL cc	DEC	B	CP	6	JR	Z,BLK2	;OP n	DEC	B	AND	A	RET Z		;RET cc	CP	7	RET Z		;RST n	AND	3	CP	1	JR	Z,BLK2	;PUSH,POP rr	BIT	5,M	RET	NZ	INC	B	;IN,OUT n	RET;SKIP	INC	HL	LD	A,M	CP	3	JR	NZ,SK1	INC	HL	LD	A,M	CP	0F0H	JR	NZ,SK1	INC	B	INC	HL	;Systemsprungver	LD	A,M	SUB	23H	;PRS ?	JR	NZ,SK1SK0	INC	B	INC	HL	CP 	M	JR	NZ,SK0SK1	XOR	A	RET;; Programm zum Berechnen der Adr. des;	n{chsten Befehls;NXTST	LD	HL,(PCN)	PUSH	HL	CALL	LEN	POP	HL	LD	C,B	XOR	A	LD	B,A	ADD	HL,BC	RET;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Registeranzeige;	DEFW	PROLOG	DEFM	'REG'	DEFB	1FH	LD	A,82H;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Registeranzeige;; A: (LINES); Register in den TEMO-Arbeitszellen; VR: AF,BC,DE,HL,IY,AF',BC',DE',HL';REG	BIT	7,A	JR	NZ,REG1	LD	HL,(CRSR);Crsr->Stack	PUSH	HL	PUSH	AF	CALL	SHOME	POP	AFREG1	PUSH	AF	LD	A,(WINNR)	LD	(WINDOW),A	XOR	A	CALL	SETW	CALL	PRS	DEFM	' A  BC   DE   HL   M '	DEFM	'-Flags--  IX   IY  '	DEFB	0	LD	(DMODE),A	LD	(CMODE),A	LD	HL,RAF	CALL	PRLINE	;Fehlendes CRLF	CALL	PRLINE	LD	IY,(PCO)	CALL	WOFF	CALL	DCRLF	POP	AF	PUSH	AF	RES	7,A	LD	B,A	XOR	A	LD	(DMODE),A	LD	IY,(PCN)REG2	PUSH	BC	CALL	WOFF	CALL	DCRLF	POP	BC	DJNZ	REG2	LD	A,(WINDOW)	CALL	SETW	POP	AF	RET NZ	POP	HL	LD	(CRSR),HL	RET;PRLINE	LD	C,M	;Flags	INC	HL	LD	A,M	INC	HL	CALL	AHSP	;A	LD	B,3	CALL	WORDS	;BC,DE,HL	LD	A,(DE)	CALL	AHSP	;M	LD	B,8+1	LD	DE,FLAGLPRL1	LD	A,' '	SLA	C	JR	NC,PRL2	LD	A,(DE)PRL2	INC	DE	CALL	ROUT	DJNZ	PRL1	LD	B,2WORDS	LD	E,M	INC	HL	LD	D,M	INC	HL	EX 	DE,HL	CALL	HLHX	EX	DE,HL	DJNZ	WORDS	RET;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Display;	DEFW	PROLOG	DEFM	'DISPLAY'	DEFB	1	JP	DISPL;	DEFW	PROLOG	DEFM	'MODIFY'	DEFB	1	JP	MOD0;	DEFW	PROLOG	DEFM	'LIST'	DEFB	1	JP	LIST;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Transformationsprogramm; nur in Stacktiefe 1 aufrufen !!!;; HL: Anfang; DE: Ende; BC: Wert; A:  ARGN;   HL: Anfang;   DE: Wert;   BC: L{nge;   A:  ARGN;   CY=0;FORM	;FORM1	EX	DE,HL	DEC	HL	SBC	HL,DE	JR	C,ERR1	;Ende<=Anfang	INC	HL	EX	DE,HL	PUSH	BC	LD	B,D	LD	C,E	POP	DE	RET;ERR1	POP	HL	CALL	PRS	DEFM	'invalid range'	DEFB	BEEP,0	JP	ERRM1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Ports lesen und schreiben;	DEFW	PROLOG	DEFM	'IN'	DEFB	13HXIN	LD	B,H	LD	C,L	IN	A,(C)	JP	AHCR;	DEFW	PROLOG	DEFM	'OUT'	DEFB	5XOUT	LD	B,H	LD	C,L	LD	HL,ARG1OUT1	DEC	A	RET Z	INC	HL	INC	HL	LD	D,M	OUT	(C),D	JR	OUT1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Bereiche f}llen; HL: Anfang; DE: Ende; C:  Byte;	DEFW	PROLOG	DEFM	'FILL'	DEFB	17HXFILL	CALL	FORMFILL1	LD	M,E	CPI	JP	PE,FILL1	RET;; Bereich austauschen;	DEFW	PROLOG	DEFM	'EXCH'	DEFB	17HXEXCH	CALL	FORMEX1	LD	A,(DE)	LDI	DEC	HL	LD	M,A	INC	HL	JP	PE,EX1	RET;; Bereich verschieben;	DEFW	PROLOG	DEFM	'MOVE'	DEFB	17HXMOVE	CALL	FORM	SBC	HL,DE	ADD	HL,DE	JR	C,SH1	LDIR		;nach vorn->LDIR	RET;SH1	ADD	HL,BC	;nach hinten	EX	DE,HL	;->LDDR	ADD	HL,BC	EX	DE,HL	DEC	HL	DEC	DE	LDDR	RET;	DEFW	PROLOG	;+,- 16 bit	DEFM	'HELP'	;*   32 bit	DEFB	3XHELP	PUSH	HL	PUSH	DE	OR	A	SBC	HL,DE	PUSH	HL	ADD	HL,DE	ADD	HL,DE	POP	DE	CALL	HLDE	;+/- ausdrucken	POP	DE	POP	BC	;Fakt. aus Stack	LD	HL,0	;Mult.	LD	A,10H	RR	D	RR	EHE1	JR	NC,HE2	ADD	HL,BCHE2	RR	H	RR	L	RR	D	RR	E	DEC	A	JR	NZ,HE1	;HLDE=Produkt	CALL	HLDE	;Ausdr.HLDE	JP	CRLF;	DEFW	PROLOG	DEFM	'WORKRAM'	DEFB	13H	LD	A,L	JP	WORK;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Zweitregister holen;ZHOLD	LD	HL,(ZHL)	LD	DE,(ZDE)	LD	BC,(ZBC)	EXX	LD	HL,(ZAF)	PUSH	HL	POP	AF	EX	AF	LD	BC,(RBC)	LD	IY,(RIY)	LD	HL,(RSP);Zweitreg.,IY,	RET		;BC, SP (in HL);;*__*__*__*__*__*__*__*__*__*__*__*__*__;; RST 38-Routine;RST38	EX	(SP),HL	DEC	HL	EX	(SP),HL	PUSH	AF	PUSH	HL	LD	A,1	LD	(MODE),A	LD	HL,(BREAK)	LD	A,(STAT)	LD	M,A	POP	HL	JR	INT1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;; Interruptroutine f}r TEMO;INTR	PUSH	AF	LD	A,3	OUT	CTC0	CALL	EIRETI	;CTC abschalten;INT1	LD	(RHL),HL	LD	(RDE),DE	LD	(RBC),BC	POP	HL	LD	(RAF),HL ;Erstregister;	LD	HL,(PCN)	LD	(PCO),HL	POP	HL	LD	(PCN),HL	EX	DE,HL	POP	HL	LD	(RTS),HL	PUSH	HL	LD	(RSP),SP  ;PC, SP ...;	LD	(RIX),IX	LD	(RIY),IY  ;Indexreg.;	EXX		  ;Zweitregister	LD	(ZHL),HL	LD	(ZDE),DE	LD	(ZBC),BC	EXX	EX	AF	PUSH	AF	EX	AF	POP	HL	LD	(ZAF),HL  ;VR: DE,HL	LD	A,(MODE)	AND	A	JR	NZ,ANZ	  ;mit Anzeige	LD	HL,(SBRK)	SBC	HL,DE	JR	Z,ANZ1	  ;Adr. erreicht	LD	A,(IX+13)	CP	BRK	JR	Z,ANZ1	  ;BRK gedr.	JR	HOLD1;;*__*__*__*__*__*__*__*__*__*__*__*__*__;	DEFW	PROLOG	DEFM	'GO'	DEFB	1	AND	A	JR	Z,GO1	LD	(PCN),HLGO1	LD	HL,(BREAK)	LD	A,M	LD	(STAT),A	LD	M,0FFHGO2	CALL	ZHOLD	LD	SP,HL	LD	HL,(PCN)	PUSH	HL	LD	HL,(RAF)	PUSH	HL	LD	HL,(RHL)	LD	DE,(RDE)	POP	AF	RET;	DEFW	PROLOG	DEFM	'STEP'	DEFB	1	AND	A	JR	Z,HOLD	LD	(PCN),HL;HOLD	CALL	ZHOLD	;Zweitr.	LD	SP,HL;HOLD1	LD	HL,(PCN)	PUSH	HL	LD	HL,(RAF)	PUSH	HL	LD	HL,(RHL)	LD	DE,(RDE);AF,DE,HL geholt	LD	A,87H	DI	OUT	CTC0	LD	A,2	OUT	CTC0	NOP	NOP	POP	AF	;Warten	EI	RET		;Start;;*__*__*__*__*__*__*__*__*__*__*__*__*__;ANZ	DEC	A	JR	NZ,SPRANZ1	LD	A,(LINEST)	LD	SP,(SYSP)	CALL	REGANZ2	CALL	ICHR	CP	'B'	;B=Break	JP	Z,PRSE	CP	CR	JR	Z,TNEXT	CP	CUD	JR	Z,TONCE	CP	'G'	;n{chster mit GO	JR	Z,TGO	CP	'L'	JR	Z,GO2	SUB	'C'	;continue	JR	Z,TCONT	CP	'S'-'C'	JR	NZ,ANZ2	LD	A,2	;only SkipsTCONT	LD	(MODE),A;(DJNZ,JR,JP,STEP2	JR	HOLD	; CALL,RET);TNEXT	LD	A,1	JR	TCONT;TONCE	CALL	NXTST	LD	(SBRK),HL	JR	TCONT;TGO	CALL	NXTST	LD	(BREAK),HL	JP	GO1;SPR	LD	HL,(PCN)	CALL	LEN	JR	Z,ANZ1	JR	STEP2;;;************* E  N  D  E **************;; Disassembler - Routinen;WOFF	EQU	0D7B8HLIST	EQU	0D8AEHDCRLF	EQU	0D42AH;; Assembler - Routinen;ASMLN	EQU	0C981HOPT	EQU	  24AHERR	EQU	  266HMSGP	EQU	0DB12H;;*__*__*__*__*__*__*__*__*__*__*__*__*__;.;Ende@û