The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: $nooc on January 31, 2008, 03:19:20 PM

Title: Assembler beginner
Post by: $nooc on January 31, 2008, 03:19:20 PM
hey guys!

well.. i am an absolute "assembler-beginner" and i am here to ask you, if someone knows a good tutorial for me?
i use the MASM32 8.0 under Visual C++ Express Edition!

it would be nice if some one had a tutorial that explains everything step by step.
i noticed that the syntax is different from Assembler to Assembler, so please dont give me a tutorial for TASM or anything else..

thank you guys for any comments!

ps: i am not an absolutely beginner relating to programming.. at home i write applications with C++ but i really would like to use inline assembler under C++. at the one side i'd like to write fast code if it's needed, and at the other side i'm interested in understanding how computers really work.  :U
Title: Re: Assembler beginner
Post by: ToutEnMasm on January 31, 2008, 03:24:12 PM
Hello,
To have a full answer at your question:
See the left upper corner of this page and type Tutorial in the search edit box.Many answers are here.
Title: Re: Assembler beginner
Post by: hutch-- on January 31, 2008, 03:53:58 PM
$nooc,

Download the version 10 beta of the masm32 project in the masm32 sub forum. It is compatible with the ML.EXE version 8.0 you have available.
Title: Re: Assembler beginner
Post by: $nooc on January 31, 2008, 03:54:41 PM
i'm afraid that i have to say:

i can't find something that really helps me!

first of all i don't really know if i set up my environment correctly..

i can't even execute stuff like


; [...]

include \masm32\include\user32.inc

; [...]


because it seems that MASM doesn't know where this .inc file is..
i don't even know what's the difference between user32.inc and user32.lib...

but before i want to link anything, i'd be glad if i could write an executable routine/function.

every tutorial i find starts with confusing stuff like:

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model

but doesn't explain why we create 32 bit code instead of 16 bit.. what effects it has..

i don't even know what the command 'mov' causes..

you see, i really have no plan about anything that relates to assembler..
would you mind posting me a good link for absolute noobs like me?
Title: Re: Assembler beginner
Post by: ragdog on January 31, 2008, 05:45:01 PM
hi

   
Here are a few tutorials to learn masm32

This is very helpful :U :U

http://win32assembly.online.fr/tutorials.html

greets and welcome
ragdog
Title: Re: Assembler beginner
Post by: $nooc on January 31, 2008, 05:57:06 PM
thank you, but..

Quote from: tutorial
This tutorial assumes that the reader knows how to use MASM.

all those tutorials say something like: "I assume that you posses at least basic knowledge of Assembly
language"
Title: Re: Assembler beginner
Post by: ragdog on January 31, 2008, 06:01:35 PM
http://win32assembly.online.fr/tut1.html

answered nevertheless yours ask


.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include    windows.inc

include    user32.inc
include    kernel32.inc
includelib user32.lib
includelib kernel32.lib

.data
szCaption db "information",0
szText db "masm32 example",0

.code
start:
   invoke MessageBox,NULL,addr szText,addr szCaption,MB_OK   
   invoke ExitProcess,0
end start


you can compile with this

make a bat and paste this

c:\masm32\bin\ml.exe /c /coff source.asm

c:\masm32\bin\link.exe /SUBSYSTEM:WINDOWS source.obj


Title: Re: Assembler beginner
Post by: $nooc on January 31, 2008, 07:50:57 PM
ragdog are you kidding me?

i said that i don't understand any line of the assembler language.. so what the hell should i do with this code?
i don't want to know how i use a messagebox, i want to learn the syntax of the assembler language..

why should i use WinAPI, if don't even know how to declare and define variables, functions and so on..

someone wants to build a car..
you would say: this is the gas pedal, this is the break, there is the gear change and here we got our tailgate..
Title: Re: Assembler beginner
Post by: MichaelW on January 31, 2008, 08:26:51 PM
Take a look at \masm32\help\asmintro.hlp, and in the MASM manuals available here:

http://webster.cs.ucr.edu/Page_TechDocs/index.html
Title: Re: Assembler beginner
Post by: jj2007 on January 31, 2008, 08:45:06 PM
Quote from: MichaelW on January 31, 2008, 08:26:51 PM
Take a look at \masm32\help\asmintro.hlp
That requires that he took Hutch's advice seriously, i.e. download and install MASM32...
$nooc, how much programming experience do you have, and in which languages? Assembler is not the ideal Beginner's All-purpose Symbolic Instruction Code  :wink
Title: Re: Assembler beginner
Post by: ragdog on January 31, 2008, 09:12:53 PM
 @$nooc

:red :naughty:

Title: Re: Assembler beginner
Post by: $nooc on January 31, 2008, 09:18:33 PM
well... i have experiance with C++ ... i would say that i am away from the "C++ Beginner" - Status

errr...

i already know that the syntax is from assembler to assembler different (TASM, MASM)

what i've prepared:

i use the MASM under Visual C++ Express Edition.
i think i have configured everything right..

visual c++ uses the ml.exe (assembler) as "compiler"
visual c++ uses the console as subsytem..

i've linked my libraries from microsoft sdk, i've linked the headerfiles from miccrosoft sdk

my programm has dependencies from kernel32.lib and user32.lib


i only need to know the syntax of assembler under MASM32..
Title: Re: Assembler beginner
Post by: jj2007 on January 31, 2008, 09:40:20 PM
Quote from: $nooc on January 31, 2008, 09:18:33 PM
i only need to know the syntax of assembler under MASM32..
Masm32 uses the standard Microsoft syntax. I assume you have installed Masm32 in the meantime? Then these folders are a must:
C:\masm32\icztutes
C:\masm32\help

Below is a complete Assembler program, for testing if your installation works. Have fun.

include \masm32\include\masm32rt.inc

.code
AppName db "Test",0
Mess db "This is Prog A",0

start: invoke MessageBox, 0, addr Mess, addr AppName, MB_OK
invoke ExitProcess,0
end start
Title: Re: Assembler beginner
Post by: $nooc on January 31, 2008, 10:20:35 PM
well.. it doesn't work..

probably the folders

C:\masm32\icztutes
C:\masm32\help

doesn't exist on my hdd.. but..

i loaded this (http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64&displaylang=en) installation for MASM 8.0

i don't own those ".inc" files,,
i don't even know for what they are needed, but i think they are required by the linker, right?


*EDIT:

i downloaded another masm32 setup, where i found the include files..
the "compiler" says:

Quote
Error   1   fatal error A1000: cannot open file : DirectX   MASM

when i try to execute your code..

Title: Re: Assembler beginner
Post by: MichaelW on January 31, 2008, 10:42:57 PM
Quote from: $nooc on January 31, 2008, 10:20:35 PM
well.. it doesn't work..

probably the folders

C:\masm32\icztutes
C:\masm32\help

doesn't exist on my hdd..

So you need someone to lead you by the hand to do whatever it is that you are trying to do, using only whatever already exists on your hdd?
Title: Re: Assembler beginner
Post by: jj2007 on February 01, 2008, 12:00:47 AM
Quote from: $nooc on January 31, 2008, 10:20:35 PM
well.. it doesn't work..
...
i downloaded another masm32 setup, where i found the include files..
the "compiler" says:

Quote
Error   1   fatal error A1000: cannot open file : DirectX   MASM

when i try to execute your code..

Be a bit more precise, please. You installed what? Masm32 V9.0 from http://masm32.com/ ? If yes, it will work. Try to understand the build.bat file in the C:\masm32\icztutes\tute02 folder. Or use the attached AsmBuild.exe (extract to C:\ with "use folder names")

[attachment deleted by admin]
Title: Re: Assembler beginner
Post by: $nooc on February 01, 2008, 09:10:05 AM
no.. i downloaded MASM v8.0 from microsoft

http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64&displaylang=en

once i downloaded it from masm32.com, but it doesnt work..

somehow the bldlibs.bat doesnt work!

Title: Re: Assembler beginner
Post by: Bora on February 01, 2008, 10:53:37 AM
http://drpaulcarter.com/pcasm/  It is not for masm but i think it would be better if you study this for a few days , and then continue on masm32 tutorials.  This tutorial will give you the basic of asm , you will learn how the mov,add,mul,pop,push etc.. works and later you can go to masm32 world and learn API's also.

ps : In fact , when i started learning asm , i couldnt find any good tutorial or book on intel syntax. Then i bought a very good book on at&t syntax ( wrox book , can be found on amazon.com ) and it gave me lots of knowledge about asm. Also the book gives you info about MMX ,SSE ,SSE2 etc. I knew a few about Intel syntax and i read just at&t syntax and wrote intel version of it.There are not very big differences between the syntax.
Title: Re: Assembler beginner
Post by: jj2007 on February 01, 2008, 01:12:13 PM
Quote from: $nooc on February 01, 2008, 09:10:05 AM
no.. i downloaded MASM v8.0 from microsoft

http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64&displaylang=en
That won't help you much, I am afraid.

Quote
somehow the bldlibs.bat doesnt work!
OK, now it starts making sense. Provide detail! Error messages in particular. You may know that in a DOS window, you can copy & paste from the SysMenu (the one in the upper left corner of the window), "Edit". Nobody will help you here unless you make a serious effort in describing exactly your problem.
Title: Re: Assembler beginner
Post by: Rainstorm on February 02, 2008, 05:40:04 AM
hi, am learning too

http://www.madwizard.org/programming/tutorials/
there's a pretty basic tutorial for dload on that page.
Title: Re: Assembler beginner
Post by: $nooc on February 08, 2008, 10:48:59 AM
hi!

sorry that i didn't write for so long! but i became ill, and i was lying all the time in my bed, watching tv ^^

back to my problem:

i downloaded now masm32 v9.0 from this site: http://www.codingcrew.de/masm32/
i got the link from http://www.masm32.com

i'll describe everything i do step by step...

i store the file "m32v9r.zip" on my desktop.
unpack it to the folder "m32v9r"

now i got the install.exe ..
i also unpack the install.exe to "install" folder with winrar..

i rename the install folder to "masm32" and move it to C:\ (that's requested, tell me if i'm wrong)

and now there are two things i have to do, to make masm32 runable...

execute bldlibs.bat ("include" folder)
execute make.bat ("m32lib" folder)

but somewhot the bldlibs.bat doesn't work..
the just in time debugger appears...

i don't really know whats the problem.. thats why i tried it with VC++ and MASM32 v8 .. but also that doesn't work ^^

ps: there is no error message that describes the problem..

it seems like the inc2l.exe has a problem...

(http://img91.imageshack.us/img91/3571/asdlj0.jpg)

Title: Re: Assembler beginner
Post by: shuttlebug on February 09, 2008, 06:20:55 AM
Snooc,
    Be sure not to get MASM32 V9 confused with ml.exe V8. MASM32 is the integrated development            environment that you use to type in your source code. Then when you compile your source code MASM32 uses the ml.exe program to change your source code into a machine language program. If you plan to use visual c++ as your debugger you must compile your programs with debugging information in the file.
Title: Re: Assembler beginner
Post by: $nooc on February 09, 2008, 06:49:32 AM
i tried it with masm32 v8 für visual c++

and after that i tried masm32 v9

my upper post shows the problem with masm32 v9 --> it doesn't create my library files.

my question: how hard can it be to set up my system for assembler? i f*cking don't understand why nothing works here on my computer..
Title: Re: Assembler beginner
Post by: jj2007 on February 09, 2008, 08:44:47 AM
For those who don't speak German: He got an "untreated exception", vulgo GPF, in inc2l.exe.
Title: Re: Assembler beginner
Post by: Vortex on February 09, 2008, 08:53:21 AM
Quotenow i got the install.exe ..
i also unpack the install.exe to "install" folder with winrar..
$nooc,

To install the Masm32 package, you don't need to unpack install.exe. Just run it and it will install all the tools, libraries etc for you.
Title: Re: Assembler beginner
Post by: $nooc on February 09, 2008, 09:53:03 AM
no, that doesn't work!

i asked in the board from http://www.codingcrew.de/ and the people there told me that i must NOT execute the install.exe.. i have to unpack this file and then execute bldlibs.bat and the make.bat

this is the file i downloaded: http://www.codingcrew.de/masm32/download.php

@ jj2007:

du sprichst deutsch? :)
Title: Re: Assembler beginner
Post by: hutch-- on February 09, 2008, 10:22:48 AM
$nooc,

Download the version 10 beta from the masm32 sub forum. run the install and it should work. The problem is because later versions of Windows had DEP anabled which messed up parts of version 9.0. version 10 solved the problem of the PE changes in later Windows versions.
Title: Re: Assembler beginner
Post by: $nooc on February 09, 2008, 10:56:38 PM
i did it!

and it works :D

now i could need a little briefing in how to use the assembler and maybe a tutorial in "understanding assemblers syntax"
has anyone a good link for me?
Title: Re: Assembler beginner
Post by: MrBogus on February 14, 2008, 12:05:35 PM
Hi to all, I am also learning assembly language (x86 system) and just been started last January seriously. I hope this forum could help me and so, I can also contribute even just a little thing. I just have noticed people are so kind here.  :cheekygreen: