On Mar 19, 2012, at 12:16 PM, Ethan Dicks wrote:
Having read the Hernia Manuals when they came out on
3-ring binders,
all I saw were references to Pascal. It looked painful/excessively
verbose to call the toolbox routines from 68K assembler. I don't
think I saw much for C on the Mac until 1986 or 1987, but there are
probably others here who were closer to that world at that time who
could provide more precise dates.
Actually, Toolbox routines from assembly weren't *that* bad. You had
to marshal your parameters properly and then drop a word in there
whose first nybble was 0xA; this was an explicitly illegal
instruction prefix (much like 0xF was the floating-point instruction
prefix) which invoked the A-Line Instruction exception handler. The
other 12 bits indicated which Toolbox instruction you were trying to
call.
If I recall correctly, this isn't too different from how TOPS-10 did
its system calls. I haven't worked much with TOPS-10 yet.
Unfortunately, that method of trapping A-line instructions makes it
impossible to try to port MacOS to Coldfire (something which I had
the harebrained idea to do once), because Coldfire uses the 0xA
prefix for its enhanced MAC (multiply-accumulate, not Mac, though
the irony is delicious) unit. You'd have to do other opcode
translations, too, but that pretty much blows the Toolbox calls out
of the water, since there's no equivalent illegal prefix.
As far as C on the Mac, it didn't come until rather later. Most of
the system which wasn't done in assembly was done in some compiled
version of Pascal (i.e. not UCSD Pascal), which is why all the
strings are Pascal-style strings (prefixed with a length byte) and
all callbacks have to use Pascal function return conventions for
stack cleanup, etc.
- Dave