p.w	#1,punchflag-d(a5)
		beq	punch
		bpl.s	.sxca

		tst.w	duckpos-d(a5)
		bne.s	.sxc00		
		move.w	actstick-d(a5),d0
		and.w	#$0303,d0
		cmp.w	#$0300,d0
		beq	.left			;links
		cmp.w	#$0200,d0
		beq	.left			;links 'nauf
		cmp.w	#$0301,d0
		beq	.left			;links 'nunter
		cmp.w	#$0003,d0
		beq	.right			;rechts
		cmp.w	#$0002,d0
		beq	.right			;rechts 'nunter
		cmp.w	#$0103,d0
		beq	.right			;rechts 'nauf
		bra.s	.sxc00

.sxca		subq.w	#1,punchflag-d(a5)
.sxc00		moveq	#0,d1
.sxc4		tst.l	manxspeed-d(a5)
		beq.s	.sxc2
		bmi.s	.sxc1

		tst.w	fallflag-d(a5)
		bne.s	.sxc003
		tst.w	jumpflag-d(a5)
		bne.s	.sxc003
		clr.w	blktype-d(a5)
		subq.l	#2,manxspeed-d(a5)
		bpl.s	.sxc001
		clr.l	manxspeed-d(a5)
.sxc001		move.w	#1,animdir-d(a5)
		bra.s	.sxc2
.sxc003		addq.w	#1,manxcount-d(a5)
		cmp.w	#2,manxcount-d(a5)
		bmi.s	.sxc2
		clr.w	manxcount-d(a5)
		subq.l	#1,manxspeed-d(a5)
		bra.s	.sxc2

.sxc1		tst.w	fallflag-d(a5)
		bne.s	.sxc004
		tst.w	jumpflag-d(a5)
		bne.s	.sxc004
		clr.w	blktype-d(a5)
		addq.l	#2,manxspeed-d(a5)
		bmi.s	.sxc002
		clr.l	manxspeed-d(a5)
.sxc002		clr.w	animdir-d(a5)
		bra.s	.sxc2
.sxc004		addq.w	#1,manxcount-d(a5)
		cmp.w	#2,manxcount-d(a5)
		bmi.s	.sxc2
		clr.w	manxcount-d(a5)
		addq.l	#1,manxspeed-d(a5)

.sxc2		

		move.w	#1,animstand-d(a5)
		move.w	#0,animphase-d(a5)

		move.w	duckpos-d(a5),d0
		tst.w	fallflag-d(a5)
		beq.s	.sxc5
		moveq	#32,d0
.sxc5		tst.w	jumpflag-d(a5)
		beq.s	.sxc6
		tst.w	janimcount-d(a5)
		bne.s	.sxc7
		moveq	#28,d0
		bra.s	.sxc6
.sxc7		moveq	#24,d0		
.sxc6		
		move.w	#2,lrcount-d(a5)
		move.w	#0,lrphase-d(a5)

		tst.w	animdir-d(a5)
		beq.s	.ldir
		lea	animposs-d(a5),a0
		move.l	(a0,d0.w),animadr-d(a5)
		bra.s	.checky
.ldir		lea	animposs+12-d(a5),a0
		move.l	(a0,d0.w),animadr-d(a5)
		
.checky		tst.w	blktype-d(a5)
		bpl	.spd
		tst.w	sxruncount-d(a5)
		beq	.ccy
		bmi	.ccy3
		and.w	#$fffe,sxruncount-d(a5)
		lea	sxruntab2-d(a5),a0
		move.w	sxruncount-d(a5),d0
		lsr.w	#1,d0
		subq.w	#2,sxruncount-d(a5)
		
		tst.l	manxspeed-d(a5)
		beq	.ccy
		bpl	.cr
		
		move.l	d0,d3
		move.l	a0,a3
		moveq	#8,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	.ccyend
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend
		
;		cmp.b	#10,d0
;		beq	.ccyend
;		move.w	-_levwidth(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.ccyend
;		move.w	-_levwidth*2(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.ccyend

		move.l	a3,a0
		move.l	d3,d0
		bra	.lcont

.cr		move.l	d0,d3
		move.l	a0,a3
		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	.ccyend
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend

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

		move.l	a3,a0
		move.l	d3,d0
		bra	.rcont

.ccy3		clr.w	sxruncount-d(a5)
		
.ccy		tst.l	manxspeed-d(a5)
		bpl	.ccyrcheck
		moveq	#8,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	.ccyend
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend

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

.ccydo		tst.l	manxspeed-d(a5)
		bpl.s	.ccydo2
		cmp.l	#8,absmanxpos-d(a5)
		bmi	.ccyend
.ccydo2		move.l	manxspeed-d(a5),d0
		add.w	d0,agamanxpos-d(a5)
		add.l	d0,agaabsmanxpos-d(a5)
		rts
		
.ccyrcheck	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	.ccyend
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.ccyend

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

		bra	.ccydo

.ccyend		clr.l	manxspeed-d(a5)
.end		rts

.ccy2		move.w	#48,sxruncount-d(a5)
		rts
		
.ccyr		clr.w	sxruncount-d(a5)
		bra	.ccy

.spd		move.w	blktype-d(a5),d0
		tst.l	manxspeed-d(a5)
		beq.s	.ccy2
		bpl.s	.spdr
		cmp.w	#2,d0
		beq.s	.lslow
		cmp.w	#3,d0
		bne.s	.ccyr
		lea	sxruntab2-d(a5),a0
		move.w	sxruncount-d(a5),d0
		addq.w	#1,sxruncount-d(a5)
		cmp.w	#48,sxruncount-d(a5)
		bmi.s	.lcont
		move.w	#46,sxruncount-d(a5)
		bra.s	.lcont
		
.lslow		lea	sxruntab-d(a5),a0
		move.w	sxruncount-d(a5),d0
		addq.w	#1,sxruncount-d(a5)
		cmp.w	#48,sxruncount-d(a5)
		bmi.s	.lcont
		move.w	#46,sxruncount-d(a5)

.lcont		moveq	#0,d1
		move.b	(a0,d0.w),d1
		sub.w	d1,agamanxpos-d(a5)
		sub.l	d1,agaabsmanxpos-d(a5)
		rts

.spdr		cmp.w	#0,d0
		beq.s	.rslow
		cmp.w	#1,d0
		bne	.ccyr
		lea	sxruntab2-d(a5),a0
		move.w	sxruncount-d(a5),d0
		addq.w	#1,sxruncount-d(a5)
		cmp.w	#48,sxruncount-d(a5)
		bmi.s	.rcont
		move.w	#46,sxruncount-d(a5)
		bra.s	.rcont

.rslow		lea	sxruntab-d(a5),a0
		move.w	sxruncount-d(a5),d0
		addq.w	#1,sxruncount-d(a5)
		cmp.w	#48,sxruncount-d(a5)
		bmi.s	.rcont
		move.w	#46,sxruncount-d(a5)

.rcont		moveq	#0,d1
		move.b	(a0,d0.w),d1
		add.w	d1,agamanxpos-d(a5)
		add.l	d1,agaabsmanxpos-d(a5)
		rts

.mid		tst.w	duckpos-d(a5)
		bne.s	.mid2
		move.l	#42*928,d0
		tst.w	animdir-d(a5)
		bne.s	.mc1
		move.l	#43*928,d0
.mc1		move.l	d0,animadr-d(a5)
		subq.w	#1,punchcount2-d(a5)
		rts

.mid2		move.l	#52*928,d0
		tst.w	animdir-d(a5)
		bne.s	.mc2
		move.l	#53*928,d0
.mc2		move.l	d0,animadr-d(a5)
		subq.w	#1,punchcount2-d(a5)
		rts

.sxca2		moveq	#1,d1
		bra	.sxc4

.left		moveq	#8,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	.sxca2
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.sxca2
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.sxca2
		
;		cmp.b	#10,d0
;		beq	.sxca2
;		move.w	-_levwidth(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.sxca2
;		move.w	-_levwidth*2(a0),d2
;		and.w	#$3ff,d2
;		move.b	(a4,d2.w),d0
;		cmp.b	#10,d0
;		beq	.sxca2


		clr.w	animdir-d(a5)
		tst.w	jumpflag-d(a5)
		bne.s	.lc3
		tst.w	fallflag-d(a5)
		beq	.lc2
		cmp.l	#-8,manxspeed-d(a5)
		beq.s	.lc9
		subq.l	#1,manxspeed-d(a5)

.lc9		move.l	animposs+44-d(a5),animadr-d(a5)
		move.w	#1,animstand-d(a5)
		bra	.checky

.lc3		cmp.l	#-8,manxspeed-d(a5)
		beq.s	.lc7
		subq.l	#1,manxspeed-d(a5)

.lc7		move.w	#1,animstand-d(a5)
		tst.w	janimcount-d(a5)
		bne.s	.lc10
		move.l	animposs+40-d(a5),animadr-d(a5)
		bra	.checky
.lc10		move.l	animposs+36-d(a5),animadr-d(a5)
		bra	.checky

.lc2		cmp.l	#-8,manxspeed-d(a5)
		beq.s	.lc4
		subq.l	#1,manxspeed-d(a5)
		cmp.l	#-8,manxspeed-d(a5)
		beq.s	.lc4
		subq.l	#1,manxspeed-d(a5)

.lc4		move.w	#1,animstand-d(a5)
		cmp.w	#3,lrphase-d(a5)
		beq.s	.lc11
		cmp.w	#2,lrphase-d(a5)
		beq.s	.lc12
		cmp.w	#1,lrphase-d(a5)
		beq.s	.lc22
		move.l	animadr-d(a5),d0
		cmp.l	animposs-d(a5),d0
		beq.s	.lc23
		cmp.l	animposrs-d(a5),d0
		bne.s	.lc22
.lc23		move.l	animposfrnt-d(a5),animadr-d(a5)
		bra.s	.lc13
.lc22		move.l	animposs+12-d(a5),animadr-d(a5)
		bra.s	.lc13
.lc24		addq.w	#1,lrphase-d(a5)
.lc12		move.l	animposrs+4-d(a5),animadr-d(a5)
.lc13		subq.w	#1,lrcount-d(a5)
		bne	.checky
		move.w	#2,lrcount-d(a5)
		addq.w	#1,lrphase-d(a5)
		bra	.checky

.lc11		lea	animposl-d(a5),a0
		bsr	.domananim
		bra	.checky
		
.right		moveq	#32,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	.sxca2
		move.w	-_levwidth(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.sxca2
		move.w	-_levwidth*2(a0),d2
		and.w	d6,d2
		cmp.w	d5,d2
		beq	.sxca2

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

		move.w	#1,animdir-d(a5)
		tst.w	jumpflag-d(a5)
		bne.s	.rc3
		tst.w	fallflag-d(a5)
		beq	.rc2
		cmp.l	#8,manxspeed-d(a5)
		beq.s	.rc9
		addq.l	#1,manxspeed-d(a5)

.rc9		move.l	animposs+32-d(a5),animadr-d(a5)
		move.w	#1,animstand-d(a5)
		bra	.checky

.rc3		cmp.l	#8,manxspeed-d(a5)
		beq.s	.rc7
		addq.l	#1,manxspeed-d(a5)

.rc7		move.w	#1,animstand-d(a5)
		tst.w	janimcount-d(a5)
		bne.s	.rc10
		move.l	animposs+28-d(a5),animadr-d(a5)
		bra	.checky
.rc10		move.l	animposs+24-d(a5),animadr-d(a5)
		bra	.checky

.rc2		cmp.l	#8,manxspeed-d(a5)
		beq.s	.rc4
		addq.l	#1,manxspeed-d(a5)
		cmp.l	#8,manxspeed-d(a5)
		beq.s	.rc4
		addq.l	#1,manxspeed-d(a5)

.rc4		move.w	#1,animstand-d(a5)
		cmp.w	#3,lrphase-d(a5)
		beq.s	.rc11
		cmp.w	#2,lrphase-d(a5)
		beq.s	.rc12
		cmp.w	#1,lrphase-d(a5)
		beq.s	.rc22
		move.l	animadr-d(a5),d0
	 	cmp.l	animposs+12-d(a5),d0
		beq.s	.rc23
		cmp.l	animposrs+4-d(a5),d0
		bne.s	.rc22
.rc23		move.l	animposfrnt-d(a5),animadr-d(a5)
		bra.s	.rc13
.rc22		move.l	animposs-d(a5),animadr-d(a5)
		bra.s	.rc13
.rc24		addq.w	#1,lrphase-d(a5)
.rc12		move.l	animposrs-d(a5),animadr-d(a5)
.rc13		subq.w	#1,lrcount-d(a5)
		bne	.checky
		move.w	#2,lrcount-d(a5)
		addq.w	#1,lrphase-d(a5)
		bra	.checky

.rc11		lea	animposr-d(a5),a0
		bsr	.domananim
		bra	.checky
		
.domananim	addq.w	#1,animcount-d(a5)
		cmp.w	#4,animcount-d(a5)
		bne.s	.rc1
		clr.w	animcount-d(a5)
		addq.w	#1,animphase-d(a5)
		cmp.w	#12,animphase-d(a5)
		bne	.rc1
		clr.w	animphase-d(a5)
.rc1		move.w	animphase-d(a5),d0
		add.w	d0,d0
		add.w	d0,d0
		move.l	(a0,d0.w),animadr-d(a5)
		clr.w	animstand-d(a5)
		rts

*****
punch		lea	d(pc),a4
		tst.w	punchcount-d(a4)
		bne	.mid	
		tst.w	sxpunchflagr-d(a4)
		bne	.punchr
		tst.w	sxpunchflagl-d(a4)
		bne	.punchl
		clr.w	collpointen-d(a4)
		tst.w	duckpos-d(a4)
	