Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linux assembly 1

Status
Not open for further replies.

newbieatassembly

Technical User
Oct 4, 2000
39
0
0
IN
Hi,

I am just learning assembly and I am trying to write in Linux.
Linux seems to use eax,ebx etc register while dos uses ax,bx etc. Whats the deal?

I don't get it. Linux-Assembly-HOWTO doesn't have much to say.
Do you have any idea where linux assembly tutorials are given ?

Is asm OS specific?
 
The use of EAX, EBX, etc. is only possible on 32 bit processors (in the 80x86 family: starting with the 80386). Now each of the registers EAX, EBX, ECX and EDX can now be accessed in four ways (example for EAX):
1. AL, the low 8 bits of register AX D0-D7 (data bits 0-7)
2. AH, the high 8 bits of register AX D8-D15
3. AX, the low 16 bits of register EAX D0-D15
4. EAX, the full 32 bits D0-D32
Also the registers SP, BP, SI, DI, IP and Flags are expanded to, respectively, ESP, EBP, ESI, EDI, EIP and EFlags (newly added flags: VM, RF, NT, IOPL).
Also added: 2 (data) segment registers: FS and GS; 3 control registers: CR0, CR2 (Page fault linear address) and CR3 (Page directory base); 4 system address registers: GDTR, IDTR, TR and LDTR; 6 debug registers: DR0, DR1, DR2, DR3, DR6 and DR7; and 2 test registers: TR6 and TR7.
All these added registers are still available on 80486, Pentium and Pentium Pro (probably on PII and PIII too). Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
I'm sorry, I missed the "learning" part, only the first half is relevant to you. Also ASM is hardware specific, but depending on the OS you use, you will be able or not to run some ASM compiler programs. Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
Ok, I am downloading the intel's 3 manuals. Will it contain all these things? Will that be helpful.

Starting assembly in linux - is it advisable ?
 
I wouldn't know, I've used "The 80x86 Family: Design, Programming and Interfacing" by John Uffenbeck.
To your second question: I have no experience with Linux. Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
The main thing that the manuals are good for is to use the architecture of the chip and look at the instruction set. One thing, though, is that some of the instructions, espically on Intel chips, have undocumented side effects. As for good docs, I haven't found any for GAS yet (the Gnu ASsembler), so please post it if you do. One thing you can do to see some examples is to write a small c program, say it's called test.c, and then run:

gcc -S test.c

This will produce the assembler code for your source file. It is in a file called test.s (or filename.s, depending on filename.c) This can be used to see some examples, but will be tough to learn from.

Good Luck!

MWB As always, I hope that helped!

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top