;UPRAVA MSX HRY WONDER
;ADJWON2;5 ; 31-OCT-91 ; 20:35

;(C) ROS, 10-SEP-91

	.RADIX 16T

	ORG	0D000

;--------------------------------
SETINT	EQU	430A
SUBINT	EQU	410D
LIVES	EQU	405D
;--------------------------------
START	DI
	LD	HL,9000
	LD	DE,8000
	LD	BC,4000
	LDIR
	LD	HL,ODKUD
	LD	DE,0E000
	LD	BC,ZKONEC-ODKUD
	LDIR
	JP	0E000
;--------------------------------
ODKUD	LD	A,(0FFFE)
	CALL	013B
	LD	HL,TSTMSX+DIFF
	LD	BC,KONMSX-TSTMSX
	LD	A,(0006)
	CP	10
	JR	NZ,MSX
	LD	HL,4000
	LD	DE,0C000
	LD	BC,2000
	LDIR
	LD	HL,0000
	LD	DE,4000
	LD	BC,4000
	CALL	0059
	XOR	A
	LD	(HELP+DIFF),A
	LD	HL,41B2
	LD	(HL),0DB
	INC	HL
	LD	(HL),30
	INC	HL
	LD	(HL),07
	INC	HL
	LD	(HL),2F
	INC	HL
	LD	(HL),0FB
	LD	A,21
	LD	(58BF),A
	LD	HL,TESTM5+DIFF
	LD	BC,KONM5-TESTM5
MSX	LD	DE,0FDEA
	PUSH	DE
	LDIR
	POP	HL
	LD	(SETINT),HL
	LD	HL,0F3E9
	LD	(HL),0F
	INC	HL
	LD	A,4
	LD	(HL),A
	INC	HL
	LD	(HL),A
	CALL	00CC
	CALL	006F
	LD	HL,TEXT+DIFF
TISK	LD	A,(HL)
	OR	A
	JR	Z,PAUSE
	CALL	00A2
	INC	HL
	JR	TISK
PAUSE	LD	BC,1000
PAUS1	XOR	A
PAUS2	DEC	A
	JR	NZ,PAUS2
	DEC	BC
	OR	B
	JR	NZ,PAUS1
	CALL	013E
	LD	HL,(4002)
	JP	(HL)
;--------------------------------
TSTMSX	PUSH	AF
	LD	A,78
	OUT	(0AA),A
	IN	A,(0A9)
	BIT	1,A
	LD	A,4
	JR	Z,DEAD1
	IN	A,(0A9)
	BIT	2,A
	LD	A,35
	JR	NZ,VENMSX
DEAD1	LD	(LIVES),A
VENMSX	POP	AF
	JP	SUBINT
KONMSX
;--------------------------------
TESTM5	PUSH	AF
	IN	A,(30)
	CPL
	AND	0C
	JR	Z,SHIFTY
	IN	A,(50)
	RLCA
	JR	C,RESET
VEN	POP	AF
	JP	SUBINT
;---------------
SHIFTY	DI
	LD	HL,0C000
	LD	DE,4000
	LD	BC,2000
	LDIR
	XOR	A
	OUT	(6C),A
	OUT	(30),A
	LD	A,3
	OUT	(7F),A
	IN	A,(11)
	JP	0000
;---------------
RESET	IN	A,(50)
	RLCA
	JR	C,RESET
	LD	A,(LIVES)
	XOR	31
	LD	(LIVES),A
	JR	VEN
KONM5
;--------------------------------
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 '31-OCT-91',0D,0A,0A,0A,0A,0A,0A,0A,0A,0A,0A
HELP	DB 0A,' Nesmrtelnost:',0D,0A,0A,' HOME - zapne, INS - vypne',0
;--------------------------------
ZKONEC
DIFF	EQU	0E000-ODKUD
	END
