Ceci est une version archivée de
Setexc() à 2006-01-08 20:20:46.
(Set exception)
(VOIDP)() Setexc( num, newvec )
WORD num;
VOID (*newvec)();
Setexc() allows to read or modify system exception vectors.
Opcode
5 (0x05)
Availability
Parameters
num is the m68k CPU exception vector number you want to redirect.
newvec is the pointer to your new vector handler.
Binding
pea newvec
move.w #num,-(sp)
move.w #$05,-(sp)
trap #13
addq.l #8,sp
Commands and arguments
Passing VEC_INQUIRE (-1) as newvec will return current system exception handler.
CPU exception vectors
num (name) |
num (value) |
Vector |
VEC_BUSERROR |
0x02 |
m68k Bus error exception |
VEC_ADDRESSERROR |
0x03 |
m68k Address error exception |
VEC_ILLEGALINSTRUCTION |
0x04 |
m68k Illegal instruction exception |
VEC_DIVIDEBYZERO |
0x05 |
m68k Divide by zero exception |
VEC_CHKINST |
0x06 |
m68k CHK instruction exception |
VEC_TRAPINST |
0x07 |
m68k TRAPV, FTRAPcc, TRAPcc, cpTRAPcc instruction exception |
VEC_PRIVILEGEVIOLATION |
0x08 |
m68k Privilege violation exception |
VEC_TRACE |
0x09 |
m68k Trace exception |
VEC_LINEA |
0x0a |
m68k Line-A exception |
VEC_LINEF |
0x0b |
m68k Line-F exception |
VEC_COPROVIOLATION |
0x0d |
m68k coprocessor protocol violation exception |
VEC_FORMATERROR |
0x0e |
m68k format error exception |
VEC_UNINITINTERRUPT |
0x0f |
m68k uninitialized interrupt exception |
VEC_AUTOVECTOR0 |
0x18 |
m68k Spurious interrupt |
VEC_AUTOVECTOR1 |
0x19 |
m68k Autovectorised level 1 interrupt |
VEC_AUTOVECTOR2 = VEC_HBL |
0x1a |
m68k Autovectorised level 2 interrupt (HBL) |
VEC_AUTOVECTOR3 |
0x1b |
m68k Autovectorised level 3 interrupt |
VEC_AUTOVECTOR4 = VEC_VBL |
0x1c |
m68k Autovectorised level 4 interrupt (VBL) |
VEC_AUTOVECTOR5 |
0x1d |
m68k Autovectorised level 5 interrupt |
VEC_AUTOVECTOR6 |
0x1e |
m68k Autovectorised level 6 interrupt |
VEC_AUTOVECTOR7 |
0x1f |
m68k Autovectorised level 7 interrupt |
VEC_TRAP0 |
0x20 |
m68k Trap #0 |
VEC_TRAP1 = VEC_GEMDOS |
0x21 |
m68k Trap #1 (GemDOS) |
VEC_TRAP2 = VEC_GEM |
0x22 |
m68k Trap #2 (AES, VDI) |
VEC_TRAP3 |
0x23 |
m68k Trap #3 |
VEC_TRAP4 |
0x24 |
m68k Trap #4 |
VEC_TRAP5 |
0x25 |
m68k Trap #5 |
VEC_TRAP6 |
0x26 |
m68k Trap #6 |
VEC_TRAP7 |
0x27 |
m68k Trap #7 |
VEC_TRAP8 |
0x28 |
m68k Trap #8 |
VEC_TRAP9 |
0x29 |
m68k Trap #9 |
VEC_TRAP10 |
0x2a |
m68k Trap #10 |
VEC_TRAP11 |
0x2b |
m68k Trap #11 |
VEC_TRAP12 |
0x2c |
m68k Trap #12 |
VEC_TRAP13 = VEC_BIOS |
0x2d |
m68k Trap #13 (BIOS) |
VEC_TRAP14 = VEC_XBIOS |
0x2e |
m68k Trap #14 (XBIOS) |
VEC_TRAP15 |
0x2f |
m68k Trap #15 |
FPU exception vectors
num (name) |
num (value) |
Vector |
VEC_FPUUNORDEREDCONDITION |
0x30 |
FPU branch or set on unordered condition exception |
VEC_FPUINEXACT |
0x31 |
FPU inexact result exception |
VEC_FPUDIVIDEBYZERO |
0x32 |
FPU floating-point divide by zero exception |
VEC_FPUUNDERFLOW |
0x33 |
FPU underflow exception |
VEC_FPUOPERANDERROR |
0x34 |
FPU operand error exception |
VEC_FPUOVERFLOW |
0x35 |
FPU overflow exception |
VEC_FPUSIGNAN |
0x36 |
FPU signaling NAN exception |
PMMU exception vectors
num (name) |
num (value) |
Vector |
VEC_PMMUCONFIGERROR |
0x38 |
PMMU configuration error exception |
VEC_PMMUILLEGAL |
0x39 |
PMMU illegal operation exception |
VEC_PMMUACCESSVIOLATION |
0x3a |
PMMU access violation exception |
MFP #0 exception vectors
Note: The default vector base value can be set in MFP Vector Register. TOS sets it so the base vector is 0x40.
num (name) |
num (value) |
Vector |
VEC_MFP0_0 = VEC_PARALLEL |
0x40 |
MFP interrupt #0 (GPIP pin #0, Parallel port receive) |
VEC_MFP0_1 |
0x41 |
MFP interrupt #1 (GPIP pin #1, RS-232 carrier detect) |
VEC_MFP0_2 |
0x42 |
MFP interrupt #2 (GPIP pin #2, RS-232 clear to send) |
VEC_MFP0_3 = VEC_BLITTER |
0x43 |
MFP interrupt #3 (GPIP pin #3, Blitter operation complete) |
VEC_MFP0_4 = VEC_TIMERD |
0x44 |
MFP interrupt #4 (Timer D, RS-232 baud rate generator) |
VEC_MFP0_5 = VEC_TIMERC |
0x45 |
MFP interrupt #5 (Timer C, 200hz system clock) |
VEC_MFP0_6 = VEC_ACIA |
0x46 |
MFP interrupt #6 (GPIP pin #4, ACIA receive) |
VEC_MFP0_7 = VEC_DISKDMA |
0x47 |
MFP interrupt #7 (GPIP pin #5, Floppy, hard disk DMA) |
VEC_MFP0_8 = VEC_TIMERB |
0x48 |
MFP interrupt #8 (Timer B, HBL) |
VEC_MFP0_9 |
0x49 |
MFP interrupt #9 (RS-232 transmit error) |
VEC_MFP0_10 |
0x4a |
MFP interrupt #10 (RS-232 transmit buffer error) |
VEC_MFP0_11 |
0x4b |
MFP interrupt #11 (RS-232 receive error) |
VEC_MFP0_12 |
0x4c |
MFP interrupt #12 (RS-232 receive buffer error) |
VEC_MFP0_13 = VEC_TIMERA |
0x4d |
MFP interrupt #13 (Timer A, audio DMA) |
VEC_MFP0_14 |
0x4e |
MFP interrupt #14 (GPIP pin #6, RS-232 ring indicator) |
VEC_MFP0_15 |
0x4f |
MFP interrupt #15 (GPIP pin #7, Monochrome monitor) |
MFP #1 exception vectors
Note: The default vector base value can be set in MFP Vector Register. TOS sets it so the base vector is 0x50. This second MFP is only present on TT machines.
num (name) |
num (value) |
Vector |
VEC_MFP1_0 |
0x50 |
MFP interrupt #0 (GPIP pin #0) |
VEC_MFP1_1 |
0x51 |
MFP interrupt #1 (GPIP pin #1) |
VEC_MFP1_2 |
0x52 |
MFP interrupt #2 (GPIP pin #2, SCC DMA complete) |
VEC_MFP1_3 |
0x53 |
MFP interrupt #3 (GPIP pin #3, RS-232 ring indicator) |
VEC_MFP1_4 |
0x54 |
MFP interrupt #4 (Timer D, RS-232 baud rate generator) |
VEC_MFP1_5 |
0x55 |
MFP interrupt #5 (Timer C, SCC TRxCB) |
VEC_MFP1_6 |
0x56 |
MFP interrupt #6 (GPIP pin #4) |
VEC_MFP1_7 |
0x57 |
MFP interrupt #7 (GPIP pin #5, SCSI DMA complete) |
VEC_MFP1_8 |
0x58 |
MFP interrupt #8 (Timer B) |
VEC_MFP1_9 |
0x59 |
MFP interrupt #9 (RS-232 transmit error) |
VEC_MFP1_10 |
0x5a |
MFP interrupt #10 (RS-232 transmit buffer error) |
VEC_MFP1_11 |
0x5b |
MFP interrupt #11 (RS-232 receive error) |
VEC_MFP1_12 |
0x5c |
MFP interrupt #12 (RS-232 receive buffer error) |
VEC_MFP1_13 |
0x5d |
MFP interrupt #13 (Timer A) |
VEC_MFP1_14 |
0x5e |
MFP interrupt #14 (GPIP pin #6, Real time clock) |
VEC_MFP1_15 |
0x5f |
MFP interrupt #15 (GPIP pin #7, SCSI controller) |
SCC exception vectors
num (name) |
num (value) |
Vector |
VEC_SCC_B_TBE |
0x60 |
SCC Port B transmit buffer empty |
VEC_SCC_B_ESC |
0x62 |
SCC Port B external status change |
VEC_SCC_B_RCA |
0x64 |
SCC Port B receive character available |
VEC_SCC_B_SRC |
0x66 |
SCC Port B special receive condition |
VEC_SCC_A_TBE |
0x68 |
SCC Port A transmit buffer empty |
VEC_SCC_A_ESC |
0x6a |
SCC Port A external status change |
VEC_SCC_A_RCA |
0x6c |
SCC Port A receive character available |
VEC_SCC_A_SRC |
0x6e |
SCC Port A special receive condition |
System exception vectors
num (name) |
num (value) |
Vector |
VEC_TIMER |
0x100 |
System timer (etv_timer) |
VEC_CRITICALERROR |
0x101 |
Critical error handler (etv_critic) |
VEC_TERMINATE |
0x102 |
Process terminate handler (etv_term) |
Return Value
The (VOIDP)() value is the previous function pointer to the system vector.
Comments
m68k CPU has predefined exception vectors, like bus error, illegal instruction, division by zero, and so on. For example, the bus error exception is the #2 exception. Virtual memory managers redirect it to a custom routine to swap needed memory in.
If you need to redirect some vectors in your program, beware to restore them upon exit, or the system will crash. If you make a
TSR program, you must use
XBRA? protocol to ensure your vector will not be deleted by some other programs. Last but not least, redirecting system vectors under a mutitasking OS like
MiNT is definitely not recommended, and should be avoided.