ARM mode
ARM architecture
For all user intents and purposes the ARM CPU has sixteen 32 bit registers noted R0 to R15 (R15 is also the program counter, R14 is the link register (ie: a BL (GOSUB) instruction copies the return address in R14 before jumping, a Return From Subroutine is performed by doing MOV PC, LR), and R13 is the Stack pointer).
Each instruction can be conditionally executed depending on the value of 5 flags.
Each instruction can be told to modify or not modify these 5 flags (add the S suffix to the instruction). Please read the ARM ARM (ARM Architecture and Reference Manual) for more information.
Please look at the ARMSAT Saturn instruction and the ARM mode documentation to see the instruction set and the rules of calling ARM code from Saturn code.
Skips
Skips are a first step from ML to a third generation language, even if they are only another way to write ASM instructions.
Skips are wonderful as they allow you to:
-structure your program
-avoid using gotos
-make programs and piece of code that can be easily copied and past (because there is no label) The foundation of Skips is the Block structure.
A block is enclosed in { and }, and can be nested within another block. The following instructions deal with blocks.
SKIPS instructions | Equivalents |
|
{ ... } | Defines a block (generates no code) | |
SK<Cond> { ... } | B<cond> .S... | *.S |
SKUB<Cond> { ... } | BL<cond> .S | ... *.S |
Once blocks are defined, special instructions can be used in them. The instructions called EXIT and UP allow jumping to the end or to the beginning of a block.
These instructions | are equivalent to |
{ | *.Beginning |
EXIT<Cond> | B<Cond> .End |
UP<Cond> | B<Cond>.Beginning |
} | *.End |
EXIT and UP can jump to the beginning or to the end of an
These instructions | Are equivalent to |
{ | *.Beg3 |
{ | *.Beg2 |
{ | *.Beg1 |
UP<Cond>2 | B<Cond> .Beg2 |
UP<Cond>3 | B<Cond> .Beg3 |
EXIT<Cond>1 | B<Cond> .End1 |
EXIT<Cond>3 | B<Cond> .End3 |
} | *.End1 |
} | *.End2 |
} | *.End3 |
Note: EXIT1 is equivalent to EXIT, and UP1 is equivalent to UP.