View previous topic :: View next topic |
Author |
Message |
thesmartestass Just Arrived
Joined: 06 Apr 2005 Posts: 0
|
Posted: Wed Apr 27, 2005 8:39 pm Post subject: Pre-Assembly |
|
|
Are there any prerequirements to learn assembly?
|
|
Back to top |
|
|
White Scorpion Just Arrived
Joined: 19 Sep 2003 Posts: 5 Location: The Netherlands
|
Posted: Wed Apr 27, 2005 9:22 pm Post subject: |
|
|
a high level programming language and a good understanding of how a computer (cpu) works internally is recommended, but of course anything can be learned without pre-knowledge. it just would take you a lot longer.
I suggest starting with masm32 if you really want to learn assembly. masm32 is for windows only but it does look alot like a highlevel language since you can use the macros in it. This makes the learning part and getting acquainted with the registers a lot easier then when you start learning a new language all over again from scratch...
here's a simple example to show what i mean:
C code:
Code: |
#include <windows.h>
char Message[]="Hello World!";
char AppName[]="White Scorpion";
int main(void)
{
MessageBoxA(NULL,Message,AppName,MB_OK);
ExitProcess(0);
}
|
masm style assembly:
Code: |
.586
.model flat,stdcall
option casemap:none
include masm32includewindows.inc
include masm32includekernel32.inc
include masm32includeuser32.inc
includelib masm32libkernel32.lib
includelib masm32libuser32.lib
.DATA
Message db "Hello World!",0
AppName db "White Scorpion",0
.CODE
start:
invoke MessageBoxA,NULL,addr Message,addr AppName,MB_OK
;----------------------------------------------
;Could be written as the following as well:
;------------------------------------------------
push 0
push offset AppName
push offset Message
push 0
call MessageBoxA
;-------------------
invoke ExitProcess,0
end start
|
as you can see it looks a lot alike by using the macros. the return value of a windows API always returns in EAX unless stated otherwise.
knowing the above you can already start writing your own programs in assembly. Try doing that with any other assembler with that speed )
I hope this helps .
Last edited by White Scorpion on Thu Apr 28, 2005 6:40 pm; edited 1 time in total |
|
Back to top |
|
|
thaw^ Just Arrived
Joined: 24 Apr 2005 Posts: 0
|
Posted: Wed Apr 27, 2005 10:11 pm Post subject: |
|
|
C++ I guess..?
|
|
Back to top |
|
|
White Scorpion Just Arrived
Joined: 19 Sep 2003 Posts: 5 Location: The Netherlands
|
Posted: Thu Apr 28, 2005 12:50 pm Post subject: |
|
|
Quote: |
Quote:
C code:
C++ I guess..? |
Nope, C.
C++ would have been something in the same line, but if you are using more functions you would definitely see the difference a lot easier...
|
|
Back to top |
|
|
mekros Just Arrived
Joined: 15 Jul 2003 Posts: 1 Location: Manila
|
Posted: Tue May 03, 2005 4:26 am Post subject: |
|
|
if youve decided to try masm out i'd suggest for you to get a copy of the masm 6.1 manual, as per the recommendations of the people at masmforum, that manual is said to be the bible among masm users. seems to be that copies of that manual is pretty scarce, so if you want you can get a pdf copy you can get it here.
|
|
Back to top |
|
|
Dunceor Just Arrived
Joined: 05 Sep 2003 Posts: 4 Location: Sweden
|
Posted: Sun May 08, 2005 4:21 pm Post subject: |
|
|
I would recommend to use nasm(http://nasm.sourceforge.net/) if you wanna do x86 assembly though and do it in *nix since Windows got a pretty complex API if you are not used to it.
In *nix you can easily send system calls directly and it's much cleaner.
But if you wanna learn for windows masm is the way to go.[/url]
|
|
Back to top |
|
|
|