[comp.sys.mac.programmer] CurrentA5 and DDP listeners

bell@eniac.seas.upenn.edu (Mike Bell) (06/29/89)

This is from Barry Twycross at Du Pont Pixel systems in England really

I was writting a DDP socket listener running under multifinder, and I
assumed that the interupt handler would take care to make sure that your
CurrentA5 would be set up correctly, but it dosn't. I seem to get other
programs A5 value occasionally (this is good for crashing lightspeed C
or the debugger out from underneath of you as I was writing into thier
global space.)

The fix I use is to store my CurrentA5 processor relative in the code,
but this is really against my principles.






********************************************************************************
     
Mike Bell                                     CSnet: BELLMA%ERVX01@dupont.com
Senior Engineer                               Applelink: D2747
DuPont Electronic Imaging
Core Technology Group

            Can YOUR mac play FOOTBALL ????

********************************************************************************

tim@hoptoad.uucp (Tim Maroney) (07/12/89)

In article <12515@netnews.upenn.edu> bell@eniac.seas.upenn.edu (Mike Bell)
writes:
>This is from Barry Twycross at Du Pont Pixel systems in England really
>
>I was writting a DDP socket listener running under multifinder, and I
>assumed that the interupt handler would take care to make sure that your
>CurrentA5 would be set up correctly, but it dosn't. I seem to get other
>programs A5 value occasionally (this is good for crashing lightspeed C
>or the debugger out from underneath of you as I was writing into thier
>global space.)
>
>The fix I use is to store my CurrentA5 processor relative in the code,
>but this is really against my principles.

I've been writing DDP socket listeners for something like five years
now, and I have yet to find another solution.  Way back when, Switcher
had the same problem.  It is not only in socket listeners, but in all
interrupt driven code -- if you install your own interrupt handlers,
you can't assume that you will only be called when your application
controls CurrentA5.  There's no place else to store your A5 except in
PC-relative code space.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com
Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934

"Superhero stories could best be described as entertainment that externalizes
 childhood power fantasies." -- Timothy Fay on rec.arts.comics

ts@cup.portal.com (Tim W Smith) (07/15/89)

I'd like to see a slight change in the interface to protocol handlers to
address this problem.  The change would be that register A5, instead of
being defined as "available" when the protocol handler is called, would
instead be defined as contiaing the value it contained when the protocol
handler was attached.

					Tim Smith

tim@hoptoad.uucp (Tim Maroney) (07/16/89)

In article <20453@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
>I'd like to see a slight change in the interface to protocol handlers to
>address this problem.  The change would be that register A5, instead of
>being defined as "available" when the protocol handler is called, would
>instead be defined as contiaing the value it contained when the protocol
>handler was attached.

I'd like this change to be made retroactively -- unfortunately, as much
sense as the proposed change makes, you'd have to work even harder than
you do now.  You'd have to check the driver version and go to your
A5-saving code if the new one were not installed, skipping it if the
new one were installed.  Most people would just leave out the version
test and go on saving and restoring A5 as at present -- it's easier.
So it's really not worth changing the driver.  It would have been nice
if this had been in the definition from the start, though.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Strong men tremble when they hear it.
 They've got cause enough to fear it;
 It's even blacker than they smear it!
 No one mentions -- my name." - Bill Sykes, "Oliver"