News:

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

assembling in masm

Started by easton91, January 02, 2009, 04:57:26 AM

Previous topic - Next topic

easton91

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

ecube

: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.

vanjast

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)

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

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

farklesnots

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.

jj2007

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