[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pgubook-readers] Register name history & style
From: |
Jonathan Bartlett |
Subject: |
Re: [Pgubook-readers] Register name history & style |
Date: |
Wed, 18 Aug 2004 07:11:52 -0700 (PDT) |
> 1) There's not much documented on the origins of the register labels:
> (ie eax, ebp, ...). You go into a little detail on the "e" addition,
> but not much on the origins of "ax, bp, ...". I can't remember if
> Randall's HLA Book explains these, I do have the book with me but have
> yet to research this further. Main reason I make mention, is I'm having
> a tough time remembering the register names! I figure if I knew the
> history, I may remember the names more easily. (maybe)
"A" stands for "accumulator", I believe. It's kind of the default,
generic register. In the 32-bit architecture, that's not as much of a
distinction, but in the 16-bit version, ax had more of a special role.
It's still special for multiplication and division.
"BP" is the "base pointer" also called the "frame pointer". It is used to
have a constant location for the start of the stack frame at the beginning
of a function. It's not technically needed -- you can also do offsets
from the stack pointer ESP. However, often times during a function you
will want to push things onto the stack, and using EBP will keep you from
having to recalculate your offsets every time you do a stack operation.
gcc even has a compilation option to do this, I think it's
-fomit-frame-pointer.
"CX" is often used as a counter.
"SI" is the "string index" register -- it is often used for string
operations.
I'm not sure if BX or DX have any specific meanings, or if they were just
"alphabet fillers".
> 2) I noticed you didn't make much mention on the (spacing) style of your
> source assembly files. Hate typing in source and trying to figure out
> if there's 2 spaces or what, although spacing doesn't make much
> difference. C has a tool called "indent" that will alter the spacing
> according to the style choosen. Anything similar for ASM?
I don't think there is an assembly language spacing guideline. It's
mostly pretty flat anyway.
Jon