The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: easton91 on January 02, 2009, 04:57:26 AM

Title: assembling in masm
Post by: easton91 on January 02, 2009, 04:57:26 AM
I apologize for posting what may seem like such a trivial question, but I have never programmed in assembly before. I am very good with java, php, c++/obj-c so hopefully learning assembly will not be a huge feat. However, the issue I have now is not with assembler specific syntax (not yet anyway). The problem is with masm specific command line instructions for assembling/linking. I have installed the latest masm from the first us mirror and it installed successfully (or at least it said it did), however ml, masm(32), and asm(32) all will not assemble a small asm file. All help appreciated,

Easton91
Title: Re: assembling in masm
Post by: ecube on January 02, 2009, 04:59:20 AM
:MAKE
\MASM32\BIN\ML /c /coff /Cp thefile.asm
\MASM32\BIN\link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib /SECTION:.text,RWX thefile.obj

ECHO.
PAUSE
CLS


just put the above as watever.bat in the same directory as thefile.asm to compile it.

heres a debug console build example

:MAKE
\masm32\bin\ml /c /coff /Zi thefile.asm
\masm32\bin\link /SUBSYSTEM:CONSOLE /DEBUG /DEBUGTYPE:CV thefile.obj
ECHO.
PAUSE
CLS


heres building with a resource example that deletes *.objs after
:MAKE

\MASM32\BIN\ML /c /coff /Cp thefile.asm
\MASM32\BIN\rc RSRC.rc
\MASM32\BIN\link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib /SECTION:.text,RWX thefile.obj RSRC.resĀ 
DEL *.OBJ
ECHO.
PAUSE
CLS

this stuff really should be in a masm quickstart guide or something, I got it from icezlion tuts long time ago and modified to my liking, you can also put your asm code in a .bat with the code above changed abit and self compile.
Title: Re: assembling in masm
Post by: vanjast on January 05, 2009, 11:13:03 PM
Also the right files in the correct folders helps as well.
If you install in a folder other than the default "C:\masm32\" you have to change a lot of options.
Actually I haven't checked this with the latest masm - just installed defaultĀ  :red

If you can post the error messages your get, someone will pick it up fairly quickly.

:8)
Title: Re: assembling in masm
Post by: hutch-- on January 07, 2009, 10:46:18 PM
Hi Easton91,

Show us a small sample of what you were trying to assemble, it saves us guessing what you have been trying to do.
Title: Re: assembling in masm
Post by: dedndave on January 24, 2009, 03:38:25 PM
I am with vanjast - it is a big help to install in the default folder.
All of the includes, for example, are referenced as being located in C:\masm32\include.
If they aren't where they belong, you have alot of editing to do.
There is also some great info at the link below concerning environment variables.
- Dave
http://faculty.kfupm.edu.sa/COE/mudawar/coe205/tools/index.htm#Installing MASM 6.15
Title: Re: assembling in masm
Post by: farklesnots on January 24, 2009, 10:49:03 PM
It doesn't actually have to be the C: drive, as long as it's off the root folder of whatever drive or partition you use. I regularly install the package to D:\masm32\ and it works fine.
The big thing is giving it it's own root-level folder, and keeping your source files on the same drive in folders that don't have a space in the name.
Title: Re: assembling in masm
Post by: jj2007 on January 25, 2009, 09:13:43 AM
I also vote for the hard-coded paths. The handling of environment variables in Windows XP is horribly messed up. Apart from being overly complicated (see the link above), it often seems not to work properly. For exampler, the PCCONN~1 bit below is a leftover from the Nokia(TM) suite (apparently programmed by hobby coders well below my level) that I disinstalled a week ago. I have removed it from the Control Panel, and it is still there. It might disappear after a reboot.
Recommended solution: Stick to include \masm32\include\masm32rt.inc at the beginning of your code.

Path before
PATH=C:\PROGRA~1\PCCONN~1\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
em;D:\DB_CIRCS\WEBSITE\0_SERVER\PhpBin
(set PATH=D:\masm32\lib;D:\masm32\include)
PATH=D:\masm32\lib;D:\masm32\include
...
tmp_file.asm(1) : fatal error A1000:cannot open file : masm32rt.inc