Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main Page
Community Portal
Village Pump
Recent Changes
Upload File
Help
Help Contents
Editing Guide
Repair Guide Template
Sandbox
Browse Wiki
๐ Service Manuals
๐ Schematics
๐ Apple
๐ฎ Nintendo
๐ Sega
โก Troubleshooting
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Macintosh Toolbox
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== 68000 Implementation === The Toolbox uses the 68000's illegal instruction exception to implement system calls through '''A-line traps'''โopcodes from $A000-$AFFF that trigger exception vector 10 ($28): '''Trap Word Format:''' <pre> Bits 15-12: 1010 (A-line identifier) Bit 11: 0=OS trap, 1=Toolbox trap Bit 10: Auto-pop flag (Toolbox only) Bit 9: Reserved (later: extended trap) Bits 8-0: Trap number (0-511 or 0-1023) </pre> '''Dispatch Process:''' # CPU encounters A-line instruction # Exception 10 triggers, saving PC and SR # Dispatch routine at ($28) examines trap word # For Toolbox traps: index into dispatch table at $E00 # For OS traps: index into dispatch table at $400 # Jump to routine address from table # Routine executes and returns via RTS/RTD '''Register-Based Parameters:''' Despite Pascal conventions, many traps use registers for speed: * '''D0-D2''': Scratch/parameters/results * '''A0-A1''': Pointers/handles * '''A2-A4''': Preserved across calls * '''A5''': QuickDraw globals pointer * '''A6''': Stack frame (when used) * '''A7''': Stack pointer '''Common Trap Examples:''' * '''$A876''' (_NewPtr): Allocate pointer, size in D0, result in A0 * '''$A322''' (_NewHandle): Allocate handle, size in D0, result in A0 * '''$A8FE''' (_NewWindow): Parameters on stack, result in A0 * '''$A873''' (_SetPort): GrafPort in A0, no result
Summary:
Please note that all contributions to RetroTechCollection may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
RetroTechCollection:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Macintosh Toolbox
(section)
Add topic