Hello,
I am an absolute beginner with assembly language, and have been steered towards MASM32.
I have tried to do a "hello world" tutorial, but alas i am faced with the error aptly stated.
the code i used:
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\include\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\include\user32.lib
.data
msg db "Hello World!!!", 0
cpt db "MY FIRST PROGRAM", 0
.code
start:
invoke MessageBox, NULL, addr msg, addr cpt, MB_OK
invoke ExitProcess, NULL
end start
I am running this on windows 7 64-bit, Intel Core Duo T6500
the main MASM folder is D:\MASM32
and the HelloWorld.asm is is D:\MASM32\Projects
a nudge or a pummel in the right direction would be highly appreciated, then I can stop filling the forum with nooby stuff, and fill it with happy stuff... ::)
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
the libraries are in the lib sub folder
lol of course they are. teaches me for not reading it properly.
1st lesson, never assume ^^
Cheers!
if you look inside this file:
\masm32\include\masm32rt.inc
you will see that all that stuff is typed out for you - well, most of it :P
once in a while, you may have to add another inc/lib pair
but, for many beginner programs...
INCLUDE \masm32\include\masm32rt.inc
is all you need
it even has the processor, model, and casemap
(http://smiles.kolobok.us/light_skin/bye.gif)
Quote from: dedndave on December 11, 2011, 05:15:10 AM
if you look inside this file:
\masm32\include\masm32rt.inc
you will see that all that stuff is typed out for you - well, most of it :P
once in a while, you may have to add another inc/lib pair
but, for many beginner programs...
INCLUDE \masm32\include\masm32rt.inc
is all you need
it even has the processor, model, and casemap
thanks, that was a nice shove in the right direction indeed :)
also showed that I had used the wrong code starter?? (.386 , was suppose to be .486), but as a point of interest, will it make much of a difference using either one these?
@Bomz thanks for that example, I had a look through the inc files being included, but how does one know what parameters a, let's say MessageBox takes?
As i may assume... (what did we say about this?) in the user32.inc, invoke MessageBox, calls MessageBox equ <MessageBoxA>, which creates a MessageBoxA with 4 parameters? (DWORD).... and if this is the case, how do we know what parameters do what?
we will get there eventually :)
386 for this prog - OK
for many beginner programs, .386 will work
the processor directive simply tells the assembler which instruction set you want to use
if you want to use certain instructions or certain addressing forms, you may have to use a higher processor
examples that come to mind are the CPUID and RDTSC instructions - .586 or higher is required to use them
if you want to use SSE instructions, a more involved set of directives is used
it should be understood that a 32-bit processor directive (.386 or above), should appear before the .MODEL directive
this tells the assembler you are writing a 32-bit program
after that, the processor selection may be elevated at any location in the source file
so, if you wanted to use processor instructions above 486...
INCLUDE \masm32\include\masm32rt.inc
.586
will work fine
it is a fairly safe assumption that nearly everyone has at least a pentium in their machine (586)
it is a requirement for any OS from Windows 2000 or newer
as i recall, i think you can install Windows 95 on a 386 and Windows 98 requires a 486 or higher with an FPU