;UPRAVA PRESUNUJICICH SE HER MSX
;ADJPOOYAN ; 27-JUL-91 ; 18:32
;
;(C) ROS, 13-OCT-90

	.RADIX 16T

	ORG	0D000

;--------------------------------
ADR1	EQU	9015 ;INIT INT
ADR2	EQU	5753 ;SUBR INT
ADR3	EQU	41F8 ;LIVE-
;--------------------------------
START	DI
	LD	A,(0006)
	CP	10
	JR	Z,SORDM5
	IN	A,(0A8)
	AND	0F3
	LD	B,A
	RRA
	RRA
	AND	0C
	OR	B
	OUT	(0A8),A
	LD	HL,9000
	LD	DE,4000
	LD	B,D
	LD	C,E
	LDIR
	JR	RUN
;--------------------------------
SORDM5	LD	HL,0F3E9
	LD	A,0F
	LD	(HL),A
	INC	HL
	LD	A,4
	LD	(HL),A
	INC	HL
	LD	(HL),A
	CALL	00CC
	CALL	006F
	LD	HL,TEXT
TISK	LD	A,(HL)
	OR	A
	JR	Z,PAUSE
	CALL	00A2
	INC	HL
	JR	TISK
PAUSE	LD	BC,0E00
PAUS1	XOR	A
PAUS2	DEC	A
	JR	NZ,PAUS2
	DEC	BC
	OR	B
	JR	NZ,PAUS1
	LD	A,10
	LD	(0AA82),A
	LD	HL,TEST
	LD	(ADR1),HL
RUN	CALL	EXCLOP
	LD	HL,(4002)
	IN	A,(11)
	EI
	JP	(HL)
;--------------------------------
EXCLOP	DI
	LD	HL,9000
	LD	DE,4000
	LD	B,D
	LD	C,E
EX1	LD	A,(DE)
	LDI
	DEC	HL
	LD	(HL),A
	INC	HL
	JP	PE,EX1
	RET
;--------------------------------
TEST	PUSH	AF
	IN	A,(30)
	CPL
	AND	0C
	JR	Z,SHIFTY
	IN	A,(50)
	RLCA
	JR	C,RESET
VEN	POP	AF
	JP	ADR2
;---------------
SHIFTY	CALL	EXCLOP
	RST	0
;---------------
RESET	IN	A,(50)
	RLCA
	JR	C,RESET
	LD	A,(ADR3)
	CP	0
	ORG	$-1
	OR	A
	JR	Z,SMRTEL
	LD	A,0
	ORG	$-1
	OR	A
ULOZIT	LD	(ADR3),A
	JR	VEN
SMRTEL	LD	A,0
	ORG	$-1
	DEC	A
	JR	ULOZIT
;--------------------------------
TEXT	DB 0C,0A,0A,0A,0A,0A,0A,09,'Pro SORD m.5',0D,0A,0A,'      upravil LZR Soft',0D,0A,0A,09,20
	DB '27-JUL-91',0
;--------------------------------
ZKONEC
	END	8FF8
