News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Hello World MASM

Started by why06, January 18, 2010, 04:24:37 AM

Previous topic - Next topic

why06

Well hello everyone.

I am an absolute noob. Well in the since I have very little understanding of assembly langauge. All I want to do now is compile my 1st program in assembly language. It's hard enough trying to find example code and books are mostly dated. Sorry about complaining I'm sure all of you have been to the same thing. On to the point:

Im using the IDE provided in the newest version of MASM32. I try to compile the the code and it seems to be working, but when I try to run the code nothing happens. Here is the code:


.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke MessageBoxA, NULL, addr HelloWorld, addr HelloWorld, MB_OK
invoke ExitProcess, 0
end start



I don't understand what the problem is. I don't think there is a problem with the code, but at the same time I'm so new to ASM its hard for me to tell. I really do what to learn and I'm not a guy who guy who goes begging for help, but I have nothing to work with. I need a foot in the door :(

EDIT: ??? well I'll be darned. I turned off masm and now it's working... haha. And was getting so fustrated because nothing seemed to be working. and now everything is working perfectly. I don't get it, but I suppose nvm then. =/

dedndave

welcome to the forum

i would take the space out that preceeds the colon in this line...

option casemap :none

but, it assembles and runs fine for me   :U

are you using the BUILD.BAT batch file that is in masm32\bin ?
that is what i used
perhaps you are using the wrong command line parameters for ML and/or LINK
you may examine the BUILD.BAT file with notepad to see if you have the right parameters

sinsi

Works fine here too. If you are using qeditor the steps are file->save, project->build all, project->run.
Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

lol sinsi - he got me too - if you read his edit - he got it working already
aren't you glad we could help ? - lol

Finder

Hi why06
          I runed the programe in my PC, it's ok.Show a MessageBox.
          I think your system maybe trouble! :green
                                                Finder

why06

Quote from: sinsi on January 18, 2010, 04:35:28 AM
Works fine here too. If you are using qeditor the steps are file->save, project->build all, project->run.


I think that was sort of the problem. Hehe... I spent all day trying to figure out why it wouldn't work. Turned out I forgot to save it so its weird. Once I exited qedit it prompted me to save and then everything worked. Funny it worked for me as soon as I decided to give up. It wasn't a compiler error or a code error. It was just my error. xD (as usual)

I guess I should introduce myself because I'm new:

My name is Shaun Carter, but I prefer to go by "why" on forums.
I have a little background in Java and C++. And I want to learn asm for a number of reasons, but I suppose mostly its the next logical step from having only a mediocre understanding of the two others... haha. Anyway you guys have been nice. This probably won't be the last time I post a question like this.

Anyway I'm still trying to find my way around the forum. Is there a tutorials section or thread that a noobie should check out?

dedndave

welcome to the forum, Shaun
in the upper right hand corner of the forum is a links page - on there, you will find Iczelion's tutorials
also, in the masm32 package there are a few good tutorials in the masm32\tutorial folder
in the masm32\examples folder are many good (tested) examples to learn from

why06

Quote from: dedndave on January 18, 2010, 01:28:31 PM
welcome to the forum, Shaun
in the upper right hand corner of the forum is a links page - on there, you will find Iczelion's tutorials

Ummm.... Im looking. Upper right? I don't see it.  :dazzled:

EDIT: again nvm. My fault as usual. I hid the box :P

Vortex

Hi why06,

Welcome to the forum.

farklesnots

in the MASM32 forum of the Project Support Forums, hutch has a sub-forum called Starting with MASM32. It has some good suggestions for someone new to this.

Also, welcome to the forums!  :U

why06

Quote from: farklesnots on January 18, 2010, 10:55:46 PM
in the MASM32 forum of the Project Support Forums, hutch has a sub-forum called Starting with MASM32. It has some good suggestions for someone new to this.

Also, welcome to the forums!  :U

Thanks for the info!

One more question, because I don't want to create another topic for such a simple one:

What does "db" mean? I see it used when declaring strings like so:

String db "String",0

The masm tutorial never specifically explained those two letters.

BlackVortex

I think of them as "data byte", "data word" etc.

MichaelW

I think the 'd' was intended to mean 'define', with DB, DW, DD, DF, DQ, and DT classed as data-definition directives.
eschew obfuscation

hutch--

Why,

When you see DB as in the list Michael posted, its telling you the SIZE of the data that it specifies. Witrh BYTE data specified as "name DB "text etc ...", 0" its telling you that the data is a sequence of BYTE size pieces.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

why06

Oh hey.. thanks a lot. That's pretty neat. :)