PDA

Click to See Complete Forum and Search --> : New to assembly


Filik
Oct 11th, 2005, 02:30 PM
Hi, im thinking of learning assembly, but i cant figure out what program do you use to do that. I'm pretty sure that you can do it in VS.NET 2003 or 2005, but i cant figure out where, plz help.
Thx

Jacob Roman
Oct 11th, 2005, 04:43 PM
Start using it in C++ like so:


#include <stdio.h>

int Addition(int val1, int val2){

_asm{

mov eax, val1
mov ebx, val2
add eax, ebx

}

//function automatically returns whats in the eax register

}

int main(void){

printf("%d\n", Addition(10,20));

return 0;

{


And the best website to learn assembly is www.artofassembly.com . Start in the 16 bit DOS section. The instruction set is introduced in Chapter 3 and 6, with more instructions introduced in the later chapters. ;)

wossname
Oct 12th, 2005, 04:20 AM
Well I found that website pretty useless, way too much info and no obvious starting point.

I'd suggest you grab yourself a copy of "Assembly Language for Intel-Based Computers" (Author: Kip Irvine, Publisher: Prentice Hall, ISBN: 0-13-049146-2).

It comes with a CD and its everything you need to learn ASM. Teaches you how the hardware works first so you can start coding easily. Jumping into the code without appreciating the hardware makes it 10x harder to learn.

It covers a LOT of different techniques and has an excelltnt instruction set reference and comprehensive glossary and index.

I would have happily paid twice as much for this book. Go and buy it.

chemicalNova
Oct 12th, 2005, 05:03 AM
Once done with what wossname said, I would suggest MASM for GUI windows based stuff.

(I really should get paid for how much I promote MASM here).

Others may disagree, as there are easier syntaxes for Windows Based ASM, but meh.

chem

wossname
Oct 12th, 2005, 05:14 AM
That book I suggested uses MASM al the way through :D It has the compiler on the CD too.

Very very cool indeed.

Filik
Oct 12th, 2005, 09:13 AM
Start using it in C++ like so:


#include <stdio.h>

int Addition(int val1, int val2){

_asm{

mov eax, val1
mov ebx, val2
add eax, ebx

}

//function automatically returns whats in the eax register

}

int main(void){

printf("%d\n", Addition(10,20));

return 0;

{


And the best website to learn assembly is www.artofassembly.com . Start in the 16 bit DOS section. The instruction set is introduced in Chapter 3 and 6, with more instructions introduced in the later chapters. ;)

You mean the only way to program assembly in VS is in C++? I hope it doesn't use anything of C++ itself, cause i've never studied it, i only know VB.NET.


And thx for all the links on books and stuff :)

chemicalNova
Oct 12th, 2005, 11:08 AM
I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:

int main()
{
__asm {
xor eax,eax
}
return 0;
}

..for example.

chem

Filik
Oct 12th, 2005, 11:52 AM
I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:

int main()
{
__asm {
xor eax,eax
}
return 0;
}

..for example.

chem

Thx for info :thumb:

wossname
Oct 12th, 2005, 04:04 PM
Even so, the basics of C++ is still a lot to learn in order to learn ASM. It would be a major obstacle.

There's little advantage to using VS as a debugger anyway. I find it much easier to use notepad and the console. It gives you a better idea of how things work. The book covers EVERYTHING you need to know. :D

chemicalNova
Oct 13th, 2005, 04:43 AM
Why would you bother with VS anyway. The MASM "IDE" is pretty much just notepad anyway :)

chem

Raedwulf
Oct 14th, 2005, 02:17 AM
Once done with what wossname said, I would suggest MASM for GUI windows based stuff.

(I really should get paid for how much I promote MASM here).

Others may disagree, as there are easier syntaxes for Windows Based ASM, but meh.

chem

I would also try fasm - its really good as well. You can do almost the same amount of things with fasm macros as with masm macros unlike most other assemblers. http://flatassembler.net/

But of course masm has a nice code library and some pretty good ides:
http://www.easycoder.org/English/index.htm (For MASM and looks like Visual Basic 6)
http://radasm.visualassembler.com/ (Supports a wide range of assemblers but support for FASM is minimal)
http://www.winasm.net/ (Supports MASM and FASM (with Shoorik's add-in))

Jacob Roman
Oct 15th, 2005, 02:15 PM
I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:

int main()
{
__asm {
xor eax,eax
}
return 0;
}

..for example.

chem


You didn't have to return 0. It automatically returns whats in the eax register. So you pretty much zeroed the result. But since theres no value in the eax register anyways...

chemicalNova
Oct 15th, 2005, 07:12 PM
Sif pick something like that up in a small example :p

I assumed that he would have stored other values in eax :)

chem

penagate
Oct 16th, 2005, 12:57 PM
You didn't have to return 0. It automatically returns whats in the eax register. So you pretty much zeroed the result. But since theres no value in the eax register anyways...
1) Nothing "automatically returns" eax. The return code is STORED in eax.

2) Since this is main(), you don't want to return a value. 0 is the successful application return code.

Jacob Roman
Oct 16th, 2005, 01:55 PM
1) Nothing "automatically returns" eax. The return code is STORED in eax.

You just controdicted yourself. The return code is stored in eax, hence it did it for ya, and the user didn't have to do it ;)

It's automatic like I said :bigyello:

penagate
Oct 17th, 2005, 02:00 AM
You just controdicted yourself. The return code is stored in eax, hence it did it for ya, and the user didn't have to do it ;)

It's automatic like I said :bigyello:

No, you contradicted yourself in saying that... the return code is stored in eax, but nothing did it for you, you moved it there yourself ;)

I think you are being unnecessarily confusing when you say "automatically returns". Returning a value is an action. In C you use the "return" statement to both set the return value and exit the procedure in one hit. In ASM you just exit the procedure and the value in the eax register, whatever it is at the time, is taken to be the return value.

So, we are both trying to say the same thing anyway ;)

wossname
Oct 17th, 2005, 03:41 AM
"Semantics gennelmen, semantics" :D