.vector_handler_31
 TST     R1, #1				;is it our code asking for the actual
 BICNE   R1, R1, #1			;..address?
 BNE     vector_handler_forward		;YES, pass to OS

 LDR     R12, is_screen_remapped
 TEQ     R12, #0			;is the screen memory remapped?
 BEQ     vector_handler_forward		;NO, exit

 #if JIT_WIMP_support == 1
   BL      check_task_ID		;task we support?
   BNE     vector_handler_forward	;NO, pass to OS
 #endif

 LDR     R12, emulate_RISCOS
 CMP     R12, #&350 << 8		;don't remap RO3.50+
 BGE     vector_handler_forward

 LDR     R12, [R13, #4]			;get PC from stack
 #if compile_RO == 400
   BIC     R12, R12, #&FC000003
 #endif
 ADR     R14, swi_to_pass_to_OS + 4
 CMP     R12, R14			;check for hypervised call
 CMPNE   R12, #jit_slotsize		;is the OS asking for the address?
 BHI     vector_handler_forward		;YES, pass to OS
 STMFD   R13!, {R0, R2-R4}
 ADR     R2, _table
 ADR     R3, _table_end
 SUB     R12, R0, #4
 ._L1
   LDR     R14, [R12, #4]!

   TEQ     R14, #148			;ScreenStart?
   TEQNE   R14, #149			;DisplayStart?
   SUBEQ   R4, R12, R0
   STREQ   R4, [R2], #4			;store the result address

   CMN     R14, #1			;last in list?
   TEQNE   R2, R3			;end of our table?
 BNE     _L1

 ADR     R12, _SPSR
 BL      pre_SWI_veneer			;call SWI that follows
 SWI     XOS_ReadVduVariables
 BL      post_SWI_veneer
 BL      dontexit_SWI_veneer

 LDR     R3, DA2_address
 LDR     R0, DA2_size
 SUB     R3, R3, #&2000000
 ADD     R3, R3, R0
 ADR     R0, _table
 ._L2
   TEQ     R0, R2			;last entry?
   LDMEQFD  R13!, {R0, R2-R4, R12, PC}^	;YES, exit

   LDR     R12, [R0], #4
   LDR     R4, [R1, R12]		;get the entry
   CMP     R4, #&2000000		;is it in RO3.5+ space?
   SUBHI   R4, R4, R3			;YES, correct address
   STRHI   R4, [R1, R12]		; |+ store back
 B        _L2


 ._SPSR		DBD 4
 ._table        DBD 4
 ._table_end