;%111LLLL1 111RRRR1 ;#df..#ff
;pop hl:ldd:ld a,(hl):ld (bc),a

chmap_4x2=chmap_old
chdata_4x2=chdata_old

	macro C2POLDFIX delta,chunk,data
_newa=(data&#0f)*#11
	if (_newa)!=_a
	if (((_newa*#101)/2)&#ff)==_a
	rlca
	else
	if _newa==(((_a*#101)/2)&#ff)
	rrca
	else
	ld a,_newa
	endif
	endif
	endif
_a=_newa
	ld (((chunk*2)+(chdata_4x2/256))*#0101+#100+delta),a
	endm

	macro C2POLDFIX2 chunk,data
	C2POLDFIX +0,chunk,data
	endm

	macro C2POLDFIX3 chunk,data
	C2POLDFIX +1,chunk,data
	endm

c2p
c2p_4x2
;44368 t полосатое (64x32)
;45170 t с фиксом (64x32)
;pop hl:ldd:ld a,(hl):ld (bc),a
	if C2PFIX
c2p_4x2_fixtop
_a=#ffff ;impossible number
	C2POLDFIX3 #1,%0100
	C2POLDFIX3 #2,%0100
	C2POLDFIX2 #5,%1000
	C2POLDFIX2 #6,%1000

	C2POLDFIX3 #3,%0101
	C2POLDFIX2 #7,%1010

	C2POLDFIX3 #9,%1101
	C2POLDFIX3 #A,%1101
	C2POLDFIX2 #D,%1110
	C2POLDFIX2 #E,%1110
	sbc a,a
_a=#ff
	C2POLDFIX3 #B,%1111
	C2POLDFIX2 #F,%1111
;193t
	;ret
	endif
	ld hl,chmap_4x2
	ld de,scrtop+(chmwid/2)-1
	call c2p_4x2_pp
	if C2PFIX
c2p_4x2_fixbottom
	xor a
_a=0
	C2POLDFIX3 #1,%0000
	C2POLDFIX2 #5,%0000

	C2POLDFIX3 #2,%0001
	C2POLDFIX3 #3,%0001
	C2POLDFIX2 #6,%0010
	C2POLDFIX2 #7,%0010

	C2POLDFIX3 #9,%0101
	C2POLDFIX2 #D,%1010

	C2POLDFIX3 #A,%0111
	C2POLDFIX3 #B,%0111
	C2POLDFIX2 #E,%1011
	C2POLDFIX2 #F,%1011
;193t
	;ret
	endif
	ld hl,chmap_4x2+#100
	ld de,scrtop+(chmwid/2)-1+#200
c2p_4x2_pp
	ld (c2p_4x2_sp),sp
	ld hx,chmhgt/4
c2p_4x2_pp0
c2p_4x2_pp1
	ld sp,hl
	ld b,d
	ld c,e
	inc b
	inc bc
	dup chmwid/2
	pop hl
	ldd
	ld a,(hl)
	ld (bc),a
	edup
	ld hl,chmwid/2+#400
	add hl,de
	ex de,hl
	ld hl,#200-chmwid
	add hl,sp
	bit 2,d
	jp nz,c2p_4x2_pp1
	ld a,e
	sub -32
	ld e,a
	sbc a,a
	and #f8
	add a,d
	ld d,a
	dec hx
	jp nz,c2p_4x2_pp0
c2p_4x2_sp=$+1
	ld sp,0
	ret

	include "c2p_singlebyte_cls.asm"
c2pgfx_4x2_add=(c2pgfx_4x2-(chdata_4x2/256))&#ff
