Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!husc6!rutgers!ames!ucbcad!ucbvax!decvax!tektronix!reed!iscuva!jimc
From: jimc@iscuva.UUCP (Jim Cathey)
Newsgroups: comp.sys.mac
Subject: Re: LSC 1.02 Interfaces
Message-ID: <434@iscuva.UUCP>
Date: Mon, 12-Jan-87 12:14:48 EST
Article-I.D.: iscuva.434
Posted: Mon Jan 12 12:14:48 1987
Date-Received: Tue, 13-Jan-87 05:26:40 EST
References: <546@runx.OZ> <1018@sphinx.UChicago.UUCP>
Reply-To: jimc@iscuva.UUCP (Jim Cathey)
Organization: ISC Systems Corporation, Spokane, Wa.
Lines: 34

In article <1018@sphinx.UChicago.UUCP> fdot@sphinx.UUCP (Tom Lippincott) writes:
>           ... I wrote
>a short, thouroughly hacked bit of code to call an arbitrary trap from LSC,
>and I think it went like this (sorry, my source isn't handy):
>
>calltrap
>wcalltrap
>lcalltrap
>start	move.l	(sp)+,d0	;pop the return adress
>	move.l	d0,end+2	;store it to be jumped to
>	move.w	(sp)+,d0	;pop the trap word
>	move.w	d0,trap		;set up trap
>trap	nop			;do it
>end	jmp	0		;return
>

Ick!!!!  Be warned that anything you write with this hack will probably FAIL
on a 68020 machine due to the prefetch effect of the cache.  Self modifying
code is usually something to be avoided, but if you must do it you've got to
take into account prefetch queues, caches, et. al.  If you must do this, try
pushing your calculated code onto the stack and calling it there.  

Also, if LSC works like Aztec, the caller deallocates the pushed parameters
when the callee returns.  Since the above fragment eats the trap word you
should expect the stack to get hosed.

+----------------+
! II      CCCCCC !  Jim Cathey
! II  SSSSCC     !  ISC Systems Corp.
! II      CC     !  Spokane, WA
! IISSSS  CC     !  UUCP: ihnp4!tektronix!reed!iscuva!jimc
! II      CCCCCC !  (509)927-5757
+----------------+
			"With excitement like this, who is needing enemas?"