News:

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

How do I assemble my masm file?

Started by tyloki, February 03, 2007, 07:31:35 AM

Previous topic - Next topic

tyloki

I just downloaded masm 9. I have my .masm file written, but I don't know how to comile/assemble it.

I want to add a command to textpad that will automatically assemble the file that is open.

ChrisLeslie

Welcome tyloki

If you have downloaded and installed the masm32 package then look for the program called Qeditor.exe in the masm32 directory. Use this for your editor and IDE. There are menu items under "project" that will compile and run directly. Try loading, compiling and running some of the examples.

Chris  :U

ic2

Your question makes me wonder if you wanted to comply a executionable while just using your notepad file .  We might be able to simply make a copy of the BLDALL.BAT file  from  the bin and change all .asm extension to .txt i and put it in the same directory as your project... Never tried it but It might work.

tyloki

Thanks for the reply :)

I assembled the program and it said it couldn't find the path specified. A window popped up and said it couldn't find c:documents

Any other suggestions?

ic2: I have a .asm file that I have written and compiled on another computer. In textpad, the program I use for programming (in java, c++) it has an option that lets you add a program that will compile the file currently in use. It works for java and c++, but I can't get it to work for masm. I'll try to use BLDALL.BAT to see what happens.

tyloki

Ok, new error. I assembled this is qeditor

'C:\masm32\bin\Program2.asm(31) : error A2006: undefined symbol : DGROUP'

.MODEL   SMALL
      .STACK   64
      .DATA
      .CODE

startx      DW ?
endx      DW ?

MAIN   PROC   FAR
mov ax, @data; <----------------------------------------- the error is here.
mov ds, ax


It works on another masm assembler, but not on this one, and I have no idea why.

ChrisLeslie

You are assembling a 16 bit real program. The masm32 won't compile 16 bit progs with the default switches as in the batch file. And the linker will never work because it is a 32 bit linker. You will have to compile with ml.exe seperately, and then link with a 16 bit linker. At the top right of the forum screen you will find links to download a 16 bit linker.

Chris

tyloki

Thanks! I was able to find a linker and make it work. I have it working in textpad as well.

I am now looking for a way to make the .lst file.

TomRiddle

(Required) [Optional]

Under 16-bit DOS Masm:
Masm16.exe(MASM)(Macro Assembler 6.00)
  Usage: Masm16 [Options] File[.Asm]
  Notes:
  Options:
    /AT             Enable tiny model (.COM file)
    /Bl<linker>     Use alternate linker
    /c              Assemble without linking     
    /Cp             Preserve case of user identifiers
    /Cu             Map all identifiers to upper case
    /Cx             Preserve case in publics, externs
    /D<name>[=text] Define text macro   
    /EP             Output preprocessed listing to stdout
    /F <hex>        Set stack size (bytes)   
    /Fb[file]       Generate bound executable
    /Fe<file> Name executable         
    /Fl[file] Generate listing       
    /Fm[file] Generate map           
    /Fo<file> Name object file       
    /FPi Generate 80x87 emulator encoding
    /Fr[file] Generate limited browser info
    /FR[file] Generate full browser info   
    /G<c|d> Generate Pascal or C calls   
    /H<number> Set max external name length
    /I<name> Add include path           
    /nologo Suppress copyright message
    /Sa Maximize source listing
    /Sf Generate first pass listing
    /Sl<width> Set line width
    /Sn Suppress symbol-table listing
    /Sp<length> Set page length
    /Ss<string> Set subtitle
    /St<string> Set title
    /Sx List false conditionals

    /Ta<file> Assemble non-.ASM file
    /VM Enable virtual memory
    /w Same as /W0 /WX
    /WX Treat warnings as errors
    /W<number> Set warning level
    /X Ignore INCLUDE environment path
    /Zd Add line number debug info
    /Zf Make all symbols public
    /Zi Add symbolic debug info
    /Zm Enable MASM 5.10 compatibility
    /Zp[n] Set structure alignment
    /Zs Perform syntax check only

And 32-bit Windows Console Masm:
Masm32.exe(ML.EXE)(Macro Assembler 6.14.8444)
  Usage: Masm32 (Options) [File].asm
  Notes: Options Are Case Sensitive.
  Files:
  Options:
    /AT             Enable Tiny Model (.COM file)
    /Bl<Linker>     Use Alternate Linker
    /c              Assemble Without Linking
    /Cp             Preserve Case of User Identifiers
    /Cu             Map All Identifiers to Upper Case
    /Cx             Preserve Case in Publics, Externs
    /coff           Generate COFF Format Object File
    /D<Name>[=Text] Define Text Macro
    /EP             Output Preprocessed Listing to Stdout
    /F              <hex> Set Stack Size(Bytes)
    /Fe<File>       Name Executable
    /Fl[File]       Generate Listing
    /Fm[File]       Generate Map
    /Fo<File>       Name Object File
    /FPi            Generate 80x87 Emulator Encoding
    /Fr[File]       Generate Limited Browser Info
    /FR[File]       Generate Full Browser Info
    /G<c|d|z>       Use Pascal, C, or Stdcall Calls
    /H<Number>      Set Max External Name Length
    /I<Name>        Add Include Path
    /link           Linker Options and Libraries>
    /nologo         Suppress Copyright Message
    /Sa             Maximize Source Listing
    /Sc             Generate Timings in Listing
    /Sf             Generate First Pass Listing
    /Sl<Width>      Set Line Width
    /Sn             Suppress Symbol-Table Listing
    /Sp<Length>     Set Page Length
    /Ss<String>     Set Subtitle
    /St<String>     Set Title
    /Sx             List False Conditionals
    /Ta<File>       Assemble Non-.ASM File
    /WX             Treat Warnings as Errors
    /W<number>      Set Warning Level
    /X              Ignore INCLUDE Environment Path
    /Zd             Add Line Number Debug Info
    /Zf             Make All Symbols Public
    /Zi             Add Symbolic Debug Info
    /Zm             Enable MASM 5.10 Compatibility
    /Zp[n]          Set Structure Alignment
    /Zs             Perform Syntax Check Only

Remember, our version might not be the same, but looking at the options, they aren't gonna be world apart different.

tyloki

I attempted to use the Fl command, but it failed when I tried it. Do you place the name of the current file where it says file, the name of the file you want to send to, or just leave it as file? I tried it a couple of ways last week with no success.

BytePtr

For example your .ASM file is Program2.asm.
The do this:

masm16 /Fl Program2.asm

And the listing should be done. You will see Program2.lst file in same folder.

I dont have MASM32 installed so i cant try. I tested only with MASM 6.1 which has another switch for same work..
masm /l test.asm

MichaelW

Using this source:

.model small
.stack
.data
    msg db "Hello, press any key to exit...$"
.code
.startup
    mov ah, 9
    mov dx, OFFSET msg
    int 21h
    mov ah, 10h
    int 16h
.exit
end

And this batch file to assemble and link:

: ML.EXE, ML.ERR, and the 16-bit linker renamed to LINK16.EXE
: (and hello.asm) must be in the current directory.
ML /Fl /Sa /c hello.asm
pause
LINK16 /MAP hello.obj;
pause

Will produce, in addition to the object module and the EXE, this listing:

Microsoft (R) Macro Assembler Version 6.14.8444     02/10/07 09:25:17
hello.asm      Page 1 - 1


.model small
.stack
0000 .data
0000 48 65 6C 6C 6F 2C     msg db "Hello, press any key to exit...$"
       20 70 72 65 73 73
       20 61 6E 79 20 6B
       65 79 20 74 6F 20
       65 78 69 74 2E 2E
       2E 24
0000 .code
.startup
0000    *@Startup:
0000  BA ---- R    *     mov    dx, DGROUP
0003  8E DA    *     mov    ds, dx
0005  8C D3    *     mov    bx, ss
0007  2B DA    *     sub    bx, dx
0009  D1 E3    *     shl    bx, 001h
000B  D1 E3    *     shl    bx, 001h
000D  D1 E3    *     shl    bx, 001h
000F  D1 E3    *     shl    bx, 001h
0011  FA    *     cli   
0012  8E D2    *     mov    ss, dx
0014  03 E3    *     add    sp, bx
0016  FB    *     sti   
0017  B4 09     mov ah, 9
0019  BA 0000 R     mov dx, OFFSET msg
001C  CD 21     int 21h
001E  B4 10     mov ah, 10h
0020  CD 16     int 16h
.exit
0022  B4 4C    *     mov    ah, 04Ch
0024  CD 21    *     int    021h
end
Microsoft (R) Macro Assembler Version 6.14.8444     02/10/07 09:25:17
hello.asm      Symbols 2 - 1




Segments and Groups:

                N a m e                 Size     Length   Align   Combine Class

DGROUP . . . . . . . . . . . . . GROUP
_DATA  . . . . . . . . . . . . . 16 Bit 0020   Word   Public  'DATA'
STACK  . . . . . . . . . . . . . 16 Bit 0400   Para   Stack   'STACK'
_TEXT  . . . . . . . . . . . . . 16 Bit 0026   Word   Public  'CODE'


Symbols:

                N a m e                 Type     Value    Attr

@CodeSize  . . . . . . . . . . . Number 0000h
@DataSize  . . . . . . . . . . . Number 0000h
@Interface . . . . . . . . . . . Number 0000h
@Model . . . . . . . . . . . . . Number 0002h
@Startup . . . . . . . . . . . . L Near 0000   _TEXT
@code  . . . . . . . . . . . . . Text    _TEXT
@data  . . . . . . . . . . . . . Text    DGROUP
@fardata?  . . . . . . . . . . . Text    FAR_BSS
@fardata . . . . . . . . . . . . Text    FAR_DATA
@stack . . . . . . . . . . . . . Text    DGROUP
msg  . . . . . . . . . . . . . . Byte 0000   _DATA

   0 Warnings
   0 Errors

And this map:


Start  Stop   Length Name                   Class
00000H 00025H 00026H _TEXT                  CODE
00026H 00045H 00020H _DATA                  DATA
00050H 0044FH 00400H STACK                  STACK

Origin   Group
0002:0   DGROUP

  Address         Publics by Name


  Address         Publics by Value


Program entry point at 0000:0000
eschew obfuscation