Mark Schmid wrote:
Hi all,
O.K., it seems this list still is working after all.
Sorry for the test email.
Here's something which got me very nervous today:
I'm in chapter 5 right now and I'm stuck because
of a failing hard disk, so I started reading another
book about assembly programming and guess what:
In almost ALL OTHER references to assembly programming,
it says when you want to move a value from one place
to the other with "mov" or "movl", you FIRST state
the DESTINATION and THEN the SOURCE!
Like this: mov eax, $1
That's the EXACT opposite of what we've been learning!
(movl $1, %eax)
Here's why: It seems Programming from the Ground up is
specific to the Linux assembler (G)AS, which uses the
AT&T syntax or convention of "mov". Other than that,
most other assemblers seem to follow the Intel syntax
or convention, which is the exact OPPOSITE of AT&T's
in regards to the mov command!
Here's more about it:
http://www.faqs.org/docs/Linux-HOWTO/Assembly-HOWTO.html
Scroll or jump down to:
3.2.2. What is this AT&T syntax
I think this is a MUST-MENTION in the BEGINNING of Programming
form the ground up, because one of the first things anyone
learning from this book will do, is to check out other
sources about assembly... And BOY will he be confused!
Regards and greetings,
Mark
Differing syntax has never been a problem for me. I was raised to scan
the manual for new languages before programming in them. gas is a
different language than nasm, then asm or even as.
gas (GNU as) is not Linux-specific. It is a GNU assembler. Per the
manual, the syntax was inspired by the 4.2 BSD assembler syntax. 4.2 BSD
is the Unix designed by UC, Berkeley students. It appears they kept the
syntax used by AT&T's assembler.
gas can assemble code for several processors, each having its own
specific syntax (gas stays with AT&T regardless of the processor). He
who designs the processor gets to design the processor's syntax. I think
the syntax is specific to the wiring (God, I'm old). So Motorola uses
source, destination in their manuals and Intel uses the reverse, because
of hardware designs.
assemblers written for a single processor would, in all likelyhood, use
the syntax specified by the manufacturer. When AT&T wrote their
assembler, they used destination, source. I would guess because either
the PDP assembler was written that way, or the assembler on the
mainframe being used to work on MULTICS was written that way. Not being
there, and having never been that curious as to why, I don't really know.
All of this was a few years before Intel's first processor, the 4004,
and their choice of laying down traces determining their syntax. It was
a decade or more before Unix was ported to the 8086-series of processors
and an Intel-specific assembler was used by Microsoft in Zenix.
GNU was not designed with Zenix in mind. It was, and is, meant to run on
big-iron. That is not to say that today's PC is not much more powerful
than the big iron of 1984. Nobody in 1984 even dreamed of a desktop with
4G and more or memory and a 2GHz multi-core processor. And, at the time,
laptops were just a dream. So GNU as was written using the same syntax
as AT&T's for the most part. After all, GNU as was a drop-in replacement
for the proprietary as that came with Unix, just better.
Other assemblers, like nasm, were written to run on CP\M or other
8080-specific OS's. As the processor grew up, so did they, retaining the
Intel-syntax.
Should pgu-book warn us about differing syntaxes? It's been my
experience that what one learns by getting caught in the mud is better
understood. Probably because I'm still struggling to get out and I need
some company. So I think that merely stating that pgu-book uses the
syntax used in GNU as or whichever assembler the author was using when
he wrote the book is sufficient. Caveat Emptor!
Disclaimer: This was all off the top of my head which is well-worn. My
memory is faulty this morning, so research my meandering before quoting.
My facts may be all wrong.
/herbc whose first computer ever used 9-track magnetic tape for storage,
had a full 16K core memory, and took up an entire basement. His
supervisor first worked with a computer that had 2K vacuum-tube memory
and used magnetic drums for storage. The memory took up an entire
basement. The loader (BIOS), operating system, applications and data
being worked on had to fit within the memory. Those were the days when
students competed on who could write the shortest EBCDIC to ASCII or
digit to character translators. I remember one translator routine that
was less than 72bits. Shorter than most instructions, nowadays. Ah, the
days when we actually studied clock-cycles within an instruction.
_______________________________________________
Pgubook-readers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pgubook-readers