#NO_APP
	.text
	.even
_copyonepixel:
	moveml #0x3e00,sp@-
	movel sp@(24),a0
	movel sp@(28),d3
	movel sp@(32),a1
	movel sp@(36),d2
	movel sp@(40),d5
	clrl d4
	tstl a0
	jeq L3
	moveb #1,d4
	moveq #-1,d0
	cmpl a0,d0
	jeq L3
	movel d3,d0
	notl d0
	moveq #7,d1
	andl d1,d0
	moveb #1,d1
	lsll d0,d1
	lsrl #3,d3
	moveb a0@(d3:l),d0
	andb d1,d0
	sne d0
	moveb d0,d4
	extbl d4
	negl d4
L3:
	movel d2,d3
	lsrl #3,d3
	notl d2
	moveq #7,d0
	andl d0,d2
	moveb #1,d0
	lsll d2,d0
	moveb d0,d1
	moveb a1@(d3:l),d2
	moveb d2,d0
	andb d1,d0
	sne d0
	extbl d0
	negl d0
	clrw d6
	btst #4,d5
	jeq L6
	tstl d4
	jne L6
	tstl d0
	jeq L19
	.even
L6:
	btst #5,d5
	jeq L8
	tstl d4
	jne L8
	tstl d0
	jne L20
	.even
L8:
	btst #6,d5
	jeq L10
	tstl d4
	jeq L10
	tstl d0
	jeq L21
	.even
L10:
	tstb d5
	jge L12
	tstl d4
	jeq L12
	tstl d0
	jeq L12
	.even
L16:
	orb d1,d2
	jra L17
	.even
L12:
	tstw d6
	jne L16
	notb d1
	andb d1,d2
	jra L17
	.even
L21:
	moveq #1,d6
	jra L10
	.even
L20:
	moveq #1,d6
	jra L8
	.even
L19:
	moveb #1,d6
	jra L6
	.even
L17:
	moveb d2,a1@(d3:l)
	moveml sp@+,#0x7c
	rts
	.even
	.globl	_NewBltBitMap
_NewBltBitMap:
	addw #-68,sp
	moveml #0x3f3e,sp@-
	movel a0,sp@(108)
	movel d0,a4
	movel d1,sp@(104)
	movel a1,sp@(100)
	movel d2,a5
	movel d3,sp@(96)
	movel d4,a3
	movel d5,sp@(92)
	movel d6,sp@(88)
	movel d7,sp@(84)
	movel a2,sp@(80)
	tstw a0@(6)
	jne L24
	tstw a1@(6)
	jeq L23
L24:
	jbsr _oldBltBitMap
L25:
	movel sp@(76),d0
	jra L22
	.even
L23:
	movel _GfxBase,a6
	moveq #8,d1
#APP
	jsr a6@(-0x3c0:W)
#NO_APP
	movel d0,d4
	movel _GfxBase,a6
	movel sp@(100),a0
	moveq #8,d1
#APP
	jsr a6@(-0x3c0:W)
#NO_APP
	movel d0,d3
	clrl sp@(64)
	movel _GfxBase,a6
	movel sp@(108),a0
	moveq #4,d1
#APP
	jsr a6@(-0x3c0:W)
#NO_APP
	movel d0,sp@(68)
	movel _GfxBase,a6
	movel sp@(100),a0
	moveq #4,d1
#APP
	jsr a6@(-0x3c0:W)
#NO_APP
	cmpl sp@(68),d0
	jcc L26
	movel d0,sp@(68)
L26:
	tstl a4
	jlt L73
	tstl sp@(104)
	jlt L74
L28:
	movel sp@(104),d1
	addl sp@(92),d1
	movel sp@(108),a0
	movew a0@(2),d2
	clrl d0
	movew d2,d0
	cmpl d0,d1
	jle L29
	clrw sp@(92)
	movew d2,sp@(94)
	movel sp@(104),d0
	subl d0,sp@(92)
L29:
	movel sp@(96),d1
	addl sp@(92),d1
	movel sp@(100),a0
	movew a0@(2),d2
	clrl d0
	movew d2,d0
	cmpl d0,d1
	jle L30
	clrw sp@(92)
	movew d2,sp@(94)
	movel sp@(96),d0
	subl d0,sp@(92)
L30:
	lea a4@(0,a3:l),a0
	cmpl a0,d4
	jhi L31
	movel d4,a3
	subl a4,a3
L31:
	lea a5@(0,a3:l),a0
	cmpl a0,d3
	jhi L32
	movel d3,a3
	subl a5,a3
L32:
	tstl sp@(92)
	jle L70
	tstl a3
	jle L70
	tstl sp@(84)
	jeq L70
	clrl sp@(76)
	clrl sp@(72)
	clrl d2
	cmpl sp@(68),d2
	jcc L25
	clrl sp@(56)
	movel sp@(108),a0
	addql #8,a0
	movel a0,sp@(44)
	movel sp@(100),d7
	addql #8,d7
	clrl sp@(48)
	.even
L60:
	movel d7,a6
	movel a6@,d1
	jeq L37
	moveq #-1,d0
	cmpl d1,d0
	jeq L37
	moveq #1,d0
	movel sp@(72),d2
	lsll d2,d0
	andl sp@(84),d0
	jeq L37
	addql #1,sp@(76)
	clrl d6
	tstl sp@(92)
	jls L37
	clrl sp@(60)
	clrl sp@(52)
	.even
L59:
	movel sp@(104),d0
	addl d6,d0
	movel sp@(108),a6
	movew a6@,d4
	movew d4,sp@(62)
	mulsl sp@(60),d0
	movel sp@(44),a0
	movel a0@,d3
	addl d0,d3
	movel sp@(96),d0
	addl d6,d0
	movel sp@(100),a6
	movew a6@,d5
	movew d5,sp@(58)
	mulsl sp@(56),d0
	movel d1,d2
	addl d0,d2
	cmpl d3,d2
	jcs L45
	movew d4,sp@(54)
	movel sp@(52),d0
	addl d3,d0
	cmpl d0,d2
	jcs L44
L45:
	cmpl d2,d3
	jcs L43
	movew d5,sp@(50)
	movel sp@(48),d0
	addl d2,d0
	cmpl d0,d3
	jcs L44
L43:
	lea 0:w,a2
	tstl a3
	jls L42
	lea _copyonepixel,a6
	.even
L58:
	movel sp@(88),sp@-
	pea a5@(a2:l)
	movel d2,sp@-
	pea a4@(a2:l)
	movel d3,sp@-
	jbsr a6@
	addw #20,sp
	addql #1,a2
	cmpl a3,a2
	jcs L58
L42:
	addql #1,d6
	cmpl sp@(92),d6
	jcc L37
	movel d7,a0
	movel a0@,d1
	jra L59
	.even
L70:
	clrl d0
	jra L22
	.even
L44:
	tstl sp@(64)
	jeq L75
L46:
	movel _SysBase,a6
	movel d3,a0
	movel sp@(64),a1
	clrl d0
	movew d4,d0
#APP
	jsr a6@(-0x270:W)
#NO_APP
	lea 0:w,a2
	tstl a3
	jls L42
	lea _copyonepixel,a6
	.even
L53:
	movel sp@(88),sp@-
	pea a5@(a2:l)
	movel d2,sp@-
	pea a4@(a2:l)
	movel sp@(80),sp@-
	jbsr a6@
	addw #20,sp
	addql #1,a2
	cmpl a3,a2
	jcc L42
	movel sp@(88),sp@-
	pea a5@(a2:l)
	movel d2,sp@-
	pea a4@(a2:l)
	movel sp@(80),sp@-
	jbsr a6@
	addw #20,sp
	addql #1,a2
	cmpl a3,a2
	jcs L53
	jra L42
	.even
L75:
	movel sp@(80),sp@(64)
	jeq L76
L48:
	tstl sp@(64)
	jeq L70
	movel sp@(108),a0
	movew a0@,d4
	jra L46
	.even
L74:
	movel sp@(104),d0
	subl d0,sp@(96)
	addl d0,sp@(92)
	clrl sp@(104)
	jra L28
	.even
L73:
	subl a4,a5
	addl a4,a3
	lea 0:w,a4
	tstl sp@(104)
	jge L28
	jra L74
	.even
L37:
	addql #1,sp@(72)
	addql #4,d7
	addql #4,sp@(44)
	movel sp@(72),d0
	cmpl sp@(68),d0
	jcs L60
	tstl sp@(64)
	jeq L25
	tstl sp@(80)
	jne L25
	movel _SysBase,a6
	movel sp@(64),a1
	movel sp@(108),a0
	clrl d0
	movew a0@,d0
#APP
	jsr a6@(-0xd2:W)
#NO_APP
	jra L25
	.even
L76:
	movel _SysBase,a6
	clrl d0
	movew d4,d0
	clrl d1
#APP
	jsr a6@(-0xc6:W)
#NO_APP
	movel d0,sp@(64)
	jra L48
	.even
L22:
	moveml sp@+,#0x7cfc
	addw #68,sp
	rts
