;UPRAVA HRY ALIBABA MSX
;(C) ROS, 1990
;ADJALIB;0 ; 03-AUG-90 ; 19:05
;
	.RADIX 16T

	ORG	0D08C

;--------------------------------
ADR1	EQU	0DFFF ; LIVE-
ADR2	EQU	0DFFF ; SUBR INT
ADR3	EQU	0DFFF ; SET INT
;--------------------------------
START	DI
	LD	A,(0006)
	CP	10
	JP	NZ,0D000
SORDM5	CALL	00CC
	CALL	006F
	LD	HL,TEXT
TISK	LD	A,(HL)
	PUSH	AF
	CALL	00A2
	POP	AF
	OR	A
	JR	Z,PAUSE
	INC	HL
	JR	TISK
PAUSE	LD	BC,1000
PAUS1	XOR	A
PAUS2	DEC	A
	JR	NZ,PAUS2
	DEC	BC
	OR	B
	JR	NZ,PAUS1
	LD	A,03
	LD	(0B9E2),A
	LD	A,10
	LD	(0BCCA),A
	LD	(0B9CE),A
	LD	(0BC52),A
	LD	(0BC5F),A
	LD	(0BC7D),A
	LD	(0C32A),A
	INC	A
	LD	(9018),A
	LD	(0B5FC),A
	LD	(0B603),A
	LD	(0BCCF),A
	LD	(0BCD4),A
	LD	(0BCE2),A
	LD	(0BCE9),A
	LD	HL,96B3
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),0DB
	INC	HL
	LD	(HL),34
	LD	HL,96D5
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),0DB
	INC	HL
	LD	(HL),31
	INC	HL
	LD	(HL),07
	LD	HL,96F3
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),0DB
	INC	HL
	LD	(HL),34
	LD	HL,9705
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),0DB
	INC	HL
	LD	(HL),34
	INC	HL
	LD	(HL),0E6
	INC	HL
	LD	(HL),02
	LD	HL,9679
	LD	(HL),0D5
	INC	HL
	LD	(HL),1E
	INC	HL
	LD	(HL),0CF
	INC	HL
	LD	(HL),28
	INC	HL
	LD	(HL),02
	INC	HL
	LD	(HL),1E
	INC	HL
	LD	(HL),0AF
	INC	HL
	LD	(HL),0CD
	INC	HL
	LD	(HL),02
	INC	HL
	LD	(HL),11
	INC	HL
	LD	(HL),0CD
	INC	HL
	LD	(HL),0C
	INC	HL
	LD	(HL),11
	INC	HL
	LD	(HL),0D1
	INC	HL
	XOR	A
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	LD	A,0CD
	LD	(0B584),A
	LD	HL,SOUND1
	LD	(0B585),HL
	XOR	A
	LD	(0B587),A
	LD	(0B588),A
	LD	(0B589),A
	LD	A,0CD
	LD	(0B598),A
	LD	HL,SOUND1
	LD	(0B599),HL
	XOR	A
	LD	(0B59B),A
	LD	(0B59C),A
	LD	(0B59D),A
	LD	A,0CD
	LD	(0B5AC),A
	LD	HL,SOUND1
	LD	(0B5AD),HL
	XOR	A
	LD	(0B5AF),A
	LD	(0B5B0),A
	LD	(0B5B1),A
	LD	A,0C3
	LD	(0B734),A
	LD	HL,SOUND2
	LD	(0B735),HL
	XOR	A
	LD	(0B737),A
	LD	A,0CD
	LD	(0B76E),A
	LD	HL,SOUND3
	LD	(0B76F),HL
	XOR	A
	LD	(0B771),A
	LD	(0B772),A
	LD	(0B773),A
	LD	A,0C3
	LD	(0B78B),A
	LD	HL,SOUND4
	LD	(0B78C),HL
	LD	A,0CD
	LD	(0B7B4),A
	LD	HL,SOUND3
	LD	(0B7B5),HL
	XOR	A
	LD	(0B7B7),A
	LD	(0B7B8),A
	LD	(0B7B9),A
	LD	A,0C3
	LD	(0B7D1),A
	LD	HL,SOUND5
	LD	(0B7D2),HL
	LD	A,0CD
	LD	(0B7E4),A
	LD	HL,SOUND6
	LD	(0B7E5),HL
	LD	HL,0B7E7
	LD	BC,43T
	CALL	NULPAD
	LD	A,0CD
	LD	(0B81D),A
	LD	HL,SOUND7
	LD	(0B81E),HL
	LD	HL,0B820
	LD	BC,44T
	CALL	NULPAD
	LD	A,0CD
	LD	(0B86E),A
	LD	HL,SOUND8
	LD	(0B86F),HL
	XOR	A
	LD	(0B871),A
	LD	(0B872),A
	LD	(0B873),A
	LD	A,0CD
	LD	(0B887),A
	LD	HL,SOUND9
	LD	(0B888),HL
	XOR	A
	LD	(0B88A),A
	LD	(0B88B),A
	LD	A,0CD
	LD	(0B892),A
	LD	HL,SOUNDA
	LD	(0B893),HL
	LD	HL,0B895
	LD	BC,27T
	CALL	NULPAD
	LD	A,0CD
	LD	(0B8BB),A
	LD	HL,SOUNDB
	LD	(0B8BC),HL
	LD	HL,0B8BE
	LD	BC,27T
	CALL	NULPAD
	LD	A,0CD
	LD	(0B8F0),A
	LD	HL,SOUNDC
	LD	(0B8F1),HL
	XOR	A
	LD	(0B8F3),A
	LD	(0B8F4),A
	LD	(0B8F5),A
	LD	A,0CD
	LD	(0B907),A
	LD	HL,SOUNDC
	LD	(0B908),HL
	XOR	A
	LD	(0B90A),A
	LD	(0B90B),A
	LD	(0B90C),A
	LD	A,0CD
	LD	(0B91E),A
	LD	HL,SOUNDC
	LD	(0B91F),HL
	XOR	A
	LD	(0B921),A
	LD	(0B922),A
	LD	(0B923),A

	LD	HL,TEST
	LD	(ADR3),HL

	CALL	EXCLOP
	LD	HL,(4002)
	EI
	IN	A,(11)
	JP	(HL)
;--------------------------------
EXCLOP	DI
	LD	HL,9000
	LD	DE,4000
	LD	BC,4000
EX1	LD	A,(DE)
	LDI
	DEC	HL
	LD	(HL),A
	INC	HL
	JP	PE,EX1
	RET
;--------------------------------
NULPAD	XOR	A
	LD	D,H
	LD	E,L
	INC	DE
	LD	(HL),A
	DEC	BC
	LDIR
	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,(ADR1)
	OR	A
	JR	Z,SMRTEL
	XOR	A
ULOZIT	LD	(ADR1),A
	JR	VEN
SMRTEL	LD	A,3D
	JR	ULOZIT
;--------------------------------
SOUND1	PUSH	DE
	LD	A,0C0
	CALL	1102
	POP	DE
	RET
SOUND2	PUSH	DE
	LD	E,9C
	CALL	1102
	LD	A,8
	LD	E,0
	CALL	1102
	LD	A,9
	CALL	1102
	LD	A,0A
	CALL	1102
	POP	DE
	RET
SOUND3	PUSH	DE
	INC	HL
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUND4	PUSH	DE
	LD	E,(HL)
	CALL	1102
	XOR	A
	INC	HL
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUND5	PUSH	DE
	LD	E,(HL)
	CALL	1102
	LD	A,2
	INC	HL
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUND6	PUSH	DE
	LD	E,10
	CALL	1102
	INC	HL
	LD	A,0D
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,0C
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,0B
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,3
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,2
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUND7	PUSH	DE
	LD	E,0
	CALL	1102
	LD	A,0D
	CALL	1102
	LD	A,0C
	CALL	1102
	LD	A,0B
	CALL	1102
	LD	A,03
	CALL	1102
	LD	A,02
	CALL	1102
	POP	DE
	RET
SOUND8	PUSH	DE
	INC	HL
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUND9	PUSH	DE
	LD	E,B
	CALL	1102
	POP	DE
	RET
SOUNDA	PUSH	DE
	LD	E,10
	CALL	1102
	INC	HL
	LD	A,0D
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,0C
	LD	E,(HL)
	CALL	1102
	INC	HL
	LD	A,0B
	LD	E,(HL)
	CALL	1102
	POP	DE
	RET
SOUNDB	PUSH	DE
	LD	E,0
	CALL	1102
	LD	A,0D
	CALL	1102
	LD	A,0C
	CALL	1102
	LD	A,0B
	CALL	1102
	POP	DE
	RET
SOUNDC	PUSH	DE
	LD	E,0
	CALL	1102
	POP	DE
	RET
;--------------------------------
TEXT	DB 0C,0A,0A,0A,0A,0A,0A,0D,09
	DB         'Pro SORD m.5'
	DB 0D,0A,0D,0A,09
	DB         'v potu tvare'
	DB 0D,0A,0D,0A
	DB '       pracne upravil'
	DB 0D,0A,0D,0A
	DB '     LZR Soft 3.8. 1990'
	DB 0D,0
;--------------------------------
ZKONEC
	END	8FF8
