.Entry_ADFGO
 LDR     R12, [R12, #0]

 MOV     R6, R14
 MOV     R1, R0				;command tail
 MOV     R0, #16			;base 16 number
 SWI     XOS_ReadUnsigned		;read the value PRM1-460
 MOVVS   PC, R6
.Entry_ADFGO_GOARM3JIT
 MOV     R4, R2				;R4=start address

 ._L1					;do we have an environment string?
   LDRB    R0, [R1], #1
   TEQ     R0, #ASC(";")		;environment string?
   TEQNE   R0, #10
   TEQNE   R0, #13
   TEQNE   R0, #0			;terminator?
 BNE     _L1				;NO
 MOV    R3, R1

 TEQ    R0, #0
 BEQ    _no_environment
 ._L2					;find terminator
   LDRB    R0, [R1], #1
   TEQ     R0, #10
   TEQNE   R0, #13
   TEQNE   R0, #0			;terminator?
 BNE     _L2				;NO

 ._no_environment
 SUB     R1, R1, #1			;R1 points to a NULL
 STMFD   R13!, {R1-R3}
 SWI     XOS_GetEnv			;PRM1-301
 MOV     R7, R1				;R7=end of appspace
 LDMFD   R13!, {R1-R3}

 MOV     R0, #FSControl_StartApplication	;setup environment
 BL      pass_SWI_on
 SWI     XOS_FSControl			;PRM2-85
 MOVVS   PC, R6

 LDR     R13, [R12, #SVC_stack_init - VARS]	;collapse the SVC stack
 #if compile_RO == 311
   MOV     R2, PC
   BIC     R2, R2, #&FC000003		;USER IRQ/FIQ enabled
   TEQP    R2, #0
   NOP
   MOV     R13, R7
   MOV     R12, R13			;set R12 to stack pointer
   MOV     R14, PC
   MOV     PC, R4			;call code, R0=environment string
 #endif
 #if compile_RO > 311
   BL      check_JIT_and_taskID		;is the task under the JIT?
   BNE     _P2				;NO

   BL      get_taskID
   MRS     R2, CPSR			;go into the correct USER mode
   BIC     R2, R2, #%11001111 + (%1111 << 28)	;USER/USER32 IRQ/FIQ enabled
   MSR     CPSR_all, R2
   #if compile_IOMD == 1
     NOP
   #endif
   LDR     R13, pre_JIT_wimp_slot_size	;YES, put stack at end of appspace
   ADD     R13, R13, #&8000
   LDR     R14, [R12, #jit_managed_os_exit - VARS]
   MOV     R12, R13			;set R12 to stack pointer
  ADD     PC, R4, #jit_code_start	;call code, R0=environment string

   ._P2
   MRS     R2, CPSR			;go into the correct USER mode
   BIC     R2, R2, #%11001111 + (%1111 << 28)	;USER/USER32 IRQ/FIQ enabled
   MSR     CPSR_all, R2
   #if compile_IOMD == 1
     NOP
   #endif
   MOV     R13, R7
   MOV     R12, R13			;set R12 to stack pointer
   MOV     R14, PC
   MOV     PC, R4			;call code, R0=environment string
 #endif

.call_OS_Exit
 MOV     R0, #0
 MOV     R1, #0
SWI     OS_Exit
