News:

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

how to compile code

Started by new_comer, February 04, 2006, 05:29:34 PM

Previous topic - Next topic

new_comer

Hi!!

If anybody knows how to compile my .asm file in dos command line mode.
(I wrote the code using 'edit' editor now I wish to compile it)


Thanks in advance.

dsouza123

If you are trying to assemble Windows 32-bit assembly source code and have MASM installed
then in the c:\masm32\bin directory ( if installed on the c: drive) there is a file build.bat that
shows all the steps of assembling from the command prompt.

The main lines in the bat file are:

\masm32\bin\ml /c /coff "%1.asm"
\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF "%1.obj"

For example if your source code file is  first.asm in the directory c:\testcode
Go to the directory.
cd c:\testcode

Doing it manually:
Enter the following at the prompt
c:\masm32\bin\ml /c /coff first.asm

Do a dir, if first.obj was created then you can link it with
c:\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF first.obj

Automating the procedure:
Using the batch file instead of doing all the steps manually
run the build.bat file with the source code filename without the extention
c:\masm32\bin\build  first

This gives usefull information if there are errors which prevent a complete assemble and link.

new_comer

#2
see my source code is
(I want to print a string)


.MODAL SMALL
.STACK 100h
.DATA

MSG DB "HELLO!$"

.CODE
MAIN PROC
   MOV AX,@DATA
   MOV DS,AX

   LEA DX,MSG
   MOV AH,9
   INT 21H
   MOV AH,4CH

   INT 21H
   MOV AH,4CH
   INT 21H
  MAIN ENDP
END MAIN



I am not getting any output. My OS is winxp and I have masm32 ver 8

Please help


MichaelW

Your code is for a 16-bit DOS program. Except for a few typos (MODAL instead of MODEL, MOVE instead of MOV) the code is OK. See this post for more information:

http://www.masmforum.com/simple/index.php?topic=1123.msg8291#msg8291

This actually belongs in the 16-bit DOS Programming forum, and I will be moving it there shortly.

eschew obfuscation

new_comer

Thanks for that


Kindly tell me how to compile the code, I mean from where I will get a 16 bit compiler.

MichaelW

You can use the ML.EXE from the MASM32 package, and get the 16-bit linker as explained in the post I linked. You can assemble and link with a batch file like the samples in frameworks.zip.

eschew obfuscation

new_comer

Thanks again.

Incidently I got the same answer from http://www.letsdiscuss.info

now I can compile my programs and analysis my output using .lst file.