# M68K Exceptions

[M68K Documentation](https://asm-editor.specy.app/documentation/m68k.md)

Web page: https://asm-editor.specy.app/documentation/m68k/exceptions

Exception vectors, handler entry and return, stack frames, processor modes, interrupts and cycle counts for the 68000, 68010 and 68020.

20 entries, each with its own page of markdown:

- [Exceptions](https://asm-editor.specy.app/documentation/m68k/exceptions/exceptions.md): An exception transfers control from the running program to a handler for a particular cause.
- [The vector table](https://asm-editor.specy.app/documentation/m68k/exceptions/the-vector-table.md): The vector table contains 256 vectors, each a four-byte handler address.
- [Writing a handler](https://asm-editor.specy.app/documentation/m68k/exceptions/handlers.md): Write the handler's address into its vector before the exception can occur.
- [What the processor does](https://asm-editor.specy.app/documentation/m68k/exceptions/what-the-processor-does.md): On exception entry, the processor saves the old status register, sets S to enter supervisor mode, and clears tracing while the handler runs.
- [Exception frames](https://asm-editor.specy.app/documentation/m68k/exceptions/frames.md): Choose the layout for the processor selected by opt p=: processor ordinary exceptions bus and address errors other frames ----------------------…
- [User and supervisor mode](https://asm-editor.specy.app/documentation/m68k/exceptions/modes.md): Bit 13 of sr, S, selects the privilege mode: In supervisor mode, S is set and supervisor-only instructions are permitted.
- [Traps](https://asm-editor.specy.app/documentation/m68k/exceptions/traps.md): trap #0 to trap #14 use vectors 32 to 46, at $80 to $B8 when VBR is zero.
- [Trace](https://asm-editor.specy.app/documentation/m68k/exceptions/trace.md): Bit 15 of sr, T, enables a trace exception, vector 9, after each instruction.
- [When there is no handler](https://asm-editor.specy.app/documentation/m68k/exceptions/no-handler.md): An odd address in an exception vector ends the program.
- [Interrupts](https://asm-editor.specy.app/documentation/m68k/exceptions/interrupts.md): An interrupt request, or IRQ, asks the processor to run a handler between instructions.
- [Cycles](https://asm-editor.specy.app/documentation/m68k/exceptions/cycles.md): A clock cycle is one beat of the processor's clock.
- [On the 68010](https://asm-editor.specy.app/documentation/m68k/exceptions/68010.md): Select the 68010 with opt p=68010.
- [Format errors](https://asm-editor.specy.app/documentation/m68k/exceptions/format-error.md): On the 68010 and 68020, rte checks the format/vector-offset word at 6(sp) to determine how many bytes to remove.
- [On the 68020](https://asm-editor.specy.app/documentation/m68k/exceptions/68020.md): Select the 68020 with opt p=68020.
- [Master and interrupt stacks](https://asm-editor.specy.app/documentation/m68k/exceptions/master-stack.md): On the 68020, bit 12 of sr, M, selects which supervisor stack a7 uses.
- [The throwaway frame](https://asm-editor.specy.app/documentation/m68k/exceptions/throwaway-frame.md): An IRQ taken with M set first pushes the interrupted program's frame on the master stack.
- [Frames on the 68020](https://asm-editor.specy.app/documentation/m68k/exceptions/68020-frames.md): The 68020 uses eight-byte format $0 frames for most exceptions, with the same SR, PC and format/vector-offset positions as the 68010.
- [Tracing on the 68020](https://asm-editor.specy.app/documentation/m68k/exceptions/68020-trace.md): T1, bit 15, is the 68000's T bit and traces every instruction.
- [Data at odd addresses](https://asm-editor.specy.app/documentation/m68k/exceptions/odd-addresses.md): The 68020 permits word and long data accesses at odd addresses.
- [Cycles on the 68020](https://asm-editor.specy.app/documentation/m68k/exceptions/68020-cycles.md): A real 68020 overlaps work on successive instructions and has an instruction cache.
