

Understanding ARM Assembly, Part 1 - ingve
http://blogs.msdn.com/b/ntdebugging/archive/2013/11/22/understanding-arm-assembly-part-1.aspx

======
snvzz
I think this, while Raspberry Pi specific:

[https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/)

is a better intro to arm asm.

------
joosters
Perhaps I'm jumping ahead of the series here, but one of the unique (I think?)
features of ARM is that all the various conditionals listed (NE, EQ, LT etc)
can be applied to just about any instruction, and not just a branch. So, you
could have an instruction sequence like:

    
    
      SUBS R1,R2,R3
      ADDEQ R4,R4,#1
    

whereas in other instruction sets you'd have to branch over the 'ADD'
instruction if the previous comparison was non-zero.

(Not sure if this applies to ARM thumb style instructions or not; my ARM
experience is very out of date!)

~~~
leicmi
For ARM thumb2 style you need a third instruction between the two:

    
    
      IT EQ

The 'IT' is for 'if then'. There could also be more 'then's and 'else's for
the conditional execution of muliple instructions:

    
    
      ITTE LT

(If then then else) The following instructions could for example be:

    
    
      ADDEQ ...
      STREQ ...
      BNE ... (Branch - not equal because of the else)
    
    

Source:
[http://community.arm.com/groups/processors/blog/2010/09/30/c...](http://community.arm.com/groups/processors/blog/2010/09/30/condition-
codes-3-conditional-execution-in-thumb-2)

------
cesarb
I believe this link came from today's Raymond Chen's blog post:
[http://blogs.msdn.com/b/oldnewthing/archive/2015/08/11/10634...](http://blogs.msdn.com/b/oldnewthing/archive/2015/08/11/10634261.aspx)

He has just finished a 10-part series on IA-64, and probably posted that to
provide some contrast.

------
shepardrtc
This series ends abruptly at Part 2. The author said there would be a Part 3,
but I couldn't find anything.

In any case, if you want another overview article on ARM Assembly, try this:
[http://www.coranac.com/tonc/text/asm.htm](http://www.coranac.com/tonc/text/asm.htm)

If you want a tutorial: [http://thinkingeek.com/2013/01/09/arm-assembler-
raspberry-pi...](http://thinkingeek.com/2013/01/09/arm-assembler-raspberry-pi-
chapter-1/)

And finally, this is a pretty good book if you've never looked at Assembly
before and you've got a RPi or RPi emulator: [http://www.amazon.com/Raspberry-
Assembly-Language-RASPBIAN-B...](http://www.amazon.com/Raspberry-Assembly-
Language-RASPBIAN-Beginners/dp/1492135283)

~~~
lurker145
Part 3:
[http://blogs.msdn.com/b/ntdebugging/archive/2014/05/29/under...](http://blogs.msdn.com/b/ntdebugging/archive/2014/05/29/understanding-
arm-assembly-part-3.aspx)

------
mhd
One thing I remember when RiscOS was still a bit of a thing was that a lot of
its users praised ARM assembly. That, plus the short burst of 68k ASM when the
Palm Pilot came out, was probably the last "big" hobbyist surge of assembly
that I can think of right now.

~~~
louthy
I used to write games on RiscOS in ARM assembly. Sooo much nicer than any
other the others I'd used before or since. One thing I vaguely remember (my
memory is pretty poor) was being able to load 64 bytes worth of data into the
registers with one instruction (and store them with another). This meant
writing sprite blit routes was a joy and super fast. The conditional
instructions also were lovely.

A few years later when I was writing R3000 assembly on the PS1 I remember
thinking how poor it felt compared to writing ARM assembly (the R3000 was the
only other RISC assembly language I'd used other than ARM at that point).

It was the only assembly language I genuinely enjoyed writing code in rather
than what usually felt like a fight with most other assemblers. I give Sophie
Wilson the credit for that, and probably the credit for my entire career,
because of BBC BASIC on the BBC Micro before that!

------
wyc
If you're interested in picking apart a small self-contained project, I wrote
a simple IRC bot in ARM for GNU/Linux a while ago:

[https://github.com/wyc/armbot](https://github.com/wyc/armbot)

There are instructions to run/debug it on an x86_64 machine via qemu.

------
stephengillie
> _As you can see here the SIMD (NEON) extension adds 16 – 128 bit registers
> (q0-q15) onto the floating point registers. So if you reference Q0 it is the
> same as referencing D0-D1 or S0-S1-S2-S3._

Is this how SIMD is usually implemented in hardware? Have a set of circuitry
that pushes one command to multiple registers?

~~~
oso2k
SIMD does stand for Single Instruction Multiple Data [0]. So, the hardware
performs some linear algebra operation on one or more vectors. Whether the
vector is stored in unique registers, combined registers (as described above),
or memory buffer(s), that is up to the hardware designer. In fact, on x86, the
MMX registers were aliases to the normal floating point registers [1], and
whereas on SSE, new registers were added [2].

[0] [https://en.wikipedia.org/wiki/SIMD](https://en.wikipedia.org/wiki/SIMD)

[1]
[https://en.wikipedia.org/wiki/MMX_(instruction_set)#Technica...](https://en.wikipedia.org/wiki/MMX_\(instruction_set\)#Technical_details)

[2]
[https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions#Regi...](https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions#Registers)

