🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #29226

RTE causing bus error

#29226
From: B E Nicholson
Date: Mon, 16 Nov 1987 05:49
66 lines
2567 bytes
[ Line eater, come and get it]


I've recently been developing some code which installs it's own interrupt,
and trap handlers.  Unfortunately, whenever the code tries to return to 
the original code a bus error results.  For example, if the routine 
_clock_int is installed as either a trap, timer interrupt, or any other
exception handler by the main routine when the rte instruction is executed 
at the end of the _restart routine a bus error will result.  I'm a little 
lost as to why.  

_start:
	lea	main,a0		* 41F9 0000 00D6  ; use the os routine to
	move.l	a0,-(a7)	* 2F08		  ; execute main in 
	move.w	#$26,d0		* 303C 0026       ; supervisor state
	move.w	d0,-(a7)	* 3F00
	trap	#$E		* 4E4E
	adda.w	#$6,a7		* DEFC 0006
	jsr	_fault		* 4EB9 0000 08BA  ; this should never happen
_save:
	move	#$2700,sr	* 46FC 2700
	move.l	a6,-(a7)	* 2F0E
	lea	proc_ptr,a6	* 4DF9 0000 0BDC  ; proc_ptr is a temporary
	move.l	$0(a6),d0	* 202E 0000       ; storage location
	movea.l	d0,a6		* 2C40
	adda.w	#$46,a6		* DCFC 0046
	movem.l	d0-d7/a0-a5,-(a6)		* 48E6 FFFC
	move.l	(a7)+,d0		* 201F
	move.l	(a7)+,d1		* 221F
	movea.l	d1,a1		* 2241
	move.l	d0,$FFFC(a6)		* 2D40 FFFC
	move	usp,a0		* 4E68
	move.l	a0,d0		* 2008
	move.l	d0,$FFF8(a6)		* 2D40 FFF8
	move.l	(a7)+,d0		* 201F
	movea.l	d0,a0		* 2040
	move.l	a0,$FFF4(a6)		* 2D48 FFF4
	move.w	(a7)+,d0		* 301F
	move.w	d0,$FFF2(a6)		* 3D40 FFF2
	jmp	(a1)		* 4ED1
_restart:
	move	#$2700,sr		* 46FC 2700
	lea	proc_ptr,a6		* 4DF9 0000 0BDC
	move.l	$0(a6),d0		* 202E 0000
	movea.l	d0,a6		* 2C40
	move.w	$0(a6),d0		* 302E 0000
	move.w	d0,-(a7)		* 3F00
	move.l	$2(a6),d0		* 202E 0002
	move.l	d0,-(a7)		* 2F00
	move.l	$6(a6),d0		* 202E 0006
	movea.l	d0,a0		* 2040
	move	a0,usp		* 4E60
	move.l	$A(a6),d0		* 202E 000A
	move.l	d0,-(a7)		* 2F00
	adda.w	#$E,a6		* DCFC 000E
	movem.l	(a6)+,d0-d7/a0-a5		* 4CDE 3FFF
	movea.l	(a7)+,a6		* 2C5F
	rte		* 4E73
_clock_i:
	jsr	_save		* 4EB9 0000 0020
	jsr	switch		* 4EB9 0000 0372
	bra.b	_restart		* 60BC


Thanks, 
	Barry Nicholson
Technical Details
Message-ID: <1498@ihlpm.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!necntc!ames!ptsfa!ihnp4!ihlpm!nicholso

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!necntc!ames!ptsfa!ihnp4!ihlpm!nicholso
From: nicholso@ihlpm.ATT.COM (B E Nicholson)
Newsgroups: comp.sys.atari.st
Subject: RTE causing bus error
Message-ID: <1498@ihlpm.ATT.COM>
Date: Mon, 16-Nov-87 00:49:00 EST
Article-I.D.: ihlpm.1498
Posted: Mon Nov 16 00:49:00 1987
Date-Received: Wed, 18-Nov-87 03:03:36 EST
Organization: AT&T Bell Laboratories - Naperville, Illinois
Lines: 66
Keywords: bus error, rte