News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

need help getting started

Started by John T, March 14, 2015, 07:03:39 AM

Previous topic - Next topic

John T

Hi - I'm new to MASM
I've got the MASM32 software running and trying to compile my first program in it.
The Help says I needed to state:

    include \masm32\include\masm32.inc
    includelib \masm32\lib\masm32.lib

But then I keep getting this error:
   error A2005: symbol redefinition : RUN_SYNCH_PROCESS_EX

btw, heres the whole program:

.386
.model FLAT, STDCALL
.stack 4096
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
ExitProcess PROTO, dwExitCode : DWORD

.code
main PROC
    mov eax, 10000h
    add eax, 40000h
    sub eax, 20000h
   
    INVOKE ExitProcess, 0
main ENDP
end main

Any clues appreciated.

jj2007

.stack 4096
option casemap :none                      ; case sensitive

include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib


That will do the job. However, you would have less problems with the following structure:
include \masm32\include\masm32rt.inc  ; contains lots of useful settings

.code
AppName db "Masm32:", 0

start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit

end start


Welcome to the forum :icon14:

hutch--

Remove the .STACK line as well, in 32 bit PE files the stack sizes are set by the linker. If you need this later you can add it to a batch file for your application.

John T

Wow! Thanks jj2007 and hutch--
ASM programming seems hopeful after all.
John T

amrak

I also get the same error even after using John T's code, it says fatal error A1000: cannot open file include \masm32\include\masm32rt.inc.
Same error after removing .stack part

dedndave

is masm32 installed in the root folder of the drive (C:\masm32, D:\masm32, etc) ?

is your asm file on the same drive as the \masm32 folder ?

amrak

Nope dendave masm32 is in C:\masm32 and asm files are in D:\masm  .... but I have set the environment variable to c:\masm32\bin... thought it would work as it works in java

dedndave

actually, masm allows the MASM, INCLUDE, and LIB environment variables to be used
however, the masm32 library is not designed to use them
the paths are hardcoded

so - it is easiest if the file you want to assemble is on the same drive as the masm32 install   :t

amrak

Sorry John T. I have used your thread to ask questions of mine. @dendave when i place the asm folder in D: drive it is working. I have copied the source code that you have suggested John T to use and typed >ml trial.asm but gives the following warnings and errors.
Assembling: trial.asm

************
ASCII build
*************
/z2
"trial.obj"
"trial.exe"
NUL
LINK : warning LNK4033: unrecognized option "z2"; ignored
trial.obj : warning LNK4033: converting object format from OMF to COFF
trial.exe : fatal error LNK1136: invalid or corrupt file


when I use the qeditor and run the program I get the output helloworld dialogue box. At least I got an outut after 4 days of trying. thank you


Vortex

Hi amrak,

ml /c /coff trial.asm

If you are going to build a GUI application :

link /SUBSYSTEM:WINDOWS trial.obj

For a console application :

link /SUBSYSTEM:CONSOLE trial.obj

amrak

Thanks vortex, now its working... I actually did not know how to compile the program, now I know it.

John T

I got a question...
I'm trying to use the Irvine32.inc to sent text to the console window.
I can includelib the Irvine32.lib just fine (have to proto my calls) but when I include the Irvine32.inc I get:
      warning a4011: multiple .model directives found
      error A2008: syntax error: TEXTEQU
      error A2008: syntax error: EQU

Further, if I just proto the calls like:
      WriteInt proto
      WriteString proto
I seem to be getting an invalid handle (seen thru OllyDbg) and a bad crash.

Stating:
      DumpRegs PROTO
Does'nt crash but does nothing at all - bad handle too.

In general I'm not even able to get the console window to show up - any ideas what I'm missing???
I figure either I'm not setting up and passing params right or mabey theres something I'm lacking from the Irvine32.inc file.
Dont know...
John

dedndave

it would help if you show us a complete example
the way Kip tells you to set up the machine, i don't think you need to provide paths...

    INCLUDE     irvine32.inc
    INCLUDE     floatio.inc
    INCLUDE     macros.inc
    INCLUDELIB  kernel32.lib
    INCLUDELIB  user32.lib
    INCLUDELIB  Irvine32.lib

dedndave

i don't set my machine up the way Kip says, so i add root-relative paths

        INCLUDE     \Masm32\Irvine\Irvine32.inc  ;adds SmallWin.inc, VirtualKeys.inc

        OPTION      CaseMap:None

        INCLUDE     \Masm32\Irvine\floatio.inc
        INCLUDE     \Masm32\Irvine\GraphWin.inc
        INCLUDE     \Masm32\Irvine\macros.inc

        INCLUDELIB  \Masm32\Irvine\kernel32.lib
        INCLUDELIB  \Masm32\Irvine\user32.lib
        INCLUDELIB  \Masm32\Irvine\Irvine32.lib


also, i prefer to use "CaseMap:None" so that function names are case sensitive
the Irvine32.inc file has that line in it, but it is commented out   :P

if you have it set up correctly, you don't have to prototype any Irvine32 functions

Gunther

Hi Dave,

Quote from: dedndave on March 23, 2015, 03:24:23 AM
also, i prefer to use "CaseMap:None" so that function names are case sensitive
the Irvine32.inc file has that line in it, but it is commented out   :P

if you have it set up correctly, you don't have to prototype any Irvine32 functions

It seems that Kip is very popular among students, isn't he? What's the reason for that?

Gunther
You have to know the facts before you can distort them.