EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Atmel AVR assembler

Started by Herbert Kleebauer July 21, 2005
"Herbert Kleebauer" <klee@unibwm.de> wrote in message
news:42E29DC9.C22FC2E0@unibwm.de...
> > There are also many assemblers for the x86 architecture which > are all incompatible. Non of them is the "standard". Even if > Intel would write it's own assembler, they couldn't say, this > is the valid assembler syntax for x86 processors.
Intel *did* write their own assembler. It was called ASM86 (and then ASM286, and then ASM386). IIRC, they stopped around the 386 version because DOS had become so ubiquitos as a development platform and MASM was pretty much ASM86 syntax compatible.
> All they > can define is the machine language but not the assembly > language.
Hmmm... Last time I checked, Intel hired some computer scientist types to develop the *assembly language* for the original 8086. Indeed, most of the complaints I hear from people in this newsgroup about Intel's syntax (type checking, addressing semantics, etc.), probably exist because they *had* computer scientists rather than electrical engineers design the syntax :-). Cheers, Randy Hyde
"Hans-Bernhard Broeker" <broeker@physik.rwth-aachen.de> wrote in message

> > Actually, there are only two real dialects of x86 assembly these days: > MASM (MS's implementation of the original Intel syntax), and gas. All > other assemblers that want a noticeable share of the market strive to > emulate either of these to the letter.
Last time I counted, there were about a half-dozen different dialects of x86 assembly language. I don't know how you define "real", but assemblers like NASM, FASM, GoAsm, TASM, MASM, Gas/ATT, Gas/Intel, and HLA all have fairly decent followings (numbering in the thousands of users, each). Granted, MASM (because of its 20-year history) has the largest market share, by far, but the others are growing and cutting into that market share. Particularly as people move away from using the Windows platform. Cheers, Randy Hyde
"Randall Hyde" <randyhyde@earthlink.net> &#4294967295;crivait
news:QgOEe.3092$0C.1369@newsread3.news.pas.earthlink.net: 

> assemblers like > NASM, FASM, GoAsm, TASM, MASM, Gas/ATT, Gas/Intel, and HLA all have > fairly decent followings (numbering in the thousands of users, each)
* HLA is not an Assembler. It is an HLL Pre-Parser, that reads a Source File in HLA Syntax, and outputs nothing but an Asm Source. * HLA has almost no users, as everybody can see by taking a quick look at the various boards, where you try to damage Assembly, by selling yourself. HLA has only a couple of _victims_ each week, who are gone one or two weeks later, not considering the tiny couple of definitive idiots keeping stuck with this horror. :) Betov. < http://rosasm.org >
"wolfgang kern" <nowhere@nevernet.at> &#4294967295;crivait news:dc0cfm$76k$1
@newsreader1.utanet.at:

> FASM/NASM seem to be the most used by ASM-newbies recently, > you may say this are only a handful, but the ASM-population grows daily
Indead. I regulary take a look at all Assemblers Boards, and the number of Posts, for example, at FASM Board, is now beating the number of MASM Board Posts. Also, considering that there is, so to say, no real Asmers using MASM (99% of them are HLL Programmers making occasional use of MASM for HLLs' enhancements...), and that most of FASM users are real Asmers doing real things (like the MenuetOS developers, and such...), the real growing rate of the real "ASM-population", is quite encouraging. :) Betov. < http://rosasm.org >
Randall Hyde wrote:
> "Herbert Kleebauer" <klee@unibwm.de> wrote in message
> > There are also many assemblers for the x86 architecture which > > are all incompatible. Non of them is the "standard". Even if > > Intel would write it's own assembler, they couldn't say, this > > is the valid assembler syntax for x86 processors. > > Intel *did* write their own assembler. It was called ASM86 (and then ASM286, > and then ASM386). IIRC, they stopped around the 386 version because DOS had > become so ubiquitos as a development platform and MASM was pretty much ASM86 > syntax compatible.
Don't see the logic of this statement. Just because they once did have an assembler doesn't mean that they still sell an assembler. And if they currently don't have an assembler then they also have no assembler syntax. Even if Intel would again write it's own assembler, they couldn't say, this is the only valid assembler syntax for x86 processors.
> > All they > > can define is the machine language but not the assembly > > language. > > Hmmm... > Last time I checked, Intel hired some computer scientist types to develop > the *assembly language* for the original 8086.
They can define the language for an "Intel x86 assembler" but surely not "the" assembly language for the x86. Everybody can define a syntax for a x86 assembler (not only Intel) and they are all equal. If we can't ignore (because of the market power) an awful processor architecture (like Intel X86 or Atmel AVR) then we at least should ignore the even more awful assembler syntax used by this companies.
Betov wrote:
> [snip]
You want to waste the c.a.e people's time with this? The r.g.i-f people have alread complained about this! NoDot, ...
"NoDot" <no_dot@msn.com> &#4294967295;crivait news:1122227437.170347.262770
@g43g2000cwa.googlegroups.com:

> Betov wrote: >> [snip] > > You want to waste the c.a.e people's time with this? The r.g.i-f people > have alread complained about this! > > NoDot,
Said by one from "the tiny couple of definitive idiots keeping stuck with this horror"... :)) "c.a.e", "r.g.i-f", "alread", you are sure it was not "comdlainep", kid? :)))))) Betov. < http://rosasm.org >
[F'up2 reduced to one group --- should have been done earlier.]

In comp.arch.embedded Herbert Kleebauer <klee@unibwm.de> wrote:
> Randall Hyde wrote: > > "Herbert Kleebauer" <klee@unibwm.de> wrote in message
> > > There are also many assemblers for the x86 architecture which > > > are all incompatible. Non of them is the "standard". Even if > > > Intel would write it's own assembler, they couldn't say, this > > > is the valid assembler syntax for x86 processors.
> > Intel *did* write their own assembler. It was called ASM86 (and > > then ASM286, and then ASM386). IIRC, they stopped around the 386 > > version because DOS had become so ubiquitos as a development > > platform and MASM was pretty much ASM86 syntax compatible.
> Don't see the logic of this statement. Just because they once did > have an assembler doesn't mean that they still sell an assembler.
That's quite obviously not what Randall was trying to make it mean, either. The fact that Intel actually not only documented an assembly syntax along with the processor pretty much from the get-go, but even implemented it themselves as part of marketing the chip, establishes the fact that there does exist something that doesn't leave us much chance but to call it "the" standard assembly language for this processor: that used and published by Intel. It's quite a broken design of an assembler, granted, and nobody's expected to like it particularly --- but it's still the standard syntax. This standard assembly language for x86 CPUs is also the root of the entire MASM-compatible family of x86 assembly dialects. The members of that family may not all be compatible with each other (although most can still be switched to actual MASM source compatibility) --- but they're all roughly compatible to ASM86. I.e. you can still feed assembly source from the original 8086 application notes and data sheets (or from books from that era) to MASM or one of its derivatives (running in compatibility mode, where necessary) essentially unchanged, and expect it to work. Even "rogue" assemblers like a86 still accept that assembly language, even if they'll grumble a lot about it. The only truly independent assembly language family for x86 that I'm personally aware of is AT&T (including its GNU descendants). Off-hand, this fundamentally incompatible language looks like a very bad idea, so it needs to be abandoned or justified. I think AT&T x86 assembler language makes a whole lot more sense than Intel's ever did. Not because of the oft-maligned opposite order of source and destination operand, mind you, but because it puts the definition of operation width where it belongs (as a letter in the opcode) instead of where it has to be second-guessed (by inspecting stuff like BYTE PTR [whatever]). The price to be paid for this improvement of the syntax was a loss of direct access to the entire body of pre-existing assembly source. AT&T deemed that acceptible, probably because they didn't plan on using their 'as' on any third-party original assembler sources anyway, and the compiler doesn't care what language it emits. The main problem with Intel syntax IMHO is that they were trying to let the assembler do half the linker's and a good part of the human's job on top of that of a genuine assembler. Frankly, if the human programmer has to look at more than one line of source code (setting aside macros) to figure out which actual opcode a given line of assembly code will generate, something's seriously wrong with that assembler. Once they had added BYTE PTR [] and ASSUME to the language, the damage was irreversible. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
On Sat, 23 Jul 2005 18:54:16 +0200, Herbert Kleebauer <klee@unibwm.de>
wrote:

>But how are AVR programs debugged at all? Are there AVR versions >which have support for hardware breakpoints or at least single >step interrupts? The only alternative I see at the moment is, >to add an assembler directive which automatically inserts a call >to a debug routine after each instruction. But this would >double the size of the code to debug.
AVR Studio has a Simulator - which uses the official AVR syntax of course. :-) Bigger parts have a JTAG port for use with the Atmel JTAG ICE (both the older and the new MKii version), where you can single-step, view and change cpu and peripheral registers etc. Works with AVR Studio. Newer smaller parts have debugWire, a debug port using a single pin (reset). This requires the Atmel JTAG ICE MKii and AVR Studio. Atmel also sells real In-Circuit Emulators - to be used with AVR Studio. It's everything there, and everything works fine - and requires the AVR Studio and proper symbol tables generated by the compiler, assembler and linker. Mit freundlichen Gr&#4294967295;&#4294967295;en Frank-Christian Kr&#4294967295;gel
   I'm quoting a quote because I don't see the original:

On Fri, 22 Jul 2005 17:55:32 +0200, "Jeroen" <none@none.com> wrote:

> >"Herbert Kleebauer" <klee@unibwm.de> schreef in bericht >news:42DFDF98.DC5D4AC9@unibwm.de... >> Have to write some AVR code and therefore have read the >> AVR Instruction Set manual and tried the assembler included >> in AVR studio. I think the used syntax is completely >> unusable, so I decided to write my own assembler. A very >> first version can be downloaded from: >> >> ftp://137.193.64.130/pub/assembler/adela.zip >> >> Maybe there are some AVR experts who can give some suggestions >> for an improvement or are even willing to do some testing.
I don't consider myself an AVR expert, but I might take a look at it. No one else has bother to comment on your actual assembler. I can actually see why you would want to do this, there's an addressing mode of the AVR's mov that sure seems backwards compare to how I've seen mov used elsewhere, and I was somewhat bothered by it. My solution was my mindset: I'm programing the AVR, the processor with a backwards mov. But actually writing an assembler seems extreme to me, especially when many macro assemblers are versatile enough you can just write new macros for your new opcodes and addressing modes that expand into the 'standard' assembly code. Have you considered doing this? As for the same processor having different assembly mnemonics and syntax, the most obvious case I recall is the Intel 8080 and Zilog Z80, both executing the same instruction set (ignoring the Z80's extra instructions) but with two strongly differring assembly languages. IIRC, Zilog created the new assembly mnemonics because Intel had its mnemonics copyrighted. Having said that, I have to agree whoever else said it that the C compilers thesedays have pretty much made this sort of thing moot for any 8-bit or larger processor. Writing assembly code is less and less common even for absolute (pun intended) 'bare metal' programming, as the compilers do quite well with making optimized code. Even so, I sometimes catch myself looking 'under the hood' to double-check the compiler, to see just how good the stuff is it's putting out. It's my decades of having written a significant amount of assembly myself that makes me do it... ----- http://www.mindspring.com/~benbradley

Memfault Beyond the Launch