[comp.sys.mac] Lightspeed C and A4

clubmac@runx.UUCP (06/08/87)

> From: betz@runx.ips.oz (Andrew Betzis)
>     
> Has anyone had experience with LSC's DAs and the SFGetFile filter proc.
> LSC, when compiling DAs, uses register A4 from global addressing, but when
> SFGetFile calls your filter function, then register A4 is corrupted and thus
> no global data is accessable.
> To get around this problem I have saved A4 ( using the asm{} directive) in
> a low memory global (saved contents of low memory global in DA's memory first)
> Then when the filter function is first entered, A4 is restored.
> 
> Is there at neater way to do this ?
>

ARGGH!!!

Use SetupA4() and RestoreA4() inside your filterproc....

myFilterProc(.....)
....
....
....
{
	SetUpA4();
	....
	....
	....
	RestoreA4();
	return(..);
}

I remember using this when writing my Teleport ][ DA, where I wanted to change
the "Open" button's title to "Run" whenever the user selected an application,
and reverted to "Open" when a folder was selected (this is a good idea, no?).

I'll send you a copy of my Lightspeed C source.

Jason Haines
Club President

Club Mac Macintosh Users Group, Sydney, Australia
Snail:     Box 213, Holme Building, Sydney University, NSW, 2006, Australia
ACSnet:    clubmac@runx.ips.oz	   ARPA:   clubmac%runx.ips.oz@seismo.css.gov
UUCP:{enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!runx.ips.oz!clubmac