	AREA ARMex, CODE, READONLY	; name this block of code
	ENTRY			; mark first instruction
				; to execute
0x08
	B Supervisor			; SWI entry point
	EntryTable				; addresses of supervisor routines
	DCD ZeroRtn
	DCD ReadCRtn
	DCD WriteIRtn
	
	Zero EQU 0
	ReadC EQU 256
	WriteI EQU 512
Supervisor
						; SWI has routine required in bits 8-23 and data (if any) in bits 0-7.
						; Assumes R13_svc points to a suitable stack
	STMFD R13,{R0-R2,R14}		; save work registers and return address
	LDR R0,[R14,#-4]			; get SWI instruction
	BIC R0,R0,#0xFF000000		; clear top 8 bits
	MOV R1,R0,LSR#8			; get routine offset
	ADR R2,EntryTable			; get start address of entry table
	LDR R15,[R2,R1,LSL#2]		; branch to appropriate routine
SSY					; enter with character in R0 bits 0-7
	LDR R1,#12345678
	LDMFD R13,{R0-R2,R15}^		; restore workspace and return
				; restoring processor mode and flags


0x8000
	SWI SSY			;branch to ssy
        END                         ; Mark end of file