PDA

View Full Version : Where do I learn assembly?



WebSnozz
11-11-2001, 04:31 PM
I want to learn assembly, but I don't want to do it with that HLA stuff that they use on the Art of Asembly page.

Also, could someone post a simply Hello World source that would compile in VC++ using the _asm thing?

doubleanti
11-11-2001, 04:36 PM
they probably have many other resources [perhaps even free/online] aside from AoA... however i've heard it mentioned as if it was the defacto standard to learn the language... seek and ye shall find...

Fordy
11-11-2001, 04:40 PM
Randall Hyde (http://webster.cs.ucr.edu/Page_asm/0_Page_asm.html)


This guy has written an ebook that you can download free.

Warning ASM is not for the faint hearted

zen
11-11-2001, 04:48 PM
Randall Hyde wrote AoA, what he doesn't want to do. But it's probably the best for learning to do asm on MSVC as most other books/tutorials require a dos compiler. If you want to see the asm for Hello World then you can look at the asm generated by MSVC, it'll be something like -


#include <stdio.h>

int main()
{
char* a = "Hello World!\n";
char* format = "%s";

_asm
{
mov eax,dword ptr[a]
push eax
mov ecx,dword ptr[format]
push ecx
call printf
add esp,8
}


return 0;
}

WebSnozz
11-11-2001, 04:57 PM
How do I get it to generate assembly? I only see an obj file and it opens up as a binary file type.

zen
11-11-2001, 05:12 PM
Project/Settings, C/C++ tab, Listing Files category, then select your option in the Listing File Type combo box.

edit- It's easier to understand if you compile with no optimisations.

WebSnozz
11-11-2001, 05:40 PM
Thanks Zen, I knew there had to be a way to do it.:)

oskilian
11-11-2001, 05:41 PM
I have a question for you, zen: why the

add esp,8 ?

maybe you could do



#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
char* Text="Hello, World";

_asm
{
mov ecx,MB_OK
push ecx
mov eax, dword ptr [Text]
push eax
push eax
mov eax,NULL
push eax
call MessageBox
}
return 0;
}



but, it might need a mov or an add with esp, that's why I ask
I just thought it may work, someone with time, please try it.

I have used Assembly to crack games, though I have only needed to crack one, and I did it, succesfully. But I think I'll only use it when I really need it.

Oskilian

zen
11-11-2001, 05:51 PM
Adding the size of the arguments pushed onto the stack, onto the stack pointer - cleaning up as it's __cdecl.

oskilian
11-11-2001, 05:56 PM
oh, thanks (learn one new thing every day)

Oskilian

Nick
11-11-2001, 06:22 PM
I don't think there is big gap between the HLA in AoA and

nasm or any other assembler. Anyways I have two books one of which covers linux/intel assembly the other one does SPARC like assembly with an emulator; I don't have any on windows/intel assembly.

WebSnozz
11-11-2001, 07:11 PM
What is a register?, and what is a flip-flop(not the kind on your foot?

Nick
11-11-2001, 08:39 PM
A flip-flop is a kind of sequential circuit, and a register
is made with flip-flops.

DavidP
11-11-2001, 09:22 PM
Book suggestion:


Assembly Language Primer


It is the best Assembley book you will every read.

WebSnozz
11-11-2001, 10:38 PM
Could you expand on the registry thing some more. I am going through the AoA thing and he just starts tossing the term around like it's something I should have already learned about. I don't have any formal programming or computer classes, but I grasped alot of the hardware stuff he talks about except the registers. Best guess is they are some sort of memory, are they part of the processor, mainboard, or memory?

Nick
11-12-2001, 01:28 AM
While programming you can just think of it as high speed cpu memory.

As intel doesn't allow memory to memory transfers just about all

the instructions require register usage.



Chapter 2 Memory Access and Organization might help, I havn't had

time to read his book though.

WayTooHigh
11-12-2001, 11:14 AM
Iczelion's Win32 Assembly HomePage Arguably the bible Win32 ASM resource around http://win32asm.cjb.net/

WebSnozz
11-12-2001, 12:42 PM
Yeah that's definetly a good one. The AoA, I agree, is the best, but it uses the HLA thing which is meant to make the asm language similar to a high level language for the purpose of making it easier to learn about what's going on when your compiler compiles something, and less about learning about becoming an assembly programmer. I'm going through the book but having to look elsewhere to learn the exact syntax.