PRT_LINE x1k12                        Ŀ
                         EXCEPTION PROCEDURE 
                        
EXCEPTION:
  move SR,SR_Saved
  set S
  clr T
  if Exception = Reset
  then RESET
  endif
  if Exception = Interrupt
  then move Interrupt_Pending_Level,I0_I1_I2
    if Exception = Auto_Vector_Interrupt
    then Vector# = 24+I0_I1_I2
    else (Exception=Non_Auto_Vector_Interrupt) MC68901 gives Vector#
    (if MC68901 non Reseted then Vector# = 15)
      if Bus Error
      then Vector# = 24 (Parasit Interrupt)
      endif
    endif
  else calculate Vector#
  endif
  mul #4,Vector#
  move.l PC,-(SSP)
  move SR_Saved,-(SSP)
  if Bus Error or Address Error
    if it is the 1rst Bus Error or Address Error
    then EXCEPTION
    else HALT
    endif
  endif
  if Exception = Bus Error or Address Error (cause to prefetch: PC=PC+2 ... +10)
    move Instruction_Register,-(SSP)
    move.l Fault_address,-(SSP)
    move Processor_State,-(SSP) (b0-b2=FC0-FC2  b3=I/N  b4=R/W)
       *FUNCTION CODES        FC2 FC1 FC0
        User Data              0   0   1
        User Programm          0   1   0
        Super Data             1   0   1
        Super Programm         1   1   0
        Interrupt Acknowledge  1   1   1
         -                       Other
       *I/N Instruction/exceptioN
        0: Instruction TRAP TRAPV CHK DIV0
        1: Reset Bus/Address_Error Trace Interrupt Illegal Line_A/F
           & Privilege_Violation
       *R/W  1:Read  0:Write
  endif
  move.l (Vector#),PC
  if Bus Error
    if it is the 1rst Bus Error or Address Error
    then EXCEPTION
    else HALT
    endif
  endif
  ...
RTE

HALT: wait RESET
RESET:
  move #%111,I0_I1_I2
  move #0,Vector#
  mul #4,Vector#
  move.l (Vector#),SSP
  move #1,Vector#
  mul #4,Vector#
  move.l (Vector#),PC
  ...
                             Ŀ
                              EXCEPTION PRIORITY LEVELS 
                Ĵ
                 High level     Reset                  
                                Bus Error              
                                Address Error          
                                Trace                  
                                Interrupt              
                                Illegal                
                                Line_A Line_F          
                                Privilege Violation    
                  Low level     TRAP TRAPV CHK DIV0    
                
                             Ŀ
                              INTERRUPT PRIORITY LEVELS 
Ŀ
          Interrupt if IPL2_IPL1_IPL0 >= I2_I1_I0 (Excepted for NMI)          
Ĵ
IPL2IPL1IPL0                        Interrupt                              
Ĵ
  1   1   1  (Non Maskable Interrupt , Expand Port)                        
Ĵ
  1   1   0  MC68901                                                       
Ĵ
  1   0   1  (Expand Port)                                                 
Ĵ
  1   0   0  Vertival BLanking                                             
Ĵ
  0   1   1  (Expand Port)                                                 
Ĵ
  0   1   0  Horizontal BLanking                                           
Ĵ
  0   0   1  -                                                             
Ĵ
  0   0   0  No Interrupt                                                  

                                ͻ
                                 EXCEPTION VECTORS 
ͻ
Address $ Vector#    Exception                                              
Ķ
     0/4      0/1    Reset SSP / PC                                         
       8        2    Bus Error                                              
       C        3    Address Error                                          
      10        4    Illegal Instructions                                   
      14        5    DIV by 0 Instruction                                   
      18        6    CHK Instruction                                        
      1C        7    TRAPV Instruction                                      
      20        8    Privilege Violation                                    
      24        9    Trace                                                  
      28       10    $Axxx Instructions                                     
      2C       11    $Fxxx Instructions                                     
   30-38    12-14    -                                                      
      3C       15    Non Reseted Interrupt                                  
   40-5C    16-23    -                                                      
      60       24    Parasit Interrupt                                      
      64       25    Auto_Vector Interrupt    #1= -                         
      68       26    Auto_Vector Interrupt    #2= Horizontal BLanking       
      6C       27    Auto_Vector Interrupt    #3= -                         
      70       28    Auto_Vector Interrupt    #4=   Vertical BLanking       
   74-7C    29-31    Auto_Vector Interrupt  #5-7= -                         
   80-BC    32-47    TRAP Instruction      #0-15                            
   C0-FC    48-63    -                                                      
 100-3FC   64-255    Non_Auto_Vector Interrupts                             
ͼ
