; Frost 4k Intro
; (C)2000 FeNoMen. Mad Rain.
; Converted from Alasm to SjASMPlus by Aprisobal

	DEVICE ZXSPECTRUM128

SCRSEG          EQU #88
FREESEG         EQU #8A
TXTSWSEG        EQU #8D
SINSEG          EQU #62
BANKOOO         EQU #11
BANKBUMPE       EQU #13
BANKBLOB        EQU #14
BANKBLOB2       EQU #16
BANKBLOB3       EQU #17

	ORG #6300
STARTF	XOR A
	OUT (254),A
	CALL CLS
	LD HL,NACH
	CALL NACT
	CALL IMON
	CALL SINDEC
	CALL FULLINSTALL
	CALL RDSC
	CALL TXTSWR
	CALL TXTREA
	LD A,#37
	LD (PLAY),A
	LD IX,TXT3
	CALL WATERPRINT
S000
	LD HL,STARTER
	CALL MAINS
	LD IX,TXT6
	CALL WATERPRINT
	CALL CLS7
S001
	CALL LINESIN
	LD B,128
WEDP    PUSH BC
	CALL LINES
	CALL START
	POP BC
	DJNZ WEDP
	LD HL,STARTER2
	CALL MAINS
	LD IX,TXT7
	CALL WATERPRINT
	LD HL,STARTER3
	CALL MAINS
	CALL CLS7
	LD A,#10
	CALL BANK
	CALL FNMIN
	LD BC,400
QKXX    PUSH BC
	CALL FNM
	CALL START
	POP BC
	DEC BC
	LD A,B
	OR C
	JR NZ,QKXX
IWDI
	LD HL,STARTER4
	CALL MAINS
	LD IX,TXTEND
	CALL WATERPRINT
KWS
	LD A,(POSITION)
	CP 33
	JR C,KWS
EXIT
	LD HL,STOPP
	CALL NACT
	LD A,63
	LD I,A
	IM 1
	LD IY,23610
	LD HL,10072
	EXX 
	EI 
	RET 
RNDSC
	CALL RND
	AND #3F
	SUB #20
	LD E,A
WAN1    CALL RND
	AND B
	CP C
	JR NC,WAN1
	SRL C
	SUB C
	LD D,A
	RET 
RAND
	LD LX,6
WAN0
	LD BC,#3F40
	CALL RNDSC
	LD HL,0
	CALL LINE
	DEC LX
	JR NZ,WAN0
	LD HL,#D700
	CALL CLEAR2
	LD HL,#FF00
	CALL CLEAR2
	LD H,#D8
	JP BLUR
CLEAR2
	LD E,1
	LD D,H
	LD BC,64
	LD (HL),#80
	LDIR 
	RET 
RANDIN
	LD HL,#D800
	PUSH HL
	LD (HL),#80
	CALL CLEAR
	CALL BLURIN
	POP DE
	JP RD65
LINE
	LD A,D
	SUB H
	LD D,A
	LD A,E
	SUB L
	LD E,A
	LD B,#2C
	BIT 7,A
	JR Z,FM7
	INC B
	NEG 
FM7     LD E,A
	LD A,B
	LD (FMOP1),A
	LD (FMOP2),A

	LD A,D
	LD B,#24
	BIT 7,A
	JR Z,FM8
	INC B
	NEG 
FM8     LD D,A
	LD A,B
	LD (FMOP3),A
	LD (FMOP4),A
	LD A,H
	ADD A,#D8+19
	LD H,A
	LD A,L
	ADD A,32
	LD L,A
	LD A,E
	CP D
	JR C,FM3Q
	LD B,E
	INC B
	LD A,E
	SRL A
FM2
	LD (HL),#87
FMOP1   DB #87
	ADD A,D
	CP E
	JR C,FM1
FMOP3   DB 2
	SUB E
FM1
	DJNZ FM2
	RET 
FM3Q    LD B,D
	INC B
	LD A,D
	SRL A
FM3
	LD (HL),#87
FMOP4   DB #87
	ADD A,E
	CP D
	JR C,FM4
FMOP2   DB 2
	SUB D
FM4
	DJNZ FM3
	RET 
FNM2
	LD H,#D8
	LD C,#80
	LD LX,38
FN0Q
	LD L,0
	LD B,64
FN1Q    LD A,(HL)
	CP C
	JP Z,FNL
	DEC (HL)
FNL
	INC L
	DJNZ FN1Q
	INC H
	DEC LX
	JR NZ,FN0Q
	LD A,(GRAD)
	ADD A,2
	LD (GRAD),A
	LD LX,A
	LD HX,SINSEG
	LD DE,#90D2
	CALL TAKE
	LD E,167
	CALL TAKE
	LD E,140
	CALL TAKE
	LD A,LX
	ADD A,A
	LD LX,A
	LD E,#1E
	CALL TAKE
	LD IX,VECTORS
EVK
	LD A,(IX)
	AND A
	RET Z
	CALL ROTAT
	PUSH DE
	CALL ROTAT
	POP HL
	CALL LINE
	JR EVK
ROTAT
	LD H,#90
	LD A,(IX)
	SUB 72
	LD L,A
	INC IX
	LD E,(HL)
	INC H
	LD A,(HL)
	INC H
	LD L,(IX)
	INC IX
	ADD A,(HL)
	INC H
	LD D,A
	LD A,E
	ADD A,(HL)
	LD E,A
	RET 
TAKE
	LD C,(IX)
	LD B,0
	LD L,B
	BIT 7,C
	JR Z,TK1
	DEC B
TK1
	LD A,LX
	ADD A,E
	LD LX,A
	LD E,L
	LD H,L
	PUSH HL
LO5
	LD A,H
	LD (DE),A
	ADD HL,BC
	INC E
	BIT 7,E
	JR Z,LO5
	POP HL
	OR A
	LD E,-1
LO6
	SBC HL,BC
	LD A,H
	LD (DE),A
	DEC E
	BIT 7,E
	JR NZ,LO6
	INC D
	RET 
FNM2IN
	LD A,#7A
	LD (GRAD),A
	LD HL,#D700
	LD (HL),#80
	CALL CLEAR
	LD DE,#D800
	JP RD65
KVAD
	LD E,L
	LD D,H
	LD B,16
	LD C,D
	LD A,E
	EX DE,HL
	LD HL,0
ML2     SRL C
	RRA 
	JR NC,ML3
	ADD HL,DE
ML3     EX DE,HL
	ADD HL,HL
	EX DE,HL
	DJNZ ML2
	RET 
SQR     LD A,L
	LD L,H
	LD DE,64
	LD H,D
	LD B,8
SQ1Q
	SBC HL,DE
	JR NC,SQ2Q
	ADD HL,DE
SQ2Q    CCF 
	RL D
	ADD A,A
	ADC HL,HL
	ADD A,A
	ADC HL,HL
	DJNZ SQ1Q
	LD L,D
	LD H,A
	RET 
DIV
	LD C,H
	BIT 7,C
	JR Z,DV1
	CALL MINUS
DV1
	PUSH HL
	POP IX
	LD HL,0
	LD B,16
DVV
	ADD IX,IX
	INC IX
	ADC HL,HL
	SBC HL,DE
	JR NC,DVV2
	ADD HL,DE
	DEC IX
DVV2
	DJNZ DVV
	PUSH IX
	POP HL
	BIT 7,C
	RET Z
MINUS   LD A,L
	CPL 
	LD L,A
	LD A,H
	CPL 
	LD H,A
	INC HL
	RET 
BULKAIN
	LD IY,#A000-#400
	LD HL,-19
XK1     PUSH HL
	LD A,L
	LD (XK5+1),A
	CALL KVAD
	LD (XK2+1),HL
	LD HL,-32
XK3     PUSH HL
	PUSH HL
	CALL KVAD
XK2     LD DE,#1111
	ADD HL,DE
	CALL SQR
	LD A,L
	ADD A,A
	ADD A,A
	ADD A,A
	LD L,A
	LD H,SINSEG
	LD A,(HL)
	ADD A,#80
	LD L,A
	LD H,1
	EX DE,HL
	POP HL
	LD H,L
	LD L,0
	ADD HL,HL
	CALL DIV
	LD (IY),L
	INC IY
XK5     LD H,0
	LD L,0
	ADD HL,HL
	CALL DIV
	LD (IY),L
	INC IY
	POP HL
	INC HL
	LD A,L
	CP 32
	JR NZ,XK3
	POP HL
	INC HL
	LD A,L
	CP 19
	JR NZ,XK1
	LD DE,LESS
	LD A,64
BK1
	LD HL,BAUSKO
	LD BC,BAUSKOE-BAUSKO
	LDIR 
	DEC A
	JR NZ,BK1
	LD A,#C9
	LD (DE),A
	LD DE,#B000
	JP RD61
BULKA
	LD HL,GRAD
	INC (HL)
	INC (HL)
	LD L,(HL)
	LD H,SINSEG
	LD A,(HL)
	ADD A,#80
	SRL A
	ADD A,48
	LD LX,A
	LD A,L
	ADD A,#2D
	LD L,A
	LD A,(HL)
	ADD A,#80
	SRL A
	LD HX,A
	LD HL,#A000-#400
	LD BC,#B000
	LD LY,38
BUL1
	CALL LESS
	DEC C
	INC BC
	DEC L
	INC HL
	DEC LY
	JR NZ,BUL1
	RET 
BAUSKO
	LD A,LX
	SUB (HL)
	LD E,A
	INC L
	LD A,(HL)
	ADD A,HX
	OR #C0
	LD D,A
	INC L
	LD A,(DE)
	LD (BC),A
	INC C
BAUSKOE
CLS7    LD A,7
CLS
	LD HL,#4000
	LD DE,#4001
	LD BC,6144
	LD (HL),L
	LDIR 
	LD (HL),A
	LD BC,767
	LDIR 
	RET 
WATERPRINT
	LD A,#41
	CALL CLS
IDD
	CALL WATERIN
	LD DE,#DD00
	LD L,#3F
	LD BC,#100
	CALL PRINT
	PUSH IX
	CALL WATER
	CALL START
	LD B,50
	HALT 
	DJNZ $-1
	LD B,23
EEQ
	PUSH BC
	CALL WATER
	CALL START
	POP BC
	DJNZ EEQ
	POP IX
	LD A,(IX)
	AND A
	JR NZ,IDD
	RET 
MAINS
	LD A,(HL)
	AND A
	RET Z
	LD (COLOR+1),A
	INC HL
	LD A,(HL)
	INC HL
	CALL BANK
	LD A,(HL)
	INC HL
	LD (PATW+1),A
	LD E,(HL)
	INC HL
	LD D,(HL)
	INC HL
	LD (INIT+1),DE
	LD E,(HL)
	INC HL
	LD D,(HL)
	INC HL
	PUSH HL
	LD (STTA+1),DE
INIT    CALL #CDCD
	HALT 
	LD HL,22592
	LD DE,22593
	LD BC,607
COLOR   LD (HL),#36
	LDIR 

STTA    CALL #CDCD
	CALL START
	LD A,(POSITION)
PATW    CP #FE
	JR NZ,STTA
	HALT 
	LD HL,23295
	LD DE,23294
	LD BC,6912
	LD (HL),C
	LDDR 
	POP HL
	JR MAINS
STARTER
	DB #03
	DB BANKBUMPE
	DB #04
	DW BUMPIN
	DW BUMP
	DB 0
STARTER2
	DB #04
	DB #10
	DB 10
	DW NECHIN
	DW NECH

	DB #07
	DB BANKBLOB3
	DB 12
	DW BLOBSINL
	DW BLOBS

	DB #06
	DB BANKOOO
	DB 14
	DW SCALEIN
	DW SCALE

	DB #05
	DB BANKBLOB
	DB 16
	DW BLOBSINL
	DW BLOBS
	DB 0

STARTER3
	DB #0E
	DB BANKBLOB2
	DB 19
	DW BLOBSIN
	DW BLOBS

	DB #47
	DB #10
	DB 20
	DW FNM2IN
	DW FNM2

	DB #06
	DB #10
	DB 21
	DW SCALE2IN
	DW SCALE2

	DB #47
	DB BANKOOO
	DB 23
	DW FLAGIN
	DW FLAG
	DB 0

STARTER4
	DB 1*8+#47
	DB #10
	DB 28
	DW NECHIN2
	DW NECH

	DB #02
	DB #10
	DB 29
	DW RANDIN
	DW RAND

	DB 5
	DB BANKOOO
	DB 32
	DW BULKAIN
	DW BULKA

	DB 0
FULLINSTALL
	LD A,BANKOOO
	CALL BANK
	CALL OOO
	LD A,BANKBUMPE
	CALL BANK
	CALL BUMPINF
	LD A,#16
	LD (STP),A
	LD A,#6F
	LD (BLQ+1),A

	LD A,BANKBLOB
	CALL BANK
	CALL BLOBSINF
	LD A,BANKBLOB2
	CALL BANK
	CALL BLOBSINF2

	LD A,BANKBLOB3
	CALL BANK
	CALL BLOBSINF
	LD A,#10
BANK
	LD BC,#7FFD
	OUT (C),A
	RET 
NECH
	LD A,(GRAD)
	ADD A,4
	LD (GRAD),A
	LD D,SINSEG
	LD E,A
	LD HL,#0872
	CALL SINQP
	LD (ST1QL+1),A
	LD A,L
	LD (ST1L+1),A
	LD HL,#8291
	CALL SINQP
	LD (ST2QL+1),A
	LD A,L
	LD (ST2L+1),A
	LD A,E
	ADD A,30
	LD E,A
	LD HL,#7218
	CALL SINQP
	LD (ST3QL+2),A
	LD A,L
	LD (ST3L+2),A
	LD IY,#B000-#A00
	LD B,FREESEG
ST3QL   LD HX,#26
ST1QL   LD D,#16
ST2QL   LD H,#26
	LD A,38
LSZ     EX AF,AF'
ST3L    LD LX,#2E
ST1L    LD E,#1E
ST2L    LD L,#2E
	CALL LESS
	LD A,LY
	ADD A,63
	LD LY,A
	INC IY
	INC HX
	INC D
	INC H
	EX AF,AF'
	DEC A
	JR NZ,LSZ
	RET 
NECHIN2
	LD A,4
	LD (NE4-1),A
	LD A,#6F
	LD (BLQ+1),A
NECHIN
	LD DE,#B000-#A00
	CALL RD61
	XOR A
	LD DE,LESS
NE1
	LD (BOR1+2),A
	LD (BOR2+2),A
	LD HL,NEUSKO
	LD BC,NEUSKOE-NEUSKO
	LDIR 
	INC A
	CP #40
	JR NZ,NE1
	LD A,#C9
	LD (DE),A
	LD HL,(FREESEG+1)*256
	LD C,L
NE3
	INC C
	LD B,2
NE4
	LD (HL),C
	INC L
	DJNZ NE4
	LD A,L
	AND A
	JR NZ,NE3
	LD HL,#B000
	PUSH HL
	LD (HL),L
	CALL CLEAR

	LD A,150
	LD (SKOL+1),A
	LD A,#C9
	LD (STP),A
	CALL BUMPE
	POP HL
NU0
	LD A,(HL)
	AND A
	JR NZ,NU1
	DEC H
	LD A,(HL)
	INC H
	LD (HL),A
NU1     INC HL
	LD A,H
	AND A
	JR NZ,NU0
	LD HL,FREESEG*256
UPDOWN
PN10Q
	LD A,#80
PN8Q
	LD (HL),A
	INC L
	LD (HL),A
	INC A
	INC L
	CP #88
	JR NZ,PN8Q
PN9Q
	DEC A
	LD (HL),A
	INC L
	LD (HL),A
	INC L
	CP #80
	JR NZ,PN9Q
	LD A,L
	AND A
	JR NZ,PN10Q
	RET 
NEUSKO
	LD A,(DE)
	ADD A,(HL)
BOR2    SUB (IX)
	LD C,A
	LD A,(BC)
BOR1    LD (IY),A
	INC L
	INC E
NEUSKOE
FNMIN
	LD HL,LESS
	LD A,120
	LD B,64
FN0
	LD (HL),#4E
	INC HL
	LD (HL),#0A
	INC HL
	LD (HL),#12
	INC HL
	LD (HL),#1C
	INC HL
	ADD A,220
	JR NC,FN1
	LD (HL),#2C
	INC HL
FN1
	DJNZ FN0
	LD (HL),#C9
	LD HL,FREESEG*256+#80
	LD (HL),L
	LD A,L
	INC L
FN2
	LD (HL),A
	INC A
	INC L
	JR NZ,FN2
	LD HL,TXTE1
	LD DE,TXTE1+1
	LD BC,257
	LD (HL),C
	LDIR 
	LD HL,#D800
	LD (HL),#80
	JP CLEAR
PRINTFNM
	LD A,(IX)
	AND A
	RET Z
	LD L,A
	SET 7,L
	LD H,7
	ADD HL,HL
	ADD HL,HL
	ADD HL,HL
	LD LY,6
FN8
	INC L
	LD A,(HL)
	RRCA 
	OR (HL)
	LD C,A
	LD A,#88
	LD B,8
FN7     RL C
	JP NC,FN6
	LD (DE),A
FN6     INC E
	DJNZ FN7
	LD A,E
	SUB 8
	LD E,A
	INC D
	DEC LY
	JR NZ,FN8
	INC IX
	LD A,D
	SUB 6
	LD D,A
	LD A,E
	ADD A,8
	LD E,A
	JR PRINTFNM
FNMONE
	LD A,(IY)
	DEC (IY)
	JR Z,FNTWO
	LD A,(IY+1)
	ADD A,(IY+3)
	LD (IY+1),A
	LD HL,FN3+1
	ADD A,(HL)
	LD E,A
	LD A,(IY+2)
	ADD A,(IY+4)
	LD (IY+2),A
	LD D,A
	LD A,(IY+5)
	LD LX,A
	LD A,(IY+6)
	LD HX,A
	JR PRINTFNM
FNTWO
	PUSH IY
	POP DE
	LD HL,(TXTFNM)
	LD BC,7
	LDIR 
	LD (TXTFNM),HL
	JR FNMONE
TXTFNM  DW TXTF1
TXTF1
	DB 120
	DB 64
	DB #D8+18
	DB -1,0
	DW TFT1

	DB 70
	DB 0,0,0,0
	DW TFT2-1

	DB 50
	DB 20
	DB #D1
	DB 0,1
	DW TFT15


	DB 110
	DB -45
	DB #D8+17
	DB 1,0
	DW TFT2

	DB 50
	DB -3
	DB 0;#D8+#28 ;will be "Bytes lost"
	DB 1,-1
	DW TFT3

	DB 48
	DB 10
	DB 0;#D8+#28 ;will be "Bytes lost"
	DB 0,-1
	DW TFT4

	DB 45
	DB -3
	DB #D8-6
	DB 1,1
	DW TFT5

	DB 45
	DB 12     ;X
	DB #D8-6  ;Y
	DB 0,1    ;SX,SY
	DW TFT6


	DB 120
	DB 64
	DB #D8+17
	DB -1,0
	DW TFT7

	DUP 2
	DB 0,0,0,0,0
	DW TFT1-1
	EDUP 
FNM
	LD IY,TXTE1
	CALL FNMONE
	LD IY,TXTE1+7
	CALL FNMONE

	LD B,FREESEG
	LD H,#DA+2
	LD D,#D8
	LD LX,#20
FN3
	LD L,4
	LD E,#80
	CALL LESS
	LD A,LX
	ADD A,210
	LD LX,A
	JR NC,$+3
	INC H
	INC D
	JR NZ,FN3
	LD A,(FN3+1)
	XOR #80
	LD (FN3+1),A
	LD A,(FN3+3)
	LD E,A
	XOR #80
	LD (FN3+3),A
	LD D,#D8
	JP RD65

BLOBSINF2
	XOR A
	LD (BLQ+1),A
	LD HL,(FREESEG+1)*256
	LD A,15
W2      LD B,4
W1      LD (HL),A
	INC L
	DJNZ W1
	DEC A
	JR NZ,W2
	XOR A
W3      LD (HL),A
	INC L
	JR NZ,W3
	JR WAA
BLOBSINF
	LD HL,(FREESEG+1)*256
W0E     XOR A
W1E
	LD (HL),A
	INC L
	LD (HL),A
	INC L
	INC A
	CP 8
	JR NZ,W1E
W2E
	DEC A
	LD (HL),A
	INC L
	LD (HL),A
	INC L
	AND A
	JR NZ,W2E
	LD A,L
	AND A
	JR NZ,W0E
WAA
	LD HL,#B000
	LD (HL),L
	CALL CLEAR
	CALL BUMPE
	LD HL,#FFFF-#A00
	LD DE,#FFFF
	LD BC,#4000
	LDDR 
	RET 
FLAG
	LD IY,(GRAD)
	LD BC,#0301
	ADD IY,BC
	LD (GRAD),IY
	LD HX,SINSEG
	LD BC,#B000
	LD H,FREESEG
	LD L,C
	LD A,38
FB6     EX AF,AF'
	LD A,LY
	INC LY
	INC LY
	LD LX,A
	LD A,(IX)
	INC LX
	INC LX
	ADD A,#80
	SRL A
	LD D,A
	LD A,HY
	INC HY
	LD LX,A
	LD A,(IX)
	ADD A,#80
	LD E,A
	SRL A
	ADD A,D
	LD L,A
	PUSH HL
	CALL LESS
	POP HL
	DEC L
	DEC C
	INC BC
	EX AF,AF'
	DEC A
	JR NZ,FB6
	RET 
FLAGIN
	LD IX,SINSEG*256
	LD DE,LESS
	LD IY,#4080
FB0
	INC LX
	INC LX
	LD A,(IX)
	ADD A,#80
	SRL A
	SRL A
	CP LY
	LD LY,A
	LD BC,FLUSKOE-FLUSKO-1
	JR Z,FB1
	INC C
	LD A,#2D
	JR C,FB2
	DEC A
FB2     LD (FLUSKOE-1),A
FB1
	LD HL,FLUSKO
	LDIR 
	DEC HY
	JR NZ,FB0
	LD A,#C9
	LD (DE),A
	LD HL,FREESEG*256
	LD A,L
FB5
	OR #C0
	LD (HL),A
	INC A
	INC L
	JR NZ,FB5
	LD DE,#B000
	JP RD61
FLUSKO
	LD D,(HL)
	LD A,(DE)
	LD (BC),A
	INC C
	DEC E
	DEC E
FLUSKOE
SCALE2
	LD B,40
WWO
	LD A,(SF1+1)
	LD L,A
	CALL RND
	AND #3F
	ADD A,L
	LD L,A
	CALL RND
	AND #1F
	ADD A,#D8+4
	LD H,A
	CALL RND
	AND 7
	OR #80
	LD (HL),A
	DJNZ WWO
EDEE    LD A,5
	INC A
	LD (EDEE+1),A
	CP 12
	JR NZ,EDEE2
	XOR A
	LD (EDEE+1),A
	LD A,(SF1+1)
	ADD A,35
	LD E,A
	LD D,#DF+7
	LD HL,(TEXT)
	LD A,(HL)
	INC HL
	LD (TEXT),HL
	LD L,A
	SET 7,L
	LD H,7
	ADD HL,HL
	ADD HL,HL
	ADD HL,HL
WWD5
	LD LY,16
WWD4
	LD A,(HL)
	RRCA 
	OR (HL)
	LD C,A
	LD B,8
	LD A,#89
WWD3
	RL C
	JR NC,WWD
	LD (DE),A
	INC E
	LD (DE),A
	INC E
	JR WWD2
WWD
	INC E
	INC E
WWD2
	DJNZ WWD3
	INC D
	LD A,E
	SUB 16
	LD E,A
	LD A,LY
	RRA 
	JR NC,$+3
	INC L
	DEC LY
	JR NZ,WWD4
EDEE2
	LD H,#DA+2
	LD D,#D7
	LD LX,38
SF2     LD A,5
	LD (SF2E+1),A
SL2P
	PUSH DE
	PUSH HL
SF0     LD E,0
SF1     LD A,128
SF2E    ADD A,#C6
	LD L,A
BUL     CALL #CDCD
	POP HL
	POP DE
	INC D
	LD A,LY
	ADD A,220
	LD LY,A
	LD A,H
	ADC A,0
	LD H,A
	LD A,HY
	ADD A,30
	LD HY,A
	LD A,(SF2E+1)
	ADC A,0
	LD (SF2E+1),A
	DEC LX
	JR NZ,SL2P
	LD A,(SF1+1)
	LD E,A
	LD L,A
	LD H,#D7
	PUSH HL
	DEC E
	DEC E
	DEC E
	LD D,#29
	LD B,FREESEG
BUL2
	LD L,E
	CALL LESS
	INC H
	DEC D
	JR NZ,BUL2
	POP DE
	LD A,(SF2+1)
	XOR 1
	LD (SF2+1),A
	LD A,(SF0+1)
	LD C,A
	LD A,(SF1+1)
	LD (SF0+1),A
	LD A,C
	LD (SF1+1),A
	INC D
	JP RD65
SCALE2IN
	LD HL,#D500
	LD (HL),#80
	CALL CLEAR
	LD DE,LESS
	LD A,#42
SO4
	LD HL,BUSKO
	LD BC,BUSKOE-BUSKO
	LDIR 
	DEC A
	JR NZ,SO4
	LD A,#C9
	LD (DE),A
	EX DE,HL
	INC HL
	LD (BUL+1),HL
	LD B,64
SO2
	LD (HL),#ED
	INC HL
	LD (HL),#A0
	INC HL
	LD A,C
	ADD A,220
	LD C,A
	JR C,SO1
	LD (HL),#2B
	INC HL
SO1
	LD A,E
	ADD A,20
	LD E,A
	JR NC,SO1E
	LD (HL),#25
	INC HL
SO1E
	DJNZ SO2
	LD (HL),#C9
	INC HL
	EX DE,HL
	LD HL,FREESEG*256
	LD A,#80
	LD (HL),A
	INC L
	LD (HL),A
	INC L
	LD B,7
SOP
	DUP 4
	LD (HL),A
	INC L
	EDUP 
	INC A
	DJNZ SOP
SOP2    LD (HL),A
	INC L
	JR NZ,SOP2
	RET 
CLEAR
	LD D,H
	LD E,L
	INC DE
	LD A,H
	CPL 
	LD B,A
	LD A,L
	CPL 
	LD C,A
	LDIR 
	RET 
BUMPIN
	LD HL,#F000
	LD DE,#9B00
	LD BC,#1000
	LDIR 
	LD L,E
	LD H,D
	INC DE
	LD B,#16
	LD (HL),#80
	LDIR 
	LD HL,#F000
	LD (HL),#80
	CALL CLEAR
	LD DE,LESS
	LD A,#40
KS1
	LD HL,BUUSKO
	LD BC,BUUSKOE-BUUSKO
	LDIR 
	DEC A
	JR NZ,KS1
	LD A,#C9
	LD (DE),A
	LD DE,#9000
	JP RD61
BUMP
	LD A,(GRAD)
	ADD A,5
	LD (GRAD),A
	LD D,SINSEG
	LD E,A
	LD A,(DE)
	ADD A,#80
	SRL A
	SRL A
	LD (BQ2+1),A
	LD A,E
	ADD A,28
	LD E,A
	LD A,(DE)
	ADD A,#80
	SRL A
	SRL A
	SRL A
	ADD A,#B4
	LD (BQ3+1),A

	LD DE,#9000
	LD IX,66*3+#9B00+67
	LD LY,38
BQ3     LD B,#B5
BQ1
BQ2     LD C,0
	CALL LESS
	INC IX
	INC IX
	INC B
	DEC E
	INC DE
	DEC LY
	JR NZ,BQ1
	RET 
BUUSKO
	LD A,(IX+1)
	SUB (IX-1)
BP1     ADD A,C
	INC C
	LD L,A
	LD A,(IX+66)
	SUB (IX-66)
	INC IX
	ADD A,B
	LD H,A
	LD A,(HL)
	LD (DE),A
	INC E
BUUSKOE
LINES
	LD DE,#C100
	LD HL,#BE00
	LD A,8
LB7
	LD E,0
	LD BC,64
LB6
	LDI 
	LDI 
	LDI 
	LDI 
	JP PE,LB6
	INC D
	DEC A
	JR NZ,LB7
	LD HY,38
	LD H,#A0
LB3
IDDL2   LD L,0
	LD BC,64
	LD E,B
LB4
	LDI 
	DEC L
	LDI 
	LDI 
	DEC L
	LDI 
	JP PE,LB4
	INC D
	INC H
	DEC HY
	JR NZ,LB3
	LD LY,0
LB9     CALL LIN
	DEC LY
	JR NZ,LB9
	LD A,(IDDL+1)
	INC A
	LD (IDDL+1),A
	LD (IDDL2+1),A
	LD H,#C0
	JP BLUR
LIN
	LD BC,#1F1C
	CALL RNDSC

	ADD A,#A0-8+20
	CP #C0
	RET NC
	CP #A0
	RET C
	LD H,A
	LD A,E
	ADD A,#20
	SRL A
IDDL    ADD A,0
	LD L,A
	LD A,(HL)
	CP #80
	RET Z
	LD HL,#C100
	LD A,D
	ADD A,20
	ADD A,H
	LD H,A
	LD A,E
	ADD A,#20
	ADD A,L
	LD L,A
	LD A,E
	LD B,#2C
	BIT 7,A
	JR Z,LO1P
	INC B
	NEG 
LO1P
	LD E,A
	LD A,B
	LD (LO1),A
	LD (LO1E),A
	LD A,D
	LD B,#24
	BIT 7,A
	JR Z,LO2P
	INC B
	NEG 
LO2P
	LD D,A
	ADD A,E
	CP 2
	RET C
	LD A,B
	LD (LO2),A
	LD (LO2E),A
	LD A,E
	CP D
	JR C,LIN2
	LD A,E
	SRL A
	LD C,A
LN2     BIT 6,L
	RET NZ
	LD (HL),#87
LO1     INC L
	LD A,C
	ADD A,D
	LD C,A
	CP E
	JP C,LN2
	SUB E
	LD C,A
LO2     INC H
	LD A,H
	SUB #C1
	CP 38
	RET NC
	JP LN2
LIN2
	LD A,D
	SRL A
	LD C,A
LN2E    BIT 6,L
	RET NZ
	LD (HL),#87
LO2E    INC L
	LD A,H
	SUB #C1
	CP 38
	RET NC
	LD A,C
	ADD A,E
	LD C,A
	CP D
	JP C,LN2E
	SUB D
	LD C,A
LO1E    INC L
	LD A,C
	JP LN2E
RND
	PUSH HL
	PUSH DE
	LD HL,(RND1)
	LD DE,(RND2)
	DEC HL
	RL H
	ADC HL,DE
	LD A,E
RND4    ADC A,0
	LD E,A
	LD A,D
	ADC A,0
	LD D,A
	LD (RND2),DE
	LD (RND1),HL
	LD A,H
	RLCA 
	SUB L
	LD (RND4+1),A
	XOR E
	POP DE
	POP HL
	RET 
RND1    DW #C9C9
RND2    DW #C9C9
OOO
	LD DE,#C000
	PUSH DE
	LD L,E
	LD H,L
XOS
	RES 5,H
	LD A,(HL)
	INC HL
	AND #0F
	CP 2
	JR C,XOS
	OR #80
	LD (DE),A
	INC DE
	LD A,D
	AND A
	JR NZ,XOS
	POP DE
	LD IX,TXT4
NOD5
	LD L,(IX)
	SET 7,L
	LD H,7
	ADD HL,HL
	ADD HL,HL
	ADD HL,HL
	PUSH DE
NOD4
	LD LY,8
NOD41
	PUSH DE
	LD A,(HL)
	SRL A
	OR (HL)
	LD C,A
	LD A,#80
	LD B,8
NOD3
	RR C
	JR NC,NOD
	DUP 4
	LD (DE),A
	INC E
	EDUP 
	JR NOD2
NOD
	DUP 4
	INC E
	EDUP 
NOD2
	DJNZ NOD3
	POP DE
	INC D
	SET 7,D
	SET 6,D
	DEC LY
	JR NZ,NOD41
	INC L
	LD A,L
	AND 7
	JR NZ,NOD4
	POP DE
	LD A,E
	ADD A,8*4+2
	LD E,A
	INC IX
	BIT 7,(IX)
	JR Z,NOD5
	LD B,6
WWOX2   LD HL,#C000
WWOX    LD A,(HL)
	INC HL
	SET 7,H
	SET 6,H
	LD C,H
	DEC H
	SET 7,H
	SET 6,H
	ADD A,(HL)
	INC L
	LD H,C
	ADD A,(HL)
	DEC L
	INC H
	SET 7,H
	SET 6,H
	ADD A,(HL)
	LD H,C
	SRL A
	SRL A
	OR #80
	LD (HL),A
	LD A,L
	AND A
	JR NZ,WWOX
	LD A,H
	CP #C0
	JR NZ,WWOX
	DJNZ WWOX2
	RET 
GRAD    DW #C9C9
BLOBS
	LD A,(GRAD)
	ADD A,4
	LD (GRAD),A
	LD D,SINSEG
	LD E,A
	LD HL,#0872
	CALL SINQP
	LD (ST1Q+1),A
	LD A,L
	LD (ST1+1),A
	LD HL,#8291
	CALL SINQP
	LD (ST2Q+1),A
	LD A,L
	LD (ST2+1),A
	LD A,E
	ADD A,30
	LD E,A
	LD HL,#7218
	CALL SINQP
	LD (ST3Q+2),A
	LD A,L
	LD (ST3+2),A
BLOB
	LD A,B
	SRL A
	SRL A
	ADD A,#C0-#A-#2
	LD D,A
	LD A,B
	AND 3
	RRCA 
	RRCA 
	ADD A,C
	LD E,A
ST2Q    LD H,#26
ST1Q    LD D,#16
ST3Q    LD HX,#26
	LD B,FREESEG
	LD IY,#B000-#A00
	LD A,38
BH2     EX AF,AF'
ST1     LD E,#1E
ST2     LD L,#2E
ST3     LD LX,#2E
	CALL LESS
	LD A,LY
	ADD A,#3F
	LD LY,A
	INC IY
	INC D
	INC H
	INC HX
	EX AF,AF'
	DEC A
	JR NZ,BH2
	RET 
SINQP
	LD A,E
	ADD A,L
	LD E,A
	LD A,(DE)
	ADD A,#80
	SRL A
	SRL A
	LD L,A
	LD A,E
	ADD A,H
	LD E,A
	LD A,(DE)
	ADD A,#80
	SRL A
	LD C,A
	SRL A
	ADD A,C
	SRL A
	SRL A
	SRL A
	ADD A,#B6
	RET 
BLOBSINL
	LD A,#96
	LD (BER1-1),A
	CALL BLOBSIN
	LD A,#AE
	LD (BER1-1),A
	RET 
BLOBSIN
	LD HL,#C000
	LD DE,#C000-#A00
	LD BC,#4000
	LDIR 
	LD DE,#A600
	CALL RD61
	LD DE,LESS
	XOR A
LW1
	LD (BER1+2),A
	LD (BER2+2),A
	LD HL,BLUSKO
	LD BC,BLUSKOE-BLUSKO
	LDIR 
	INC A
	CP #40
	JR NZ,LW1
	LD A,#C9
	LD (DE),A
	LD HL,FREESEG*256
	LD A,#80
W5
	LD (HL),A
	INC L
	LD (HL),A
	INC L
	INC A
	CP #87
	JR NZ,W5
W6
	LD (HL),A
	INC L
	BIT 7,L
	JR Z,W6
	LD A,#80
W7
	LD (HL),A
	INC L
	JR NZ,W7
	RET 
BLUSKO
	LD A,(DE)
	ADD A,(HL)
BER1    ADD A,(IX)
	LD C,A
	LD A,(BC)
BER2    LD (IY),A
	INC E
	INC L
BLUSKOE
BUMPINF
	LD HL,#AE00
	LD (HL),#80
	CALL CLEAR

	XOR A
	LD (BLQ+1),A
	LD HL,(FREESEG+1)*256
	LD A,#87
	LD B,20
W1A
	LD (HL),A
	INC L
	DJNZ W1A
W2A
	DUP 4
	LD (HL),A
	INC L
	EDUP 
	DEC A
	CP #80
	JR NZ,W2A
W3A     LD (HL),A
	INC L
	JR NZ,W3A
	CALL BUMPE
	LD HL,#F000
	LD DE,66*54
KX1
	CALL RND
	AND #3F
	LD (HL),A
	INC HL
	DEC DE
	LD A,E
	OR D
	JR NZ,KX1
	LD LY,2
	CALL KX3
	LD IX,TXT2
	LD BC,66
	LD DE,66*12+#F002
	LD L,#3C
	CALL PRINT
	LD LY,2
KX3     LD IX,#F000
	LD DE,66*54
KX2     LD A,(IX-1)
	ADD A,(IX-66)
	ADD A,(IX+1)
	ADD A,(IX+66)
	SRL A
	SRL A
	LD (IX),A
	INC IX
	DEC DE
	LD A,D
	OR E
	JR NZ,KX2
	DEC LY
	JR NZ,KX3
	RET 
BUMPE
	XOR A
	LD (GRAD),A
	LD HY,FREESEG+1
	LD C,A
	LD B,A
TN9E
	PUSH BC
	LD HL,FREESEG*256
	LD D,H
	LD E,L
	LD HX,E
	LD LY,C
TN5E
	LD A,HX
	LD (HL),A
	ADD IX,BC
	LD A,HX
	NEG 
	DEC E
	LD (DE),A
	INC L
	BIT 7,L
	JR Z,TN5E
	LD H,SINSEG
	LD L,0
TN7E
	LD C,L
	LD E,(HL)
	LD A,(DE)
	ADD A,#40
	CP #80
	JR NC,TN6E
	LD LX,A
	LD A,L
	ADD A,64
	LD L,A
	LD E,(HL)
	LD A,(DE)
	ADD A,#28
	CP #50
	JR NC,TN6E
	ADD A,#B0
	LD HX,A
	LD A,L
	ADD A,A
BLQ     LD LY,A
	LD A,(IY)
	LD (IX),A
TN6E    LD L,C
	INC L
	JR NZ,TN7E
TN8E    LD HL,20
	POP BC
	INC C
	LD A,C
SKOL    CP 100
	JR C,TN9E
STP     DB #C9,#02
BE3     LD H,#B0
	LD C,#50
BE2     LD L,#FF
	LD A,1
	LD B,128
BE1     INC L
	DEC H
	ADD A,(HL)
	INC L
	INC H
	ADD A,(HL)
	DEC L
	INC H
	ADD A,(HL)
	DEC H
	INC A
	SRL A
	SRL A
	LD (HL),A
	DJNZ BE1
	INC H
	DEC C
	JR NZ,BE2
	DEC D
	JR NZ,BE3
	RET 
SCALEIN
	LD DE,#B000-#A00
	CALL RD61
	LD DE,LESS
	LD A,64
SC1
	LD HL,SUSKO
	LD BC,SUSKOE-SUSKO
	LDIR 
	DEC A
	JR NZ,SC1
	LD A,#C9
	LD (DE),A
	RET 
SCALE
	LD HL,GRAD
	INC (HL)
	INC (HL)
	LD E,(HL)
	LD D,SINSEG
	LD A,(DE)
	ADD A,#80
	LD L,A
	LD H,0
	LD BC,-128
	ADD HL,BC
	ADD HL,HL
	ADD HL,HL
	LD (FIV+1),HL
	LD A,E
	ADD A,34
	LD E,A
	LD A,(DE)
	ADD A,#80
	LD L,A
	LD H,0
	LD BC,-128
	ADD HL,BC
	ADD HL,HL
	ADD HL,HL
	LD (FIV2+1),HL
	LD HL,#B000-#A00
	LD C,#C0
	EXX 
FCH     LD HL,#2121
FCH2    LD IX,#4021
FIV     LD BC,#0101
FIV2    LD DE,#1111
	LD LY,38
SC2
	PUSH HL
	PUSH IX
	CALL LESS
	POP IX
	POP HL
	ADD IX,BC
	OR A
	SBC HL,DE
	DEC DE
	DEC DE
	DEC DE
	DEC LY
	JR NZ,SC2
	LD HL,(FCH+1)
	ADD HL,DE
	LD (FCH+1),HL
	LD HL,(FCH2+2)
	ADD HL,BC
	ADD HL,BC
	LD (FCH2+2),HL
	RET 
SUSKO
	ADD HL,BC
	ADD IX,DE
	LD A,H
	EXX 
	OR C
	LD D,A
	LD E,HX
	LD A,(DE)
	LD (HL),A
	INC HL
	EXX 
SUSKOE
WATERIN
	LD HL,#A000
	PUSH HL
	LD (HL),L
	CALL CLEAR
	LD DE,LESS
	XOR A
WT0
	LD (SOS+2),A
	LD HL,WUSKO
	LD BC,WUSKOE-WUSKO
	LDIR 
	INC A
	CP #40
	JR NZ,WT0
	LD A,#C9
	LD (DE),A
	LD HL,FREESEG*256
	XOR A
	LD (HL),A
	INC L
WT1
	LD (HL),A
	INC L
	INC A
	CP #3F
	JR NZ,WT1
WT2     LD (HL),#3F
	INC L
	LD A,L
	CP #80+#20
	JR NZ,WT2
WT3     LD (HL),#00
	INC L
	JR NZ,WT3
	INC H
	LD A,#80
WT4
	LD B,8
	LD (HL),A
	INC L
	DJNZ $-2
	INC A
	CP #89
	JR NZ,WT4
	POP DE
	JP RD61
WATER
	HALT 
	LD H,#FF-#27-2
	LD D,#AB
	LD IX,#A000
	LD B,FREESEG
	LD LY,38
EED
	LD L,-1
	LD E,0
	CALL LESS
	LD A,LX
	ADD A,63
	LD LX,A
	INC IX
	INC H
	INC D
	DEC LY
	JR NZ,EED
	LD A,(WATER+1)
	LD C,A
	LD A,(WATER+3)
	LD (WATER+1),A
	LD A,C
	LD (WATER+3),A
	RET 
WUSKO
	LD A,(HL)
	INC L
	DEC H
	ADD A,(HL)
	INC H
	INC L
	ADD A,(HL)
	INC H
	DEC L
	ADD A,(HL)
	SRL A
	DEC H
	EX DE,HL
	SUB (HL)
	LD C,A
	LD A,(BC)
	LD (HL),A
	INC B
	LD C,A
	LD A,(BC)
	DEC B
SOS     LD (IX),A
	INC L
	EX DE,HL
WUSKOE
BLURIN
	CALL RD64
	LD HL,#B000
	LD (HL),#80
	CALL CLEAR
	LD HL,FREESEG*256
BL1
	LD A,L
	INC A
	SRL A
	SRL A
	OR #80
	LD (HL),A
	INC L
	JR NZ,BL1
	LD DE,LESS
	LD A,64
BL2
	LD HL,BUSKO
	LD BC,BUSKOE-BUSKO
	LDIR 
	DEC A
	JR NZ,BL2
	LD A,#C9
	LD (DE),A
	RET 
BLUR
	LD B,FREESEG
	LD A,39
EEE     EX AF,AF'
	LD L,#FF
	LD A,#80
	CALL LESS
	INC H
	EX AF,AF'
	DEC A
	JR NZ,EEE
	RET 
BUSKO
	INC L
	DEC H
	ADD A,(HL)
	INC H
	INC L
	ADD A,(HL)
	INC H
	DEC L
	ADD A,(HL)
	LD C,A
	LD A,(BC)
	DEC H
	LD (HL),A
BUSKOE

START
	HALT 
	DI 
	LD A,SCRSEG
EOP     LD (SCSG+2),A
	LD A,(SL5)
	XOR #14
	LD (SL5),A
	LD HL,0
	LD (SL4),HL
	LD HL,BUF1
	LD A,38
	CALL SLOP
	LD HL,#1414
	LD (SL4),HL
	LD HL,64+BUF1
	LD A,38
	CALL SLOP
	EI 
	RET 
SLOP
	LD (SPL+1),SP
	JP TXTSWSEG*256
CONT
SCSG    LD SP,SCRSEG*256
	JR SL2
SL1     LD SP,0
SL2     POP HL
	POP DE
	LD (SL1+1),SP
SL5     NOP 
SL4     NOP 
	NOP 
	LD SP,HL
	DUP 32
	POP HL
	LDI 
	EDUP 
	DEC A
	JP NZ,SL1
SPL     LD SP,#3131
	RET 
RDSC
	LD HL,SCRSEG*256+2
	LD DE,#4040
	CALL SW0
	LD DE,#4440
SW0     LD B,19
SW2
	LD (HL),E
	INC L
	LD (HL),D
	INC L
	INC L
	INC L
	LD A,E
	ADD A,#20
	LD E,A
	JR NC,SW1
	LD A,D
	ADD A,8
	LD D,A
SW1     DJNZ SW2
	RET 
RD61    LD BC,64
	JR RD66
RD64
	LD DE,#C100
RD60
RD65
	LD BC,256
RD66    PUSH DE
	LD HL,SCRSEG*256
	CALL SQ0
	POP DE
	EX DE,HL
	ADD HL,BC
	EX DE,HL

SQ0     LD A,19
SQ1     LD (HL),E
	INC L
	LD (HL),D
	INC L
	INC L
	INC L
	EX DE,HL
	ADD HL,BC
	ADD HL,BC
	EX DE,HL
	DEC A
	JR NZ,SQ1
	RET 
IMON
	LD HL,#6000
	LD A,#61
IL1     LD (HL),A
	INC L
	JR NZ,IL1
	INC H
	LD (HL),A
	LD H,A
	LD L,A
	LD (HL),#C3
	INC L
	LD (HL),low IMPROC
	INC L
	LD (HL),high IMPROC
	DEC A
	LD I,A
	IM 2
	EI 
	RET 

IMPROC
	PUSH AF
	PUSH HL
	PUSH DE
	PUSH BC
PLAY    OR A
	JP NC,POL
DDD     LD A,5
	INC A
	LD (DDD+1),A
	CP 6
	JR NZ,DDD2
	XOR A
	LD (DDD+1),A
	LD A,(POSITION)
	LD E,A
	LD D,0
	LD HL,POSIT
	ADD HL,DE
	LD A,(HL)
	LD L,A
	LD H,0
	DUP 5
	ADD HL,HL
	EDUP 
	LD DE,PATTERNS
	ADD HL,DE
	LD A,(NOTE)
	LD C,A
	LD B,A
	SRL A
	LD E,A
	LD D,0
	ADD HL,DE
	LD A,(HL)
	RR C
	JR C,$+6
	DUP 4
	RLCA 
	EDUP 
	AND #0F
	JR Z,NXU
	DEC A
	ADD A,A
	ADD A,low STABLE
	LD L,A
	LD A,high STABLE
	ADC A,0
	LD H,A
	LD E,(HL)
	INC HL
	LD D,(HL)
	LD (SAMP),DE
NXU
	LD A,B
	INC A
	CP 64
	JR NZ,DDD4
	LD HL,POSITION
	INC (HL)
	XOR A
DDD4
	LD (NOTE),A
DDD2
	LD HL,(SAMP)
	LD A,(HL)
	INC A
	JR Z,POL
	DEC A
	LD E,2
	CALL RESS
	LD A,(HL)
	INC E
	CALL RESS
	LD A,(HL)
	LD E,6
	CALL RESS
	LD A,(HL)
	BIT 7,A
	LD C,0
	JR Z,$+4
	LD C,16
	BIT 6,A
	LD A,C
	JR Z,$+4
	OR 2
	OR 40
	INC E
	CALL RESS
	DEC HL
	INC E
	INC E
	LD A,(HL)
	AND #1F
	CALL RESS
	LD (SAMP),HL
POL     POP BC
	POP DE
	POP HL
	POP AF
	EI 
	RET 

NACT
	LD E,0
NC1     LD A,(HL)
	CALL RESS
	INC E
	LD A,E
	CP 14
	JR NZ,NC1
	RET 
RESS
	LD BC,#FFFD
	OUT (C),E
	LD B,#BF
	OUT (C),A
	INC HL
	RET 

TXTSWR
	LD HL,TXTSWSEG*256
	LD (HL),#F9
	INC HL
	LD C,#80
TU2
	LD A,#80
TU1     LD (HL),#E1
	INC HL
	LD (HL),#22
	INC HL
	LD (HL),A
	INC HL
	LD (HL),C
	INC HL
	ADD A,2
	CP #88
	JR NZ,TU1
	INC C
	LD A,C
	CP #88
	JR NZ,TU2
	LD (HL),#C3
	INC HL
	LD (HL),low CONT
	INC HL
	LD (HL),high CONT
	RET 
TXTREA
	LD IX,BUF1
	LD HL,TXTU
	CALL TZ0
TZ0     LD (TZ2+1),HL
	LD LY,8
TZ2
	LD DE,0
	LD B,8
TZ1
	LD A,(DE)
	AND #F0
	LD C,A
	LD A,(HL)
	AND #0F
	OR C
	LD (IX),A
	INC IX
	INC DE
	DJNZ TZ1
	INC HL
	DEC LY
	JR NZ,TZ2
	RET 
SINDEC
	LD HL,SINN
	LD DE,SINSEG*256
	LD BC,64
	LDIR 
	LD H,D
	LD L,E
SN1     DEC E
	LD A,(DE)
	LD (HL),A
	INC L
	LD A,L
	CP 128
	JR C,SN1
	LD E,C
SN2     LD A,(DE)
	NEG 
	LD (HL),A
	INC E
	INC L
	JR NZ,SN2
	RET 
LINESIN
	CALL BLURIN
	LD HL,#A000
	PUSH HL
	LD (HL),#80
	CALL CLEAR
	POP DE
	LD IX,TXT1
	LD L,#87
	INC B
PRINT
	LD (SCK+1),BC
	LD A,L
	LD (TI3-1),A
PRIN2
	LD A,(IX)
	INC IX
	AND A
	RET Z
	PUSH DE
	LD L,A
	SET 7,L
	LD H,7
	ADD HL,HL
	ADD HL,HL
	ADD HL,HL
	LD LY,32
TI2
	PUSH DE
	LD B,8
	LD C,(HL)
	LD A,C
	RRCA 
	OR C
	LD C,A
TI1     RL C
TI6     LD A,#00
	JR NC,TI3+1
	LD A,#3F
TI3     LD (DE),A
	INC DE
	DJNZ TI1
	LD A,LY
	AND 3
	JR NZ,OOWW
	INC L
OOWW    POP DE
	EX DE,HL
SCK     LD BC,#0101
	ADD HL,BC
	EX DE,HL

	DEC LY
	JR NZ,TI2
	POP DE
	DUP 9
	INC DE
	EDUP 
	JR PRIN2
VECTORS
	DB -20,10,1,-20
	DB 1,-20,20,10
	DB 30,10,60,10
	DB 60,10,60,-20
	DB 60,-20,30,-20
	DB 30,-20,30,10
	DB 70,10,100,10
	DB 85,10,85,-20
	DB 110,10,135,10
	DB 110,0,130,0
	DB 110,-20,135,-20
	DB 110,10,110,-20
	DB 145,-20,145,-20
	DB 145,10,145,-15
	DB 0

SAMP    DW #C9C9
NACH    DB 190,3,0,0,124,7,0,40,31,0,31,120,0,8
STOPP   DB 0,0,0,0,0,0,0,#FF,0,0,0
POSITION        DB 0
NOTE            DB 0
POSIT

	DUP 2
	DB 0,1,1,1,1,2,3,1,1,1,1
	EDUP 
	DB 0,1,1,1,1,2,3,1,1,1,2

STABLE  DW S4L,S5L,S6L,SBL
	INCLUDE "SAMPLES.asm"

TFT1    DB "GREETZ",0
TFT15   DB "TO",0
TFT2    DB "PSYCHO",0
TFT3    DB "AMD",0
TFT4    DB "ACL",0
TFT5    DB "OB",0
TFT6    DB "RUSH",0
TFT7    DB "AND YOU",0

TXT3    DB "FENOMEN",0
	DB "PRESENT",0
	DB "4kINTRO",0
	DB " NAMED",0,0
TXT2    DB " FROST",0
TXT6    DB "  FOR",0,0
TXT4    DB "NEM0NEF",#80
TEXT    DW TXT5
TXT5
	DB "FOR.US   "
TXT1    DB "    MILLENNIUM    "
TXT7    DB " C0DEX:",0
	DB "MadRain",0,0
TXTEND  DB "THE END",0,0
BUF1
LESS    EQU BUF1+90+90
LEN     EQU $-STARTF
TXTE1   EQU LESS+#400
	
	;save snapshot of intro
	SAVESNA "frost10.sna",STARTF