# Fielding interrupts and processing errors
# Process interpreter detected errors
pushal _intr #reset interrupt signal
# Segmentation Violations => No more memory available for the stack
# Process computational errors
pushal _except #reset signal
movl PC(fp),r0 #r0 has PC at point following error
moval errtbl-4,r1 #r1 points to error offset table
addl2 $4,r1 #determine cause of error
blssu l3405 #not in table => system error
movzwl (r1),-(sp) #select error message
# Table of offsets and their associated errors
.long _AS2, _OFF, EASSIGN
.long _INX2, _NIL, ESUBSCR
.long _ADD2, _ADD28, EFIXADD
.long _ADD28, _SUB2, EFLTADD
.long _SUB2, _SUB28, EFIXSUB
.long _SUB28, _SQR2, EFLTSUB
.long _SQR2, _MUL28, EFIXMUL
.long _MUL28, _DIV2, EFLTMUL
.long _DIV2, _MOD2, EFIXDIV
.long _MOD2, _ABS2, EMODDIV
.long _ABS2, _ABS8, EFIXNEG
.long _DVD2, _IND1, EFLTDIV
.long _RANG2, _CASE1OP, ERANGE
.long _STOI, _UNDEF, EBUILTIN
.long _PACK, _UNPACK, EPACK
.long _UNPACK, _GET, EUNPACK
# recover values of dp and lino from the stack
.word R2|R3|R4|R5|R6|R7|R8|R9|R10|R11
pushl fp #sift through the stack to get the
movl sp,oldsp # values of dp and lino
bicw3 $0xf000,MASK(fp),mask #register save mask
moval REGS(fp),sp #point to saved registers
cmpl PC(fp),$_interpret #check for interpreter frame
cmpl PC(fp),$_endinterpret #check for end of interpreter
movl FP(fp),fp #get next frames registers
movl oldsp,sp #restore current frame
movl r9,*4(ap) #return dp
movl r11,*8(ap) #return lino
oldsp: .space 4 #old value of sp
mask: .space 2 #register pop mask