[comp.sys.mac.programmer] Hacking SANE Opcodes.

chris@arrakis.nevada.edu (Chris Hayes) (10/20/89)

Hello Netland.  I was recently disassembling an XCMD.  Along the way, I ran
into
a large group of _Pack4 calls.  These are the calls for The Floating Point 
Package.  

According to Inside Macintosh, (II - 406) :  {paraphrased}

  The macros for calling the Floating-Point routines push a two-byte 
opword onto the stack and then invoke _Pack4.  These macros are fully 
documented in the Apple Numerics Manual.

  It's the last part that is the problem.  I need to figure out what each
call is.  Unfortunately that is all IM says about _Pack4.  Does anybody know 
where I can find the list of opwords?  I know of no local copies of the Apple
Numerics Manual.  Does anyone know of an FTPable list?  Any one care to type 
one in?  I don't need lengthy documentation, just a table of the Opwords and 
what they mean.

 ___________________________________________________________________________
/ Chris Hayes                     |These pictures, called "icons", make your\
| Internet:                       |electronic desktop very easy to work     |
\ chris@arrakis.nevada.edu        |with. -Welcome to Macintosh              /
 ///////////////////////////////// \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


*-------------------------------------*---------------------------------------*
|  Chris Hayes, Mad Mac Man, UNLV     |   Not all Vegas is gambling, some of  |
|  UseNet:   chris@arrakis.nevada.edu |   us like the food and shows!         |

earleh@eleazar.dartmouth.edu (Earle R. Horton) (10/21/89)

In article <934@unsvax.NEVADA.EDU> chris@arrakis.nevada.edu.uucp
	(Chris Hayes) writes:
>Hello Netland.

Howdy!

>  The macros for calling the Floating-Point routines push a two-byte 
>opword onto the stack and then invoke _Pack4.  These macros are fully 
>documented in the Apple Numerics Manual.
>
>  It's the last part that is the problem.  I need to figure out what each
>call is.  Unfortunately that is all IM says about _Pack4.  Does anybody know 
>where I can find the list of opwords?

It's in the assembler header files for MPW.  The whole set can be
obtained using anonymous ftp from apple.com.  You want
/pub/dts/mac/mpw/aincludes.hqx.  Extract "SANEMacs.a" from this and
you should have all the info you need.

I don't know why nobody seems to put the SANE interface info in C and
Pascal header files.  A couple of times, I wished the MPW folks had
done so.

Earle R. Horton

oster@dewey.soe.berkeley.edu (David Phillip Oster) (10/22/89)

By coincidence, I was just doing this yesterday. 
1.) Lightspeed C and THINK C both include a file "sane.h" in the library
folder that gives you most of the opcodes. There is a word or two about
this file in the printed documentation, but not enough to help.
2.) the phonebook edition of Inside Mac has a preliminary version of the
Apple Numerics Manual that includes most of the opcodes and a good
discussion of the theory of SANe.
3.) What I was actually trying to do was ascii to float and float to ascii
conversion. The C sprintf library takes 6800 or so bytes, and I needed the
space.  I had to dis-assemble Str2Dec and Dec2Str to figure out how they
worked, but I got it going, saving about 5000 bytes.  Time to buy a
numerics manual.

> The mac is a detour in the inevitable march of mediocre computers.
> drs@bnlux0.bnl.gov (David R. Stampf)
--- David Phillip Oster          -master of the ad hoc odd hack. 
Arpa: oster@dewey.soe.berkeley.edu 
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu 

siegel@endor.harvard.edu (Rich Siegel) (10/22/89)

In article <934@unsvax.NEVADA.EDU> chris@arrakis.nevada.edu.uucp (Chris Hayes) writes:
>call is.  Unfortunately that is all IM says about _Pack4.  Does anybody know 
>where I can find the list of opwords?  I know of no local copies of the Apple
>Numerics Manual.  Does anyone know of an FTPable list?  Any one care to type 
>one in?  I don't need lengthy documentation, just a table of the Opwords and 
>what they mean.

	If you're using THINK C, the Sane.h header has the opcodes. MPW's
C and assembly interfaces have the opcodes listed as well, I think.

	I don't care what anyone says, I think that floating-point math
is a lot of fun...

		--Rich
~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"There is no personal problem which cannot be solved by sufficient
application of high explosives."

~~~~~~~~~~~~~~~