.w	nmactypos(a0),d1
		asr.w	#1,d1
		bsr	calcnmblock
		move.w	(a1),d1
		and.w	#$fc00,d1
		cmp.w	#$0c00,d1
		bne.s	.hc2
		clr.w	nmxspeed(a0)
		bra.s	.c2

.hc2		cmp.w	#$e800,d1
		bne.s	.hc1
		move.w	nmxspeed(a0),d0
		asr.w	#2,d0
		neg.w	d0
		move.w	d0,nmxspeed(a0)

		bra.s	.c2
		
.hc1		tst.w	nmyspeed(a0)
		bne.s	.c2
		addq.w	#4,nmxspeed(a0)
		bmi.s	.c2
		clr.w	nmxspeed(a0)

.c2		

.ret		move.w	nmactypos(a0),d0
		lsr.w	#1,d0
		add.w	nmypos+2(a0),d0
		move.w	nmypos(a0),nmydir+2(a0)
		move.w	d0,nmypos(a0)
		
.ret01		tst.w	nmactypos+2(a0)
		beq.s	.ret02
		move.w	nmypos(a0),lorrypos-d(a5)

.ret02		tst.w	nmanimpos(a0)
		beq.s	.ret2

		move.w	nmypos(a0),d0
		sub.w	#56,d0
		ext.l	d0
		move.l	absmanypos-d(a5),d1
		move.l	d0,absmanypos-d(a5)
		sub.l	d1,d0
		add.w	d0,manypos-d(a5)
		
		move.w	nmxpos(a0),d0
		sub.w	#56,d0
		ext.l	d0
		add.l	d0,d0
		add.l	d0,d0
		move.l	agaabsmanxpos-d(a5),d1
		move.l	d0,agaabsmanxpos-d(a5)
		sub.l	d1,d0
		add.w	d0,agamanxpos-d(a5)

.ret2		movem.l	(a7)+,a1/a2
		bsr	maskblitxy
		rts


m3phase		dc.w	0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8
		dc.w	16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24
m3ofs		dc.w	12,12,13,13,13,13,13,13,14,14,14,14,14,14,14,14
		dc.w	16,16,16,16,16,16,16,16,17,17,18,18,19,19,19,19
		
m3phase2	dc.w	24,24,24,24,24,24,16,16,16,16,16,16,16,16,16,16
		dc.w	8,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0
m3ofs2		dc.w	25,25,26,26,19,19,20,20,21,21,22,22,22,22,22,22
		dc.w	24,24,24,24,16,16,16,16,16,16,18,18,18,18,18,18

m3phase3	dc.w	48,48,48,48,48,40,40,40,40,40,40,40,40,40,40,40
		dc.w	32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,0
m3ofs3		dc.w	19,19,19,19,18,18,17,17,16,16,16,16,16,16,16,16
		dc.w	14,14,14,14,14,14,14,14,13,13,13,13,13,13,12,12

m3phase4	dc.w	0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32
		dc.w	40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48
m3ofs4		dc.w	18,18,18,18,18,18,16,16,16,16,16,16,24,24,24,24
		dc.w	22,22,22,22,22,22,21,21,20,20,19,19,26,26,25,25
		
m3phasetab	dc.l	0*160+4,31
		dc.l	0*160+10,33
		dc.l	0*160+16,35
		dc.l	0*160+22,36
		dc.l	36*160+22,33
		dc.l	35*160+16,35
		dc.l	33*160+10,36

;------------------------------------------------
move4		tst.w	textflag-d(a5)
		bne	maskblitxy
		tst.w	nmstartflag(a0)
		beq.s	.c3
		clr.w	nmstartflag(a0)
		move.w	#3,nmenable+2(a0)
		
.c3		move.w	#1,nmnoreset(a0)
		movem.l	d0/d1/a1/a2,-(a7)
		tst.w	nmcoll(a0)
		beq.s	.c1
		tst.w	nmenable+2(a0)
		beq.s	.c4
		bsr	backdrop
		bra	.ret
.c4		bsr	falling_down2
		bra	.ret
		
.c1		tst.w	nmxdir(a0)
		bne	.right
.left		moveq	#0,d0
		move.w	nmxpos(a0),d0
		subq.w	#6,d0
		lsr.w	#4,d0
		add.w	d0,d0
		subq.w	#8,d0
		move.w	nmypos(a0),d1
		lsr.w	#4,d1
		addq.w	#3,d1
		mulu	#_levwidth,d1
		add.l	d1,d0
		move.l	_xmem,a1
		add.l	ldatofs-d(a5),a1
		lea	blocktab-d(a5),a2
		move.w	-2(a1,d0.l),d1
		move.w	d1,d0
		and.w	#$fc00,d0
		cmp.w	#$e800,d0
		beq.s	.lc1
		and.w	#$3ff,d1
		cmp.b	#1,(a2,d1.w)
		beq.s	.lc1
		
.lturn		move.w	#1,nmxdir(a0)
.lc1		and.w	#$fff0,nmypos(a0)
		clr.l	nmyspeed(a0)
		lea	.ltab(pc),a2
		
		eor.w	#1,nmanimcount(a0)
		move.w	nmanimcount(a0),d0
		sub.w	d0,nmxpos(a0)
		bra	.end
		
.right		moveq	#0,d0
		move.w	nmxpos(a0),d0
		addq.w	#3,d0
		lsr.w	#4,d0
		add.w	d0,d0
		subq.w	#4,d0
		move.w	nmypos(a0),d1
		lsr.w	#4,d1
		addq.w	#3,d1
		mulu	#_levwidth,d1
		add.l	d1,d0
		move.l	_xmem,a1
		add.l	ldatofs-d(a5),a1
		lea	blocktab-d(a5),a2
		move.w	2(a1,d0.l),d1
		move.w	d1,d0
		and.w	#$fc00,d0
		cmp.w	#$e800,d0
		beq.s	.rc1
		and.w	#$3ff,d1
		cmp.b	#1,(a2,d1.w)
		beq.s	.rc1
		
.rturn		clr.w	nmxdir(a0)
.rc1		and.w	#$fff0,nmypos(a0)
		clr.l	nmyspeed(a0)
		lea	.rtab(pc),a2
		
		eor.w	#1,nmanimcount(a0)
		move.w	nmanimcount(a0),d0
		add.w	d0,nmxpos(a0)

.end		move.w	nmanimpos(a0),d0
		lsr.w	#1,d0
		and.w	#$fffc,d0
		move.l	(a2,d0.w),nmdata(a0)
		addq.w	#1,nmanimpos(a0)
		cmp.w	#48,nmanimpos(a0)
		bmi.s	.ret
		clr.w	nmanimpos(a0)
.ret		movem.l	(a7)+,d0/d1/a1/a2
		bsr	maskblitxy
		
		move.w	mancoll-d(a5),d0
		or.w	d0,defmancoll-d(a5)
		rts
		

.ltab		dc.l	80*160,80*160+4,80*160+8,80*160+12,80*160+16,80*160+20
.rtab		dc.l	128*160,128*160+4,128*160+8,128*160+12,128*160+16,128*160+20
;------------------------------------------------
move5		tst.w	textflag-d(a5)
		bne	maskblitxy
		movem.l	a1,-(a7)
		
		tst.w	nmxdir(a0)
		bne.s	.c1
		move.w	#-1,nmxdir(a0)
		bra	.left
.c1		bpl	.right
.left		moveq	#0,d0
		add.w	nmxpos(a0),d0
		moveq	#16,d1
		add.w	nmypos(a0),d1
		bsr	calcnmblock
		cmp.b	#1,d0
		beq.s	.chgright
		move.w	(a1),d1
		and.w	#$fc00,d1
		cmp.w	#$e800,d1
		bne.s	.end
.chgright	move.w	#1,nmxdir(a0)
		bra.s	.end
		
.right		moveq	#64,d0
		add.w	nmxpos(a0),d0
		moveq	#16,d1
		add.w	nmypos(a0),d1
		bsr	calcnmblock
		cmp.b	#1,d0
		beq.s	.chgleft
		move.w	(a1),d1
		and.w	#$fc00,d1
		cmp.w	#$e800,d1
		bne.s	.end
.chgleft	move.w	#-1,nmxdir(a0)

.end		bsr	teststand2
		eor.w	#1,nmanimcount(a0)
		bne.s	.c2
		move.w	nmxdir(a0),d0
		add.w	d0,nmxpos(a0)
		tst.w	d1
		beq.s	.c2
		ext.l	d0
		add.l	d0,d0
		add.l	d0,d0
		add.l	d0,agaabsmanxpos-d(a5)
		add.w	d0,agamanxpos-d(a5)
.c2		move.l	#28,nmdata(a0)
		movem.l	(a7)+,a1
		bsr	maskblitxy
		rts
;------------------------------------------------
move6		move.w	#1,nmobj(a0)
		move.l	#36,nmdata(a0)
		bsr	maskblit
		tst.w	mancoll-d(a5)
		beq.s	.ret
		clr.w	mancoll-d(a5)
		move.w	#1,touchflag-d(a5)
		move.l	#objectspr+1*4*16,touchdata-d(a5)
		move.w	#1,touchtext-d(a5)
		move.w	#1,touchtext2-d(a5)
		move.l	a0,touchpos-d(a5)
.ret		rts
;------------------------------------------------
move7		move.w	#2,nmobj(a0)
		move.l	#nrmbobs+20,nmdata(a0)
		moveq	#0,d5
		move.w	nmstartxpos(a0),d0
		sub.w	#16,d0
		move.w	d0,nmxpos(a0)
		move.w	nmstartypos(a0),d0
		sub.w	#16,d0
		move.w	d0,nmypos(a0)
		bsr	normblit
		tst.w	mancoll-d(a5)
		beq.s	.ret
		clr.w	mancoll-d(a5)
		move.w	#1,touchflag-d(a5)
		move.l	#objectspr+1*4*16,touchdata-d(a5)
		move.w	#2,touchtext-d(a5)
		move.w	#2,touchtext2-d(a5)
		move.l	a0,touchpos-d(a5)
.ret		rts
;------------------------------------------------
move8		move.l	a1,-(a7)
		move.l	nmstartblk(a0),a1
		or.w	#$e800,-_levwidth(a1)
		move.l	(a7)+,a1
		move.w	#3,nmobj(a0)
		move.l	#4+32*160,nmdata(a0)
		move.w	nmstartxpos(a0),d0
		sub.w	#16,d0
		move.w	d0,nmxpos(a0)
		move.w	nmstartypos(a0),d0
		sub.w	#16,d0
		move.w	d0,nmypos(a0)
		bsr	maskblit
		tst.w	mancoll-d(a5)
		beq.s	.ret
		clr.w	mancoll-d(a5)
		move.w	#1,touchflag-d(a5)
		move.l	#objectspr+1*4*16,touchdata-d(a5)
		move.w	#3,touchtext-d(a5)
		move.w	#3,touchtext2-d(a5)
		move.l	a0,touchpos-d(a5)
.ret		rts
;------------------------------------------------
setboba1	movem.l	d1/a2,-(a7)
		move.l	nm(pc),a1
		moveq	#_nmeno-1,d1
.l1		tst.w	nmenable(a1)
		beq.s	.c1
		addq.l	#4,a1
		dbra	d1,.l1
		bra	.end

.c1		move.w	#1,nmenable(a1)
		move.w	#1,nmstartflag(a1)
		moveq	#0,d1
		move.l	d1,nmanimpos(a1)
		move.l	d1,nmanimcount(a1)
		move.w	d1,nmcoll(a1)
		move.w	d1,nmdieyspd+2(a1)
		move.w	d1,nmobj(a1)
		move.l	d1,nmxdir(a1)
		move.l	d1,nmlevxadd(a1)
		move.l	d1,nmlevyadd(a1)
		move.w	d1,nmdieyspd(a1)
		move.l	d1,nmxspeed(a1)
		move.l	d1,nmyspeed(a1)
		move.w	d1,nmstartno(a1)
		add.w	d2,d2
		add.w	d2,d2
		move.l	_xmem,d1
		add.l	ldatofs-d(a5),d1
		move.l	d1,nmstartblk(a1)
		
		lea	movetab-d(a5),a2
		move.l	(a2,d2.w),nmmove(a1)
		lea	nmxsizetab-d(a5),a2
		move.w	(a2,d2.w),nmxsize(a1)
		lea	nmysizetab-d(a5),a2
		move.w	(a2,d2.w),nmysize(a1)
		lea	nmxcentertab-d(a5),a2
		move.l	(a2,d2.w),nmxcenter(a1)
		lea	nmycentertab-d(a5),a2
		move.l	(a2,d2.w),nmycenter(a1)
		lea	nmxhittab-d(a5),a2
		move.l	(a2,d2.w),nmxhit(a1)
		lea	nmyhittab-d(a5),a2
		move.l	(a2,d2.w),nmyhit(a1)

.end		movem.l	(a7)+,d1/a2
		rts
;------------------------------------------------
;------------------------------------------------
;------------------------------------------------
nm		dc.l	0

invnotab	dc.w	6,7,8

;		dc.w	7,9,10,11,12,14,15,16
;		dc.w	17,18,19,20,21,22,23,24
;		dc.w	25,26,27,28,29,30

movetab		dc.l	1,2,3,4,5,6,7,8

		dc.l	9,10,12,13,14,15,16,17
		dc.l	18,19,20,21,22,23,24,25
		dc.l	26,27,28,29,30,31,32,33
		dc.l	34,35,36,37,38,39,40,41
		
;	01 .. Türrahmen
;	02 .. Tür
;	03 .. Lore (Krainer)
;	04 .. Skelett
;	05 .. automobiler Schwan
;	06 .. Stein
;	07 .. Kerbe
;	08 .. Barriere

;	09 .. Kübel
;	10 .. Luckertes Boot
;	11 .. Teerkübel
;	12 .. Tragekorb
;	13 .. Wurm
;	14 .. Kurbel
;	15 .. Holz
;	16 .. Feuersteine
;	17 .. Hammer
;	18 .. Kerzen
;	19 .. Schlüssel
;	20 .. Kristall
;	21 .. Paddel
;	22 .. kaputte Winde
;	23 .. Winde
;	24 .. Feuerstelle
; 	25 .. Brunnen
;	26 .. Nägel
;	27 .. Seil
;	28 .. Schlucht
;	29 .. Herunterhängendes Seil
;	30 .. Repariertes Boot
;	31 .. Insekt
;	32 .. Insektenschuß
;	33 .. Sumpfmonster rechts
;	34 .. Sumpfmonster links
;	35 .. Code für Copper aus
;	36 .. Spuckendes Viech
;	37 .. Tropfen
;	38 .. Energie
;	39 .. Leben
;	40 .. kleiner Fisch
		
ofsxtab		dc.l	48*$10000+2,48*$10000+2,32*$10000+4,32*$10000+2,16*$10000+6,0,0,0

ofsytab		dc.l	3*_levwidth,3*_levwidth,2*_levwidth,2*_levwidth,_levwidth,0,0,0

nmxsizetab	dc.w	32,32,32,32,64,48,48,32,80,64,16,16,48,48,48,48

nmysizetab	dc.w	64,0,64,0,32,0,48,0,32,0,16,0,32,0,32,0

nmxcentertab	dc.w	4,24,4,8,4,24,4,16,4,56,0,16,0,48,0,16
		
nmycentertab	dc.w	4,40,4,40,4,72,4,40,4,24,0,16,-16,16,-4,16

nmxhittab	dc.w	0,0,0,16,0,32,0,32,0,0,0,0,0,0,0,0

nmyhittab	dc.w	0,0,32,16,0,16,0,48,0,0,0,0,0,0,0,0
;------------------------------------------------
fg		dc.l	0

fganimstart	dc.l	lgraph+32+36,lgraph+32+38,lgraph+32+2560+36,lgraph+32+2560+38
		dc.l	lgraph+32+10240,lgraph+32+10240,lgraph+32+10240,lgraph+32+10240,lgraph+32+10240,lgraph+32+10240,lgraph+32+10240,lgraph+32+10240
		dc.l	lgraph+32+12800,lgraph+32+12800,lgraph+32+12800,lgraph+32+12800,lgraph+32+12800,lgraph+32+12800,lgraph+32+12800,lgraph+32+12800
		dc.l	lgraph+32+15360,lgraph+32+15360,lgraph+32+15360,lgraph+32+15360,lgraph+32+15360,lgraph+32+15360,lgraph+32+15360,lgraph+32+15360
		dc.l	lgraph+32+17920,lgraph+32+17920,lgraph+32+17920,lgraph+32+17920,lgraph+32+17920,lgraph+32+17920,lgraph+32+17920,lgraph+32+17920
		dc.l	lgraph+32+20480,lgraph+32+20480,lgraph+32+20480,lgraph+32+20480,lgraph+32+20480,lgraph+32+20480,lgraph+32+20480,lgraph+32+20480
fganimend	

fganimtab	ds.l	(fganimend-fganimstart)/4
		
fganimpostab	dc.l	0,0,0,0
		dc.l	0,2,4,6,8,10,12,14
		dc.l	0,2,4,6,8,10,12,14
		dc.l	0,2,4,6,8,10,12,14
		dc.l	0,2,4,6,8,10,12,14
		dc.l	0,2,4,6,8,10,12,14

fgani