	org 512
__START_PROGRAM:
	di
	push ix
	push iy
	exx
	push hl
	exx
	ld hl, 0
	add hl, sp
	ld (__CALL_BACK__), hl
	ei
	jp __LABEL__charmap01end
__LABEL__charmap01:
#line 2
		defb $77,$75,$55,$77,$77,$57,$55,$77
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $AA,$AA,$AA,$AA,$AA,$BE,$82,$C3
		defb $AA,$AB,$A8,$AC,$AC,$A8,$AB,$AA
		defb $AA,$AB,$A8,$AC,$A0,$B0,$80,$C0
		defb $00,$00,$00,$00,$00,$00,$00,$00
		defb $0B,$08,$08,$08,$00,$38,$08,$00
		defb $00,$FB,$FB,$38,$08,$00,$00,$00
		defb $00,$F0,$E8,$A8,$BC,$E8,$BC,$30
		defb $0C,$28,$2C,$38,$0B,$0F,$2F,$38
		defb $00,$23,$EF,$FC,$EC,$33,$2F,$BE
		defb $20,$FC,$EC,$20,$E3,$F8,$2F,$00
		defb $00,$2C,$3C,$20,$00,$00,$00,$00
		defb $0C,$08,$3C,$3C,$3C,$3C,$3B,$08
		defb $30,$3C,$0C,$08,$08,$08,$08,$3C
		defb $00,$3C,$3F,$2B,$38,$2B,$0C,$00
		defb $00,$00,$3C,$3B,$2B,$2C,$0C,$00
		defb $00,$00,$00,$00,$00,$38,$08,$3C
		defb $00,$00,$00,$00,$E8,$20,$00,$00
		defb $00,$00,$00,$00,$00,$38,$38,$00
		defb $0F,$0F,$08,$08,$3C,$3C,$20,$00
		defb $00,$00,$28,$2B,$2F,$2B,$38,$00
		defb $00,$08,$38,$3C,$0C,$3A,$00,$00
		defb $00,$3B,$3F,$03,$0F,$2A,$3A,$00
		defb $3C,$2B,$0B,$08,$0F,$3B,$38,$00
		defb $00,$0C,$3E,$22,$2A,$2B,$0F,$0F
		defb $00,$00,$E8,$E8,$E0,$2C,$08,$EC
		defb $00,$00,$0B,$3C,$38,$3F,$3B,$08
		defb $08,$EB,$0F,$08,$0C,$08,$0C,$00
		defb $2C,$FC,$EC,$EC,$38,$3C,$28,$3C
		defb $00,$2C,$B8,$A8,$EC,$0C,$28,$38
		defb $00,$00,$0C,$3C,$00,$3C,$3C,$00
		defb $00,$00,$3C,$3C,$00,$08,$38,$2C
		defb $00,$0E,$0B,$28,$2C,$38,$08,$0C
		defb $00,$00,$2B,$30,$00,$2A,$00,$00
		defb $00,$20,$2C,$38,$0B,$38,$2C,$20
		defb $28,$2B,$3B,$0F,$38,$00,$08,$08
		defb $00,$2B,$3F,$3B,$3B,$30,$23,$3B
		defb $00,$00,$38,$3B,$32,$2A,$3E,$F0
		defb $00,$00,$2B,$32,$3B,$3A,$3E,$2B
		defb $00,$00,$38,$2C,$20,$3A,$0A,$00
		defb $00,$00,$2B,$2F,$3F,$38,$EC,$00
		defb $00,$3B,$3C,$38,$38,$3C,$3A,$3B
		defb $00,$2B,$2C,$2B,$2B,$20,$20,$20
		defb $00,$3C,$2C,$F0,$F8,$FB,$FC,$28
		defb $00,$0F,$FE,$FB,$EB,$FF,$FF,$0C
		defb $00,$28,$3C,$3C,$3C,$2C,$2B,$00
		defb $00,$02,$0A,$33,$3F,$2B,$38,$00
		defb $30,$3F,$3A,$0B,$08,$3A,$3C,$00
		defb $30,$30,$30,$F0,$F0,$FB,$E8,$00
		defb $00,$20,$2F,$2A,$3A,$3E,$F2,$F0
		defb $02,$3E,$3E,$3A,$3E,$32,$30,$20
		defb $00,$3B,$2F,$23,$3F,$2B,$38,$00
		defb $0B,$3B,$33,$3E,$3B,$3C,$3C,$30
		defb $3C,$28,$FF,$F3,$3F,$2B,$3A,$03
		defb $00,$38,$3F,$3B,$3C,$3B,$3E,$00
		defb $00,$2C,$20,$2C,$08,$08,$2C,$00
		defb $00,$0B,$EB,$3C,$3C,$3C,$3C,$00
		defb $00,$02,$22,$22,$2E,$3A,$0B,$00
		defb $22,$22,$3B,$3B,$0B,$08,$00,$00
		defb $00,$33,$3E,$2E,$3A,$3B,$3C,$00
		defb $EF,$EC,$28,$38,$3B,$2F,$00,$00
		defb $00,$C3,$EF,$2B,$3B,$08,$08,$00
		defb $E8,$2B,$0F,$08,$3C,$2F,$2B,$00
		defb $00,$3B,$3C,$3C,$3C,$3B,$3A,$00
		defb $C0,$E0,$E0,$3C,$08,$0F,$03,$00
		defb $3B,$3B,$03,$03,$03,$3B,$3B,$00
		defb $0C,$0B,$3A,$3E,$23,$00,$00,$00
		defb $00,$00,$00,$00,$00,$00,$EB,$00
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AB,$BF
		defb $AA,$AA,$AA,$AA,$AB,$AB,$AB,$FB
		defb $FA,$FE,$FF,$DF,$D7,$D7,$D7,$D7
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $FF,$FF,$FF,$FF,$FF,$FD,$FD,$F5
		defb $FF,$FF,$FF,$7F,$5D,$5D,$5D,$55
		defb $55,$55,$55,$55,$55,$69,$69,$65
		defb $FF,$FF,$5F,$5F,$5F,$7F,$7F,$7F
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $AA,$AA,$AB,$AB,$AB,$AB,$AB,$AF
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$59,$59,$59
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $55,$A9,$AA,$6A,$6A,$65,$65,$65
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $BF,$F5,$F5,$F5,$FF,$FF,$FF,$BF
		defb $FB,$7F,$7F,$5F,$FF,$FD,$FD,$FD
		defb $DE,$FE,$FA,$EA,$EA,$7A,$7F,$7F
		defb $AA,$AA,$AA,$AA,$AA,$EA,$FA,$FE
		defb $F5,$F5,$D5,$D5,$55,$D5,$D5,$F5
		defb $95,$95,$A5,$A5,$AA,$6A,$6A,$5A
		defb $65,$A5,$A5,$95,$95,$95,$95,$55
		defb $FF,$D7,$57,$57,$57,$55,$55,$55
		defb $AA,$AA,$AA,$AA,$AA,$AA,$FF,$FF
		defb $5F,$7F,$7F,$F5,$F5,$F5,$F5,$F5
		defb $55,$55,$D5,$D5,$FF,$FF,$55,$55
		defb $AA,$AA,$AA,$AA,$FF,$FE,$FA,$FA
		defb $5A,$6A,$6A,$55,$55,$55,$55,$95
		defb $55,$55,$95,$A5,$A5,$69,$5A,$5A
		defb $65,$65,$65,$65,$55,$55,$95,$95
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $AF,$AA,$AA,$AA,$AA,$AA,$AF,$BF
		defb $AF,$AB,$AB,$AA,$AB,$AF,$FF,$FF
		defb $7F,$FD,$F7,$D7,$DB,$FA,$FA,$FE
		defb $5E,$5F,$57,$57,$DF,$FF,$FF,$FE
		defb $FF,$FD,$FD,$F5,$F5,$D5,$D5,$D5
		defb $5A,$6A,$66,$A6,$95,$95,$55,$55
		defb $AA,$AA,$9A,$95,$95,$95,$95,$A5
		defb $A5,$A5,$A5,$A5,$65,$55,$55,$55
		defb $BF,$AF,$AB,$AB,$AA,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$5D,$5D,$7F
		defb $5F,$7F,$FE,$FA,$FA,$FA,$FA,$FA
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $95,$95,$AA,$AA,$A9,$95,$55,$55
		defb $AA,$AA,$AA,$AA,$56,$55,$59,$59
		defb $A5,$A5,$A9,$AA,$5A,$56,$55,$55
		defb $55,$55,$55,$55,$96,$AA,$A9,$59
		defb $BD,$F5,$D5,$D5,$D7,$FF,$FF,$BF
		defb $7F,$FB,$EB,$EB,$EB,$AB,$AA,$AA
		defb $5E,$5F,$57,$5F,$5F,$FF,$FF,$FE
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $F5,$F5,$F5,$FD,$FD,$FF,$FF,$FF
		defb $55,$55,$75,$75,$75,$F5,$F5,$F5
		defb $A5,$A5,$A5,$A5,$A9,$95,$55,$55
		defb $FF,$FF,$FF,$FF,$7F,$7F,$7F,$FF
		defb $AA,$AA,$AA,$AA,$AB,$AB,$AB,$AA
		defb $FF,$FB,$EA,$EA,$AA,$AA,$AA,$AA
		defb $FA,$FA,$FA,$FA,$BA,$BA,$BA,$AA
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $59,$59,$65,$A5,$A5,$A5,$65,$65
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $59,$59,$59,$55,$55,$55,$55,$55
		defb $FA,$EA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $FF,$BF,$BF,$AE,$EA,$FA,$FA,$FB
		defb $AA,$AA,$AA,$9A,$96,$56,$56,$56
		defb $FF,$FF,$FF,$FF,$BF,$BF,$BF,$BF
		defb $55,$55,$55,$55,$55,$55,$55,$69
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $A9,$AA,$AA,$A6,$A6,$A6,$AA,$6A
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $AF,$AF,$AF,$AF,$BF,$BF,$BF,$FF
		defb $AA,$AB,$AA,$AA,$AA,$AA,$AA,$AA
		defb $AF,$FF,$FF,$FE,$FE,$BE,$BE,$FA
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$EA
		defb $55,$55,$55,$56,$5A,$6A,$5A,$56
		defb $55,$55,$A5,$A5,$A5,$A5,$A5,$A5
		defb $65,$A5,$A9,$AA,$AA,$BE,$BF,$BE
		defb $55,$55,$55,$55,$95,$95,$95,$95
		defb $AF,$AB,$EA,$FA,$FA,$FE,$FE,$FA
		defb $59,$55,$55,$55,$55,$95,$A5,$A5
		defb $56,$5A,$5A,$6A,$6A,$5A,$55,$55
		defb $BF,$BF,$FF,$FF,$AF,$AF,$AB,$FA
		defb $AA,$AA,$96,$96,$AA,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$55,$55,$95
		defb $65,$65,$55,$55,$95,$95,$95,$96
		defb $69,$A9,$A9,$96,$A6,$AA,$AA,$A9
		defb $FF,$FB,$AA,$AA,$AA,$AA,$AA,$AA
		defb $EA,$FA,$FE,$FE,$BF,$BF,$AF,$AF
		defb $FA,$FA,$FA,$FA,$FB,$FF,$FF,$FF
		defb $EA,$FA,$FA,$FE,$FE,$FF,$EF,$AB
		defb $6A,$AA,$AA,$AA,$BE,$AF,$AF,$6F
		defb $AA,$AA,$AA,$AA,$AA,$FA,$FA,$EA
		defb $BA,$AA,$A9,$A5,$A9,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$95,$95,$A9
		defb $AA,$AA,$A5,$A5,$A5,$A5,$A5,$A5
		defb $A5,$55,$55,$55,$55,$59,$6A,$6A
		defb $55,$55,$55,$55,$59,$5A,$5A,$5A
		defb $5A,$5A,$5A,$5A,$5A,$5A,$AA,$AA
		defb $69,$55,$55,$55,$55,$55,$59,$6A
		defb $A5,$69,$6A,$5A,$5A,$6A,$69,$A5
		defb $9A,$A9,$A9,$A5,$95,$95,$A5,$69
		defb $A9,$55,$55,$55,$55,$55,$55,$55
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $AB,$AB,$AB,$AB,$AB,$AF,$AF,$AF
		defb $FF,$FE,$FE,$FE,$FE,$FE,$FE,$BE
		defb $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
		defb $6F,$6A,$6A,$6A,$6A,$59,$59,$55
		defb $AA,$AA,$AA,$9A,$5A,$5A,$6A,$6B
		defb $5A,$5A,$56,$95,$95,$95,$95,$95
		defb $AA,$FA,$A9,$A9,$69,$69,$59,$55
		defb $AF,$EA,$EA,$FF,$FF,$FF,$FF,$FF
		defb $AB,$AB,$FA,$FE,$FE,$FE,$FE,$FF
		defb $5A,$5A,$5A,$6A,$AA,$AA,$AA,$AA
		defb $AF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
		defb $6A,$96,$96,$9A,$AA,$AA,$6A,$69
		defb $95,$55,$55,$55,$55,$55,$55,$55
		defb $5A,$56,$55,$55,$55,$55,$55,$55
		defb $A9,$AA,$AA,$A6,$A6,$A6,$6A,$69
		defb $AB,$AB,$AA,$AA,$AA,$AA,$AA,$AA
		defb $FF,$FE,$FE,$BF,$AF,$AF,$AB,$AA
		defb $BE,$AF,$AF,$AF,$AF,$BF,$BE,$BE
		defb $AA,$EA,$FA,$EA,$EA,$AA,$AA,$AA
		defb $55,$55,$55,$55,$55,$55,$55,$55
		defb $6F,$6F,$6F,$6F,$BF,$AA,$AA,$A5
		defb $95,$95,$A5,$A5,$A5,$A5,$95,$55
		defb $55,$55,$55,$55,$55,$55,$55,$55
#line 199
__LABEL__charmap01end:
	ld a, 154
	call _mc1000screen
	xor a
	push af
	call _mc1000cls
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, 34
	push hl
	ld hl, 7
	push hl
	call _mc1000vpokechr
	ld hl, 0
	ld (_eey), hl
	jp __LABEL0
__LABEL3:
	ld hl, 0
	ld (_eex), hl
	jp __LABEL5
__LABEL8:
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, (_eey)
	ld de, 16
	call __MUL16_FAST
	ex de, hl
	ld hl, (_eex)
	add hl, de
	push hl
	ld hl, (_eey)
	ld de, 32
	call __MUL16_FAST
	ld de, 239
	add hl, de
	ex de, hl
	ld hl, (_eex)
	add hl, de
	push hl
	call _mc1000vpokechr
	ld hl, (_eex)
	inc hl
	ld (_eex), hl
__LABEL5:
	ld hl, 15
	ld de, (_eex)
	or a
	sbc hl, de
	jp nc, __LABEL8
	ld hl, (_eey)
	inc hl
	ld (_eey), hl
__LABEL0:
	ld hl, 15
	ld de, (_eey)
	or a
	sbc hl, de
	jp nc, __LABEL3
__LABEL__gamesystemstartup:
__LABEL__1000:
__LABEL__title:
__LABEL__2000:
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, (__LABEL__text02) - (__LABEL__text01)
	push hl
	ld hl, __LABEL__text01
	push hl
	ld hl, 12
	push hl
	ld hl, 3
	push hl
	call _mc1000writetext
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, (__LABEL__text03) - (__LABEL__text02)
	push hl
	ld hl, __LABEL__text02
	push hl
	ld hl, 13
	push hl
	ld hl, 3
	push hl
	call _mc1000writetext
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, (__LABEL__text04) - (__LABEL__text03)
	push hl
	ld hl, __LABEL__text03
	push hl
	ld hl, 20
	push hl
	ld hl, 3
	push hl
	call _mc1000writetext
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, __LABEL__title
	push hl
	ld hl, 4
	push hl
	ld hl, 4
	push hl
	ld hl, 2
	push hl
	ld hl, 2
	push hl
	call _putchars
	ld hl, (__LABEL__charmap01) - (216)
	push hl
	ld hl, __LABEL__patterns9
	push hl
	ld hl, 4
	push hl
	ld hl, 4
	push hl
	ld hl, 3
	push hl
	ld hl, 3
	push hl
	call _putchars
__LABEL10:
	jp __LABEL10
__LABEL__2100:
__LABEL__2200:
__LABEL__scoretable:
__LABEL__3000:
__LABEL__3020:
__LABEL__gameplay:
__LABEL__4000:
__LABEL__shufflingcards:
__LABEL__4050:
__LABEL__4054:
__LABEL__4056:
__LABEL__displaybackcards:
__LABEL__4100:
__LABEL__displaytext:
__LABEL__starttimer:
__LABEL__4200:
__LABEL__maingameloop:
__LABEL__4400:
__LABEL__cursormotion:
__LABEL__4500:
__LABEL__cardchecking:
__LABEL__4600:
__LABEL__cardparitychecking:
__LABEL__4700:
__LABEL__removingcards:
__LABEL__4720:
__LABEL__hidingcards:
__LABEL__4740:
__LABEL__displayingcards:
__LABEL__4800:
__LABEL__displaymeancard:
__LABEL__4850:
__LABEL__displaybackofcard:
__LABEL__4860:
__LABEL__displaycardmotion:
__LABEL__4870:
__LABEL__displaytimerpairs:
__LABEL__4900:
__LABEL__scorewriting:
__LABEL__5000:
__LABEL__textinputloop:
__LABEL__5100:
__LABEL__findinghiscorehole:
__LABEL__5200:
__LABEL__5300:
__LABEL12:
	jp __LABEL12
__LABEL__patterns:
__LABEL__attributes:
__LABEL__typeface:
__LABEL__patterns2:
__LABEL__patterns9:
#line 485
		defb $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F
		defb 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
#line 487
__LABEL__text01:
#line 495
		defb "MEMORAMA"
#line 496
__LABEL__text02:
#line 499
		defb "BY PAULO SILVA, '06, '11"
#line 500
__LABEL__text03:
#line 503
		defb "PUSH SPACE KEY"
#line 504
__LABEL__text04:
	ld hl, 0
	ld b, h
	ld c, l
__END_PROGRAM:
	di
	ld hl, (__CALL_BACK__)
	ld sp, hl
	exx
	pop hl
	pop iy
	pop ix
	exx
	ei
	ret
__CALL_BACK__:
	DEFW 0
_mc1000screen:
#line 1
		out($80),a
		ld($00F5),a
#line 3
_mc1000screen__leave:
	ret
_mc1000cls:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 0
	push hl
	push hl
	push hl
	inc sp
	ld (ix-3), 0
	ld (ix-2), 2
	ld (ix-1), 0
	ld a, (245)
	ld h, 248
	and h
	sub 128
	sub 1
	jp nc, __LABEL15
	ld (ix-3), 0
	ld (ix-2), 4
__LABEL15:
	ld a, (245)
	ld h, 252
	and h
	sub 136
	sub 1
	jp nc, __LABEL17
	ld (ix-3), 0
	ld (ix-2), 8
__LABEL17:
	ld a, (245)
	ld h, 252
	and h
	sub 140
	sub 1
	jp nc, __LABEL19
	ld (ix-3), 0
	ld (ix-2), 6
__LABEL19:
	ld a, (245)
	ld h, 248
	and h
	sub 144
	sub 1
	jp nc, __LABEL21
	ld (ix-3), 0
	ld (ix-2), 12
__LABEL21:
	ld a, (245)
	ld h, 248
	and h
	sub 152
	sub 1
	jp nc, __LABEL23
	ld (ix-3), 0
	ld (ix-2), 24
__LABEL23:
	ld a, (245)
	ld h, 132
	and h
	sub 128
	sub 1
	jp nc, __LABEL25
	ld a, (ix+5)
	ld h, 3
	and h
	ld h, 85
	call __MUL8_FAST
	ld (ix-1), a
__LABEL25:
	ld a, (245)
	ld h, 132
	and h
	sub 132
	sub 1
	jp nc, __LABEL27
	ld a, (ix+5)
	ld h, 1
	and h
	ld h, 255
	call __MUL8_FAST
	ld (ix-1), a
__LABEL27:
	ld a, (245)
	ld h, 96
	and h
	sub 96
	sub 1
	jp nc, __LABEL29
	ld (ix-1), 0
	ld a, (ix+5)
	ld h, 7
	and h
	ld h, 4
	cp h
	jp nc, __LABEL31
	ld a, (ix+5)
	ld h, 3
	and h
	ld b, 6
__LABEL58:
	add a, a
	djnz __LABEL58
	ld h, a
	ld a, 63
	or h
	ld (ix-1), a
__LABEL31:
__LABEL29:
	ld a, (245)
	ld h, 96
	and h
	sub 64
	sub 1
	jp nc, __LABEL33
	ld (ix-1), 0
	ld a, (ix+5)
	ld h, 15
	and h
	ld h, 8
	cp h
	jp nc, __LABEL35
	ld a, (ix+5)
	ld h, 7
	and h
	add a, a
	add a, a
	add a, a
	add a, a
	ld h, a
	ld a, 15
	or h
	ld (ix-1), a
__LABEL35:
__LABEL33:
	ld a, (245)
	ld h, 252
	and h
	sub 1
	jp nc, __LABEL37
	ld a, (ix+5)
	ld h, 1
	and h
	ld b, 7
__LABEL59:
	add a, a
	djnz __LABEL59
	ld h, a
	ld a, 32
	or h
	ld (ix-1), a
__LABEL37:
	ld (ix-5), 0
	ld (ix-4), 0
	jp __LABEL38
__LABEL41:
	ld l, (ix-5)
	ld h, (ix-4)
	ld de, 32768
	add hl, de
	push hl
	ld a, (ix-1)
	pop hl
	ld (hl), a
	ld l, (ix-5)
	ld h, (ix-4)
	inc hl
	ld (ix-5), l
	ld (ix-4), h
__LABEL38:
	ld l, (ix-5)
	ld h, (ix-4)
	push hl
	ld l, (ix-3)
	ld h, (ix-2)
	dec hl
	pop de
	or a
	sbc hl, de
	jp nc, __LABEL41
_mc1000cls__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	ex (sp), hl
	exx
	ret
_mc1000vpokechr:
	push ix
	ld ix, 0
	add ix, sp
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 768
	call __MODU16
	ld (ix+4), l
	ld (ix+5), h
	ld hl, 8
	push hl
	ld l, (ix+8)
	ld h, (ix+9)
	push hl
	ld l, (ix+6)
	ld h, (ix+7)
	add hl, hl
	add hl, hl
	add hl, hl
	ex de, hl
	pop hl
	add hl, de
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld h, 0
	ld a, l
	and 31
	ld l, a
	ld de, 32768
	add hl, de
	ld de, 0
	push de
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 32
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 256
	call __MUL32
	pop bc
	add hl, bc
	pop bc
	ex de, hl
	adc hl, bc
	ex de, hl
	push hl
	call _minivadersldir32b
_mc1000vpokechr__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_minivadersldir32b:
	push ix
	ld ix, 0
	add ix, sp
#line 2
		ld d,(ix+5)
		ld e,(ix+4)
		ld h,(ix+7)
		ld l,(ix+6)
		ld b,(ix+9)
		ld c,(ix+8)
minivadersldir32bloop:
		ld a,(hl)
		ld (de),a
		inc hl
		ex de,hl
		push de
		ld de,32
		add hl,de
		pop de
		ex de,hl
		dec bc
		ld a,b
		or c
		jp nz,minivadersldir32bloop
#line 22
_minivadersldir32b__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_mc1000writetext:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 0
	ld (_tq2), hl
	jp __LABEL43
__LABEL46:
	ld l, (ix+12)
	ld h, (ix+13)
	push hl
	ld l, (ix+8)
	ld h, (ix+9)
	ex de, hl
	ld hl, (_tq2)
	add hl, de
	ld b, h
	ld c, l
	ld a, (bc)
	ld l, a
	ld h, 0
	push hl
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 32
	call __MUL16_FAST
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ex de, hl
	pop hl
	add hl, de
	ex de, hl
	ld hl, (_tq2)
	add hl, de
	push hl
	call _mc1000vpokechr
	ld hl, (_tq2)
	inc hl
	ld (_tq2), hl
__LABEL43:
	ld l, (ix+10)
	ld h, (ix+11)
	dec hl
	ld de, (_tq2)
	or a
	sbc hl, de
	jp nc, __LABEL46
_mc1000writetext__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_putchars:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 0
	push hl
	push hl
	push hl
	inc sp
	ld hl, 0
	ld (_tqy3), hl
	jp __LABEL48
__LABEL51:
	ld hl, 0
	ld (_tqx3), hl
	jp __LABEL53
__LABEL56:
	ld l, (ix+14)
	ld h, (ix+15)
	push hl
	ld l, (ix+12)
	ld h, (ix+13)
	push hl
	ld l, (ix+8)
	ld h, (ix+9)
	ex de, hl
	ld hl, (_tqy3)
	call __MUL16_FAST
	ex de, hl
	pop hl
	add hl, de
	ex de, hl
	ld hl, (_tqx3)
	add hl, de
	ld b, h
	ld c, l
	ld a, (bc)
	ld l, a
	ld h, 0
	push hl
	ld l, (ix+6)
	ld h, (ix+7)
	ex de, hl
	ld hl, (_tqy3)
	add hl, de
	ld de, 32
	call __MUL16_FAST
	ld de, 0
	call __U32TOFREG
	push bc
	push de
	push af
	push ix
	pop hl
	ld de, -5
	add hl, de
	call __PLOADF
	call __ADDF
	push bc
	push de
	push af
	ld hl, (_tqx3)
	ld de, 0
	call __U32TOFREG
	call __ADDF
	push bc
	push de
	push af
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 0
	call __U32TOFREG
	call __ADDF
	call __FTOU32REG
	push hl
	call _mc1000vpokechr
	ld hl, (_tqx3)
	inc hl
	ld (_tqx3), hl
__LABEL53:
	ld l, (ix+8)
	ld h, (ix+9)
	dec hl
	ld de, (_tqx3)
	or a
	sbc hl, de
	jp nc, __LABEL56
	ld hl, (_tqy3)
	inc hl
	ld (_tqy3), hl
__LABEL48:
	ld l, (ix+10)
	ld h, (ix+11)
	dec hl
	ld de, (_tqy3)
	or a
	sbc hl, de
	jp nc, __LABEL51
_putchars__leave:
	exx
	ld hl, 12
__EXIT_FUNCTION:
	ld sp, ix
	pop ix
	pop de
	add hl, sp
	ld sp, hl
	push de
	exx
	ret
#line 1 "addf.asm"
#line 1 "stackf.asm"
	; -------------------------------------------------------------
	; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
	; -------------------------------------------------------------
	
	
	__FPSTACK_PUSH EQU 2AB6h	; Stores an FP number into the ROM FP stack (A, ED CB)
	__FPSTACK_POP  EQU 2BF1h	; Pops an FP number out of the ROM FP stack (A, ED CB)
	
__FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
	                 ; Second argument to push into the stack calculator is popped out of the stack
	                 ; Since the caller routine also receives the parameters into the top of the stack
	                 ; four bytes must be removed from SP before pop them out
	
	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
	    exx
	    pop hl       ; Caller-Caller return addr
	    exx
	    pop hl       ; Caller return addr
	
	    pop af
	    pop de
	    pop bc
	
	    push hl      ; Caller return addr
	    exx
	    push hl      ; Caller-Caller return addr
	    exx
	 
	    jp __FPSTACK_PUSH
	
	
__FPSTACK_I16:	; Pushes 16 bits integer in HL into the FP ROM STACK
					; This format is specified in the ZX 48K Manual
					; You can push a 16 bit signed integer as
					; 0 SS LL HH 0, being SS the sign and LL HH the low
					; and High byte respectively
		ld a, h
		rla			; sign to Carry
		sbc	a, a	; 0 if positive, FF if negative
		ld e, a
		ld d, l
		ld c, h
		xor a
		ld b, a
		jp __FPSTACK_PUSH
#line 2 "addf.asm"
	
	; -------------------------------------------------------------
	; Floating point library using the FP ROM Calculator (ZX 48K)
	; All of them uses A EDCB registers as 1st paramter.
	; For binary operators, the 2n operator must be pushed into the
	; stack, in the order AF DE BC (F not used).
	;
	; Uses CALLEE convention
	; -------------------------------------------------------------
	
__ADDF:	; Addition
		call __FPSTACK_PUSH2
		
		; ------------- ROM ADD
		rst 28h
		defb 0fh	; ADD
		defb 38h;   ; END CALC
	
		jp __FPSTACK_POP
	
#line 875 "memorama.bas"
#line 1 "and8.asm"
	; FASTCALL boolean and 8 version.
	; result in Accumulator (0 False, not 0 True)
; __FASTCALL__ version (operands: A, H)
	; Performs 8bit and 8bit and returns the boolean
	
__AND8:
		or a
		ret z
		ld a, h
		ret 
	
#line 876 "memorama.bas"
#line 1 "div16.asm"
	; 16 bit division and modulo functions 
	; for both signed and unsigned values
	
#line 1 "neg16.asm"
	; Negates HL value (16 bit)
__ABS16:
		bit 7, h
		ret z
	
__NEGHL:
		ld a, l			; HL = -HL
		cpl
		ld l, a
		ld a, h
		cpl
		ld h, a
		inc hl
		ret
	
#line 5 "div16.asm"
	
__DIVU16:    ; 16 bit unsigned division
	             ; HL = Dividend, Stack Top = Divisor
	
		;   -- OBSOLETE ; Now uses FASTCALL convention
		;   ex de, hl
	    ;	pop hl      ; Return address
	    ;	ex (sp), hl ; CALLEE Convention
	
__DIVU16_FAST:
	    ld a, h
	    ld c, l
	    ld hl, 0
	    ld b, 16
	
__DIV16LOOP:
	    sll c
	    rla
	    adc hl,hl
	    sbc hl,de
	    jr  nc, __DIV16NOADD
	    add hl,de
	    dec c
	
__DIV16NOADD:
	    djnz __DIV16LOOP
	
	    ex de, hl
	    ld h, a
	    ld l, c
	
	    ret     ; HL = quotient, DE = Mudulus
	
	
	
__MODU16:    ; 16 bit modulus
	             ; HL = Dividend, Stack Top = Divisor
	
	    ;ex de, hl
	    ;pop hl
	    ;ex (sp), hl ; CALLEE Convention
	
	    call __DIVU16_FAST
	    ex de, hl	; hl = reminder (modulus)
					; de = quotient
	
	    ret
	
	
__DIVI16:	; 16 bit signed division
		;	--- The following is OBSOLETE ---
		;	ex de, hl
		;	pop hl
		;	ex (sp), hl 	; CALLEE Convention
	
__DIVI16_FAST:
		ld a, d
		xor h
		ex af, af'		; BIT 7 of a contains result
	
		bit 7, d		; DE is negative?
		jr z, __DIVI16A	
	
		ld a, e			; DE = -DE
		cpl
		ld e, a
		ld a, d
		cpl
		ld d, a
		inc de
	
__DIVI16A:
		bit 7, h		; HL is negative?
		call nz, __NEGHL
	
__DIVI16B:
		call __DIVU16_FAST
		ex af, af'
	
		or a	
		ret p	; return if positive
	    jp __NEGHL
	
		
__MODI16:    ; 16 bit modulus
	             ; HL = Dividend, Stack Top = Divisor
	
	    ;ex de, hl
	    ;pop hl
	    ;ex (sp), hl ; CALLEE Convention
	
	    call __DIVI16_FAST
	    ex de, hl	; hl = reminder (modulus)
					; de = quotient
	
	    ret
	
#line 877 "memorama.bas"
#line 1 "ftou32reg.asm"
#line 1 "neg32.asm"
__ABS32:
		bit 7, d
		ret z
	
__NEG32: ; Negates DEHL (Two's complement)
		ld a, l
		cpl
		ld l, a
	
		ld a, h
		cpl
		ld h, a
	
		ld a, e
		cpl
		ld e, a
		
		ld a, d
		cpl
		ld d, a
	
		inc l
		ret nz
	
		inc h
		ret nz
	
		inc de
		ret
	
#line 2 "ftou32reg.asm"
	
__FTOU32REG:	; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS 32 bit signed)
					; Input FP number in A EDCB (A exponent, EDCB mantissa)
				; Output: DEHL 32 bit number (signed)
		PROC
	
		LOCAL __IS_FLOAT
	
		or a
		jr nz, __IS_FLOAT 
		; Here if it is a ZX ROM Integer
	
		ld h, c
		ld l, d
	ld a, e	 ; Takes sign: FF = -, 0 = +
		ld de, 0
		inc a
		jp z, __NEG32	; Negates if negative
		ret
	
__IS_FLOAT:  ; Jumps here if it is a true floating point number
		ld h, e	
		push hl  ; Stores it for later (Contains Sign in H)
	
		push de
		push bc
	
		exx
		pop de   ; Loads mantissa into C'B' E'D' 
		pop bc	 ; 
	
		set 7, c ; Highest mantissa bit is always 1
		exx
	
		ld hl, 0 ; DEHL = 0
		ld d, h
		ld e, l
	
		;ld a, c  ; Get exponent
		sub 128  ; Exponent -= 128
		jr z, __FTOU32REG_END	; If it was <= 128, we are done (Integers must be > 128)
		jr c, __FTOU32REG_END	; It was decimal (0.xxx). We are done (return 0)
	
		ld b, a  ; Loop counter = exponent - 128
	
__FTOU32REG_LOOP:
		exx 	 ; Shift C'B' E'D' << 1, output bit stays in Carry
		sla d
		rl e
		rl b
		rl c
	
	    exx		 ; Shift DEHL << 1, inserting the carry on the right
		rl l
		rl h
		rl e
		rl d
	
		djnz __FTOU32REG_LOOP
	
__FTOU32REG_END:
		pop af   ; Take the sign bit
		or a	 ; Sets SGN bit to 1 if negative
		jp m, __NEG32 ; Negates DEHL
		
		ret
	
		ENDP
	
	
__FTOU8:	; Converts float in C ED LH to Unsigned byte in A
		call __FTOU32REG
		ld a, l
		ret
	
#line 878 "memorama.bas"
#line 1 "mul16.asm"
__MUL16:	; Mutiplies HL with the last value stored into de stack
				; Works for both signed and unsigned
	
			PROC
	
			LOCAL __MUL16LOOP
	        LOCAL __MUL16NOADD
			
			ex de, hl
			pop hl		; Return address
			ex (sp), hl ; CALLEE caller convention
	
;;__MUL16_FAST:	; __FASTCALL ENTRY: HL = 1st operand, DE = 2nd Operand
	;;		ld c, h
	;;		ld a, l	 ; C,A => 1st Operand
	;;
	;;		ld hl, 0 ; Accumulator
	;;		ld b, 16
	;;
;;__MUL16LOOP:
	;;		sra c	; C,A >> 1  (Arithmetic)
	;;		rra
	;;
	;;		jr nc, __MUL16NOADD
	;;		add hl, de
	;;
;;__MUL16NOADD:
	;;		sla e
	;;		rl d
	;;			
	;;		djnz __MUL16LOOP
	
__MUL16_FAST:
	        ld b, 16
	        ld a, d
	        ld c, e
	        ex de, hl
	        ld hl, 0
	
__MUL16LOOP:
	        add hl, hl  ; hl << 1
	        sla c
	        rla         ; a,c << 1
	        jp nc, __MUL16NOADD
	        add hl, de
	
__MUL16NOADD:
	        djnz __MUL16LOOP
	
			ret	; Result in hl (16 lower bits)
	
			ENDP
	
#line 879 "memorama.bas"
#line 1 "mul32.asm"
#line 1 "_mul32.asm"
	
; Ripped from: http://www.andreadrian.de/oldcpu/z80_number_cruncher.html#moztocid784223
	; Used with permission.
	; Multiplies 32x32 bit integer (DEHL x D'E'H'L')
	; 64bit result is returned in H'L'H L B'C'A C
	
	
__MUL32_64START:
			push hl
			exx
			ld b, h
			ld c, l		; BC = Low Part (A)
			pop hl		; HL = Load Part (B)
			ex de, hl	; DE = Low Part (B), HL = HightPart(A) (must be in B'C')
			push hl
	
			exx
			pop bc		; B'C' = HightPart(A)
			exx			; A = B'C'BC , B = D'E'DE
	
				; multiply routine 32 * 32bit = 64bit
				; h'l'hlb'c'ac = b'c'bc * d'e'de
				; needs register a, changes flags
				;
				; this routine was with tiny differences in the
				; sinclair zx81 rom for the mantissa multiply
	
__LMUL:
	        and     a               ; reset carry flag
	        sbc     hl,hl           ; result bits 32..47 = 0
	        exx
	        sbc     hl,hl           ; result bits 48..63 = 0
	        exx
	        ld      a,b             ; mpr is b'c'ac
	        ld      b,33            ; initialize loop counter
	        jp      __LMULSTART  
	
__LMULLOOP:
	        jr      nc,__LMULNOADD  ; JP is 2 cycles faster than JR. Since it's inside a LOOP
	                                ; it can save up to 33 * 2 = 66 cycles
	                                ; But JR if 3 cycles faster if JUMP not taken!
	        add     hl,de           ; result += mpd
	        exx
	        adc     hl,de
	        exx
	
__LMULNOADD:
	        exx
	        rr      h               ; right shift upper
	        rr      l               ; 32bit of result
	        exx
	        rr      h
	        rr      l
	
__LMULSTART:
	        exx
	        rr      b               ; right shift mpr/
	        rr      c               ; lower 32bit of result
	        exx
	        rra                     ; equivalent to rr a
	        rr      c
	        djnz    __LMULLOOP
	
			ret						; result in h'l'hlb'c'ac
	       
#line 2 "mul32.asm"
	
__MUL32:	; multiplies 32 bit un/signed integer.
				; First operand stored in DEHL, and 2nd onto stack
				; Lowest part of 2nd operand on top of the stack
				; returns the result in DE.HL
			exx
			pop hl	; Return ADDRESS
			pop de	; Low part
			ex (sp), hl ; CALLEE -> HL = High part
			ex de, hl
			call __MUL32_64START
	
__TO32BIT:  ; Converts H'L'HLB'C'AC to DEHL (Discards H'L'HL)
			exx
			push bc
			exx
			pop de
			ld h, a
			ld l, c
			ret
	
	
#line 880 "memorama.bas"
#line 1 "mul8.asm"
__MUL8:		; Performs 8bit x 8bit multiplication
		PROC
	
		;LOCAL __MUL8A
		LOCAL __MUL8LOOP
		LOCAL __MUL8B
				; 1st operand (byte) in A, 2nd operand into the stack (AF)
		pop hl	; return address
		ex (sp), hl ; CALLE convention
	
;;__MUL8_FAST: ; __FASTCALL__ entry
	;;	ld e, a
	;;	ld d, 0
	;;	ld l, d
	;;	
	;;	sla h	
	;;	jr nc, __MUL8A
	;;	ld l, e
	;;
;;__MUL8A:
	;;
	;;	ld b, 7
;;__MUL8LOOP:
	;;	add hl, hl
	;;	jr nc, __MUL8B
	;;
	;;	add hl, de
	;;
;;__MUL8B:
	;;	djnz __MUL8LOOP
	;;
	;;	ld a, l ; result = A and HL  (Truncate to lower 8 bits)
	
__MUL8_FAST: ; __FASTCALL__ entry, a = a * h (8 bit mul) and Carry
	
	    ld b, 8
	    ld l, a
	    xor a
	
__MUL8LOOP:
	    add a, a ; a *= 2
	    sla l
	    jp nc, __MUL8B
	    add a, h
	
__MUL8B:
	    djnz __MUL8LOOP
		
		ret		; result = HL
		ENDP
	
#line 881 "memorama.bas"
#line 1 "ploadf.asm"
	; Parameter / Local var load
	; A => Offset
	; IX = Stack Frame
; RESULT: HL => IX + DE
	
#line 1 "iloadf.asm"
	; __FASTCALL__ routine which
	; loads a 40 bits floating point into A ED CB
	; stored at position pointed by POINTER HL
	;A DE, BC <-- ((HL))
	
__ILOADF:
	    ld a, (hl)
	    inc hl
	    ld h, (hl)
	    ld l, a
	
	; __FASTCALL__ routine which
	; loads a 40 bits floating point into A ED CB
	; stored at position pointed by POINTER HL
	;A DE, BC <-- (HL)
	
__LOADF:    ; Loads a 40 bits FP number from address pointed by HL
		ld a, (hl)	
		inc hl
		ld e, (hl)
		inc hl
		ld d, (hl)
		inc hl
		ld c, (hl)
		inc hl
		ld b, (hl)
		ret
	
#line 7 "ploadf.asm"
	
__PLOADF:
	    push ix
	    pop hl
	    add hl, de
	    jp __LOADF
	   
#line 882 "memorama.bas"
#line 1 "u32tofreg.asm"
	
__I8TOFREG:
		ld l, a
		rlca
		sbc a, a	; A = SGN(A)
		ld h, a
		ld e, a
		ld d, a
	
__I32TOFREG:	; Converts a 32bit signed integer (stored in DEHL)
					; to a Floating Point Number returned in (A ED CB)
	
		ld a, d
		or a		; Test sign
	
		jp p, __U32TOFREG	; It was positive, proceed as 32bit unsigned
	
		call __NEG32		; Convert it to positive
		call __U32TOFREG	; Convert it to Floating point
	
		set 7, e			; Put the sign bit (negative) in the 31bit of mantissa
		ret
	
__U8TOFREG:
					; Converts an unsigned 8 bit (A) to Floating point
		ld l, a
		ld h, 0
		ld e, h
		ld d, h
	
__U32TOFREG:	; Converts an unsigned 32 bit integer (DEHL)
					; to a Floating point number returned in A ED CB
	
	    PROC
	
	    LOCAL __U32TOFREG_END
	
		ld a, d
		or e
		or h
		or l
	    ld b, d
		ld c, e		; Returns 00 0000 0000 if ZERO
		ret z
	
		push de
		push hl
	
		exx
		pop de  ; Loads integer into B'C' D'E' 
		pop bc
		exx
	
		ld l, 128	; Exponent
		ld bc, 0	; DEBC = 0
		ld d, b
		ld e, c
	
__U32TOFREG_LOOP: ; Also an entry point for __F16TOFREG
		exx
		ld a, d 	; B'C'D'E' == 0 ?
		or e
		or b
		or c
		jp z, __U32TOFREG_END	; We are done
	
		srl b ; Shift B'C' D'E' >> 1, output bit stays in Carry
		rr c
		rr d
		rr e
		exx
	
		rr e ; Shift EDCB >> 1, inserting the carry on the left
		rr d
		rr c
		rr b
	
		inc l	; Increment exponent
		jp __U32TOFREG_LOOP
	
	
__U32TOFREG_END:
		exx
	    ld a, l     ; Puts the exponent in a
		res 7, e	; Sets the sign bit to 0 (positive)
	
		ret
	    ENDP
	
#line 883 "memorama.bas"
	
ZXBASIC_USER_DATA:
_tadrv2:
	DEFB 00, 00
_tq2:
	DEFB 00, 00
_tqx3:
	DEFB 00, 00
_tqy3:
	DEFB 00, 00
_eex:
	DEFB 00, 00
_eey:
	DEFB 00, 00
	; Defines DATA END --> HEAP size is 0
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
	; Defines USER DATA Length in bytes
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
	END
