t,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-d(a5),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	#$c400,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-d(a5),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	#$c400,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
*****
;------------------------------------------------
blitbgnd	blitbgnd_m
;------------------------------------------------
incnumber	incnumber_m
;------------------------------------------------
decnumber	decnumber_m
;------------------------------------------------
reset		reset_m
;------------------------------------------------
setblkr		setblkr_m

setblkl		setblkl_m

setblkd		setblkd_m

setblku		setblku_m
;------------------------------------------------
setbobr		setbobr_m

setbobl		setbobl_m

setbobu		setbobu_m

setbobd		setbobd_m

doset2		doset2_m
;------------------------------------------------
clrbobs		clrbobs_m
;------------------------------------------------
blitbobs	clr.w	speakflag-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.w	xsoft-d(a5),d6
		lsr.w	#2,d6
		and.w	#$f,d6
		waitblt
		move.l	#$ffff0000,$44(a6)
		moveq	#_nmeno-1,d7
bl1		moveq	#0,d1
		move.l	d1,nmsize1(a0)
		tst.w	nmenable(a0)
		beq	blit1
		
		lea	movjmptab(pc),a4
		move.l	nmmove(a0),d0
		add.w	d0,d0
		add.w	d0,d0
		jsr	(a4,d0.w)
		
blit1		addq.l	#4,a0
		addq.w	#2,bobno-d(a5)
		dbra	d7,bl1
		rts

		bra	wheelanim		
movjmptab	bra	move1
		bra	move1
		bra	move2
		bra	move3
		bra	move4
		bra	move5
		bra	move6
		bra	move7
		bra	move8
		bra	move9
		bra	move10
		bra	move11
		bra	move12
;------------------------------------------------
fganim		fganim_m
;------------------------------------------------
testmancoll	lea	d(pc),a5
		bsr	showenergy
	
		tst.w	deathflag-d(a5)
		bne	.death		
		tst.w	ouchflag-d(a5)
		bmi	.c2
		bne	.c1
		tst.w	defmancoll-d(a5)
		beq	.show

		sub.w	#32,energy-d(a5)
		move.w	#20,ouchflag-d(a5)

;		move.w	#1,jumpflag-d(a5)
;		clr.w	jumppos-d(a5)
;		move.w	#4,janimcount-d(a5)
;		move.w	#0,jumphold-d(a5)

		cmp.w	#4,energy-d(a5)
		bpl.s	.show
		move.w	#1,deathflag-d(a5)
		move.w	#$10,priority-d(a5)

.show		moveq	#17,d1
		move.w	actenergy-d(a5),d0
		asr.w	#4,d0
		sub.w	d0,d1
		cmp.w	#13,d1
		bpl.s	.c01
		subq.w	#1,d1
		cmp.w	#6,d1
		bpl.s	.c01	
		subq.w	#1,d1
.c01		move.w	d1,d0
		add.w	#$1c,d0
		lea	statsprpos,a0
		add.l	(_nmem).w,a0
		move.b	d0,2(a0)
		move.b	d0,10(a0)
		add.w	d1,d1
		add.w	d1,d1
		move.l	#statusspr-4,d0
		add.l	(_nmem).w,d0
		add.w	d1,d0
		lea	statsprdata,a0
		add.l	(_nmem).w,a0
		move.w	d0,6(a0)
		swap	d0
		move.w	d0,2(a0)
		swap	d0
		add.l	#(objectspr-statusspr)/2,d0
		move.w	d0,14(a0)
		swap	d0
		move.w	d0,10(a0)

.end		clr.w	defmancoll-d(a5)
		rts

.c1		tst.w	stauchflag-d(a5)
		bne	.nomove	
		lea	.tab(pc),a0
		moveq	#20,d1
		sub.w	ouchflag-d(a5),d1
		add.w	d1,d1
		move.w	(a0,d1.w),d3
		ext.l	d3
		move.l	#83*928,d0
		tst.w	animdir-d(a5)
		beq.s	.left
		move.l	#82*928,d0

		moveq	#12,d0
		moveq	#64,d1
		bsr	calcblockno

		move.w	(a0),d2
		move.w	#$fc00,d6
		move.w	#$e800,d5
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4

;		cmp.b	#10,d0
;		beq	.c4
;		move.w	-_levwidth(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.c4
;		move.w	-_levwidth*2(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.c4

		sub.l	d3,agaabsmanxpos-d(a5)
		sub.w	d3,agamanxpos-d(a5)
		subq.w	#1,ouchflag-d(a5)
		beq	.c4
		bra.s	.c3
.left		moveq	#24,d0
		moveq	#64,d1
		bsr	calcblockno

		move.w	(a0),d2
		move.w	#$fc00,d6
		move.w	#$e800,d5
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.c4

;		cmp.b	#10,d0
;		beq	.c4
;		move.w	-_levwidth(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.c4
;		move.w	-_levwidth*2(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.c4

		add.l	d3,agaabsmanxpos-d(a5)
		add.w	d3,agamanxpos-d(a5)
.nomove2	subq.w	#1,ouchflag-d(a5)
		beq.s	.c4
		bra.s	.c3

.nomove		move.l	#26*928,d0
		tst.w	animdir-d(a5)
		beq.s	.c001
		move.l	#27*928,d0
.c001		cmp.w	#8,ouchflag-d(a5)
		bmi.s	.nomove2
		cmp.w	#24,ouchflag-d(a5)
		bpl.s	.nomove2
		add.l	#928*2,d0
		bra.s	.nomove2


.c3		move.l	d0,animadr-d(a5)
		clr.w	defmancoll-d(a5)
		bra	.show
		
.c4		move.w	#-100,ouchflag-d(a5)
		clr.w	stauchflag-d(a5)
		bra.s	.c3
		
.c2		clr.w	defmancoll-d(a5)
		addq.w	#1,ouchflag-d(a5)
		bra	.show
		
		
.death		lea	.tab(pc),a0
		moveq	#20,d1
		sub.w	ouchflag-d(a5),d1
		add.w	d1,d1
		move.w	(a0,d1.w),d3
		ext.l	d3
		tst.w	animdir-d(a5)
		beq.s	.left2
		sub.l	d3,agaabsmanxpos-d(a5)
		sub.w	d3,agamanxpos-d(a5)
		bra.s	.c03
		
.left2		add.l	d3,agaabsmanxpos-d(a5)
		add.w	d3,agamanxpos-d(a5)

.c03		subq.w	#1