The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: new_comer on February 04, 2006, 05:29:34 PM

Title: how to compile code
Post by: new_comer on February 04, 2006, 05:29:34 PM
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.
Title: Re: how to compile code
Post by: dsouza123 on February 05, 2006, 12:07:41 AM
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.
Title: Re: how to compile code
Post by: new_comer on February 05, 2006, 06:27:36 AM
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

Title: Re: how to compile code
Post by: MichaelW on February 05, 2006, 06:51:34 AM
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.

Title: Re: how to compile code
Post by: new_comer on February 05, 2006, 08:09:54 AM
Thanks for that


Kindly tell me how to compile the code, I mean from where I will get a 16 bit compiler.
Title: Re: how to compile code
Post by: MichaelW on February 05, 2006, 08:50:40 AM
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.

Title: Re: how to compile code
Post by: new_comer on February 07, 2006, 04:25:30 PM
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.