		org	#8000
		
		CALL	INIT
		
scrl		
		call	KEY_TEST
		call	UPDATE
		call	COPY_SCREEN
		
		call	MOV_LEFT
		call	MOV_RIGHT
		call	DRAW
		call	SWAP_SCREEN

		jr scrl

;---------------------------------
cur_x		equ	15
cur_y		defb	144
old_y		defb	144	
VEL_UP		defw	#0800	
VEL_DN		defb	#08		
l_WALL		defb	0
r_WALL		defb	0
WORK_TABLE	defw	0

pers_faze	defb	0
pers_sprite	defw	pers
l_shifted	defw	0		;   
r_shifted	equ	l_shifted+1	;   
fly		defb	0		;  /

;---------------------------------
INIT
	call	flip_spr

	ld	a,%00010111
	call	SET_PAGE_MODE_A

	ld	hl,LEFT_TABLE
	ld	(WORK_TABLE),hl

	call	INIT_TABLE

	ld 	b,0			;  x
	xor	a
	or	b
	jr	z,no_shift
shift	push	bc
	call	R_ON_TABLE
	pop	bc
	djnz	shift

no_shift
	ld	hl,LEFT_TABLE
	ld	de,RIGHT_TABLE
	ld	bc,table_size
	ldir

	ld	hl,RIGHT_TABLE
	ld	(WORK_TABLE),hl


	ld 	b,31
fill_s	push	bc
	ld	a,31
	sub	b
	
	call	PRINT_COLUMN
	call	R_ON_TABLE

	pop	bc
	djnz	fill_s

	ld	a,31
	call	PRINT_COLUMN

	call	SWAP_SCREEN
	call	COPY_SCREEN
	ret

;----------------------------------
flip_spr
	di
	ld	(fs_sp+1),sp
	ld	sp,pers
	ld	hl,pers+128

	ld	b,64
fs1	pop	de

	ld	a,d
	rra
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e
	rr	d
	rl	e

	ld	(hl),e
	inc	hl
	ld	(hl),d
	inc	hl

	djnz	fs1


fs_sp	ld	sp,0
	ei



;----------------------------------
MOV_RIGHT
	ld	a,(r_wall)		;  ,  
	or	a
	ret	nz

	ld	a,(L_PRESSED)		;      ,  
	or	a
	ret	nz

	ld	a,(R_PRESSED)		;   ,  
	or	a
	ret	z

	ld	hl,pers
	ld	(pers_sprite),hl

	call	scroll_mini_left

	ld	hl,LEFT_TABLE
	ld	(WORK_TABLE),hl
	call	R_ON_TABLE
	ld	hl,RIGHT_TABLE
	ld	(WORK_TABLE),hl
	call	R_ON_TABLE


	ld	a,31
	call	PRINT_COLUMN
	ret

;----------------------------------
MOV_LEFT
	ld	a,(l_wall)		;  ,  
	or	a
	ret	nz

	ld	a,(R_PRESSED)		;      ,  
	or	a
	ret	nz

	ld	a,(L_PRESSED)		;   ,  
	or	a
	ret	z

	ld	hl,pers+128
	ld	(pers_sprite),hl

	call	scroll_mini_right

	ld	hl,RIGHT_TABLE
	ld	(WORK_TABLE),hl
	call	L_ON_TABLE
	ld	hl,LEFT_TABLE
	ld	(WORK_TABLE),hl
	call	L_ON_TABLE

	xor	a
	call	PRINT_COLUMN

	

	ret

;----------------------------------	
INIT_TABLE
	ld	ix,(WORK_TABLE)

	ld	b,0
IT1	push	bc

	ld	de,LEVEL
	call	ADDR_AFTER255
	ld	(ix+LINE_PTR),e
	ld	(ix+LINE_PTR+1),d
	ld	(ix+LINE_START),e
	ld	(ix+LINE_START+1),d

	ex	de,hl
	ld	b,(hl)
	inc	hl
	ld	a,(hl)
	ld	(ix+RIBBON_CNT),a
	ld	(ix+RIBBON_MAX),a
	ld	de,RIBBONS
	call	ADDR_AFTER255
	

	ld	(ix+RIBBON_PTR),e
	ld	(ix+RIBBON_PTR+1),d
	ld	(ix+RIBBON_START),e
	ld	(ix+RIBBON_START+1),d

	ld	de,table_step
	add	ix,de
	pop	bc
	inc	b	
	ld	a,24
	cp	b	
	jr	nz,IT1

	ret

;----------------------------------
ADDR_AFTER255
	xor	a	
	cp	b	
	ret	z	
AA1	ld	a,(de)	
	inc	de	
	cp	255
	jr	nz,AA1
	djnz	AA1
	ret

;-------------------------------
PRINT_COLUMN
	ld	(attr_a+1),a
	ld	(prnt_a+1),a

	ld	e,a
	ld	d,0

	and	7
	xor	7
	rlca
	rlca
	rlca
	add	a,#86		;+RES 0,(HL)
	ld	(resbit+1),a	;RES bit,(HL)
	add	a,#40		;RES -> set
	ld	(setbit+1),a	;set bit,(HL)


	ld	a,e
	rrca
	rrca
	rrca
	and	3
	ld	e,a
	ld	hl,MINI_SCR;+3
	add	hl,de
	ld	(MS_ADDR+1),hl

AT_BIT	ld	a,%11011000
	ld	(attr_a+2),a

	ld	ix,(WORK_TABLE)

	ld	a,0
PRR0	push	af
	push	af	

	ld	l,(ix+ribbon_ptr)
	ld	h,(ix+ribbon_ptr+1)
	ld	a,(hl)			; 
	inc	hl	
	ld	b,(hl)			; 


MS_ADDR	ld	hl,0;(MINI_SCR_ADDR)
resbit	res	0,(hl)
	bit	7,b
	jr	z,PRR1
setbit	set	0,(hl)
PRR1	inc	hl	
	inc	hl	
	inc	hl	
	inc	hl	
	ld	(MS_ADDR+1),hl

	res	7,b
attr_a	ld	hl,#0000
	ld	(hl),b
	ld	de,32
	add	hl,de
	ld	(attr_a+1),hl	


	ld	l,a	
	ld	h,0
	add	hl,hl	
	add	hl,hl	
	add	hl,hl	
	ld	de,SPRITES
	add	hl,de

	pop	bc		;<-af
	ld	a,b
	and	%00011000	;7
PR_BIT	or	%11000000	;7
	ld	d,a		;4
	ld	a,b		;4
	rrca			;4
	rrca			;4
	rrca			;4
	and	%11100000	;7
prnt_a	or	0
	ld	e,a		;4

	ld	b,8
PRR2	ld	a,(hl)	
	ld	(de),a	
	inc	hl	
	inc	d	
	djnz	PRR2

	ld	de,table_step
	add	ix,de

	pop	af
	inc	a
	cp	24
	jr	nz,PRR0

	ret

;------------------------------
R_ON_TABLE
	ld	ix,(WORK_TABLE)

	ld	b,24
NR1	push	bc

	ld	l,(ix+ribbon_ptr)
	ld	h,(ix+ribbon_ptr+1)
	inc	hl
	inc	hl
	ld	a,(hl)	
	cp	255
	jr	nz,NR3
	dec	(ix+ribbon_cnt)
	jr	nz,NR2
	call	R_LINE_PTR
	jr	NR4
NR2	ld	l,(ix+ribbon_start)
	ld	h,(ix+ribbon_start+1)
NR3	ld	(ix+ribbon_ptr),l
	ld	(ix+ribbon_ptr+1),h


NR4	ld	de,table_step
	add	ix,de
	pop	bc
	djnz	NR1

	

	ret	

;------------------------------
L_ON_TABLE
	ld	ix,(WORK_TABLE)

	ld	b,24
pR1	push	bc


	ld	l,(ix+ribbon_ptr)
	ld	h,(ix+ribbon_ptr+1)
	dec	hl
	ld	a,(hl)
	dec	hl
	
	cp	255 
	jr	nz,pR3
	
	inc	(ix+ribbon_cnt)		;6
	ld	a,(ix+ribbon_max)	;5
	inc	a
	cp	(ix+ribbon_cnt)
	jr	nz,pR2			;max >= cnt

	call	L_LINE_PTR

	jr	pR4

pR2	
	ld	l,(ix+ribbon_start)	; ribbon end
	ld	h,(ix+ribbon_start+1)
pr5	ld	a,(hl)
	cp	255
	jr	z,pr6
	inc	hl
	jr	pr5
pr6	dec	hl
	dec	hl

pR3	ld	(ix+ribbon_ptr),l
	ld	(ix+ribbon_ptr+1),h


pR4	ld	de,table_step
	add	ix,de
	pop	bc
	djnz	pR1

	

	ret	
	
	
;------------------------------
R_LINE_PTR
	ld	l,(ix+LINE_PTR)
	ld	h,(ix+LINE_PTR+1)
	inc	hl
	inc	hl
	ld	a,(hl)
	cp	255
	jr	nz,NLP1
	ld	l,(ix+LINE_START)
	ld	h,(ix+LINE_START+1)

NLP1	ld	(ix+LINE_PTR),l
	ld	(ix+LINE_PTR+1),h

	ld	b,(hl)	
	ld	de,RIBBONS
	call	ADDR_AFTER255
	ld	(ix+RIBBON_PTR),e
	ld	(ix+RIBBON_PTR+1),d
	ld	(ix+RIBBON_START),e
	ld 	(ix+RIBBON_START+1),d
	inc	hl	
	ld	a,(hl)	
	ld	(ix+RIBBON_CNT),a
	ld	(ix+RIBBON_MAX),a
	ret	
	

;------------------------------
L_LINE_PTR
	
	ld	l,(ix+LINE_PTR)
	ld	h,(ix+LINE_PTR+1)

	dec	hl
	ld	a,(hl)
	dec	hl

	cp	255
	jr	nz,pLP1


	ld	l,(ix+LINE_START)
	ld	h,(ix+LINE_START+1)

plp5	ld	a,(hl)
	cp	255
	jr	z,plp6
	inc	hl
	jr	plp5
plp6	dec	hl
	dec	hl

pLP1	ld	(ix+LINE_PTR),l
	ld	(ix+LINE_PTR+1),h

	ld	b,(hl)	
	inc	b

	ld	de,RIBBONS
	call	ADDR_AFTER255
	dec	de
	dec	de
	dec	de
	ld	(ix+RIBBON_PTR),e
	ld	(ix+RIBBON_PTR+1),d
llp4	dec	de
	ld	a,(de)
	cp	255
	jr	nz,llp4
	inc	de
	
	ld	(ix+RIBBON_START),e
	ld 	(ix+RIBBON_START+1),d
	

	inc	hl	
	ld	a,(hl)	
	ld	(ix+RIBBON_MAX),a
	ld	(ix+RIBBON_CNT),1

	ret	

	
;----------------------------
UPDATE
	ld	a,1
	ld	(fly),a
	
	ld	hl,(VEL_UP)
	ld	a,h	
	or	l	
	jr	z,upd1
	ld	de,#80
	and	a	
	sbc	hl,de
	ld	(VEL_UP),hl
upd1	ld	a,(VEL_UP+1)
	ld	b,a	
	ld	a,(VEL_DN)
	ld	d,a	
	ld	a,(cur_y)
	ld	(old_y),a
	add	a,d	
	sub	b	
	ld	(cur_y),a
	call	COLLISION
	ret
;---------------------------------
	
COLLISION
	srl	a
	srl	a
	srl	a
	ld	b,a	
	ld	de,4
	ld	hl,MINI_SCR+1
cl_1	and	a	
	jr	z,cl_2
	add	hl,de	
	dec	a	
	jr	cl_1
cl_2	ld	(r_WALL),a
	ld	(l_WALL),a


	ld	a,23
	cp	b	
	jr	c,cl_ln2

	ld	a,(hl)	
	and	%00000001
	ld	c,a
	inc	hl
	ld	a,(hl)
	dec	hl	
	and	%10000000
	or	c
	jr	z,cl_ln1
	;  
	ld	a,(cur_y)
	and	%11111000
	add	a,8
	ld	(cur_y),a
	ld	de,0
	ld	(VEL_UP),de
	ld	de,4

cl_ln1
	;1  
	bit	1,(hl)
	jr	z,no_lw1
	ld	a,1
	ld	(l_WALL),a
no_lw1	inc	hl
	bit	6,(hl)
	jr	z,no_rw1
	ld	a,1
	ld	(r_WALL),a
no_rw1	dec	hl


cl_ln2	;2  
	inc	b	
	add	hl,de	
	ld	a,23
	cp	b	
	jr	c,cl_ln3

	bit	1,(hl)
	jr	z,no_lw2
	ld	a,1
	ld	(l_WALL),a
no_lw2	inc	hl
	bit	6,(hl)
	jr	z,no_rw2
	ld	a,1
	ld	(r_WALL),a
no_rw2	dec	hl


cl_ln3	;3  
	inc	b	
	add	hl,de	
	ld	a,23
	cp	b	
	jr	c,cl_ln4

	bit	1,(hl)
	jr	z,no_lw3
	ld	a,1
	ld	(l_WALL),a
no_lw3	inc	hl
	bit	6,(hl)
	jr	z,no_rw3
	ld	a,1
	ld	(r_WALL),a
no_rw3	dec	hl


cl_ln4	;4  
	inc	b	
	add	hl,de	
	ld	a,23
	cp	b	
	jr	c,cl_flr

	bit	1,(hl)
	jr	z,no_lw4
	ld	a,1
	ld	(l_WALL),a
no_lw4	inc	hl
	bit	6,(hl)
	jr	z,no_rw4
	ld	a,1
	ld	(r_WALL),a
no_rw4	dec	hl


cl_flr	; 
	inc	b	
	add	hl,de	
	ld	a,23
	cp	b	
	jr	c,cl_end

	ld	a,(hl)	
	and	%00000001
	ld	c,a
	inc	hl
	ld	a,(hl)
	dec	hl	
	and	%10000000
	or	c
	jr	z,cl_end	; 

	xor	a
	ld	(fly),a

	ld	a,(cur_y)
	and	%11111000
	ld	(cur_y),a
	ld	de,#0800
	ld	a,(U_PRESSED)
	and	a	
	jr	z,cl_e
	ld	de,#1080
cl_e
	ld	(VEL_UP),de
cl_end
	ret

;--------------------------------	
SHL_BUFFER
	ld	hl,#c001
	ld	de,#c000
	ld	bc,6912
	ldir
	ret

;--------------------------------	
COPY_SCREEN
	xor	a
	ld	(r_shifted),a
	ld	(l_shifted),a

	di

S_SRC	ld	hl,#4000
	ld	a,(r_pressed)
	and	a	
	jr	z,no_shl

	ld	a,(r_wall)
	and	a	
	jr	nz,no_shl
	
	ld	a,1
	ld	(r_shifted),a

	inc	hl	
no_shl	ld	(S_SRC1+1),hl

S_DST	ld	hl,#c000
	ld	a,(l_pressed)
	and	a	
	jr	z,no_shr

	ld	a,(l_wall)
	and	a	
	jr	nz,no_shr

	ld	a,1
	ld	(l_shifted),a

	inc	hl	
no_shr	ld	de,16
	add	hl,de	
	ld	(S_DST1+1),hl

	ld	(SAVE_SP+1),sp

	ld	b,216
S_SRC1	ld	sp,0
	pop	hl	
	pop	de	
	pop	af	
	pop	ix
	pop	iy
	exx	
	pop	hl	
	pop	de	
	pop	bc	
	ld	(S_SRC2+1),sp
	
S_DST1	ld	sp,0
	push	bc	
	push	de	
	push	hl	
	exx	
	push	iy
	push	ix
	push	af	
	push	de	
	push	hl	
	ld	hl,32
	add	hl,sp	
	ld	(S_DST2+1),hl
	
S_SRC2	ld	sp,0
	pop	hl	
	pop	de	
	pop	af	
	pop	ix
	pop	iy
	exx	
	pop	hl	
	pop	de	
	pop	bc	
	ld	(S_SRC1+1),sp
	
S_DST2	ld	sp,0
	push	bc	
	push	de	
	push	hl	
	exx	
	push	iy
	push	ix
	push	af	
	push	de	
	push	hl	
	
	ld	hl,32
	add	hl,sp	
	ld	(S_DST1+1),hl
	djnz	S_SRC1
	
SAVE_SP	ld	sp,0

	ei
	ret
;----------------------------	
SCR_ADDR
	; 0-  	
	ld	a,b
	and	%00011000
	or	%01000000	;+16384
	ld	h,a
	ld	a,b
	rrca
	rrca
	rrca
	ld	d,a		;  
	and	%11100000	;+31
	ld	l,a

	;   
	ld	e,l		;  
	ld	a,d
	and	%00000011
	or	%01011000	;+22528
	ld	d,a

	ret
	
;-----------------------------
SWAP_SCREEN
	di
	ld a,(#5B5C)
	xor 8
	ld (#5B5C),a
	ld bc,#7FFD
	out (c),a
	ei
	
	ld	a,(S_SRC+2)
	xor	%10000000
	ld	(S_SRC+2),a

	ld	a,(S_DST+2)
	xor	%10000000
	ld	(S_DST+2),a
	
	ld	a,(PR_BIT+1)
	xor	%10000000
	ld	(PR_BIT+1),a

	ld	a,(AT_BIT+1)
	xor	%10000000
	ld	(AT_BIT+1),a
	
	ld	a,(AP_BIT+1)
	xor	%10000000
	ld	(AP_BIT+1),a
	ret	

;--------------------------
SET_PAGE_MODE_A
	DI
	LD	(#5B5C),A
	LD	BC,#7FFD
	OUT	(C),A
	EI
	RET

;---------------------------------
DOWN
	inc h	
	ld a,h	
	and 7
	ret nz	
	ld a,l	
	add a,32
	ld l,a	
	ret c	
	ld a,h	
	sub 8
	ld h,a	
	ret	
	
;------------------------------
ADR_PIX
	ld a,e	
	and a	
	rra	
	scf	
	rra	
	and a	
	rra	
	xor e	
	and %11111000
	xor e	
AP_BIT	or %11000000
	ld h,a	
	ld a,d	
	rrca	
	rrca	
	xor e	
	and %11000111
	xor e	
	rlca	
	rlca	
	ld l,a	
	ret	
	
;-------------------------
DRAW
	ld	hl,(l_shifted)	
	ld	a,cur_x
	add	a,l		;     
	sub	h		;     
	
	ld	d,a	
	ld	a,(old_y)
	ld	e,a

	
	ld	hl,FON_BUFFER
	call	DRAW_SOURCE


	ld	a,(cur_y)
	ld	e,a	
	ld	d,cur_x
	push	de
	call	ADR_PIX
	call	COPY_FON

	ld	hl,(pers_sprite)
	ld	a,(l_pressed)
	ld	b,a
	ld	a,(r_pressed)
	or	b
	jr	z,no_faze
	

	ld	a,(fly)
	and	a
	jr	nz,no_faze

	ld	a,(pers_faze)
	xor	64
	ld	(pers_faze),a
	ld	d,0
	ld	e,a
	add	hl,de
no_faze	pop	de
	
	call	DRAW_SOURCE
	ret


;----------------------	
DRAW_SOURCE
	ld b,32
	ld a,e	
	cp 192
	jr c,l8339h
l8332h
	inc hl	
	inc hl	
	dec b	
	ret z	
	inc e	
	jr nz,l8332h
l8339h
	push hl	
	call ADR_PIX
	pop de	
l833eh
	ld a,(de)	
	ld (hl),a	
	inc hl	
	inc de	
	ld a,(de)	
	ld (hl),a	
	dec hl	
	inc de	
	call DOWN
	djnz l833eh
	ret

;----------------------------	
COPY_FON
	push hl	
	ld de,FON_BUFFER
	ld b,32
l8352h
	ld a,(hl)	
	ld (de),a	
	inc hl	
	inc de	
	ld a,(hl)	
	ld (de),a	
	dec hl	
	inc de	
	call DOWN
	djnz l8352h
	pop hl	
	ret	
	
;-----------------------------	
DRAW_MINI
	ld de,0
	call ADR_PIX
	ld de,MINI_SCR
	ld b,24
l836ch
	push hl	
	ld a,(de)	
	ld (hl),a	
	inc de	
	inc hl	
	ld a,(de)	
	ld (hl),a	
	inc de	
	inc hl	
	ld a,(de)	
	ld (hl),a	
	inc de	
	inc hl	
	ld a,(de)	
	ld (hl),a	
	inc de	
	pop hl	
	call DOWN
	djnz l836ch
	ret

;------------------------------------	
SCROLL_MINI_LEFT
	ld hl,MINI_SCR+95
	ld b,96
SML	rl (hl)
	dec hl	
	djnz SML
	ret

;------------------------------------	
SCROLL_MINI_RIGHT
	ld hl,MINI_SCR
	ld b,96
SMR	rr (hl)
	inc hl	
	djnz SMR
	ret
;-------------------------------------	
KEY_TEST
	xor a	
	ld (U_PRESSED),a
	ld (D_PRESSED),a
	ld (L_PRESSED),a
	ld (R_PRESSED),a
	ld (F_PRESSED),a

	ld a,(F_PORT)
	in a,(254)
	bit 0,a
	jr nz,K_T1
	ld a,1
	ld (F_PRESSED),a
K_T1
	ld a,(L_PORT)
	in a,(254)
	bit 0,a
	jr nz,K_T2
	ld a,1
	ld (L_PRESSED),a
K_T2
	ld a,(D_PORT)
	in a,(254)
	bit 1,a
	jr nz,K_T3
	ld a,1
	ld (D_PRESSED),a
K_T3
	ld a,(R_PORT)
	in a,(254)
	bit 2,a
	jr nz,K_T4
	ld a,1
	ld (R_PRESSED),a
K_T4
	ld a,(U_PORT)
	in a,(254)
	bit 1,a
	ret nz	
	ld a,1
	ld (U_PRESSED),a

	ret
	
U_PRESSED	DEFB	0
D_PRESSED	DEFB	0	
L_PRESSED	DEFB	0	
R_PRESSED	DEFB	0	
F_PRESSED	DEFB	0	
U_PORT		DEFB	#FB	;    
D_PORT		DEFB	#FD	;  
L_PORT		DEFB	#FD
R_PORT		DEFB	#FD
F_PORT		DEFB	#BF
;-----------------------------------





LINE_PTR	equ	0	;2
LINE_START	equ	2	;2
RIBBON_PTR	equ	4	;2
RIBBON_START	equ	6	;2
ribbon_cnt	equ	8	;1
ribbon_max	equ	9	;1

table_step	equ	10
table_size	equ	240
RIGHT_TABLE	DEFS	table_size,0
LEFT_TABLE	DEFS	table_size,0

	
MINI_SCR	defs	96,0

	DEFB	255
LEVEL	DEFB	11,19,8,1,11,17,8,2,11,29,8,1,11,16,8,2,11,29,8,1,11,16,8,2,11,29,8,1,11,7,8,3,11,6,8,2,11,25,255
	DEFB	11,18,9,1,12,1,10,1,11,15,9,1,12,2,10,1,11,27,9,1,12,1,10,1,11,14,9,1,12,2,10,1,11,27,9,1,12,1,10,1,11,14,9,1,12,2,10,1,11,27,9,1,12,1,10,1,11,5,9,1,12,3,10,1,11,4,9,1,12,2,10,1,11,24,255
	DEFB	11,9,8,1,11,8,13,1,15,1,14,1,11,7,8,3,11,5,13,1,15,2,14,1,11,17,8,1,11,9,13,1,15,1,14,1,11,6,8,3,11,5,13,1,15,2,14,1,11,17,8,1,11,9,13,1,15,1,14,1,11,6,8,3,11,5,13,1,15,2,14,1,11,17,8,1,11,9,13,1,15,1,14,1,11,5,13,1,15,3,14,1,11,4,13,1,15,2,14,1,11,13,29,1,31,1,11,9,255
	DEFB	11,8,9,1,12,1,10,1,11,16,9,1,12,3,10,1,11,24,9,1,12,1,10,1,11,16,9,1,12,3,10,1,11,24,9,1,12,1,10,1,11,16,9,1,12,3,10,1,11,24,9,1,12,1,10,1,11,43,30,1,11,9,255
	DEFB	11,8,13,1,15,1,14,1,11,16,13,1,15,3,14,1,11,24,13,1,15,1,14,1,11,16,13,1,15,3,14,1,11,24,13,1,15,1,14,1,11,16,13,1,15,3,14,1,11,24,13,1,15,1,14,1,11,43,32,1,11,9,255
	DEFB	11,198,32,1,11,9,255
	DEFB	11,22,3,1,11,57,2,8,11,3,2,3,3,1,11,14,3,1,11,11,2,3,11,4,2,1,3,2,2,1,11,56,27,2,11,8,32,1,11,9,255
	DEFB	11,22,4,1,11,57,2,8,11,3,2,3,4,1,11,14,4,1,11,11,2,3,11,4,2,1,4,2,2,1,11,56,28,2,11,8,32,1,11,9,255
	DEFB	11,187,27,3,11,8,32,1,11,9,255
	DEFB	11,187,28,3,11,8,32,1,11,9,255
	DEFB	11,186,27,4,11,8,32,1,11,9,255
	DEFB	11,186,28,4,11,8,32,1,11,9,255
	DEFB	11,185,27,5,11,8,32,1,11,4,36,3,11,2,255
	DEFB	11,185,28,5,11,8,32,1,11,4,2,3,11,2,255
	DEFB	11,16,3,1,11,3,2,1,3,1,2,1,3,1,2,1,11,21,5,1,11,9,5,1,11,18,2,1,3,1,2,1,11,14,2,1,11,5,2,2,11,4,3,1,11,2,3,1,11,2,3,1,11,5,2,1,11,10,2,2,11,6,27,1,11,2,27,1,11,10,27,2,11,2,27,1,11,12,2,2,3,1,2,1,11,12,27,6,11,8,32,1,11,4,33,1,2,1,34,1,11,2,255
	DEFB	11,16,4,1,11,3,2,1,4,1,2,1,4,1,2,1,11,21,6,1,11,9,6,1,11,18,2,1,4,1,2,1,11,14,2,1,11,5,2,2,11,4,4,1,11,2,4,1,11,2,4,1,11,5,2,1,11,10,2,2,11,6,28,1,11,2,28,1,11,10,28,2,11,2,28,1,11,12,2,2,4,1,2,1,11,12,28,6,11,8,32,1,11,4,33,1,2,1,34,1,11,2,255
	DEFB	11,38,5,1,11,6,7,1,11,9,7,1,11,77,27,2,11,2,27,2,11,8,27,3,11,2,27,2,11,26,27,7,11,8,32,1,11,3,36,1,2,3,36,1,11,1,255
	DEFB	11,2,20,1,11,35,6,1,11,6,7,1,11,2,20,1,11,6,7,1,11,39,20,1,11,37,28,2,11,2,28,2,11,4,20,1,11,3,28,3,11,2,28,2,11,26,28,7,11,4,20,1,11,3,32,1,11,3,2,5,11,1,255
	DEFB	11,1,21,1,26,1,23,1,11,24,5,1,11,8,7,1,11,6,7,1,11,1,21,1,26,1,23,1,11,5,7,1,11,38,21,1,26,1,23,1,11,35,27,3,11,2,27,3,11,2,21,1,26,1,23,1,11,1,27,4,11,2,27,3,11,5,5,1,11,14,5,1,11,1,27,8,11,3,21,1,26,1,23,1,11,2,32,1,11,3,2,2,35,1,2,2,11,1,255
	DEFB	11,1,22,1,18,1,24,1,11,13,20,1,11,10,6,1,11,8,7,1,11,6,7,1,11,1,22,1,18,1,24,1,11,5,7,1,11,6,20,1,11,31,22,1,18,1,24,1,11,13,20,1,11,21,28,3,11,2,28,3,11,2,22,1,18,1,24,1,11,1,28,4,11,2,28,3,11,3,20,1,11,1,6,1,11,14,6,1,11,1,28,8,11,3,22,1,18,1,24,1,11,2,32,1,11,3,2,2,35,1,2,2,11,1,255
	DEFB	21,1,26,1,18,1,25,1,23,1,11,7,16,3,11,1,21,1,26,1,23,1,11,5,16,1,11,3,7,1,11,8,7,1,11,2,16,1,11,3,7,1,21,1,26,1,18,1,25,1,23,1,11,4,7,1,11,1,16,3,11,1,21,1,26,1,23,1,11,5,16,1,11,17,16,1,11,5,21,1,26,1,18,1,25,1,23,1,11,7,16,3,11,1,21,1,26,1,23,1,11,5,16,1,11,13,27,4,16,2,27,4,21,1,26,1,18,1,25,1,27,5,11,2,27,4,11,1,21,1,26,1,23,1,7,1,11,3,16,1,11,10,7,1,27,9,11,2,21,1,26,1,18,1,25,1,23,1,11,1,27,1,11,3,2,2,35,1,2,2,11,1,255
	DEFB	22,1,18,3,24,1,11,6,17,1,18,3,19,1,22,1,18,1,24,1,11,4,17,1,18,1,19,1,11,2,7,1,11,8,7,1,11,1,17,1,18,1,19,1,11,2,7,1,22,1,18,3,24,1,11,4,7,1,17,1,18,3,19,1,22,1,18,1,24,1,11,4,17,1,18,1,19,1,11,15,17,1,18,1,19,1,11,4,22,1,18,3,24,1,11,6,17,1,18,3,19,1,22,1,18,1,24,1,11,4,17,1,18,1,19,1,11,12,28,4,18,2,28,4,22,1,18,3,28,5,11,2,28,4,19,1,22,1,18,1,24,1,7,1,11,2,17,1,18,1,19,1,11,9,7,1,28,9,11,2,22,1,18,3,24,1,11,1,28,1,11,3,2,2,35,1,2,2,19,1,255
	DEFB	0,69,11,2,0,15,11,3,0,64,11,2,0,53,255
	DEFB	1,69,11,2,1,15,11,3,1,64,11,2,1,53,255

	DEFB	255
RIBBONS	DEFB	0,144,1,144,255
	DEFB	16,144,17,144,255
	DEFB	30,144,30,144,255
	DEFB	9,176,10,176,255
	DEFB	25,176,26,176,255
	DEFB	6,166,7,166,0,166,8,166,255
	DEFB	22,166,23,166,0,166,24,166,255
	DEFB	27,174,28,166,0,166,29,174,255
	DEFB	2,47,3,47,255
	DEFB	0,40,4,47,255
	DEFB	5,47,0,40,255
	DEFB	0,40,0,40,255	;11
	DEFB	0,63,0,63,255
	DEFB	0,40,18,47,255
	DEFB	21,47,0,40,255
	DEFB	19,47,20,47,255
	DEFB	2,44,3,44,255
	DEFB	0,40,4,44,255
	DEFB	0,32,0,32,255	;18
	DEFB	5,44,0,40,255
	DEFB	11,44,12,44,255
	DEFB	0,40,13,44,255	;21
	DEFB	13,44,0,32,255	;22
	DEFB	14,44,0,40,255
	DEFB	0,32,14,44,255
	DEFB	15,32,0,32,255
	DEFB	0,32,15,32,255	;26
	DEFB	31,232,32,232,255
	DEFB	33,232,34,232,255
	DEFB	0,40,14,61,255
	DEFB	14,61,0,40,255
	DEFB	37,60,0,40,255
	DEFB	38,42,0,40,255
	DEFB	30,16,0,0,255
	DEFB	0,0,30,16,255
	DEFB	0,0,0,0,255
	DEFB	35,42,36,42,255



SPRITES
	DEFB	0,0,0,0,0,0,0,0
	DEFB	64,65,65,65,81,94,65,65
	DEFB	0,3,7,31,31,31,57,119
	DEFB	0,192,224,224,244,190,222,254
	DEFB	0,7,15,31,31,127,127,63
	DEFB	0,16,176,240,250,254,254,252
	DEFB	0,127,3,115,115,115,115,115
	DEFB	0,255,240,246,246,246,246,246
	DEFB	0,254,0,86,46,86,46,86
	DEFB	85,128,32,135,15,142,14,134
	DEFB	86,1,5,193,225,113,113,241
	DEFB	0,0,0,0,0,7,63,255
	DEFB	0,0,0,0,0,224,252,255
	DEFB	1,3,7,15,31,63,127,255
	DEFB	128,192,224,240,248,252,254,255
	DEFB	2,7,7,7,55,50,48,48
	DEFB	0,0,192,48,15,1,1,126
	DEFB	65,65,129,129,1,1,3,126
	DEFB	27,13,6,7,0,0,0,0
	DEFB	255,191,28,192,243,126,28,0
	DEFB	191,127,61,131,199,255,60,0
	DEFB	248,252,254,254,248,96,0,0
	DEFB	115,115,115,115,115,115,0,0
	DEFB	246,246,246,246,246,246,0,0
	DEFB	46,86,46,86,46,86,0,0
	DEFB	1,129,0,129,1,160,0,255
	DEFB	113,65,193,1,65,197,1,255
	DEFB	31,23,31,23,31,23,31,23
	DEFB	251,251,251,251,251,251,251,251
	DEFB	184,88,184,88,184,88,184,88
	DEFB	255,2,2,2,255,32,32,32
	DEFB	128,64,32,16,13,10,5,10
	DEFB	1,3,7,15,95,175,95,175
	DEFB	5,10,5,10,31,63,127,255
	DEFB	95,175,95,175,247,251,253,254
	DEFB	248,248,248,248,0,216,216,216
	DEFB	29,29,29,29,0,31,31,31
	DEFB	0,124,214,146,186,238,254,56
	DEFB	3,3,3,3,3,3,3,3

PERS
	DEFB 0,0
	DEFB 1,240
	DEFB 2,12
	DEFB 4,2
	DEFB 5,254
	DEFB 9,254
	DEFB 9,230
	DEFB 12,102
	DEFB 30,36
	DEFB 47,36
	DEFB 39,248
	DEFB 67,240
	DEFB 64,32
	DEFB 143,255
	DEFB 159,255
	DEFB 159,251
	DEFB 199,226
	DEFB 97,34
	DEFB 50,60
	DEFB 12,32
	DEFB 10,16
	DEFB 12,16
	DEFB 10,16
	DEFB 12,16
	DEFB 10,136
	DEFB 20,136
	DEFB 25,72
	DEFB 23,72
	DEFB 42,72
	DEFB 50,68
	DEFB 63,126
	DEFB 63,126

	DEFB 1,240
	DEFB 2,12
	DEFB 4,2
	DEFB 5,254
	DEFB 9,254
	DEFB 9,230
	DEFB 12,102
	DEFB 30,36
	DEFB 47,36
	DEFB 39,248
	DEFB 67,240
	DEFB 64,32
	DEFB 143,255
	DEFB 159,255
	DEFB 159,251
	DEFB 199,226
	DEFB 97,34
	DEFB 50,60
	DEFB 14,32
	DEFB 13,32
	DEFB 10,32
	DEFB 12,32
	DEFB 10,32
	DEFB 4,32
	DEFB 6,32
	DEFB 4,32
	DEFB 4,64
	DEFB 4,64
	DEFB 4,64
	DEFB 4,64
	DEFB 7,192
	DEFB 7,224


	defs	128,0

FON_BUFFER	defs	64,0

print_bc
	CALL	11563
	CALL	11747
	LD	A,13
	RST	16
	ret
	page	6
	defb	0
	