Log in

View Full Version : ADD and DEC instructions


cse_india
May 31st, 2006, 03:12
please clarify my 3 doubts

1)add eax, dword ptr [404000] : means adding the value of eax + the 4 byte value at memory address 40400 and storing it in eax. correct?

2) what does this mean : add eax, dword ptr [eax] ?

3) what does this mean : add eax, dword ptr [eax+00404000] ?

and how does the registers get related to memory?


---------------------------------------------------------------------

the instruction : dec [eax+401000]

does it mean :
1) decreases the dword value at eax + the value 401000h by 1?

2) decrease the dword that is stored at [eax+401000] ?


are 1 and 2 the same ? if different please xplain in an easy language( not hi fi assembly terms)
and what does the second instruction mean?

naides
May 31st, 2006, 07:05
Option 2

[eax + 00410xxxxxx]

is a reference to the dword stored at that address

dec substracts one.

Find "art of assembly" in the web and give it a read

cse_india
May 31st, 2006, 07:28
come on!
reading "art of assembly" is a joke or what?
i know the doubts can be cleared from any assembly lang book.so why the forum?
i know cracking is a difficult hobby.u got to learn assembly.but i feel if my these doubtr r cleared many more doubts of mine would be cleaed too. these instructions com a lot in the disassembled structure.if i can understand these codes i would probably understand a lot lot more things.

can anyone please giv a solution.

naides
May 31st, 2006, 07:39
It is not a joke.
And you need not read it from begining to end, but it is a searchable reference for questions such as these. . .
And learning enough assembly and the inner workings of a computer is a necesity if you want to do reversing of any substance.

The forum is here for exchange of ideas, when you are stock, when you have a difficult problem, when you do not know obscure sources.

The forum DOES NOT replace searching, studying, reading and the intellectual challenge of RCE

cse_india
May 31st, 2006, 07:49
okay can u tell me which chapters r to be read in " art of asembly" for having a quite enough good knowledge of assembly.
i know i am weak at assembly.i thought i would try to learn assembly and at the same time i would try reversing.
i want 1 suggestion: should i learn assembly to a good extentfirst and then try reversing or should i learn assembly and reverse at the same time with very basic idea abt assembly and then progressing????

evlncrn8
May 31st, 2006, 09:21
read the whole thing.. get stronger at assembly....

1)add eax, dword ptr [404000]
adds the value @ memory address 404000 to eax
2) what does this mean : add eax, dword ptr [eax] ?
adds the value @ memory address eax is pointing to to eax...
eg: eax = 11223344
add eax,dword ptr [eax] translates to add eax,dword ptr [11223344]

3) what does this mean : add eax, dword ptr [eax+00404000] ?
add eax, value @ memory address 404000 + eax
so again, say eax = 10
add eax,dword ptr [eax+404000] translates to add eax,dword ptr [10+404000]
so...
add eax, dword ptr [404010]

the instruction : dec [eax+401000]
doesnt look right... because you have no byte/word/dword/qword/?word mnemonics...

but it subtracts 1 (decriment) from the byte/word/dword/qword/?word stored @ eax+401000


now, read the faq, do some research and stop being agressive to those trying to help... oh and stop being lazy too.. theres no corners to be cut when learning asm and/or rce

cse_india
May 31st, 2006, 09:38
hmm . i am sorry for showing my aggression . actually u said rt . i am too lazy.

but now i am gion to learn assembly from a proper book rather learning from short tutorials. i suppose good assembly knowledge and being a good cracker are directly proportional.
thanks for the help evlncrn8 .
next time i will enter the forum only when i hav a good knowledge of assembly.

LLXX
June 3rd, 2006, 03:02
It looks like the forum killed my posts again

I definitely do not recommend Art of Assembly to anyone planning on studying Asm. It used to be reasonably well-written, until the author decided to write his own "high-level-assembler" (which isn't really an assembler) with a completely different syntax and "high-level constructs" (Asm is NOT an HLL, nor should it ever become one). Reading it will confuse the minds of the infirm. What we all think of as "add eax, 4" he writes as "add(4, eax)". Everything looks like a function call, much too verbose for Asm (a language which already has a very high source:binary ratio) and confusing for the beginners. A friend of mine says she had difficulty remembering the correct operand order for a few days after reading AoA, even though she had many years of Asm experience already

I recommend the Intel(R) IA-32 Architecture Software Developer's Manuals which you can download for free from their site. They have an entire section explaining the addressing modes, as well as an extensive instruction set reference that shows the function of each instruction.

dzCepheus
June 3rd, 2006, 17:10
LLXX - after having read everywhere that "art of assembly" would be a good read, I was greatly disappointed by all the "HLA" stuff in it... So I'm glad to hear someone more knowledgeable than I agrees with me on that. :P

As far as the developer's manuals - thanks for the tip on that. I wasn't aware there was such a thing. :P piece of cake finding them too.

Maximus
June 4th, 2006, 07:19
uhm... my post went thrown away too.
I disagree recommending IA manuals -they are at 'master' level, and one wouldn't really learn anything [opening casually voll. 3.. eek!!].

AoA still teaches assembler, though in a odd form and -if you just skip the part that talks of HLA structures, it is ok too (a bit messy for AT&T syntax style and parenthesis, however).

As an alternative, look for [uhm... fetching it, a sec...]
http://www.drpaulcarter.com/pcasm/

should be fine (didnt read it all, but enough to say it seems pretty good). On many languages.

Regards,
Maximus

dzCepheus
June 4th, 2006, 11:31
I tried as you suggested - ignoring the HLA parts - except the whole document is practically peppered with it... So for a noob like me it's hard to seperate the crap from the gold...

And yeah - I think I will try to get a better handle on ASM before I delve into the Intel docs... yikes.

LLXX
June 4th, 2006, 18:01
If you can find the older versions of AoA, they might be worth reading since he didn't write HLA yet and used a standard assembler like MASM.

In fact, if you Google HLA + "not an assembler" you'll find some interesting discussions.

WaxfordSqueers
June 4th, 2006, 18:11
Quote:
[Originally Posted by Maximus]AoA still teaches assembler, though in a odd form and -if you just skip the part that talks of HLA structures, it is ok too (a bit messy for AT&T syntax style and parenthesis, however).
I found it to be a stretch trying to read between the lines. I think the author made a major mistake by trying to cater to students from a different discipline rather than teaching them assembler as it is normally used.

Check out this apparent freebie at:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/

some of the diagrams are in gif format and the fonts seem to be wrong.

I like to have hard copies of books available as well. I use the small reference manual from Microsoft that came with it's MASM compiler (see URL above). Many cities have bookstores that specialize in computers. It's possible to get really good deals on computer books at these stores. I have two such books that I can recommend:

1)Microsoft Macro Assembler by Nabajyoti Barkakati (SAMS Publishing - The Waite Group)

http://www.amazon.com/gp/product/0672301555/104-4983491-1771163?v=glance&n=283155 (price is quoted from $11.45). Beware that it probably costs more than the book is worth to ship it.

2)Mastering Turbo Assembler (2nd ed.) - by Tom Swan (SAMS publishing)

http://www.amazon.com/gp/product/0672305267/104-4983491-1771163?v=glance&n=283155

both of these books explain assembler in depth and give good explanations of the instruction set.