displaybegin=$
	if NOISECLS
copyscreen
	if NOISECLS==1
copyscreen_rnd=$+2
	ld ix,#2444
	 endif
copyscreen_lphase=$+1
	ld l,scrbuf&255
copyscreen_phase=$+2
	ld de,scrtop+scrbrim
oddline=$-1
	ld a,d
	xor 1
	ld (copyscreen_phase),a
	 if NOISECLS ;???
	ld a,l
	xor 1
	ld (copyscreen_lphase),a
	 endif
	ld h,scrbuf/256+scrbrim
	if NOISECLS==1
	ld b,scrhgt/2
	else
	ld bc,(scrhgt/2)*#100
	endif
copyscreen0
	if NOISECLS==1
	ld c,(ix)
	endif
	;
	 if NOISECLS
	dup scrwid/2
	ld a,(hl) ;+48
	ld (de),a ;+0 (+55)
	and c
	ld (hl),a ;+11
	inc h
	inc e
	ld a,(hl)
	ld (de),a ;+33
	inc h
	inc e     ;+41
	edup
	 else
	dup scrwid
	ld a,(hl) ;+23(22)
	ld (de),a ;+0 (+31)
	ld (hl),c ;+7
	inc h
	inc e
	edup
	 endif
	org $-2
	inc l
	inc d
	inc d
	;
	 if NOISECLS
	dup scrwid/2;32
	ld a,(hl) ;+48
	ld (de),a ;+0 (+55)
	and c
	ld (hl),a ;+11
	dec h
	dec e
	ld a,(hl)
	ld (de),a ;+33
	dec h
	dec e     ;+41
	edup
	 else
	dup scrwid
	ld a,(hl) ;+23(22)
	ld (de),a ;+0 (+31)
	ld (hl),c ;+7
	dec h
	dec e
	edup
	 endif
	org $-2
	inc l
	inc d
	inc d
	ld a,d
	and 6
	jp nz,dde2q
	ld a,e
	sub -32
	ld e,a
	sbc a,a
	and -8
	add a,d
	ld d,a
dde2q
	;
	 if NOISECLS==1
	inc lx
	 endif
	dec b
	jp nz,copyscreen0
	 if NOISECLS==1
	ld (copyscreen_rnd),ix
	 endif
	 if NOISECLS ;???
	bit 0,l
	ld hl,scrbuf+(scrbrim*256)
	jr z,$+2+2
	ld l,255&(scrbuf+scrhgt)
	dup scrwid
	ld (hl),b
	inc h
	edup
	org $-1
	 endif
	ret

	else ;~NOISECLS
copyscreen
	ld hl,(coltab+1) ;coltab+br1
	ld h,l
	ld (copyscreenclsdata),hl
	;di
	ld ix,scrtop+31-scrbrim
copyscreen_phase=$-1
oddline=$-1
	ld a,hx
	xor 1
	ld (copyscreen_phase),a
	ld (copyscreensp),sp
	ld l,scrbuf&#ff;+scrhgt-1
	ld c,scrhgt/4
copyscreen0
	inc ix
	ld b,4
copyscreen1
	ld sp,ix
	ld h,scrbuf/256+scrwid-1
	dup scrwid/2
	ld d,(hl)
	dec h
	ld e,(hl)
	push de
	dec h
	edup
	org $-2
	inc l;dec l
	;дальше по прерыванию в стек пишется de
	ld (ix-scrwid),e
	ld (ix-(scrwid-1)),d
	inc hx
	inc hx ;down ix
	djnz copyscreen1
	dec ix
	ld a,lx
	sub -32
	ld lx,a
	sbc a,a
	and -8
	add a,hx
	ld hx,a
	dec c
	jp nz,copyscreen0

copyscreenclsdata=$+1
	ld de,0
	;ld d,c
	;ld e,c
	ld hl,scrbuf+scrhgt
	ld b,scrwid
copyscreencls0
	ld sp,hl
	dup scrhgt/2
	push de
	edup
	inc h
	djnz copyscreencls0

copyscreensp=$+1
	ld sp,0
	
	;ei
	ret
	
	endif

	display "display size=",$-displaybegin
