gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > ARM Assembler Newbie questions

#2932 - I.C.E - Fri Feb 14, 2003 5:08 pm

I have the following questions:

1. What does "!" do? According to a ARM Quick Reference Card here it stands for Updates base register after data transfer. But what does that mean?

2. Why do I have to use "=" in instructions like that: LDR r1,=REG_DISPCNT? I think It has something to do with the addressing mode because according to QRC the syntax for LDR is LDR{cond} Rd, <a_mode2>. If I look at the addressing mode 2, there are some examples for pre/post indexing with immediate offset and so on. So I think that beacuse REG_DISPCNT is just a value and not a register (which are used in addressing mode 2) I have to use the "=" sign. But what does it exactly do?

3. For what is a Soft Preload (Memory system hint) PLD <a_mode2> usefull?

4. About assembler instruction description. The registers in documents are often called Rd, Rm, Rs, Rn. Do the "d" "m" "s" and "n" have a special meaning or are they just variables for any register? I ask because the naming scheme is a bit odd.

Thanks :)
_________________
To this day, many C programmers believe that "strong typing" just means pounding extra hard on the keyboard.
- Peter van der Linden

#2934 - jeff - Fri Feb 14, 2003 6:02 pm

Quote:
1. What does "!" do? According to a ARM Quick Reference Card here it stands for Updates base register after data transfer. But what does that mean?


It will set a W (writeback) bit in the instruction. For example:
ldr r0,[r1,#4]!

will evaluate to:
r0 = [r1+4]
r1 = r1 + 4

Quote:
Why do I have to use "=" in instructions like that: LDR r1,=REG_DISPCNT?


It tells the assembler to add a constant to the "pool" and to actually do a load that is an offset of the program counter.

Example:
ldr r0,=#0x403
.pool

will evaluate to:
ldr r0,[pc,#-4]
0x00000403

It is just easier to read.

Question 3, I don't know :)

Quote:
The registers in documents are often called Rd, Rm, Rs, Rn. Do the "d" "m" "s" and "n" have a special meaning or are they just variables for any register?


d = destination
m/n = operands
s = shift

In ARM mode, these can be ANY of the 16, 32-bit registers, except in a few cases (where you can't use the PC).

HTH,
Jeff