The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: mr_miyagi on June 20, 2005, 07:22:15 PM

Title: : vs +
Post by: mr_miyagi on June 20, 2005, 07:22:15 PM
i am a n00b to x86 asm and i was wonder what is the difference between using
mov eax,[fs:30h]
and using
mov eax,[fs+30h]
i am using NASM (yeah i know this is a MASM forum but its one of the only x86 asm boards i could find) if it helps
thanks for your help
Title: Re: : vs +
Post by: AeroASM on June 20, 2005, 07:52:50 PM
: is used to show which segment the data is in.
+ simply means add up to find the address.

The first instruction puts into eax the dword at address 30h in the segment pointed to by fs.
The second instruction puts into eax the dword at the address (30h + value of fs register) in the segment pointe to by ds.
Title: Re: : vs +
Post by: Bieb on June 20, 2005, 09:33:28 PM
Speaking of which, is there a tutorial somewhere about how segmentation works?  I never did learn all that...
Title: Re: : vs +
Post by: AeroASM on June 20, 2005, 09:55:21 PM
Segmentation means that to get a linear address, you add together a base and an offset.

THe offset is specified in the program, and has the option of depending on registers as well as constants.

In real mode the base is the value of the segment register * 16
IN protected mode the base is worked out by looking up the entry in the GDT referenced by the segment register.
Title: Re: : vs +
Post by: Eóin on June 21, 2005, 10:23:19 AM
Robert check out charpter 4 (http://webster.cs.ucr.edu/AoA/DOS/ch04/CH04-1.html) of Randall Hydes Art of Assembly book for 16bit DOS. It explains it all very well.
Title: Re: : vs +
Post by: donkey on June 21, 2005, 03:09:55 PM
Hello Mr Miyagi,

Yes, this is the same Donkey as at the other forum you are banned from, BTW you can probably add this one to the list of bans, it will be Hutch who makes that determination. We are well aware that you are only interested in shellcode for malicious purposes and I do watch your IP and can track you if I please.
Title: Re: : vs +
Post by: hutch-- on June 22, 2005, 03:54:29 AM
mr_miyagi,

Take the moderators warning seriously, both members and moderators here know what this type of code is used for and we have all heard the tricks and other nonsense before. You are welcome here as a member to ask technical questions related to programming issues but our rules are specific to ANY ilegal activity whatsoever and if there is any nonsense, we will act to prevent it from happening.

This is the only warning you will get and we will act if there are any more indiscretions.