Programming in assembler?

May one program a Raspberry Pi 3 in assembly language? Yes, I would suppose, but what tools are available? Naturally, I'd like free ones.

-- Do, as a concession to my poor wits, Lord Darlington, just explain to me what you really mean. I think I had better not, Duchess. Nowadays to be intelligible is to be found out. -- Oscar Wilde, Lady Windermere's Fan

Reply to
Peter Percival
Loading thread data ...

Yes. Writing assembly on linux is easy.

You should have an assembler already installed. There are tons of references and howtos on google to get you going.

If you want to do bare metal (no linux or Risc-OS) then it is still possible but a bit more involved.

--
Andy Leighton => andyl@azaal.plus.com 
"We demand rigidly defined areas of doubt and uncertainty!" 
   - Douglas Adams
Reply to
Andy Leighton

I assume Pis come with Gcc.

That will assemble OK

--
"Women actually are capable of being far more than the feminists will  
let them."
Reply to
The Natural Philosopher

Yes, you can. The assembler is included in the C compiler suite, actually it is a part of the binutils package (binary utilities).

The assembler is called 'as' and the linker is 'ld'. However, you may need to call C routines in the standard runtime library, libc, to access operating system facilities.

--

-TV
Reply to
Tauno Voipio

On x86, at least, "as" is a bit of a pain to use. It is more suited to the output of gcc than for humans to use.

Is "as" as bad on Arm? Is there no more helpful free assembler for the RPi?

--
James Harris
Reply to
James Harris

It doesn't look too bad, especially if you set up a makefile to manage compilations.

At a glance, its worst feature would seem to be its apparent insistence on using C-compatible entry points and exit methods.

ARM supports their multi-OS assembler armasm but a quick search failed to find a Raspbian package of that name.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

formatting link

compile from source that one.

--
?it should be clear by now to everyone that activist environmentalism  
(or environmental activism) is becoming a general ideology about humans,  
about their freedom, about the relationship between the individual and  
the state, and about the manipulation of people under the guise of a  
'noble' idea. It is not an honest pursuit of 'sustainable development,'  
a matter of elementary environmental protection, or a search for  
rational mechanisms designed to achieve a healthy environment. Yet  
things do occur that make you shake your head and remind yourself that  
you live neither in Joseph Stalin?s Communist era, nor in the Orwellian  
utopia of 1984.? 

Vaclav Klaus
Reply to
The Natural Philosopher

ARM is a kind of a RISC computer, and they are notoriously hard to program in assembler, but it is not as bad as Sparc or MIPS.

The problem is not in the assembler, but in the machine instruction set. I leave most of the programs to C, and insert embedded assembly when nothing else helps.

Anyway, ARM's instruction set is far more regular than what we have on x86.

--

-TV
Reply to
Tauno Voipio

!!!!???

You must be joking! I don't know the others but ARM is a dream.

It has an instruction set so short you can memorise it in a day.

Every operation can be performed on any register.

The way you can perform multiple operations on multiple registers in a single instruction is positively inspired!

--
W J G
Reply to
Folderol

+1

In order of niceness: (IMHO)

ARM

68xxx 6800 (HD63xx) Z80 8080 PIC16xxxx . . . . x86 (especially with MASM)

6809 is a nice instruction set but I've never used it with gusto on a commercial job so if feels wrong to include it. Likewise PowerPC and MIPS4k.

Reply to
mm0fmf

Yes, there will be a small need for assembler, but these days, is there any pressing need to program in assembler for the vast majority of folk? I've looked at some of the code produced by compilers in the last 5 years or so and it's really quite good. Yes, you can shave a little time off it by hand coding, but you would likely get a much greater saving by tuning your algorithms. Use a code profiler to see where the bottlenecks are, and work on those. That's my experience, anyway.

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

I used 6809 a bit - mainly C, but some asm. Its OK. Not much to it really.

--
You can get much farther with a kind word and a gun than you can with a  
kind word alone. 

Al Capone
Reply to
The Natural Philosopher

Hey, this is amateur stuff. Assembler is FUN

--
A lie can travel halfway around the world while the truth is putting on  
its shoes.
Reply to
The Natural Philosopher

The 6809 was nice but my favourite was the MOS Tech 6502 - simple, elegant and did everything. Mind you I was brought up on the KDF9 and IBM assemblers so anything was simple after that.

Another Dave

--
Change nospam to gmx
Reply to
Another Dave

I've done a reasonable amount with 68xxx, 6809 and 6800 MPUs. I'd put them in that order (descending order of niceness, obviously).

Apart from them, my main assembler experience was with ICL 1900 machines. They had a surprisingly nice assembler even if they did lack a stack - it was very regular (you could often guess the mnemonic rather than looking it up) and orthogonal (use any address mode and/or stack reference with any instruction where the combination made programming sense). In short, not dissimilar from the 68xx and 68xxx assemblers.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

A 'detail' that seems to pass right over the heads of so many people.

--
W J G
Reply to
Folderol

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^accumulator

sorry about the obvious typo.

'accumulator' is the 1900 term for register.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

of so many people.

Agree, but you sometimes need to qualify 'fun', e.g. I normally classify programming in BASIC as 'not fun' - unless the target system is a STAMP or a PicAxe and the project is mine.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

I wrote a BASIC interpreter for fun - does that count? :-)

(It doesn't support in-line assembler though, sorry)

Gordon

Reply to
Gordon Henderson

I have used 6809 in a commercial project & liked it pretty much an enhanced 6083 which is what we normaly used i also liked the 6502 which was used in many home micros @ the time & quite similar

--
Lensmen eat Jedi for breakfast.
Reply to
alister

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.