	org 128
__START_PROGRAM:
	di
	push ix
	push iy
	exx
	push hl
	exx
	ld hl, 0
	add hl, sp
	ld (__CALL_BACK__), hl
	ei
	jp __LABEL__charmaptest2end
__LABEL__charmaptest2:
#line 3
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0011,%1100
		defb %0011,%1100
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0001,%1000
		defb %0000,%0000
		defb %0011,%0110
		defb %0011,%0110
		defb %0011,%0110
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0011,%0110
		defb %0011,%0110
		defb %0111,%1111
		defb %0011,%0110
		defb %0111,%1111
		defb %0011,%0110
		defb %0011,%0110
		defb %0000,%0000
		defb %0001,%1000
		defb %0011,%1110
		defb %0110,%0000
		defb %0011,%1100
		defb %0000,%0110
		defb %0111,%1100
		defb %0001,%1000
		defb %0000,%0000
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0110
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0011
		defb %0110,%0011
		defb %0000,%0000
		defb %0001,%1100
		defb %0011,%0110
		defb %0001,%1100
		defb %0011,%1011
		defb %0110,%1110
		defb %0110,%0110
		defb %0011,%1011
		defb %0000,%0000
		defb %0000,%1100
		defb %0000,%1100
		defb %0001,%1000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0001,%1000
		defb %0000,%1100
		defb %0000,%0000
		defb %0011,%0000
		defb %0001,%1000
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0110,%0110
		defb %0011,%1100
		defb %0111,%1110
		defb %0011,%1100
		defb %0110,%0110
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0111,%1110
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0000,%1000
		defb %0001,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0111,%1110
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0000,%0011
		defb %0000,%0110
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0110,%0000
		defb %1100,%0000
		defb %0000,%0000
		defb %0001,%1100
		defb %0010,%0110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0011,%0010
		defb %0001,%1100
		defb %0000,%0000
		defb %0000,%1100
		defb %0001,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0011,%1111
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0000,%0111
		defb %0000,%1110
		defb %0011,%1100
		defb %0111,%0000
		defb %0111,%1111
		defb %0000,%0000
		defb %0011,%1111
		defb %0000,%0110
		defb %0000,%1100
		defb %0001,%1110
		defb %0000,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0000,%1110
		defb %0001,%1110
		defb %0011,%0110
		defb %0110,%0110
		defb %0111,%1111
		defb %0000,%0110
		defb %0000,%0110
		defb %0000,%0000
		defb %0111,%1110
		defb %0110,%0000
		defb %0111,%1110
		defb %0000,%0011
		defb %0000,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0001,%1100
		defb %0011,%0000
		defb %0110,%0000
		defb %0111,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0111,%1111
		defb %0110,%0011
		defb %0000,%0110
		defb %0000,%1100
		defb %0001,%1000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0011,%1100
		defb %0110,%0010
		defb %0111,%0010
		defb %0011,%1100
		defb %0100,%1111
		defb %0100,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0011,%1111
		defb %0000,%0011
		defb %0000,%0110
		defb %0011,%1100
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0011,%1000
		defb %0001,%1000
		defb %0011,%0000
		defb %0000,%0000
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0110,%0000
		defb %0011,%0000
		defb %0001,%1000
		defb %0000,%1100
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0111,%1110
		defb %0000,%0000
		defb %0111,%1110
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0011,%0000
		defb %0001,%1000
		defb %0000,%1100
		defb %0000,%0110
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0000,%0011
		defb %0000,%1110
		defb %0001,%1000
		defb %0000,%0000
		defb %0001,%1000
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0110,%1111
		defb %0110,%1111
		defb %0110,%1111
		defb %0110,%0000
		defb %0011,%1110
		defb %0000,%0000
		defb %0001,%1100
		defb %0011,%0110
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%1111
		defb %0110,%0011
		defb %0110,%0011
		defb %0000,%0000
		defb %0111,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%1110
		defb %0000,%0000
		defb %0001,%1110
		defb %0011,%0011
		defb %0110,%0000
		defb %0110,%0000
		defb %0110,%0000
		defb %0011,%0011
		defb %0001,%1110
		defb %0000,%0000
		defb %0111,%1100
		defb %0110,%0110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0110
		defb %0111,%1100
		defb %0000,%0000
		defb %0011,%1111
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%1110
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%1111
		defb %0000,%0000
		defb %0111,%1111
		defb %0110,%0000
		defb %0110,%0000
		defb %0111,%1110
		defb %0110,%0000
		defb %0110,%0000
		defb %0110,%0000
		defb %0000,%0000
		defb %0001,%1111
		defb %0011,%0000
		defb %0110,%0000
		defb %0110,%0111
		defb %0110,%0011
		defb %0011,%0011
		defb %0001,%1111
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%1111
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0000,%0000
		defb %0011,%1111
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0011,%1111
		defb %0000,%0000
		defb %0000,%0011
		defb %0000,%0011
		defb %0000,%0011
		defb %0000,%0011
		defb %0000,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0110
		defb %0110,%1100
		defb %0111,%1000
		defb %0111,%1100
		defb %0110,%1110
		defb %0110,%0111
		defb %0000,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%0000
		defb %0011,%1111
		defb %0000,%0000
		defb %0110,%0011
		defb %0111,%0111
		defb %0111,%1111
		defb %0111,%1111
		defb %0110,%1011
		defb %0110,%0011
		defb %0110,%0011
		defb %0000,%0000
		defb %0110,%0011
		defb %0111,%0011
		defb %0111,%1011
		defb %0111,%1111
		defb %0110,%1111
		defb %0110,%0111
		defb %0110,%0011
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0111,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%1110
		defb %0110,%0000
		defb %0110,%0000
		defb %0000,%0000
		defb %0011,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%1111
		defb %0110,%0110
		defb %0011,%1101
		defb %0000,%0000
		defb %0111,%1110
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0111
		defb %0111,%1100
		defb %0110,%1110
		defb %0110,%0111
		defb %0000,%0000
		defb %0011,%1100
		defb %0110,%0110
		defb %0110,%0000
		defb %0011,%1110
		defb %0000,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0011,%1111
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0011,%1110
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%0011
		defb %0111,%0111
		defb %0111,%1111
		defb %0001,%1100
		defb %0000,%1000
		defb %0000,%0000
		defb %0110,%0011
		defb %0110,%0011
		defb %0110,%1011
		defb %0111,%1111
		defb %0111,%1111
		defb %0111,%0111
		defb %0110,%0011
		defb %0000,%0000
		defb %0110,%0011
		defb %0111,%0111
		defb %0011,%1110
		defb %0001,%1100
		defb %0011,%1110
		defb %0111,%0111
		defb %0110,%0011
		defb %0000,%0000
		defb %0011,%0011
		defb %0011,%0011
		defb %0011,%0011
		defb %0001,%1110
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%1100
		defb %0000,%0000
		defb %0111,%1111
		defb %0000,%0011
		defb %0000,%0110
		defb %0000,%1100
		defb %0001,%1000
		defb %0011,%0000
		defb %0111,%1111
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0011,%1100
		defb %0011,%1100
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0111,%1111
		defb %0111,%1111
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0000,%0000
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0001,%1000
		defb %0011,%1100
		defb %0011,%1100
		defb %0001,%1000
		defb %0001,%1000
		defb %0000,%0000
		defb %0001,%1000
		defb %0000,%0000
		defb %0011,%1100
		defb %0100,%0010
		defb %1001,%1101
		defb %1010,%0001
		defb %1010,%0001
		defb %1001,%1101
		defb %0100,%0010
		defb %0011,%1100
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %00000000,%00000000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %11110000,%11110000
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %00001111,%00001111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
		defb %11111111,%11111111
#line 547
__LABEL__charmaptest2end:
	ld hl, 1
	push hl
	call _cpcscreenmode
	ld a, 24
	push af
	ld a, 32
	push af
	call _cpcscreensize
	ld a, 30
	push af
	ld a, 40
	push af
	call _cpcscreenoffset
	ld hl, 16384
	push hl
	ld hl, 15
	push hl
	ld hl, 49152
	push hl
	call _cpcfillram
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL0
__LABEL3:
	ld de, __LABEL__palette01
	ld hl, (_ee0)
	add hl, de
	ld b, h
	ld c, l
	ld a, (bc)
	push af
	ld hl, (_ee0)
	ld a, l
	push af
	call _cpcpaletteseq
__LABEL4:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL0:
	ld hl, 15
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL3
__LABEL2:
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL5
__LABEL8:
	ld hl, (_ee0)
	ld de, 273
	call __MUL16_FAST
	push hl
	ld hl, (_ee0)
	push hl
	call _cpcpluspalettergb
__LABEL9:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL5:
	ld hl, 15
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL8
__LABEL7:
	ld hl, 546
	push hl
	ld hl, 16
	push hl
	call _cpcpluspalettergb
	ld hl, 1073
	push hl
	ld hl, 0
	push hl
	call _cpcpluspalettergb
	ld hl, 1891
	push hl
	ld hl, 1
	push hl
	call _cpcpluspalettergb
	ld hl, 3510
	push hl
	ld hl, 2
	push hl
	call _cpcpluspalettergb
	ld hl, 2098
	push hl
	ld hl, 3
	push hl
	call _cpcpluspalettergb
	ld hl, 0
	ld (_ee1), hl
	jp __LABEL10
__LABEL13:
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL15
__LABEL18:
	ld hl, (_seed)
	call _cpcrnd
	ld (_seed), hl
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld de, 3
	ld hl, (_seed)
	call __BAND16
	ld de, 96
	add hl, de
	push hl
	ld hl, (_ee1)
	push hl
	ld hl, (_ee0)
	push hl
	call _putchar
__LABEL19:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL15:
	ld hl, 31
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL18
__LABEL17:
__LABEL14:
	ld hl, (_ee1)
	inc hl
	ld (_ee1), hl
__LABEL10:
	ld hl, 23
	ld de, (_ee1)
	or a
	sbc hl, de
	jp nc, __LABEL13
__LABEL12:
	ld hl, 0
	ld (_ee1), hl
	jp __LABEL20
__LABEL23:
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL25
__LABEL28:
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, (_ee1)
	ld de, 16
	call __MUL16_FAST
	ex de, hl
	ld hl, (_ee0)
	add hl, de
	push hl
	ld hl, (_ee1)
	ld de, 15
	add hl, de
	push hl
	ld hl, (_ee0)
	ld de, 15
	add hl, de
	push hl
	call _putchar
__LABEL29:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL25:
	ld hl, 15
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL28
__LABEL27:
__LABEL24:
	ld hl, (_ee1)
	inc hl
	ld (_ee1), hl
__LABEL20:
	ld hl, 7
	ld de, (_ee1)
	or a
	sbc hl, de
	jp nc, __LABEL23
__LABEL22:
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, 12
	push hl
	ld hl, __LABEL__text01
	push hl
	ld hl, 13
	push hl
	ld hl, 15
	push hl
	call _writetext
	ld hl, 8
	ld (_eex), hl
	ld hl, 8
	ld (_eey), hl
	ld hl, 0
	ld (_eeq), hl
__LABEL30:
	ld hl, 0
	ld (_ee0), hl
	jp __LABEL32
__LABEL35:
	ld a, 6
	call _cpckeyboard
	cpl
	ld l, a
	ld h, 0
	ld (_ej0), hl
	ld a, 9
	call _cpckeyboard
	cpl
	ld l, a
	ld h, 0
	ld (_ej1), hl
	ld de, (_ej1)
	ld hl, (_ej0)
	call __BOR16
	ld (_ejz), hl
	ld de, 8
	ld hl, (_ejz)
	call __BAND16
	ld de, 8
	call __DIVU16
	ex de, hl
	ld hl, (_eex)
	add hl, de
	push hl
	ld de, 4
	ld hl, (_ejz)
	call __BAND16
	ld de, 4
	call __DIVU16
	ex de, hl
	pop hl
	or a
	sbc hl, de
	ld (_eex), hl
	ld de, 2
	ld hl, (_ejz)
	call __BAND16
	srl h
	rr l
	ex de, hl
	ld hl, (_eey)
	add hl, de
	push hl
	ld de, 1
	ld hl, (_ejz)
	call __BAND16
	ex de, hl
	pop hl
	or a
	sbc hl, de
	ld (_eey), hl
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, (_ej0)
	push hl
	ld hl, 1
	push hl
	ld hl, 23
	push hl
	call _writebin
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, (_ej1)
	push hl
	ld hl, 2
	push hl
	ld hl, 23
	push hl
	call _writebin
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld a, 3
	call _cpckeyboard
	cpl
	ld l, a
	ld h, 0
	push hl
	ld hl, 3
	push hl
	ld hl, 23
	push hl
	call _writebin
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, (_ee0)
	push hl
	ld hl, 5
	push hl
	ld hl, 23
	push hl
	call _writebin
	ld hl, __LABEL__charmaptest2 - 512
	push hl
	ld hl, 35
	push hl
	ld hl, 32
	push hl
	ld hl, (_eeq)
	ld h, 0
	ld a, l
	and 63
	ld l, a
	ld de, 32
	add hl, de
	push hl
	ld hl, (_eey)
	push hl
	ld hl, (_eex)
	push hl
	call _putchar
	ld hl, 50
	push hl
	call _cpcdelay
	ld hl, (_eeq)
	inc hl
	ld (_eeq), hl
__LABEL36:
	ld hl, (_ee0)
	inc hl
	ld (_ee0), hl
__LABEL32:
	ld hl, 255
	ld de, (_ee0)
	or a
	sbc hl, de
	jp nc, __LABEL35
__LABEL34:
	jp __LABEL30
__LABEL31:
__LABEL__palette01:
#line 138
		defb 0,13,26, 6,   15,24,21,18,   19,20,11, 2,    5, 8, 7,17
#line 139
__LABEL__text01:
#line 143
		defb "HELLO WORLD!"
#line 144
	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
_cpcpalettergb:
	push ix
	ld ix, 0
	add ix, sp
#line 2
		ld a, (ix+6)
		ld b,a
		and $0F
		ld c,a
		ld a,b
		and $F0
		rr a
		rr a
		rr a
		rr a
		ld b,a
		ld a, (ix+7)
		and $0F
		ld d,a
		ld a,b
		rl a
		add a,b
		and $0C
		rr a
		rr a
		ld e,a
		rl a
		add a,e
		ld e,a
		ld a,d
		rl a
		add a,d
		and $0C
		rr a
		rr a
		add a,e
		ld e,a
		rl a
		add a,e
		ld e,a
		ld a,c
		rl a
		add a,c
		and $0C
		rr a
		rr a
		add a,e
		ld e,a
		ld b,0
		ld c,e
		ld hl, (tpaletteseq2)
		add hl,bc
		ld d, (hl)
		ld b,$7F
		ld c, (ix+4)
		out (c),c
		out (c),d
		jr tpaletteseq2end
tpaletteseq2:
		defb $54,$44,$55,$5C,$58,$5D,$4C,$45,$4D
		defb $56,$46,$57,$5E,$40,$5F,$4E,$47,$4F
		defb $52,$42,$53,$5A,$59,$5B,$4A,$43,$4B
tpaletteseq2end:
#line 60
_cpcpalettergb__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcrnd:
#line 2
		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, cpcrndloop
		inc  hl
cpcrndloop:
		ret
#line 19
_cpcrnd__leave:
	ret
_cpcdelay:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld b, (ix+5)
		ld c, (ix+4)
cpcdelayloop:
		dec bc
		ld a,b
		or c
		jp nz,cpcdelayloop
#line 8
_cpcdelay__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	ex (sp), hl
	exx
	ret
_cpcfillram:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld b, (ix+6)
		ld d, (ix+9)
		ld e, (ix+8)
		ld h, (ix+5)
		ld l, (ix+4)
fillram:
		ld (hl),b
		inc hl
		dec de
		ld a,d
		or e
		jr nz,fillram
#line 13
_cpcfillram__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_cpcscreenmode:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld a, (ix+4)
		and $03
		ld bc,$7f80
		or c
		ld c,a
		out (c),c
#line 7
_cpcscreenmode__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	ex (sp), hl
	exx
	ret
_cpcscreensize:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld bc,$bc01
		out (c),c
		inc b
		ld a, (ix+5)
		out (c),a
		ld bc,$bc06
		out (c),c
		inc b
		ld a, (ix+7)
		out (c),a
#line 11
_cpcscreensize__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcscreenoffset:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld bc,$bc02
		out (c),c
		inc b
		ld a, (ix+5)
		out (c),a
		ld bc,$bc07
		out (c),c
		inc b
		ld a, (ix+7)
		out (c),a
#line 11
_cpcscreenoffset__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcpluspalette:
	push ix
	ld ix, 0
	add ix, sp
#line 2
		ld a, (ix+4)
		and $3F
		rl a
		ld hl,$6400
		ld l,a
		ld a, (ix+6)
		ld (hl),a
		inc hl
		ld a, (ix+7)
		ld (hl),a
#line 12
_cpcpluspalette__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcpluspalettergb:
	push ix
	ld ix, 0
	add ix, sp
#line 2
		ld a, (ix+4)
		and $3F
		rl a
		ld hl,$6400
		ld l,a
		ld a, (ix+6)
		ld b,a
		and $0F
		ld c,a
		ld a,b
		and $F0
		rr a
		rr a
		rr a
		rr a
		ld b,a
		ld a, (ix+7)
		and $0F
		rl a
		rl a
		rl a
		rl a
		or c
		ld (hl),a
		inc hl
		ld (hl),b
#line 28
_cpcpluspalettergb__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcpalette:
	push ix
	ld ix, 0
	add ix, sp
#line 1
		ld b,$7F
		ld c, (ix+5)
		out (c),c
		ld a, (ix+7)
		out (c),a
#line 6
_cpcpalette__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpcpaletteseq:
	push ix
	ld ix, 0
	add ix, sp
	ld a, (ix+7)
	ld l, a
	ld h, 0
	ex de, hl
	ld hl, __LABEL__tpaletteseq
	add hl, de
	ld b, h
	ld c, l
	ld a, (bc)
	push af
	ld a, (ix+5)
	push af
	call _cpcpalette
	jp __LABEL__tpaletteseqend
__LABEL__tpaletteseq:
#line 14
		defb $54,$44,$55,$5C,$58,$5D,$4C,$45,$4D
		defb $56,$46,$57,$5E,$40,$5F,$4E,$47,$4F
		defb $52,$42,$53,$5A,$59,$5B,$4A,$43,$4B
#line 17
__LABEL__tpaletteseqend:
_cpcpaletteseq__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	ex (sp), hl
	exx
	ret
_cpckeyboard:
#line 2
		and $0F
		or $40
		ld d,0
		ld bc,$f782
		out (c),c
		ld bc,$f40e
		out (c),c
		ld bc,$f6c0
		out (c),c
		out (c),d
		ld bc,$f792
		out (c),c
		dec b
		out (c),a
		ld b,$f4
		in a, (c)
		ld bc,$f782
		out (c),c
		dec b
		out (c),d
#line 22
_cpckeyboard__leave:
	ret
_ldirputchar:
	push ix
	ld ix, 0
	add ix, sp
#line 16
		ld d, (ix+5)
		ld e, (ix+4)
		ld h, (ix+7)
		ld l, (ix+6)
		ld b, (ix+9)
		ld c, (ix+8)
cpcldir1024bloop:
		ld a, (hl)
		ld (de),a
		inc de
		inc hl
		ld a, (hl)
		ld (de),a
		inc hl
		ex de,hl
		push de
		ld de,2047
		add hl,de
		pop de
		ex de,hl
		dec bc
		ld a,b
		or c
		jp nz,cpcldir1024bloop
#line 40
_ldirputchar__leave:
	ld sp, ix
	pop ix
	exx
	pop hl
	pop bc
	pop bc
	ex (sp), hl
	exx
	ret
_putchar:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 8
	push hl
	ld l, (ix+14)
	ld h, (ix+15)
	push hl
	ld l, (ix+8)
	ld h, (ix+9)
	ld de, 16
	call __MUL16_FAST
	ex de, hl
	pop hl
	add hl, de
	push hl
	ld l, (ix+6)
	ld h, (ix+7)
	push hl
	ld l, (ix+10)
	ld h, (ix+11)
	ex de, hl
	pop hl
	call __MUL16_FAST
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ex de, hl
	pop hl
	add hl, de
	add hl, hl
	ld de, 49152
	add hl, de
	push hl
	call _ldirputchar
_putchar__leave:
	exx
	ld hl, 12
__EXIT_FUNCTION:
	ld sp, ix
	pop ix
	pop de
	add hl, sp
	ld sp, hl
	push de
	exx
	ret
_writetext:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 0
	ld (_writetext_t2), hl
	jp __LABEL37
__LABEL40:
	ld l, (ix+16)
	ld h, (ix+17)
	push hl
	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, (_writetext_t2)
	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)
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ex de, hl
	ld hl, (_writetext_t2)
	add hl, de
	push hl
	call _putchar
__LABEL41:
	ld hl, (_writetext_t2)
	inc hl
	ld (_writetext_t2), hl
__LABEL37:
	ld l, (ix+10)
	ld h, (ix+11)
	dec hl
	ld de, (_writetext_t2)
	or a
	sbc hl, de
	jp nc, __LABEL40
__LABEL39:
_writetext__leave:
	exx
	ld hl, 14
	jp __EXIT_FUNCTION
_writebin:
	push ix
	ld ix, 0
	add ix, sp
	ld hl, 0
	ld (_writebin_t2), hl
	jp __LABEL42
__LABEL45:
	ld l, (ix+14)
	ld h, (ix+15)
	push hl
	ld l, (ix+12)
	ld h, (ix+13)
	push hl
	ld l, (ix+10)
	ld h, (ix+11)
	push hl
	ld l, (ix+8)
	ld h, (ix+9)
	push hl
	ld de, 128
	pop hl
	call __BAND16
	ld de, 128
	call __DIVU16
	ld de, 48
	add hl, de
	push hl
	ld l, (ix+6)
	ld h, (ix+7)
	push hl
	ld l, (ix+4)
	ld h, (ix+5)
	ex de, hl
	ld hl, (_writebin_t2)
	add hl, de
	push hl
	call _putchar
	ld l, (ix+8)
	ld h, (ix+9)
	add hl, hl
	ld (ix+8), l
	ld (ix+9), h
__LABEL46:
	ld hl, (_writebin_t2)
	inc hl
	ld (_writebin_t2), hl
__LABEL42:
	ld hl, 7
	ld de, (_writebin_t2)
	or a
	sbc hl, de
	jp nc, __LABEL45
__LABEL44:
_writebin__leave:
	exx
	ld hl, 12
	jp __EXIT_FUNCTION
#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 1502 "test01.bas"
#line 1 "bor16.asm"
; vim:ts=4:et:
	; FASTCALL bitwise or 16 version.
	; result in HL
; __FASTCALL__ version (operands: A, H)
	; Performs 16bit or 16bit and returns the boolean
; Input: HL, DE
; Output: HL <- HL OR DE
	
__BOR16:
		ld a, h
		or d
	    ld h, a
	
	    ld a, l
	    or e
	    ld l, a
	
	    ret 
	
#line 1503 "test01.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 1504 "test01.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 1505 "test01.bas"
	
ZXBASIC_USER_DATA:
	_writetext_t2 EQU 48898
	_writebin_t2 EQU 48898
	_seed EQU 49040
	_ee0 EQU 49042
	_ee1 EQU 49044
	_ej0 EQU 49046
	_ej1 EQU 49048
	_eex EQU 49050
	_eey EQU 49052
	_eeq EQU 49054
	_ejz EQU 49056
	; 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
