INSTRUCTION SET
S3C4510B
ASSEMBLER SYNTAX
SWI{cond} <expression>
{cond}
Two character condition mnemonic, Table 3-2.
Evaluated and placed in the comment field (which is ignored by ARM7TDMI).
<expression>
Examples
SWI
SWI
SWINE
ReadC
WriteI+ “k”
0
; Get next character from read stream.
; Output a “k” to the write stream.
; Conditionally call supervisor with 0 in comment field.
Supervisor code
The previous examples assume that suitable supervisor code exists, for instance:
0x08 B Supervisor
EntryTable
DCD ZeroRtn
DCD ReadCRtn
DCD WriteIRtn
. . .
; SWI entry point
; Addresses of supervisor routines
Zero
EQU 0
ReadC
WriteI
EQU 256
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
; Save work registers and return address.
; Get SWI instruction.
STMFD
LDR
R13,{R0-R2,R14}
R0,[R14,#-4]
BIC
MOV
R0,R0,#0xFF000000
R1,R0,LSR#8
; Clear top 8 bits.
; Get routine offset.
ADR
LDR
R2,EntryTable
R15,[R2,R1,LSL#2]
; Get start address of entry table.
; Branch to appropriate routine.
WriteIRtn
. . . . . .
LDMFD
; Enter with character in R0 bits 0-7.
R13,{R0-R2,R15}^
; Restore workspace and return,
; restoring processor mode and flags.
3-50