Category:68000 Assembly: Difference between revisions

m
m (fixed incorrect information due to a misunderstanding of how my assembler worked.)
Line 150:
* The next 8 longwords are the hardware traps. Each represents the memory location of a function or procedure meant for a hardware error (the 68000 doesn't have segmentation faults but it's a similar concept. Among them include handlers for division by zero, signed overflow, etc.)
* Interrupt requests and user-defined traps go here as well.
 
 
Programming your own trap is a lot like programming a typical subroutine. However, there are a few differences:
* The statement to return back to your regular program must be <code>RTE</code> rather than <code>RTS</code>. Otherwise, you'll most likely crash the CPU.
 
* It's best to push all registers (D0 thru D7 and A0-A6) onto the stack at the start and pop them off at the end. This is not required for the traps you call with the <code>TRAP #?</code> command, but for the others it's absolutely necessary, since you can't know in advance when they'll happen. You can leave out A7 when doing this since that's the stack pointer itself.
 
==Alignment==
1,489

edits