version 1.215, 2010/04/10 14:36:34
|
version 1.216, 2010/04/10 15:19:27
|
Line 13046 directly encoded into the instruction mn
|
Line 13046 directly encoded into the instruction mn
|
and @code{^stm,}. |
and @code{^stm,}. |
|
|
Addressing modes for load/store multiple are not encoded as |
Addressing modes for load/store multiple are not encoded as |
instruction suffixes, but instead specified after the register that |
instruction suffixes, but instead specified like an addressing mode, |
supplies the address. Use one of @code{DA}, @code{IA}, @code{DB}, |
Use one of @code{DA}, @code{IA}, @code{DB}, @code{IB}, @code{DA!}, |
@code{IB}, @code{DA!}, @code{IA!}, @code{DB!} or @code{IB!}. |
@code{IA!}, @code{DB!} or @code{IB!}. |
|
|
The following table gives some examples: |
The following table gives some examples: |
|
|
@example |
@example |
Gforth normal assembler |
Gforth normal assembler |
r4 @{ r0 r7 r8 @} ia stm, stmia r4, @{r0,r7,r8@} |
r4 ia @{ r0 r7 r8 @} stm, stmia r4, @{r0,r7,r8@} |
r4 @{ r0 r7 r8 @} db! ldm, ldmdb r4!, @{r0,r7,r8@} |
r4 db! @{ r0 r7 r8 @} ldm, ldmdb r4!, @{r0,r7,r8@} |
sp @{ r0 r15 r-r @} ia! ^ldm, ldmfd sp!, @{r0-r15@}^ |
sp ia! @{ r0 r15 r-r @} ^ldm, ldmfd sp!, @{r0-r15@}^ |
@end example |
@end example |
|
|
Control structure words typical for Forth assemblers are available: |
Control structure words typical for Forth assemblers are available: |
Line 13076 Example of a definition using the ARM as
|
Line 13076 Example of a definition using the ARM as
|
@example |
@example |
abi-code my+ ( n1 n2 -- n3 ) |
abi-code my+ ( n1 n2 -- n3 ) |
\ arm abi: r0=sp, r1=fp, r2, r3 saved by caller |
\ arm abi: r0=sp, r1=fp, r2, r3 saved by caller |
r0 @{ r2 r3 @} IA! ldm, \ pop r2 = n2, r3 = n1 |
r0 IA! @{ r2 r3 @} ldm, \ pop r2 = n2, r3 = n1 |
r3 r2 r3 add, \ r3 = n2+n1 |
r3 r2 r3 add, \ r3 = n2+n1 |
r3 r0 -4 #]! str, \ push r3 |
r3 r0 -4 #]! str, \ push r3 |
pc lr mov, \ return (r0=sp, r1=fp) to caller |
pc lr mov, \ return (r0=sp, r1=fp) to caller |