tim@hoptoad.uucp (Tim Maroney) (12/02/86)
To the best of my knowledge, it is not correct that MacWrite calls the ROM directly, or it wouldn't even work on the new ROMs. The compatibility problem comes from its use of the TRAP #n instructions of the 68000. It installs its own handlers for nine of these traps, which are unused by the Mac OS. These are totally different from the A-traps used for system calls on the Mac, which are handled through the illegal instruction handler. Check the 68000 manual if you're interested. The TRAP #n instructions are normally for operating system use, and are not intended to be used by application processes. For instance, most 68000 UNIX implementations dispatch system calls using TRAP #0. The compatibility problem is that the exception stack frames for the processors are different. This makes the special-purpose TRAP #n exception handlers installed by MacWrite incorrect on the 68010 and 68020. This is why Apple specifically reserves all sixteen traps in the future architecture compatibility guidelines; which, to be fair, are more recent than MacWrite. Needless to say, this is bad programming practice. Using TRAP #n for frequently-used routines is doing an easy thing in a hard way. There is no good reason not to merely link the routines, and use JSR's. In fact, this is probably a good deal faster than going through exception handling. But no doubt the programmer thought it was very clever to do things this way: the age-old problem. -- Tim Maroney, Electronic Village Idiot {ihnp4,sun,well,ptsfa,lll-crg,frog}!hoptoad!tim (uucp) hoptoad!tim@lll-crg (arpa)