examples of arm assem.

40 views
Skip to first unread message

Hul Tytus

unread,
May 12, 2021, 9:18:08 PMMay 12
to

Anyone know where on the internet files of programs, or portions
of such, written an Arm assembley can be found? I'm in need
of examples of arm assembly to serve as test code for a just
written assembler.

Hul



Theo

unread,
May 13, 2021, 9:28:30 AMMay 13
to
ARM has at least 4 instruction sets:

1. The classic 32-bit ISA (32-bit instructions operating on 32 bit data)
2. Thumb compressed 16-bit instructions (operating on 32 bit data)
3. Thumb-2 compressed 16-bit instructions
(not strictly a separate ISA but a way to mix #1 and #2 in a single
instruction stream)
4. AArch64 32-bit wide instructions operating on 64-bit data
(completely different from all the above)

There are then classic ARM 32-bit mnemonics, Thumb mnemonics and UAL
'unified assembly language' intend to cover both with one syntax.

Plus armasm and gas have different ways of writing assembly code.


Choose your poison...

Theo

boB

unread,
May 13, 2021, 2:51:00 PMMay 13
to
On 13 May 2021 14:28:24 +0100 (BST), Theo
Good point about the different instruction sets !

I just use the regular Cortex M3 M4 and old non Cortex M versions
myself.

I get comfused on the actual "versions" or ARM code though...

I used the older NXP/Philips parts with no Cortex M, the LPC2368
series. Not sure if that is V4 or V7 ? Or something else ?

boB


Don Y

unread,
May 13, 2021, 2:54:57 PMMay 13
to
It's unclear whether his tool targets one dialect, all, or can be
commanded (command line switch) to address a specific one.

One assumes that having the knowledge to craft such a tool would
imply knowledge of the problem he's solving! (?)

Hul Tytus

unread,
May 13, 2021, 6:37:51 PMMay 13
to
Bob - I'm not too sure either. I'll probably find out though.
The version 7 arckitecture reference is the current source.

Hul

Hul Tytus

unread,
May 13, 2021, 6:45:37 PMMay 13
to
Don, the objective is a small assembler for in-house use and
to be included with some equipment with arm processors. Some
list files for checking the immediate and branching calculations
and placements would be handy.

Hul

Don Y

unread,
May 13, 2021, 7:55:49 PMMay 13
to
On 5/13/2021 3:45 PM, Hul Tytus wrote:
> Don, the objective is a small assembler for in-house use and
> to be included with some equipment with arm processors. Some

*Not* "self-hosting" but, rather, just to avoid the "mess" of
installing a UN*X-ish environment on <whatever> platform your
folks develop? Esp if you wanted to allow customers that
capability?

> list files for checking the immediate and branching calculations
> and placements would be handy.

So, you don't just want "sample sources" but, rather, sample
*compiled* (assembled) sources -- as a check for your code generation?

Do you have some other assembler on-hand (gas, gcc) to produce those?

[I'm assuming you are generating "absolute" objects (not relocatable
as that would further complicate such an analysis) so you'd also need
to link/load the objects built with gas, etc.?]

Theo

unread,
May 14, 2021, 5:49:51 AMMay 14
to
Hul Tytus <h...@panix.com> wrote:
> Don, the objective is a small assembler for in-house use and
> to be included with some equipment with arm processors. Some
> list files for checking the immediate and branching calculations
> and placements would be handy.

You didn't really clarify your requirements, but I'll point you at one big
'classic' 32-bit ARM codebase:

https://www.riscosopen.org/

specifically
https://gitlab.riscosopen.org/RiscOS/Sources

This is targeting the assembly format used by armasm (using an older fork
of that called objasm). Newer parts are in C but you can find lots of
assembly in the 's' folders.

There's no Thumb and little VFP or NEON, but some FPA (the original 1980s
ARM FPU). There's substantial use of macros as well.

Theo

Hul Tytus

unread,
May 14, 2021, 9:26:23 AMMay 14
to
Thanks Theo. The thumb (1 and/or 2) codes are needed though.

Hul

Jonathan Harston

unread,
May 25, 2021, 8:29:20 PMMay 25
to
Good luck. I'm in the middle of writing an ARM64 assembler, so
am in the same position. Plus untangling the complexity of the
ARM64 instruction architecture. ;)

jgh

Hul Tytus

unread,
May 31, 2021, 4:10:30 PMMay 31
to
Jonathon - I'm in the testing phase now but, thankfully, strictly 32 bit
code. One trick I've found that's been helpful is "fasmarm", which is
an offshoot of a 386 et.al. assembler. The name is, if memory serves,
flat assembler or fasm. I've got it on a Microsoft xp msdos directory.
The fasmarm handles the 64 bit codes which might make it useful for
you.

Hul
Reply all
Reply to author
Forward
0 new messages