Page 1 of 1
ARM Assembler Instruction Cheatsheet
Posted: 31 Oct 2021, 10:21
by Go4IT
Here i'd like to post some common Assembler commands found in disassembly of several firmwares utilizing ARM CPUs (like MAC7116 of IPC).
The headings of the replies are set to the topic (e.g. "Storing data to memory locations"). In each topic post some samples and explain them.
Storing data to memory locations
Posted: 31 Oct 2021, 10:22
by Go4IT
This command stores one Byte, the lowest byte (Bits 7-0) of the current value of R1 (remember: every ARM register is 32-Bit wide) to the memory location indicated by "[R0,#1]", so register R0 contains a fixed value (base address) and "#1" gives the offset to that value, so it's stored at "R0+1".
Retrieving data from memory locations
Posted: 31 Oct 2021, 10:41
by Go4IT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Retrieve a 4 Byte value (32 Bit)
By reading this instruction it's clear what it does, loading register R0 with the value 0xFC000000. What's interesting here is the "=" which denotes that the value is not located next to the LDR opcode itself, but within a range in WORD-boundaries (a WORD is 4 Bytes in ARM-Architecture). In Thumb-Mode, this instruction is only two bytes long, giving the distance to the value itself in WORD counts.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Retrieve a single Byte:
Loads a Byte from memory location "R0+2" (R0 containing the base memory address and the index number 2 given as immediate value) and store it in the lowest Byte of the 32-Bit register R1.