%begin
  %routine Set vector(%integer No, Proc, Wksp)
    %constinteger Swi OS Claim Vector=31
    *SWI_Swi OS Claim Vector
  %end

  %label nowhere, install
  %constinteger OSWRCH=3
  %integer mycode, save area, ch


  *STMDB_12!,<1,2,3,4,5,6,7,8,9,10,11,12>
  *STR_12,save area
  *BL_nowhere
nowhere:
  *ADD_1,14,#16
  *STR_1,mycode
  *B_install
vector code:
! A few no-ops in case I got my sums wrong...
  *CMP_0,0
  *CMP_0,0
  *CMP_0,0

  ! R0 = char
  ! R12 = IMP register save area
  ! R13 = FD-type stack
  ! Exit addr on stack ([R13]).
  *STMDB_13!,<1,2,3,4,5,6,7,8,9,10,11,12>
  *LDMIA_12,<1,2,3,4,5,6,7,8,9,10,11,12>
  ! Imp environment (mostly) restored
  ! stack limit not correct
  *STR_0, ch
  *LDMIA_13!,<1,2,3,4,5,6,7,8,9,10,11,12>
  *MOV_15,14


install:
  *LDMIA_12,<1,2,3,4,5,6,7,8,9,10,11,12>
  Set vector(OSWRCH, mycode, save area)
%endofprogram
