; axsh_trap.asm by Juha 'Comm' Tuominen 21-Nov-91
;		and Pasi Ojala			22-Nov-91 ;-)
	section axsh_trap, code

	xref _fatalerror
	xref _axshguru
	xdef _axshtrap
	xdef _axshtrap68000

_axshtrap68000
	move.l  (sp)+,_fatalerror	; catch the number of the guru
;	cmp.l	#4,_fatalerror		; is it REALLY very fatal? (<5)
;	bgt	quit			; no->quit
	move.l	_axshguru,$2(sp)	; change return address (sp)+2
quit
	rte				; return from exception

_axshtrap
	move.l  (sp),_fatalerror	; catch the number of the guru
	addq	#4,sp			; remove the guru number from stack
	btst.b	#7,$6(sp)		; Is this a long frame? (MSbit)
	beq	short
	bset.b	#7,$8(sp)		; If so, set the ReRun flag (MSbit)
short	;cmp.l	#4,_fatalerror		; is it REALLY very fatal? (<5)
;	bgt	quit2			; no->quit
	move.l	_axshguru,$2(sp)	; change return address (sp)+2
quit2
	rte				; return from exception

	end
