News:

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

Getting Started with Masm 32

Started by WayneSallee, May 22, 2005, 05:51:01 PM

Previous topic - Next topic

WayneSallee

Ok I've got an asm file to assemble, and run, but Masm 32 will not assemble it. It gives me erros that there is no obj file. How do I creat an obj file, and do I need other files to get this this thing to run. In the past I used masm 61.

This Masm 32 is so not userfreindly.

Wayne Sallee
Wayne@WayneSallee.com

AeroASM

To turn .asm into .obj, ml /c /coff MyAsm.asm
To turn .obj into .exe, link /subsystem:windows MyAsm.obj

Vortex

Hi Wayne,

Should you give a little more information about the error messages you are receiving?

WayneSallee

Quote from: AeroASM on May 22, 2005, 05:53:37 PM
To turn .asm into .obj, ml /c /coff MyAsm.asm
To turn .obj into .exe, link /subsystem:windows MyAsm.obj

Ok where do I put those commands?, in the asm file?

Wayne Sallee
Wayne@WayneSallee.com

WayneSallee

Quote from: Vortex on May 22, 2005, 05:58:40 PM
Hi Wayne,

Should you give a little more information about the error messages you are receiving?

error cannot open input file. c:/obj      something like that

Wayne Sallee
Wayne@WayneSallee.com

Phil

Nope, the commands don't belong in the asm file. First, you must make sure that the c:\masm32\bin directory is in your path at the command level. You can accomplish this by starting a command processor and then doing a path command like:

 C:\MyDir> path=C:\masm32\bin;%path%

This will set your search path to look first in the directory where you installed the masm32 binaries. The ML and LINK programs will be found there and they will be treated as commands if they are in the command processors search list. The %path% after the semi-colon will make sure that all previously defined directories remain in your path. Then:

 C:\MyDir> ml /c /coff MyAsm.asm
 C:\MyDir> link /subsystem:windows MyAsm.obj
 C:\MyDir> dir MyAsm.exe
 C:\MyDir> MyAsm


WayneSallee

Clear as mud.

Wayne Sallee
Wayne@WayneSallee.com

Quote from: Phil on May 22, 2005, 06:10:45 PM
Nope, the commands don't belong in the asm file. First, you must make sure that the c:\masm32\bin directory is in your path at the command level. You can accomplish this by starting a command processor and then doing a path command like:

 C:\MyDir> path=C:\masm32\bin;%path%

This will set your search path to look first in the directory where you installed the masm32 binaries. The ML and LINK programs will be found there and they will be treated as commands if they are in the command processors search list. The %path% after the semi-colon will make sure that all previously defined directories remain in your path. Then:

 C:\MyDir> ml /c /coff MyAsm.asm
 C:\MyDir> link /subsystem:windows MyAsm.obj
 C:\MyDir> dir MyAsm.exe
 C:\MyDir> MyAsm



AeroASM

ml.exe and link.exe are programs run from the command line. They normally reside in c:\masm32\bin.
Therefore to run them you could type into the commandline c:\masm32\bin\ml.exe and c:\masm32\bin\link.exe
But if you put c:\masm32\bin in your path environment variable then you only have to type ml and link into the commandline.
On Win98 you can do this by putting SET PATH=%PATH%;C:\masm32\bin at the end of c:\autoexec.bat. On WinXP you can do this by going to Control Panel...System...Advanced...Environment Variables. Find path in the System Variables section and put a ;c:\masm32\bin at the end of it.

There is a two step process for converting MyAsm.asm into MyAsm.exe:
type into console ml /c /coff MyAsm.asm.
Then type into consol link /subsystem:windows MyAsm.obj
This is assuming that your console is in the directory containing MyAsm.asm.

MichaelW

Hi Wayne,

Your problem might have a simple solution. Could you show us what you are you trying to assemble and tell us how are you trying to assemble it?

eschew obfuscation

WayneSallee

The problem was not in the software finding the masum files, it was a problem with the software not finding my files because I did not have my files in the masm32 directory. I created a temporary directory in the masm32 directroy, and it no longer gives me those errors.

But eventualy I will move back out of the masm 32 directory. To do that I guess I will have to edit an autoexe file.

Next question:

Does the asembler not check for errors??? What's up?  I can put junk in the code, and it won't give any errors.

Wayne Sallee
Wayne@WayneSallee.com

WayneSallee

Ok, the problem with check for errors was salved. Have to do a file save, or els it uses the file before editing. Masm 61 will ask to save changes before assembling.

Wayne Sallee
Wayne@WayneSallee.com

WayneSallee

Ok since I put the junk in there to see if it would find errors, I know exactly whre that junk is, but is there not a way to have it singlestep and show you exactly where in the code, that the errors are, like masm61 does?

Wayne Sallee
Wayne@WayneSallee.com

mnemonic

Hi WayneSallee,

Quote from: WayneSallee on May 22, 2005, 11:28:15 PM
Does the asembler not check for errors??? What's up?  I can put junk in the code, and it won't give any errors.
This is assembler not Java. Masm just checks for invalid mnemonic usage and the like. In general you are yourself responsible for what you code.

Quote from: WayneSallee on May 22, 2005, 11:34:44 PM
Ok, the problem with check for errors was salved. Have to do a file save, or els it uses the file before editing. Masm 61 will ask to save changes before assembling.
Huh? Sorry, but I don´t get what you´re saying half the time...
Masm won´t ask you for anything. Did you mean QEdit?

Quote from: WayneSallee on May 22, 2005, 11:44:05 PM
Ok since I put the junk in there to see if it would find errors, I know exactly whre that junk is, but is there not a way to have it singlestep and show you exactly where in the code, that the errors are, like masm61 does?
Singlestep? Do you speak of some debugger?
If masm finds syntax errors or errors in general it will tell you in which line they are.

Please try to be a bit more precise. Thanks.

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

WayneSallee

Quote from: mnemonic on May 22, 2005, 11:58:15 PM
If masm finds syntax errors or errors in general it will tell you in which line they are.


Ok it does. I did not notice that. Though single stepping like masm61 would be better, but at least it does have line numbers. I had not noticed that.

Wayne Sallee
Wayne@WayneSallee.com

hutch--

Wayne,

The problems appear to be from the amount of theory you bring in with your code. Bottom line is you must find the appropriate binaries and this can be done as per MASM32 with hard coded paths or alternatively by setting the paths in the environment. Either way you must find all of the files required to build the application or you will keep getting errors related to missing files.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php