#NO_APP
	.text
	.even
	.globl	_newReadPixelLine8
_newReadPixelLine8:
	addw #-56,sp
	moveml #0x3822,sp@-
	movel a0,d4
	movew d0,d3
	tstl a0
	jeq L2
	tstw d2
	jeq L2
	movel #_FillRoutine,sp@(38)
	lea sp@(30),a0
	movel a0,sp@(46)
	movel a2,sp@(54)
	clrw sp@(58)
	clrw sp@(60)
	movew d0,sp@(62)
	movew d1,sp@(64)
	movew d2,sp@(66)
	movew #1,sp@(68)
	clrw sp@(70)
	movel a1,sp@(50)
	movew d0,sp@(22)
	addw d2,d3
	subqw #1,d3
	movew d3,sp@(26)
	movew d1,sp@(24)
	movew d1,sp@(28)
	movel _LayersBase,a6
	movel d4,a1
	lea sp@(22),a2
#APP
	jsr a6@(-0xd8:W)
#NO_APP
	movew sp@(70),a0
	jra L1
	.even
L2:
	lea 0:w,a0
L1:
	movel a0,d0
	moveml sp@+,#0x441c
	addw #56,sp
	rts
	.even
_FillRoutine:
	addw #-20,sp
	moveml #0x3e30,sp@-
	movel a2,a3
	movel a0@(16),a2
	movew a2@(28),a0
	movew a2@(30),d6
	movew a2@(36),d5
	addw #15,d5
	andw #-16,d5
	tstl a1@
	jeq L4
	movew a1@(14),d0
	subw a2@(32),d0
	addw d0,a0
	movew a1@(18),d0
	subw a2@(34),d0
	addw d0,d6
L4:
	movew a1@(4),d3
	movew a1@(6),d4
	movew a1@(8),d2
	subw d3,d2
	addqw #1,d2
	movew a1@(10),d1
	subw d4,d1
	addqw #1,d1
	movew d2,d0
	muls d1,d0
	addw d0,a2@(40)
	movel a3@(4),sp@(28)
	movew d3,sp@(32)
	movew d4,sp@(34)
	movew d2,sp@(36)
	movew d1,sp@(38)
	movew d6,d0
	muls d5,d0
	movel d0,a1
	lea a1@(a0:w),a0
	addl a2@(24),a0
	movel a0,sp@(40)
	lea sp@(28),a0
	jbsr _PlanarToChunkyAsm
	moveml sp@+,#0xc7c
	addw #20,sp
	rts
