BAK1ASM 
;   Pr}fmodul KC 85/4
 
;   PI/AUMY   20.09.88
 
 
	ORG	0E000H
;Sprungverteiler f}r TAB1 (Schalter P2)
 
PR20:	JP	TESTB
	NOP
PR21:	JP	PXTST
	NOP
PR22:	JP	FARBT
	NOP
PR23:	JP	RATST
	NOP
PR24:	JP	SIGT
	NOP
PR25:	JP	TONT
	NOP
PR26:	JP	TESTB	;KBTAPE
	NOP
PR27:	JP	TESTB
	NOP
 
;Sprungverteiler f}r TAB2 (Schalter P1)
 
PR10:	JP	RAMVE
	NOP
PR11:	JP	RAM5
	NOP
PR12:	JP	RAMA
	NOP
PR13:	JP	IRM5
	NOP
PR14:	JP	IRMA
	NOP
PR15:	JP	PIOTE
	NOP
PR16:	JP	CSCTC
	NOP
PR17:	JP	REGTE
 
 
 
 
	;TESTBILD FUER KC 85/4
	;=====================
 
 
TESTB:	LD	A,4FH
	OUT	(8AH),A
	LD	A,1FH
	OUT	(88H),A
	LD	A,0FH
	OUT	(8AH),A
	LD	A,03H
	OUT	(8AH),A
	LD	A,8	;PIXELSPEICHER1
	OUT	(84H),A
	LD	HL,8000H;PIXEL-RAM LADEN
	LD	DE,8001H
	LD	BC,800H
	LD	M,33H
	LDIR
	LD	BC,800H
	LD	M,55H
	LDIR
	LD	BC,800H
	LD	M,0
	LDIR
	LD	BC,800H
	LD	M,0FH
	LDIR
	LD	BC,100H
	LD	M,0
	LDIR
	LD	BC,100H
	LD	M,0FFH
	LDIR
	LD	BC,100H
	LD	M,0
	LDIR
	LD	BC,100H
	LD	M,0FFH
	LDIR
	LD	BC,100H
	LD	M,0
	LDIR
	LD	BC,100H
	LD	M,0FFH
	LDIR
	LD	BC,100H
	LD	M,0
	LDIR
	LD	BC,0FFH
	LD	M,0FFH
	LDIR
	LD	HL,8000H;ZEILEN LOESCHEN
MA	LD	A,H
	CP	0A8H
	JR	Z,ME
	LD	A,L
	AND	0C1H
	CP	0
	JR	Z,LOE
	LD	A,L
	AND	0C2H
	CP	40H
	JR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7FH
;	LD	IY,RATST
;VERFB	LD	A,(IY)
;	CPL
;	CP	M
;	JR	NZ,RFFE
;	INC	HL
;	INC	IY
;	DJNZ	VERFB
;	DEC	C
;	JR	NZ,VERFC
;	LD	A,0FFH
;	CP	M
;	JR	NZ,RFFE
;	LD	HL,OK	;AUSGABE
;	JR	AUGR
;RFFE	LD	HL,FEHLER
;AUGR	LD	A,(IX+7)
;	LD	E,(IX+6)
;	ADD	18H
;	LD	D,A
 
OHNRE	LD	A,2FH
	OUT	(88H),A
	LD	A,08H
	OUT	(84H),A
;	PUSH	DE
;	POP	IY
;	CALL	TEXT
	LD	DE,10H
	ADD	IX,DE	;NAECHSTER BLOCK
	EXX
	DJNZ	BLOCK
ENDE	JR	ENDE
BLOCK	JP	BLOCK0
	;
	;UP ZUR	TEXTAUSGABE
	;------------------
ZG	EQU	0FE00H	;ZEICHENGENERAT.
	;IY=ANFANGSPOSITION
	;HL=STRINGANFANG
	;-------------------------------
TEXT	PUSH	DE
	PUSH	AF
	PUSH	HL
	PUSH	BC
TEXT1	LD	A,M
	CP	0
	CALL	NZ,TEXT2
	POP	BC
	POP	HL
	POP	AF
	POP	DE
	RET
 
;AUSGABE EINES BYTES (A)
TEXBY	PUSH	AF
	SRL	A
	SRL	A
	SRL	A
	SRL	A
	ADD	30H
	CP	3AH
	JR	C,TEXB2
	ADD	7
TEXB2	CALL	TEXAS
	POP	AF
	AND	0FH
	ADD	30H
	CP	3AH
	JR	C,TEXB3
	ADD	7
TEXB3	CALL	TEXAS
	DEC	HL
	DEC	HL	;WEGEN TEXAS
	RET
 
TEXT2	POP	DE
	LD	DE,TEXT1
	PUSH	DE		;RETADR
 
;AUSGABE EINES ASCII-ZEICHENS (A),INC HL
TEXAS	PUSH	HL
	PUSH	DE
	PUSH	BC
	LD	HL,ZG
	SUB	20H
	LD	B,0
	LD	C,A
	SLA	C
	SLA	C
	RL	B
	SLA	C
	RL	B
	ADD	HL,BC
	LD	B,8
TEXT3	LD	A,M
	LD	(IY),A
	INC	HL
	INC	IY
	DJNZ	TEXT3
	LD	BC,0F8H
	ADD	IY,BC
	POP	BC
	POP	DE
	POP	HL
	INC	HL
	RET
	;
	;STRINGSAMMLUNG
	;--------------
RAMT	DEFM    '>>> RAMT'
	DEFM	'EST FUER'
	DEFM	' KC 85/4'
	DEFM	' <<<'
	DEFB	0
SCHU	DEFM	'SCHUTZ  '
	DEFM	'WR/RD   '
;	DEFM	'RFSH'
	DEFB	0
OK	DEFM 	'OK'
	DEFB	0
FEHLER	DEFM	'FEHLER'
	DEFB	0
RAM0	DEFM	'RAM 0'
	DEFB	0
RAM4	DEFM	'RAM 4'
	DEFB	0
PIX2	DEFM	'PIX 2'
	DEFB	0
FARB2	DEFM	'FARB 2'
	DEFB	0
RAF0	DEFM	'RAF 0'
	DEFB	0
RAF1	DEFM	'RAF 1'
	DEFB	0
TON	DEFM	'TONTEST'
	DEFB	0
KBD	DEFM	'KBD'
	DEFB	0
TAPE	DEFM	'TAPE'
	DEFB	0
RCW	DEFM	'FEHLER RAS/CAS/WR'
	DEFB	0
KFA	DEFM	'ADRESSEN  OK'
	DEFB	0
KDF	DEFM	'DATEN     OK'
	DEFB	0
ABFEH	DEFM	'FEHLER BEI AB'
	DEFB	0
DBFEH	DEFM	'FEHLER BEI DB'
	DEFB	0
PIN	DEFM	'  PIN '
	DEFB	0
RT55	DEFM	'RAMTEST MIT 55H'
	DEFB	0
RTAA	DEFM	'RAMTEST MIT AAH'
	DEFB	0
TCTC	DEFM	'CTC-TEST  K0-K2'
	DEFB	0
TPIO	DEFM	'PIO-TEST  0-255'
	DEFB	0
TREG	DEFM	'REG-TEST  0-255'
	DEFB	0
TBLOK	DEFM	'BLOCKTEST OK'
	DEFB	0
TBLER	DEFM	'BLOCKTEST FEHLER'
	DEFB	0
TSIC	DEFM	'SIG CAOS-ROM C: '
	DEFB	0
TSIB	DEFM	'SIG BASIC-ROM : '
	DEFB	0
 
 
 
 
	;
	;SPEICHERBLOCKTABELLE
	;--------------------
RATA	DEFB 	00H
	DEFB	00H
	DEFB	08H
	DEFB	00H
	DEFB	07H
	DEFB	00H
	DEFB	30H
	DEFB	81H
	DEFW	RAM0
	DEFB	01H
	DEFB	88H
	DEFB	0FH
	DEFB	00H
	DEFB	00H
	DEFB	00H
	;
	DEFB	00H
	DEFB	40H
	DEFB	08H
	DEFB	01H
	DEFB	05H
	DEFB	00H
	DEFB	40H
	DEFB	81H
	DEFW	RAM4
	DEFB	01H
	DEFB	86H
	DEFB	03H
	DEFB	00H
	DEFB	00H
	DEFB	00H
	;
	DEFB	00H
	DEFB	80H
	DEFB	0CH
	DEFB	00H
	DEFB	05H
	DEFB	00H
	DEFB	50H
	DEFB	81H
	DEFW	PIX2
	DEFB	00H
	DEFB	84H
	DEFB	0CH
	DEFB	00H
	DEFB	00H
	DEFB	00H
	;
	DEFB	00H
	DEFB	80H
	DEFB	0EH
	DEFB	00H
	DEFB	05H
	DEFB	00H
	DEFB	60H
	DEFB	81H
	DEFW	FARB2
	DEFB	00H
	DEFB	84H
	DEFB	0EH
	DEFB	00H
	DEFB	00H
	DEFB	00H
	;
	DEFB	00H
	DEFB	80H
	DEFB	28H
	DEFB	00H
	DEFB	01H
	DEFB	20H
	DEFB	70H
	DEFB	81H
	DEFW	RAF0
	DEFB	01H
	DEFB	89H
	DEFB	60H
	DEFB	00H
	DEFB	00H
	DEFB	00H
	;
	DEFB	00H
	DEFB	80H
	DEFB	38H
	DEFB	00H
	DEFB	01H
	DEFB	20H
	DEFB	80H
	DEFB	81H
	DEFW	RAF1
	DEFB	01H
	DEFB	89H
	DEFB	60H
	DEFB	00H
	DEFB	00H
	DEFB	00H
 
 
 
 
 
;----------------
;
; TONTEST KC85/4
;
;----------------
 
P1AD	EQU	88H
P1AS	EQU	8AH
P1BD	EQU	89H
P1BS	EQU	8BH
CTC0	EQU	8CH
CTC1	EQU	CTC0+1
CTC2	EQU	CTC1+1
 
 
TONT:	DI
	IM	2
	LD	A,98H
	LD	I,A
	LD	IX,9000H
	LD	(IX),0
	LD	SP,0A000H
	LD	A,4FH
	OUT	(P1AS),A
	OUT	(P1BS),A
	LD	A,3FH
	OUT	(P1AD),A
	LD	A,0FH
	OUT	(P1AS),A
	OUT	(P1BS),A
	LD	A,03H
	OUT	(P1AS),A
	OUT	(P1BS),A
	CALL	CLS
	LD	HL,INTER
	LD	(980CH),HL
	LD	HL,TON	;TEXTAUSGABE
	CALL	TEXT
	LD	A,8
	OUT	(CTC0),A
	EI
TONI2	LD	HL,TABELLE
	LD	B,20	;16+4 TOENE
TONI1	PUSH	BC
	LD	C,M
	INC	HL
	LD	B,M
	INC	HL
	LD	E,M
	INC	HL
	LD	D,M
	INC	HL
	LD	A,M
	INC	HL
	INC	HL
	PUSH	HL
	DEC	HL
	LD	H,M
	LD	L,A
	CALL	TON0
	POP	HL
	POP	BC
	DJNZ	TONI1
	JR	TONI2
;
TON0	BIT	1,(IX)
	JR	NZ,TON0
;
TONB	LD	A,C
	XOR	1FH
	LD	C,A
	LD	A,B
	AND	A ;TONLAENGE=0?
	JR	Z,TON1
	SET	1,(IX)
	LD	A,0C7H ;ZAEHLER M. INT.
	OUT	(CTC2),A
	LD	A,B	;TONLAENGE
	OUT	(CTC2),A
;
TON1	LD	A,C
	SCF
	RLA
	OUT	(P1BD) ;LAUTSTAERKE
	LD	C,CTC1 ;2. KANAL
	CALL	TON2
	DEC	C	;1.KANAL
	EX	DE,HL
;
TON2	LD	A,L ;TONHOEHE
	AND	A   ;=0?
	LD	L,3 ;BEI L=0
	JR	Z,TON4
	LD	L,A
	LD	A,7
	BIT	0,H ;VORTEILER?
	JR	Z,TON3 ;VORTEILER 16
	OR	20H    ;VORTEILER 256
;
TON3	OUT	(C),A ;STEUERWORT
TON4	OUT	(C),L ;TONHOEHE (BEI
		      ;L=0 STEUERWORT)
	RET
;
INTER	PUSH	AF
	LD	A,3
	OUT	(CTC0),A
	OUT	(CTC1),A
	RES	1,(IX)
;	LD	A,47H
;	OUT	(CTC2),A
;	LD	A,20H
;	OUT	(CTC2),A
	POP	AF
	EI
	RETI
;
TABELLE	DEFW	0201H ;TON1
	DEFW	010H
	DEFW	120H
;
	DEFW	0302H ;TON2
	DEFW	018H
	DEFW	128H
;
	DEFW	0403H ;TON2
	DEFW	020H
	DEFW	130H
;
	DEFW	0504H ;TON4
	DEFW	028H
	DEFW	138H
;
	DEFW	0605H ;TON5
	DEFW	030H
	DEFW	140H
;
	DEFW	0706H ;TON6
	DEFW	038H
	DEFW	148H
;
	DEFW	0807H ;TON7
	DEFW	040H
	DEFW	150H
;
	DEFW	0908H ;TON8
	DEFW	048H
	DEFW	158H
;
	DEFW	0A09H ;TON9
	DEFW	050H
	DEFW	160H
;
	DEFW	0B0AH ;TON10
	DEFW	058H
	DEFW	168H
;
	DEFW	0C0BH ;TON11
	DEFW	060H
	DEFW	170H
;
	DEFW	0D0CH ;TON12
	DEFW	068H
	DEFW	178H
;
	DEFW	0E0DH ;TON13
	DEFW	070H
	DEFW	180H
;
	DEFW	0F0EH ;TON14
	DEFW	078H
	DEFW	188H
;
	DEFW	100FH ;TON15
	DEFW	080H
	DEFW	190H
;
	DEFW	1100H ;TON16
	DEFW	088H
	DEFW	198H
 
	DEFW	1101H
	DEFW	VTZK1
	DEFW	VTZK2
	DEFW	1102H
	DEFW	VTZK1
	DEFW	VTZK2
	DEFW	1104H
	DEFW	VTZK1
	DEFW	VTZK2
	DEFW	1108H
	DEFW	VTZK1
	DEFW	VTZK2
;---------------------------------------
 
VTZK1	EQU	050H
VTZK2	EQU	150H
ENDT1:	EQU	#
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ