4,d1.w)
		beq.s	.tst1
		cmp.w	#$e800,d5
		beq.s	.tst1
;		cmp.b	#10,(a4,d1.w)
;		beq.s	.tst1
;		cmp.b	#9,(a4,d1.w)
;		beq	.swamp
		cmp.b	#2,(a4,d1.w)
		bne.s	.testfall2
		cmp.b	#2,(a4,d2.w)
		bne	.testcrumble
		bra.s	.testfall2
;.tst3		cmp.b	#9,(a4,d2.w)
;		beq	.swamp
;		bra.s	.testfall2
.tst1		
		cmp.w	#$e800,d6
		beq.s	.testfall2
		cmp.b	#1,(a4,d2.w)
		bne	.nofall
;		cmp.b	#10,(a4,d2.w)
;		bne	.nofall

.testfall2	move.w	(a2),d2
		move.w	d2,d6
		and.w	#$fc00,d6
		and.w	#$3ff,d2
		move.w	(a3),d1
		move.w	d1,d5
		and.w	#$fc00,d5
		and.w	#$3ff,d1
		cmp.b	#1,(a4,d1.w)
		beq.s	.tst2
		cmp.w	#$e800,d5
		beq.s	.tst2
;		cmp.b	#10,(a4,d1.w)
;		beq.s	.tst2
;		cmp.b	#9,(a4,d1.w)
;		beq	.swamp
		cmp.b	#2,(a4,d1.w)
		bne.s	.fall
		cmp.b	#2,(a4,d2.w)
		bne	.testcrumble
		bra.s	.fall
;.tst4		cmp.b	#9,(a4,d2.w)
;		beq.s	.swamp
;		bra.s	.fall
.tst2		
		cmp.w	#$e800,d6
		beq.s	.fall
		cmp.b	#1,(a4,d2.w)
		bne.s	.nofall
;		cmp.b	#10,(a4,d2.w)
;		bne.s	.nofall

.fall		lea	falltab-d(a5),a0
		move.w	fallpos-d(a5),d0
		moveq	#0,d1
		move.w	(a0,d0.w),d1
		add.w	d1,manypos-d(a5)
		add.l	d1,absmanypos-d(a5)
		move.w	d1,fallspeed-d(a5)
		move.w	#1,fallflag-d(a5)
		clr.w	punchcount-d(a5)
		clr.w	punchflag-d(a5)
		clr.w	stepstandflag-d(a5)

		cmp.w	#88,d0
		beq.s	.end
		addq.w	#2,fallpos-d(a5)
.end		rts

.nofall		bsr	teststauch
		move.l	absmanypos-d(a5),d0
		and.w	#$7,d0
		and.l	#$fffffff8,absmanypos-d(a5)
		sub.w	d0,manypos-d(a5)
		clr.w	fallpos-d(a5)
		clr.w	fallspeed-d(a5)
		clr.w	fallflag-d(a5)
		clr.w	stepstandflag-d(a5)
		rts

.auer		bsr	setjump
		sub.w	#32,energy-d(a5)
		move.w	#20,ouchflag-d(a5)
		cmp.w	#4,energy-d(a5)
		bpl	.nofall
		move.w	#1,deathflag-d(a5)
		move.w	#$10,priority-d(a5)
		bra	.nofall

		
.fullstair2	move.l	d0,d2
		sub.l	#_levwidth,d2
		move.w	(a2,d2.l),d2
		and.w	#$3ff,d2
		move.b	(a4,d2.w),d2
		cmp.b	#8,d2
		beq	.testagain4
		cmp.b	#6,d2
		beq	.testagain4
		bra.s	.fsc

.fullstair	move.l	d0,d2
		sub.l	#_levwidth,d2
		move.w	(a0,d2.l),d2
		and.w	#$3ff,d2
		move.b	(a4,d2.w),d2
		cmp.b	#8,d2
		beq	.testagain3
		cmp.b	#6,d2
		beq	.testagain3

		move.w	(a3,d0.l),d2
		and.w	#$3ff,d2
		move.b	(a4,d2.w),d2
		cmp.b	#8,d2
		beq	.fall
		cmp.b	#6,d2
		beq	.fall

.fsc		;tst.w	fallflag-d(a5)
		;beq.s	.end
		move.l	absmanypos-d(a5),d0
		and.w	#$7,d0
		and.l	#$fffffff8,absmanypos-d(a5)
;		addq.l	#8,absmanypos-d(a5)
		sub.w	d0,manypos-d(a5)
;		addq.w	#8,manypos-d(a5)
		clr.w	fallpos-d(a5)
		clr.w	fallspeed-d(a5)
		clr.w	fallflag-d(a5)
		rts

.halfstair2	move.l	d1,d2
		sub.l	#_levwidth,d2
		move.w	(a2,d2.l),d2
		and.w	#$3ff,d2
		move.b	(a4,d2.w),d2
		cmp.b	#9,d2
		beq	.testagain2
		cmp.b	#7,d2
		beq	.testagain2
		bra.s	.hsc

.halfstair	move.l	d1,d2
		sub.l	#_levwidth,d2
		move.w	(a0,d2.l),d2
		and.w	#$3ff,d2
		move.b	(a4,d2.w),d2
		cmp.b	#9,d2
		beq	.testagain
		cmp.b	#7,d2
		beq	.testagain

.hsc		;tst.w	fallflag-d(a5)
		;beq.s	.end
		move.l	absmanypos-d(a5),d0
		and.w	#$f,d0
		and.l	#$fffffff0,absmanypos-d(a5)
		sub.w	d0,manypos-d(a5)
;		addq.l	#8,absmanypos-d(a5)
;		addq.w	#8,manypos-d(a5)

		clr.w	fallpos-d(a5)
		clr.w	fallspeed-d(a5)
		clr.w	fallflag-d(a5)
		rts


		
.nofall2	clr.w	fallspeed-d(a5)
.nofall3	bsr	teststauch
		clr.w	fallpos-d(a5)
		clr.w	fallflag-d(a5)
		clr.w	stepstandflag-d(a5)
		rts

.nofall4	move.w	#1,fallspeed-d(a5)
		;move.w	#8,fallpos-d(a5)
		clr.w	stepstandflag-d(a5)
		rts				
		

		
.testcrumble	moveq	#0,d0
		move.w	manxpos-d(a5),d0
		add.l	xsoftabs-d(a5),d0
		add.l	#50,d0
		move.w	d0,d2
		lsr.l	#4,d0
		add.l	d0,d0
		move.l	multab-d(a5),a0		
		move.w	manypos-d(a5),d1
		add.w	ysoft-d(a5),d1
		add.w	ysoftpos-d(a5),d1
		add.w	#72,d1
		cmp.w	#_scrheight,d1
		bmi.s	.c011
		sub.w	#_scrheight,d1
.c011		add.w	d1,d1
		add.w	d1,d1
		add.l	(a0,d1.w),d0
		add.l	draw-d(a5),d0
		move.l	d0,a0
		move.w	(a0),d1
		or.w	_scrwidth*3(a0),d1
		or.w	_scrwidth*3*2(a0),d1
		or.w	_scrwidth*3*3(a0),d1
		tst.w	d1
		beq	.fall
		move.w	#1,crstandflag-d(a5)
		bra	.nofall
		
.rough		cmp.w	#$94,manypos-d(a5)
		bpl	.nofall4
		moveq	#0,d0
		move.w	manxpos-d(a5),d0
		add.l	xsoftabs-d(a5),d0
		add.l	#50,d0
		move.w	d0,d2
		lsr.l	#4,d0
		add.l	d0,d0

		move.l	multab-d(a5),a0		
		move.w	manypos-d(a5),d1
		add.w	ysoft-d(a5),d1
		add.w	ysoftpos-d(a5),d1
		add.w	#70,d1
		cmp.w	#_scrheight,d1
		bmi.s	.c11
		sub.w	#_scrheight,d1
.c11		move.w	d1,d7
		add.w	d1,d1
		add.w	d1,d1
		add.l	(a0,d1.w),d0
		add.l	draw-d(a5),d0
		move.l	d0,a0
		
		move.l	#$80000000,d3
		and.w	#$f,d2
		lsr.l	d2,d3

		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub2
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c16
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c16		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub1
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c15
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c15		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add0
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c12
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c12		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add1
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c13
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c13		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add2

		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c14
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c14		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add3
	
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c17
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c17		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add4
	
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c18
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c18		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add5
	
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c19
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c19		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add6
	
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c20
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c20		move.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add7
		bra	.fall
	
.testnofall2	cmp.b	#18,(a4,d2.w)
		bne	.nofall4
		bra	.fall

	
	
.rough2		cmp.w	#$94,manypos-d(a5)
		bpl.s	.testnofall2
		lea	falltab-d(a5),a0
		move.w	fallpos-d(a5),d0
		move.w	(a0,d0.w),d4
		
		moveq	#0,d0
		move.b	(a4,d2.w),d0
		sub.w	#14,d0
		move.w	d0,blktype-d(a5)
		moveq	#0,d0
		move.w	manxpos-d(a5),d0
		add.l	xsoftabs-d(a5),d0
		add.l	#47,d0
		move.w	d0,d2
		lsr.l	#4,d0
		add.l	d0,d0

		move.l	multab-d(a5),a0		
		move.w	manypos-d(a5),d1
		add.w	ysoft-d(a5),d1
		add.w	ysoftpos-d(a5),d1
		add.w	#67,d1
		cmp.w	#_scrheight,d1
		bmi.s	.c1
		sub.w	#_scrheight,d1
.c1		move.w	d1,d7
		add.w	d1,d1
		add.w	d1,d1
		add.l	(a0,d1.w),d0
		add.l	draw-d(a5),d0
		move.l	d0,a0
		
		move.l	#$fe000000,d3
		and.w	#$f,d2
		lsr.l	d2,d3

		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub4
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c22
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c22		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub3
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c21
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c21		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub2
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c6
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c6		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.sub1
		
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c5
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c5		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add0
		
		subq.w	#1,d4
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c2
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c2		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add1
		
		subq.w	#1,d4
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c3
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c3		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add2

		subq.w	#1,d4
		bmi	.fall
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c4
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c4		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add3

		subq.w	#1,d4
		bmi	.fall
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c7
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c7		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne	.add4

		subq.w	#1,d4
		bmi	.fall
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c8
		sub.w	#_scrheight,d7
		sub.l	#_scrwidth*_scrdepth*3*_scrheight,a0
.c8		move.l	_scrwidth*3(a0),d1
		not.l	d1
		and.l	(a0),d1
		and.l	_scrwidth*3*2(a0),d1
		and.l	_scrwidth*3*3(a0),d1
		and.l	d3,d1
		bne.s	.add5

		subq.w	#1,d4
		bmi	.fall
		lea	_scrwidth*_scrdepth*3(a0),a0
		addq.w	#1,d7
		cmp.w	#_scrheight,d7
		bmi.s	.c9
		sub.w	#_scrhe