UHR_INT ASM;---------------------------------------
;	Uhrenprogramm mit System-CTC:
;
;	(EDAS 1.5/1.6)
;
;---------------------------------------
;leitet die Interruptroutine des inter-
;nen CTC-Kanal-2 (blinken) um, da~ im
;Sekundentakt die Uhrzeit berechnet
;wird.
;
;UHR_INT.ASM	` ML-soft 18.11.93
;---------------------------------------
WINON	EQU	0B79CH
WINLG	EQU	0B79EH
CURSO	EQU	0B7A0H
STBT	EQU	0B7A2H
COLOR	EQU	0B7A3H
 
PV1	EQU	0F003H
CRT	EQU	00H
ERRM	EQU	19H
AHEX	EQU	1CH
;-------
	ORG	200H
SEK	DB	0
MIN	DB	0
STD	DB	0
;-------
ISR:	CALL	0	;Adresse eintr.
MERK	EQU	ISR+1
	PUSH	HL
	PUSH	AF
	LD	A,0C7H
	OUT	8EH
	LD	A,50	;wieder 50 Hz
	OUT	8EH
 
	LD	HL,SEK
	LD	A,M
	ADD	1	;sek+1
	DAA
	LD	M,A
	CP	60H
	JR	NZ,TIME
	LD	M,0
	INC	HL
	LD	A,M
	ADD	1	;min+1
	DAA
	LD	M,A
	CP	60H
	JR	NZ,TIME
	LD	M,0
	INC	HL
	LD	A,M
	ADD	1	;std+1
	DAA
	LD	M,A
	CP 	24H
	JR	NZ,TIME
	LD	M,0
TIME:	LD	A,(IX+4)
	PUSH	AF
	IN	A,(88H)
	LD	H,A
	SET	2,A	;IRM on
	OUT	(88H),A
	LD	A,(IX+1)
	LD	L,A
	PUSH	HL
	AND	0F9H
	BIT	0,L
	JR	Z,TIM2
	SET	2,A	;angezeigtes
TIM2:	LD	(IX+1),A;Bild
	OUT	(84H),A
	LD	A,L
	LD	HL,(WINON)
	PUSH	HL
	LD	HL,(WINLG)
	PUSH	HL
	LD	HL,(CURSO)
	PUSH	HL
	LD	HL,(STBT);+COLOR
	PUSH	HL
	LD	L,A
	LD	A,10H	;rot/schwarz
	BIT	3,L	;im HIRES-
	JR	NZ,TIM3	;und Normal-
	XOR	A	;Modus!
TIM3:	LD	(COLOR),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