	org 49139
__START_PROGRAM:
	di
	push ix
	push iy
	exx
	push hl
	exx
	ld hl, 0
	add hl, sp
	ld (__CALL_BACK__), hl
	ei
#line 0
		ld sp,$7FFF
#line 1
	jp __LABEL__typeface01end
__LABEL__typeface01:
#line 3
		defb 000h,000h,000h,000h,000h,000h,000h,000h
		defb 018h,03ch,03ch,018h,018h,000h,018h,000h
		defb 036h,036h,036h,000h,000h,000h,000h,000h
		defb 036h,036h,07fh,036h,07fh,036h,036h,000h
		defb 018h,03eh,060h,03ch,006h,07ch,018h,000h
		defb 000h,063h,066h,00ch,018h,033h,063h,000h
		defb 01ch,036h,01ch,03bh,06eh,066h,03bh,000h
		defb 00ch,00ch,018h,000h,000h,000h,000h,000h
		defb 00ch,018h,030h,030h,030h,018h,00ch,000h
		defb 030h,018h,00ch,00ch,00ch,018h,030h,000h
		defb 000h,066h,03ch,0ffh,03ch,066h,000h,000h
		defb 000h,018h,018h,07eh,018h,018h,000h,000h
		defb 000h,000h,000h,000h,018h,008h,010h,000h
		defb 000h,000h,000h,07eh,000h,000h,000h,000h
		defb 000h,000h,000h,000h,000h,018h,018h,000h
		defb 003h,006h,00ch,018h,030h,060h,0c0h,000h
		defb 01ch,026h,063h,063h,063h,032h,01ch,000h
		defb 00ch,01ch,00ch,00ch,00ch,00ch,03fh,000h
		defb 03eh,063h,007h,01eh,03ch,070h,07fh,000h
		defb 03fh,006h,00ch,01eh,003h,063h,03eh,000h
		defb 00eh,01eh,036h,066h,07fh,006h,006h,000h
		defb 07eh,060h,07eh,003h,003h,063h,03eh,000h
		defb 01ch,030h,060h,07eh,063h,063h,03eh,000h
		defb 07fh,063h,006h,00ch,018h,018h,018h,000h
		defb 03ch,062h,072h,03ch,04fh,043h,03eh,000h
		defb 03eh,063h,063h,03fh,003h,006h,03ch,000h
		defb 000h,000h,018h,018h,000h,018h,018h,000h
		defb 000h,018h,018h,000h,038h,018h,030h,000h
		defb 00ch,018h,030h,060h,030h,018h,00ch,000h
		defb 000h,000h,07eh,000h,07eh,000h,000h,000h
		defb 030h,018h,00ch,006h,00ch,018h,030h,000h
		defb 07ch,0c6h,006h,01ch,030h,000h,030h,000h
		defb 03eh,063h,06fh,06fh,06fh,060h,03ch,000h
		defb 01ch,036h,063h,063h,07fh,063h,063h,000h
		defb 07eh,063h,063h,07eh,063h,063h,07eh,000h
		defb 01eh,033h,060h,060h,060h,033h,01eh,000h
		defb 07ch,066h,063h,063h,063h,066h,07ch,000h
		defb 03fh,030h,030h,03eh,030h,030h,03fh,000h
		defb 07fh,060h,060h,07eh,060h,060h,060h,000h
		defb 01fh,030h,060h,067h,063h,033h,01fh,000h
		defb 063h,063h,063h,07fh,063h,063h,063h,000h
		defb 03fh,00ch,00ch,00ch,00ch,00ch,03fh,000h
		defb 003h,003h,003h,003h,003h,063h,03eh,000h
		defb 063h,066h,06ch,078h,07ch,06eh,067h,000h
		defb 030h,030h,030h,030h,030h,030h,03fh,000h
		defb 063h,077h,07fh,07fh,06bh,063h,063h,000h
		defb 063h,073h,07bh,07fh,06fh,067h,063h,000h
		defb 03eh,063h,063h,063h,063h,063h,03eh,000h
		defb 07eh,063h,063h,063h,07eh,060h,060h,000h
		defb 03eh,063h,063h,063h,06fh,066h,03dh,000h
		defb 07eh,063h,063h,067h,07ch,06eh,067h,000h
		defb 03ch,066h,060h,03eh,003h,063h,03eh,000h
		defb 03fh,00ch,00ch,00ch,00ch,00ch,00ch,000h
		defb 063h,063h,063h,063h,063h,063h,03eh,000h
		defb 063h,063h,063h,077h,03eh,01ch,008h,000h
		defb 063h,063h,06bh,07fh,07fh,077h,063h,000h
		defb 063h,077h,03eh,01ch,03eh,077h,063h,000h
		defb 033h,033h,033h,01eh,00ch,00ch,00ch,000h
		defb 07fh,007h,00eh,01ch,038h,070h,07fh,000h
		defb 000h,000h,000h,03ch,03ch,000h,000h,000h
		defb 000h,000h,000h,07fh,07fh,000h,000h,000h
		defb 000h,000h,000h,000h,000h,018h,018h,000h
		defb 018h,03ch,03ch,018h,018h,000h,018h,000h
		defb 03ch,042h,09dh,0a1h,0a1h,09dh,042h,03ch
		defb 030h,018h,00ch,000h,000h,000h,000h,000h
		defb 01ch,036h,063h,063h,07fh,063h,063h,000h
		defb 07eh,063h,063h,07eh,063h,063h,07eh,000h
		defb 01eh,033h,060h,060h,060h,033h,01eh,000h
		defb 07ch,066h,063h,063h,063h,066h,07ch,000h
		defb 03fh,030h,030h,03eh,030h,030h,03fh,000h
		defb 07fh,060h,060h,07eh,060h,060h,060h,000h
		defb 01fh,030h,060h,067h,063h,033h,01fh,000h
		defb 063h,063h,063h,07fh,063h,063h,063h,000h
		defb 03fh,00ch,00ch,00ch,00ch,00ch,03fh,000h
		defb 003h,003h,003h,003h,003h,063h,03eh,000h
		defb 063h,066h,06ch,078h,07ch,06eh,067h,000h
		defb 030h,030h,030h,030h,030h,030h,03fh,000h
		defb 063h,077h,07fh,07fh,06bh,063h,063h,000h
		defb 063h,073h,07bh,07fh,06fh,067h,063h,000h
		defb 03eh,063h,063h,063h,063h,063h,03eh,000h
		defb 07eh,063h,063h,063h,07eh,060h,060h,000h
		defb 03eh,063h,063h,063h,06fh,066h,03dh,000h
		defb 07eh,063h,063h,067h,07ch,06eh,067h,000h
		defb 03ch,066h,060h,03eh,003h,063h,03eh,000h
		defb 03fh,00ch,00ch,00ch,00ch,00ch,00ch,000h
		defb 063h,063h,063h,063h,063h,063h,03eh,000h
		defb 063h,063h,063h,077h,03eh,01ch,008h,000h
		defb 063h,063h,06bh,07fh,07fh,077h,063h,000h
		defb 063h,077h,03eh,01ch,03eh,077h,063h,000h
		defb 033h,033h,033h,01eh,00ch,00ch,00ch,000h
		defb 07fh,007h,00eh,01ch,038h,070h,07fh,000h
		defb 000h,000h,000h,03ch,03ch,000h,000h,000h
		defb 000h,000h,000h,07fh,07fh,000h,000h,000h
		defb 000h,000h,000h,000h,000h,018h,018h,000h
		defb 018h,03ch,03ch,018h,018h,000h,018h,000h
		defb 03ch,042h,09dh,0a1h,0a1h,09dh,042h,03ch
#line 99
__LABEL__typeface01end:
	ld hl, 0
	ld (_cntr), hl
	ld a, 97
	push af
	ld a, 7
	push af
	call _pv2000vdp
	ld a, 2
	push af
	xor a
	push af
	call _pv2000vdp
	ld a, 226
	push af
	ld a, 1
	push af
	call _pv2000vdp
	ld a, 6
	push af
	ld a, 2
	push af
	call _pv2000vdp
	ld a, 255
	push af
	ld a, 3
	push af
	call _pv2000vdp
	ld a, 3
	push af
	ld a, 4
	push af
	call _pv2000vdp
	ld a, 54
	push af
	ld a, 5
	push af
	call _pv2000vdp
	ld a, 7
	push af
	ld a, 6
	push af
	call _pv2000vdp
	ld hl, 0
	ld (_ee1), hl
	jp __LABEL0
__LABEL3:
	ld hl, 2048
	push hl
	ld hl, 241
	push hl
	ld hl, (_ee1)
	push hl
	call _pv2000filvrm
	ld hl, 2048
	push hl
	ld hl, 31
	push hl
	ld hl, (_ee1)
	ld de, 8192
	add hl, de
	push hl
	call _pv2000filvrm
__LABEL4:
	ld hl, (_ee1)
	ld de, 2048
	add hl, de
	ld (_ee1), hl
__LABEL0:
	ld hl, 6143
	ld de, (_ee1)
	or a
	sbc hl, de
	jp nc, __LABEL3
__LABEL2:
	ld hl, 768
	push hl
	ld hl, __LABEL__typeface01
	push hl
	ld hl, 256
	push hl
	call _pv2000ldirvm
	ld hl, 768
	push hl
	ld hl, __LABEL__typeface01
	push hl
	ld hl, 2304
	push hl
	call _pv2000ldirvm
	ld hl, 768
	push hl
	ld hl, __LABEL__typeface01
	push hl
	ld hl, 4352
	push hl
	call _pv2000ldirvm
	ld hl, 0
	ld (_ee1), hl
	jp __LABEL5
__LABEL8:
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL10
__LABEL13:
	ld hl, 8
	push hl
	ld hl, (_ee0)
	ld de, 17
	call __MUL16_FAST
	push hl
	ld de, 255
	pop hl
	call __BAND16
	push hl
	ld hl, (_ee0)
	add hl, hl
	add hl, hl
	add hl, hl
	ld de, 8192
	add hl, de
	ex de, hl
	ld hl, (_ee1)
	add hl, de
	push hl
	call _pv2000filvrm
__LABEL14:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL10:
	ld hl, 15
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL13
__LABEL12:
__LABEL9:
	ld hl, (_ee1)
	ld de, 2048
	add hl, de
	ld (_ee1), hl
__LABEL5:
	ld hl, 6143
	ld de, (_ee1)
	or a
	sbc hl, de
	jp nc, __LABEL8
__LABEL7:
	ld hl, 768
	push hl
	ld hl, 12
	push hl
	ld hl, 6144
	push hl
	call _pv2000filvrm
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL15
__LABEL18:
	ld de, 255
	ld hl, (_ee0)
	call __BAND16
	push hl
	ld hl, (_ee0)
	ld de, 6144
	add hl, de
	push hl
	call _pv2000vpoke
	ld de, 255
	ld hl, (_ee0)
	call __BAND16
	push hl
	ld hl, (_ee0)
	ld de, 6400
	add hl, de
	push hl
	call _pv2000vpoke
	ld de, 255
	ld hl, (_ee0)
	call __BAND16
	push hl
	ld hl, (_ee0)
	ld de, 6656
	add hl, de
	push hl
	call _pv2000vpoke
__LABEL19:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL15:
	ld hl, 15
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL18
__LABEL17:
__LABEL__loopunkn01:
	ld hl, (_cntr)
	push hl
	ld hl, 65
	push hl
	call _zprintdecimal5
	ld hl, 0
	ld (_eee), hl
	jp __LABEL20
__LABEL23:
	ld hl, (_eee)
	ld a, l
	ld bc, 32
	out (c), a
	ld bc, 32
	in a, (c)
	push af
	ld h, 15
	pop af
	and h
	ld h, 16
	call __MUL8_FAST
	push af
	ld bc, 16
	in a, (c)
	push af
	ld h, 15
	pop af
	and h
	ld h, a
	pop af
	or h
	ld l, a
	ld h, 0
	push hl
	ld hl, (_eee)
	ld de, 32
	call __MUL16_FAST
	ld de, 23
	add hl, de
	push hl
	call _zprintbinary
__LABEL24:
	ld hl, (_eee)
	inc hl
	ld (_eee), hl
__LABEL20:
	ld hl, 9
	ld de, (_eee)
	or a
	sbc hl, de
	jp nc, __LABEL23
__LABEL22:
#line 107
		halt
#line 108
	ld hl, (_cntr)
	inc hl
	ld (_cntr), hl
	jp __LABEL__loopunkn01
	ld hl, 0
	ld b, h
	ld c, l
__END_PROGRAM:
	di
	ld hl, (__CALL_BACK__)
	ld sp, hl
	exx
	pop hl
	exx
	pop iy
	pop ix
	ei
	ret
__CALL_BACK__:
	DEFW 0
_pv2000vdp:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld a, (ix+7)
		ld ($4001),a
		ld a, (ix+5)
		or $80
		ld ($4001),a
#line 6
_pv2000vdp__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_pv2000filvrm:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld l, (ix+4)
		ld a,l
		ld ($4001),a
		ld h, (ix+5)
		ld a,h
		or $40
		ld ($4001),a
		ld b, (ix+9)
		ld c, (ix+8)
pv2000filvrmloop:
		ld a, (ix+6)
		ld ($4000),a
		dec bc
		ld a,b
		or c
		jp nz,pv2000filvrmloop
#line 17
_pv2000filvrm__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_pv2000ldirvm:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld d, (ix+5)
		ld e, (ix+4)
		ld h, (ix+7)
		ld l, (ix+6)
		ld b, (ix+9)
		ld c, (ix+8)
		ld a,e
		ld ($4001),a
		ld a,d
		or $40
		ld ($4001),a
pv2000ldirvmloop:
		ld a, (hl)
		ld ($4000),a
		inc hl
		dec bc
		ld a,b
		or c
		jp nz,pv2000ldirvmloop
#line 20
_pv2000ldirvm__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_pv2000vpoke:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld l, (ix+4)
		ld a,l
		ld ($4001),a
		ld h, (ix+5)
		ld a,h
		or $40
		ld ($4001),a
		ld a, (ix+6)
		ld ($4000),a
#line 10
_pv2000vpoke__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_pv2000rnd:
#line 1
		ld  d, h
		ld  e, l
		ld  a, d
		ld  h, e
		ld  l, 253
		or  a
		sbc  hl, de
		sbc  a, 0
		sbc  hl, de
		ld  d, 0
		sbc  a, d
		ld  e, a
		sbc  hl, de
		jr  nc, pv2000rndloop
		inc  hl
pv2000rndloop:
		ret
#line 18
_pv2000rnd__leave:
	ret
_zprintdecimal2:
	push ix
	ld ix, 0
	add ix, sp
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 10
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 10
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 10
	call __MODU16
	ld de, 48
	add hl, de
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	push hl
	call _pv2000vpoke
_zprintdecimal2__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_zprintdecimal5:
	push ix
	ld ix, 0
	add ix, sp
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 10000
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 10
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 1000
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 10
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 100
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 10
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 10
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 10
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	inc hl
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 10
	call __MODU16
	ld de, 48
	add hl, de
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	ld de, 4
	add hl, de
	push hl
	call _pv2000vpoke
_zprintdecimal5__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_zprintbinary:
	push ix
	ld ix, 0
	add ix, sp
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 128
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 64
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 32
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 16
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	inc hl
	inc hl
	inc hl
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 8
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	ld de, 4
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld de, 4
	call __DIVU16
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	ld de, 5
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	srl h
	rr l
	ld de, 0
	push de
	push hl
	ld de, 0
	ld hl, 2
	call __SWAP32
	call __MODI32
	ld bc, 0
	push bc
	ld bc, 48
	push bc
	pop bc
	add hl, bc
	ex de, hl
	pop bc
	adc hl, bc
	ex de, hl
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	ld de, 6
	add hl, de
	push hl
	call _pv2000vpoke
	ld l, (ix+6)
	ld h, (ix+7)
	ld h, 0
	ld a, l
	and 1
	ld l, a
	ld de, 48
	add hl, de
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ld de, 6144
	add hl, de
	ld de, 7
	add hl, de
	push hl
	call _pv2000vpoke
_zprintbinary__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
#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 950 "keyboardtest.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 951 "keyboardtest.bas"
#line 1 "div32.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 "div32.asm"
	
				 ; ---------------------------------------------------------
__DIVU32:    ; 32 bit unsigned division
	             ; DEHL = Dividend, Stack Top = Divisor
	             ; OPERANDS P = Dividend, Q = Divisor => OPERATION => P / Q
				 ;
				 ; Changes A, BC DE HL B'C' D'E' H'L'
				 ; ---------------------------------------------------------
	        exx
	        pop hl   ; return address
	        pop de   ; low part
	        ex (sp), hl ; CALLEE Convention ; H'L'D'E' => Dividend
	
__DIVU32START: ; Performs D'E'H'L' / HLDE
	        ; Now switch to DIVIDEND = B'C'BC / DIVISOR = D'E'DE (A / B)
	        push de ; push Lowpart(Q)
			ex de, hl	; DE = HL
	        ld hl, 0
	        exx
	        ld b, h
	        ld c, l
	        pop hl
	        push de
	        ex de, hl
	        ld hl, 0        ; H'L'HL = 0
	        exx
	        pop bc          ; Pop HightPart(B) => B = B'C'BC
	        exx
	
	        ld a, 32 ; Loop count
	
__DIV32LOOP:
	        sll c  ; B'C'BC << 1 ; Output most left bit to carry
	        rl  b
	        exx
	        rl c
	        rl b
	        exx
	
	        adc hl, hl
	        exx
	        adc hl, hl
	        exx
	
	        sbc hl,de
	        exx
	        sbc hl,de
	        exx
	        jp nc, __DIV32NOADD	; use JP inside a loop for being faster
	
	        add hl, de
	        exx
	        adc hl, de
	        exx
	        dec bc
	
__DIV32NOADD:
	        dec a
	        jp nz, __DIV32LOOP	; use JP inside a loop for being faster
	        ; At this point, quotient is stored in B'C'BC and the reminder in H'L'HL
	
	        push hl
	        exx
	        pop de
	        ex de, hl ; D'E'H'L' = 32 bits modulus
	        push bc
	        exx
	        pop de    ; DE = B'C'
	        ld h, b
	        ld l, c   ; DEHL = quotient D'E'H'L' = Modulus
	
	        ret     ; DEHL = quotient, D'E'H'L' = Modulus
	
	
	
__MODU32:    ; 32 bit modulus for 32bit unsigned division
	             ; DEHL = Dividend, Stack Top = Divisor (DE, HL)
	
	        exx
	        pop hl   ; return address
	        pop de   ; low part
	        ex (sp), hl ; CALLEE Convention ; H'L'D'E' => Dividend
	
	        call __DIVU32START	; At return, modulus is at D'E'H'L'
	
__MODU32START:
	
			exx
			push de
			push hl
	
			exx 
			pop hl
			pop de
	
			ret
	
	
__DIVI32:    ; 32 bit signed division
	             ; DEHL = Dividend, Stack Top = Divisor
	             ; A = Dividend, B = Divisor => A / B
	        exx
	        pop hl   ; return address
	        pop de   ; low part
	        ex (sp), hl ; CALLEE Convention ; H'L'D'E' => Dividend
	
__DIVI32START:
			exx
			ld a, d	 ; Save sign
			ex af, af'
			bit 7, d ; Negative?
			call nz, __NEG32 ; Negates DEHL
	
			exx		; Now works with H'L'D'E'
			ex af, af'
			xor h
			ex af, af'  ; Stores sign of the result for later
	
			bit 7, h ; Negative?
			ex de, hl ; HLDE = DEHL
			call nz, __NEG32
			ex de, hl 
	
			call __DIVU32START
			ex af, af' ; Recovers sign
			and 128	   ; positive?
			ret z
	
			jp __NEG32 ; Negates DEHL and returns from there
			
			
__MODI32:	; 32bits signed division modulus
			exx
	        pop hl   ; return address
	        pop de   ; low part
	        ex (sp), hl ; CALLEE Convention ; H'L'D'E' => Dividend
	
			call __DIVI32START
			jp __MODU32START		
	
#line 952 "keyboardtest.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 953 "keyboardtest.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 954 "keyboardtest.bas"
#line 1 "band16.asm"
; vim:ts=4:et:
	; FASTCALL bitwise and16 version.
	; result in hl 
; __FASTCALL__ version (operands: A, H)
	; Performs 16bit or 16bit and returns the boolean
; Input: HL, DE
; Output: HL <- HL AND DE
	
__BAND16:
		ld a, h
		and d
	    ld h, a
	
	    ld a, l
	    and e
	    ld l, a
	
	    ret 
	
#line 955 "keyboardtest.bas"
#line 1 "swap32.asm"
	; Exchanges current DE HL with the
	; ones in the stack
	
__SWAP32:
		pop bc ; Return address
	
		exx
		pop hl	; exx'
		pop de
	
		exx
		push de ; exx
		push hl
	
		exx		; exx '
		push de
		push hl
		
		exx		; exx
		pop hl
		pop de
	
		push bc
	
		ret
	
#line 956 "keyboardtest.bas"
	
ZXBASIC_USER_DATA:
	_eee EQU 28688
	_ee0 EQU 28690
	_ee1 EQU 28692
	_ee2 EQU 28694
	_ee3 EQU 28696
	_xdr EQU 28698
	_trk EQU 28700
	_spd EQU 28702
	_cntr EQU 28704
	; 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
