,xscrflag-d(a5)
		rts

.left		move.w	xsoft-d(a5),d0
		lsr.w	#2,d0

		move.w	#103*4,d1
		sub.w	agamanxpos-d(a5),d1
		cmp.w	#4,d1
		bpl.s	.lc01
		moveq	#4,d1
.lc01		cmp.w	#8,d1
		bmi.s	.lc02
		moveq	#8,d1
.lc02		add.w	xsoft-d(a5),d1
		lsr.w	#2,d1
		and.w	#$2,d0
		and.w	#$2,d1
		cmp.w	d0,d1
		beq	.left2

		waitblt
		move.l	#-1,$44(a6)
		move.l	#$09f00000,$40(a6)
		move.w	#$0026,$64(a6)
		move.w	#(_scrwidth*3)-2,$66(a6)
		move.l	_xmem,a0
		add.l	#_ldatofs,a0
		subq.l	#2,a0
		add.l	xpos-d(a5),a0
		add.l	actyhard-d(a5),a0
		move.l	xpos-d(a5),d0
		addq.l	#2,d0
		move.l	d0,a3
		move.l	actypos-d(a5),d2

		moveq	#0,d3
		move.w	#64*_scrdepth*16+1,d4
		move.l	index-d(a5),a1
	
		cmp.l	#_levwidth*6,xsetlpos2-d(a5)
		beq	.lc3
		
		move.w	#$fc00,d6
		move.w	#$03ff,d1
		movem.l	d2/a0,-(a7)
		add.l	xsetlpos1-d(a5),a0
		add.l	xsetpos1-d(a5),d2
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,d2
		bmi.s	.lc4
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,d2
.lc4		lea	(a3,d2.l),a4
		moveq	#0,d3
		move.w	(a0),d3
		move.w	d3,d5
		and.w	d6,d5
		cmp.w	#$f000,d5
		bhi.s	.lc12
		move.w	-4(a0),d5
		and.w	d6,d5
		beq.s	.lc10
		cmp.w	#$e800,d5
		bhi.s	.lc10
		
		movem.l	d0-a6,-(a7)
		lea	-4(a0),a0
		move.l	xpos-d(a5),d0
		subq.l	#4,d0
		lsl.l	#3,d0
		move.l	actysoftabs-d(a5),d1
		and.l	#$fffffff0,d1
		add.l	xsetsoft1-d(a5),d1
		bsr	setbobl
		movem.l	(a7)+,d0-a6
		bra.s	.lc10

.lc12		movem.l	d0/d3/d2/d4/a0/a4/a5/a6,-(a7)
		move.l	xsetsoft1-d(a5),d4
		bsr	setblkl
		movem.l	(a7)+,d0/d3/d2/d4/a0/a4/a5/a6
;		moveq	#0,d3

.lc10		and.w	d1,d3
		add.l	d3,d3
		add.l	d3,d3
		move.l	(a1,d3.l),a2
		move.l	orig-d(a5),d0
		lea	(a4,d0.l),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		lea	_scrwidth(a4),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		lea	_scrwidth(a4),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		movem.l	(a7)+,d2/a0
		add.l	xsetlpos2-d(a5),a0
		add.l	xsetpos2-d(a5),d2
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,d2
		bmi.s	.lc5
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,d2
.lc5		lea	(a3,d2.l),a4
		moveq	#0,d3
		move.w	(a0),d3
		move.w	d3,d5
		and.w	d6,d5
		cmp.w	#$f000,d5
		bhi.s	.lc13
		move.w	-4(a0),d5
		and.w	d6,d5
		beq.s	.lc11
		cmp.w	#$e800,d5
		bhi.s	.lc11

		movem.l	d0-a6,-(a7)
		lea	-4(a0),a0
		move.l	xpos-d(a5),d0
		subq.l	#4,d0
		lsl.l	#3,d0
		move.l	actysoftabs-d(a5),d1
		and.l	#$fffffff0,d1
		add.l	xsetsoft2-d(a5),d1
		bsr	setbobl
		movem.l	(a7)+,d0-a6
		bra.s	.lc11

.lc13		movem.l	d0/d3/d2/d4/a0/a4/a5/a6,-(a7)
		move.l	xsetsoft2-d(a5),d4
		bsr	setblkl
		movem.l	(a7)+,d0/d3/d2/d4/a0/a4/a5/a6
;		moveq	#0,d3

.lc11		and.w	d1,d3
		add.l	d3,d3
		add.l	d3,d3
		move.l	(a1,d3.l),a2
		move.l	orig-d(a5),d0
		lea	(a4,d0.l),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		lea	_scrwidth(a4),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		lea	_scrwidth(a4),a4
		waitblt
		move.l	a2,$50(a6)
		move.l	a4,$54(a6)
		move.w	d4,$58(a6)
		
		addq.l	#8,xsetsoft1-d(a5)
		addq.l	#8,xsetsoft1-d(a5)
		add.l	#_levwidth,xsetlpos1-d(a5)
		add.l	#_scrwidth*_scrdepth*3*16,xsetpos1-d(a5)
		subq.l	#8,xsetsoft2-d(a5)
		subq.l	#8,xsetsoft2-d(a5)
		sub.l	#_levwidth,xsetlpos2-d(a5)
		sub.l	#_scrwidth*_scrdepth*3*16,xsetpos2-d(a5)

.lc3		subq.l	#1,absxpos-d(a5)
		tst.l	absxpos-d(a5)
		bpl.s	.lc2
		add.l	#320,absxpos-d(a5)
.lc2		addq.w	#1,xscrflag-d(a5)

.left2		move.w	#103*4,d1
		sub.w	agamanxpos-d(a5),d1
		cmp.w	#4,d1
		bpl.s	.lc03
		moveq	#4,d1
.lc03		cmp.w	#8,d1
		bmi.s	.lc04
		moveq	#8,d1
.lc04		ext.l	d1
		sub.l	d1,agaxsoftabs-d(a5)
		add.w	d1,xsoft-d(a5)
		cmp.w	#64,xsoft-d(a5)
		bmi.s	.lc7
		sub.w	#64,xsoft-d(a5)
		subq.l	#2,xpos-d(a5)
.lc7		add.w	d1,agamanxpos-d(a5)
		move.w	agamanxpos-d(a5),d0
		lsr.w	#2,d0
		move.w	d0,manxpos-d(a5)
		move.l	agaabsmanxpos-d(a5),d0
		lsr.l	#2,d0
		move.l	d0,absmanxpos-d(a5)
		move.l	agaxsoftabs-d(a5),d0
		lsr.l	#2,d0
		move.l	d0,xsoftabs-d(a5)
		
		rts
		

.end		rts
*****
;------------------------------------------------
decnumber	decnumber_m
;------------------------------------------------
reset		reset_m
;------------------------------------------------
scrolly		lea	d(pc),a5
		tst.w	yscrflag-d(a5)
		beq	.end
		bpl	.down
.up		move.l	scycount-d(a5),d0
		sub.l	d0,ysoftabs-d(a5)
		sub.l	d0,yscrollofs-d(a5)
		sub.w	d0,ysoft-d(a5)
;		add.w	d0,manypos
		move.l	scyhard-d(a5),d0
		sub.l	d0,ypos-d(a5)
		bpl.s	.uc2
		add.l	#_scrwidth*_scrdepth*3*_scrheight,ypos-d(a5)
		add.w	#_scrheight,ysoft-d(a5)

.uc2		
		move.l	scycount-d(a5),d0
		sub.w	d0,ysetsoft-d(a5)
		tst.w	ysetsoft-d(a5)
		bpl.s	.uc1
		addq.w	#4,ysetsoft-d(a5)
		sub.l	#_scrwidth*_scrdepth*3*4,ysetbd-d(a5)
		tst.l	ysetbd-d(a5)
		bpl.s	.uc5
		add.l	#_scrwidth*_scrdepth*3*_scrheight,ysetbd-d(a5)
.uc5		sub.l	#40*_scrdepth*4,ysetlpos-d(a5)
		tst.l	ysetlpos-d(a5)
		bpl.s	.uc1
		add.l	#40*_scrdepth*16,ysetlpos-d(a5)
		sub.l	#_levwidth,yhard-d(a5)
		sub.l	#_scrwidth*_scrdepth*3*16,yshard-d(a5)
		bpl.s	.uc1
		add.l	#_scrwidth*_scrdepth*3*_scrheight,yshard-d(a5)
.uc1		
		waitblt
		move.l	#-1,$44(a6)
		move.l	#$09f00000,$40(a6)
		move.w	#$0026,$64(a6)
		move.w	#(_scrwidth*3)-2,$66(a6)
		move.l	_xmem,a0
		add.l	#_ldatofs,a0
		subq.l	#4,a0
		add.l	xpos-d(a5),a0
		add.l	yhard-d(a5),a0
		add.l	#_levwidth,a0
		move.l	yshard-d(a5),d0
		move.l	ysetbd-d(a5),a3
		add.l	#_scrwidth*_scrdepth*3*16,a3
		add.l	#_scrwidth*_scrdepth*3*16,d0
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,a3
		bmi.s	.uc3
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a3
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,d0
.uc3		add.l	orig-d(a5),a3
		add.l	xpos-d(a5),a3
		add.l	xpos-d(a5),d0
		move.l	a3,a4
		moveq	#0,d3
		move.w	#64*_scrdepth*4+1,d4
		move.l	index-d(a5),a1
		move.w	#$03ff,d1
		move.w	#$fc00,d6
		moveq	#0,d2
		moveq	#(_scrwidth/2)-1,d7
.ul1		moveq	#0,d3
		move.w	(a0),d3
		move.w	d3,d5
		and.w	d6,d5
		beq.s	.uc4

		cmp.w	#$f000,d5
		bhi.s	.uc6
		cmp.w	#$e800,d5
		bhi.s	.uc4
		
		movem.l	d0-a6,-(a7)
		move.l	xpos-d(a5),d0
		addq.l	#4,d0
 		lsl.l	#3,d0
		add.l	d2,d0
		move.l	ysoftabs-d(a5),d1
		and.l	#$fffffff0,d1
		bsr	setbobu
		movem.l	(a7)+,d0-a6
		bra.s	.uc4
		
.uc6		movem.l	d0/d4/d5/d6/d3/a0/a5/a6,-(a7)
		bsr	setblku
		movem.l	(a7)+,d0/d4/d5/d6/d3/a0/a5/a6
;		moveq	#0,d3

.uc4		and.w	d1,d3
		add.l	d3,d3
		add.l	d3,d3
		move.l	(a1,d3.l),a2
		add.l	ysetlpos-d(a5),a2
		waitblt
		move.l	a2,$50(a6)
		move.l	a3,$54(a6)
		move.w	d4,$58(a6)
		addq.l	#2,a3
		addq.l	#8,d2
		addq.l	#8,d2
		addq.l	#2,a0
		addq.l	#2,d0
		dbra	d7,.ul1
		
		lea	_scrwidth(a4),a3
		waitblt
		move.w	#_scrwidth*2,$64(a6)
		move.w	#_scrwidth*2,$66(a6)
		move.l	a4,$50(a6)
		move.l	a3,$54(a6)
		
		move.w	#64*_scrdepth*4+(_scrwidth/2),$58(a6)
		lea	_scrwidth(a3),a3
		waitblt
		move.l	a4,$50(a6)
		move.l	a3,$54(a6)
		move.w	#64*_scrdepth*4+(_scrwidth/2),$58(a6)

		addq.w	#1,yscrflag-d(a5)
		move.l	scycount-d(a5),d0
		rts


.down		waitblt
		move.l	#-1,$44(a6)
		move.l	#$09f00000,$40(a6)
		move.w	#$0026,$64(a6)
		move.w	#(_scrwidth*3)-2,$66(a6)
		move.l	_xmem,a0
		add.l	#_ldatofs,a0
		add.l	#_levwidth*((_viewheight+16)/16)-4,a0
		add.l	xpos-d(a5),a0
		add.l	yhard-d(a5),a0
		move.l	ysetbd-d(a5),a3
		move.l	yshard-d(a5),d0
		add.l	#_scrwidth*_scrdepth*3*(_viewheight+16),a3
		add.l	#_scrwidth*_scrdepth*3*(_viewheight+16),d0
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,a3
		bmi.s	.dc3
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a3
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,d0
.dc3		add.l	orig-d(a5),a3
		add.l	xpos-d(a5),a3
		add.l	xpos-d(a5),d0
		move.l	a3,a4
		moveq	#0,d3
		move.w	#64*_scrdepth*4+1,d4
		move.l	index-d(a5),a1
		move.w	#$03ff,d1
		moveq	#0,d2
		move.w	#$fc00,d6
		moveq	#(_scrwidth/2)-1,d7
.dl1		moveq	#0,d3
		move.w	(a0),d3
		move.w	d3,d5
		and.w	d6,d5
		beq.s	.dc4

		cmp.w	#$f000,d5
		bhi.s	.dc6
		cmp.w	#$e800,d5
		bhi.s	.dc4
		
		movem.l	d0-a6,-(a7)
		move.l	xpos-d(a5),d0
		addq.l	#4,d0
		lsl.w	#3,d0
		add.l	d2,d0
		move.l	ysoftabs-d(a5),d1
		and.l	#$fffffff0,d1
		add.l	#224,d1
		bsr	setbobd
		movem.l	(a7)+,d0-a6
		bra.s	.dc4
		
.dc6		movem.l	d0/d4/d5/d6/d3/a0/a5/a6,-(a7)
		bsr	setblkd
		movem.l	(a7)+,d0/d4/d5/d6/d3/a0/a5/a6
;		moveq	#0,d3

.dc4		and.w	d1,d3
		add.l	d3,d3
		add.l	d3,d3
		move.l	(a1,d3.l),a2
		add.l	ysetlpos-d(a5),a2
		waitblt
		move.l	a2,$50(a6)
		move.l	a3,$54(a6)
		move.w	d4,$58(a6)
		addq.l	#2,a3
		addq.l	#8,d2
		addq.l	#8,d2
		addq.l	#2,a0
		addq.l	#2,d0
		dbra	d7,.dl1

		lea	_scrwidth(a4),a3
		waitblt
		move.w	#_scrwidth*2,$64(a6)
		move.w	#_scrwidth*2,$66(a6)
		move.l	a4,$50(a6)
		move.l	a3,$54(a6)
		move.w	#64*_scrdepth*4+(_scrwidth/2),$58(a6)
		lea	_scrwidth(a3),a3
		waitblt
		move.l	a4,$50(a6)
		move.l	a3,$54(a6)
		move.w	#64*_scrdepth*4+(_scrwidth/2),$58(a6)
		
		move.l	scycount-d(a5),d0
		add.l	d0,yscrollofs-d(a5)
		add.l	d0,ysoftabs-d(a5)
		add.w	d0,ysoft-d(a5)
;		sub.w	d0,manypos
		move.l	scyhard-d(a5),d0
		add.l	d0,ypos-d(a5)
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,ypos-d(a5)
		bmi.s	.dc1
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,ypos-d(a5)
		sub.w	#_scrheight,ysoft-d(a5)
.dc1		subq.w	#1,yscrflag-d(a5)


		move.l	scycount-d(a5),d0
		add.w	d0,ysetsoft-d(a5)
		cmp.w	#4,ysetsoft-d(a5)
		bmi.s	.dc2
		subq.w	#4,ysetsoft-d(a5)
		add.l	#_scrwidth*_scrdepth*3*4,ysetbd-d(a5)
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,ysetbd-d(a5)
		bmi.s	.dc5
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,ysetbd-d(a5)
.dc5		add.l	#40*_scrdepth*4,ysetlpos-d(a5)
		cmp.l	#40*_scrdepth*16,ysetlpos-d(a5)
		bmi.s	.dc2
		sub.l	#40*_scrdepth*16,ysetlpos-d(a5)
		add.l	#_levwidth,yhard-d(a5)
		add.l	#_scrwidth*_scrdepth*3*16,yshard-d(a5)
		cmp.l	#_scrwidth*_scrdepth*3*_scrheight,yshard-d(a5)
		bmi.s	.dc2
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,yshard-d(a5)
.dc2		rts

.end		rts
*****
;------------------------------------------------
blitbobs	move.l	#-1,baddr-d(a5)
		clr.w	touchflag-d(a5)
		clr.w	touchtext-d(a5)
		clr.w	bobstand-d(a5)
		clr.w	bobno-d(a5)
		clr.w	nocopflag-d(a5)
		move.l	absmanxpos-d(a5),d0
		add.w	#74,d0
		move.w	d0,manxstrt-d(a5)
		add.w	#16,d0
		move.w	d0,manxstop-d(a5)
		move.l	absmanypos-d(a5),d0
		add.w	#24,d0
		move.w	d0,manystrt-d(a5)
		add.w	#44,d0
		move.w	d0,manystop-d(a5)
		tst.w	duckpos-d(a5)
		beq.s	.c1
		sub.w	#24,d0
		move.w	d0,manystrt-d(a5)
.c1		move.l	nm-d(a5),a0
		move.l	multab-d(a5),a1
		move.l	bmultab-d(a5),a2
		move.l	smultab-d(a5),a3
		move.