News:

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

who knows why masm32 doesn't generate obj file

Started by andrr, May 30, 2010, 05:36:25 AM

Previous topic - Next topic

dedndave

well - invoke is a call, actually - it saves some typing
        INVOKE  ExitProcess,0
is the same as
        push    0
        call    ExitProcess

with masm32, there is a macro named "exit" that saves even more typing
        exit
the print, uhex$, and inkey macros are a little more complicated
to see the code they generate, refer to the masm32\macros\macros.asm file

jj2007

Quote from: TmX on May 30, 2010, 10:08:35 AM
No. /SUBSYSTEM:WINDOWS is for GUI apps.
If you want console apps, use /SUBSYSTEM:WINDOWS

Attention, TmX meant "If you want console apps, use /SUBSYSTEM:CONSOLE"
If you use /SUBSYSTEM:WINDOWS, the executable will run but never exit, and you will need Task Manager to kill it.

clive

Quote from: TmX
No. /SUBSYSTEM:WINDOWS is for GUI apps.
If you want console apps, use /SUBSYSTEM:WINDOWS

/SUBSYSTEM:CONSOLE

Syntax
/SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]

You can specify a subsystem, and a version there of.

NATIVE - Startup environment, during initial boot
WINDOWS - Window/Dialog application
CONSOLE - Command Line application
It could be a random act of randomness. Those happen a lot as well.

clive

Quoteversion masm 10
i use command line
code ml  /c  /coff does't work

MASM32 v10 or MASM (ML) v10

The MASM32 download includes MASM v6.14.8444
MASM v10 (part of MSVC Express) generates COFF by default, and requires /OMF to get the older Intel Object Module Format

Copy the command line, and application output from the command console (DOS Box, Run "cmd")

C:\MASM>\masm32\bin\ml -c test22.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: test22.asm

C:\MASM>dir
Volume in drive C has no label.
Volume Serial Number is 227D-EC0C

Directory of C:\MASM

05/30/2010  06:54 AM    <DIR>          .
05/30/2010  06:54 AM    <DIR>          ..
05/30/2010  06:53 AM               299 test22.asm
05/30/2010  06:54 AM                95 test22.obj
               2 File(s)            394 bytes
               2 Dir(s)  20,552,540,160 bytes free


Is your problem that it isn't generating an OBJ, or that it is not generating an EXE?
It could be a random act of randomness. Those happen a lot as well.

dedndave

good tips Clive - now you are going to make me read the manual - lol

hutch--

 :bg

> how to write with pure assembler without invoke and print and inkey

Many make that assumption when they are starting up and all you need to know is how to write your own advanced runtime library in assembler.  :P

The trick is to use what you can to learn then start doing the more advanced stuff once you have enough experience.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

right Hutch
it isn't too difficult to write a "print" routine or "bin2hex", either
that inkey routine is a bugger   :P
not as easy as it should be to replace that C-runtime function
best to learn the macros well enough to get around a little bit

andrr

i would like to make the perogramme in asm as it was made earlier without any macros step by step and now its getting too complicated to understand everything
earlier everything was quite clear
  ml  first.asm, first.obj, first.lst
  link first.obj first.exe


clive

Quote from: andrr on May 30, 2010, 12:09:21 PM
i would like to make the perogramme in asm as it was made earlier without any macros step by step and now its getting too complicated to understand everything
earlier everything was quite clear
  ml  first.asm, first.obj, first.lst
  link first.obj first.exe

That looks more like the syntax for the older DOS era MASM (4.x, 5.x)

C:\MASM>\tools\masm51\binb\masm /help
Usage: masm /options source(.asm),[out(.obj)],[list(.lst)],[cref(.crf)][;]

/a              Alphabetize segments
/c              Generate cross-reference
/d              Generate pass 1 listing
/D<sym>[=<val>] Define symbol
/e              Emulate floating point instructions and IEEE format
/I<path>        Search directory for include files
/l[a]           Generate listing, a-list all
/M{lxu}         Preserve case of labels: l-All, x-Globals, u-Uppercase Globals
/n              Suppress symbol tables in listing
/p              Check for pure code
/s              Order segments sequentially
/t              Suppress messages for successful assembly
/v              Display extra source statistics
/w{012}         Set warning level: 0-None, 1-Serious, 2-Advisory
/X              List false conditionals
/z              Display source line for each error message
/Zi             Generate symbolic information for CodeView
/Zd             Generate line-number information


Now you can have it assemble, with a listing, and link as follows
ml  -coff -Fl  first.asm -link /SUBSYSTEM:CONSOLE

C:\MASM>\masm32\bin\ml -help
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.


        ML [ /options ] filelist [ /link linkoptions ]

/AT Enable tiny model (.COM file)         /nologo Suppress copyright message
/Bl<linker> Use alternate linker          /Sa Maximize source listing
/c Assemble without linking               /Sc Generate timings in listing
/Cp Preserve case of user identifiers     /Sf Generate first pass listing
/Cu Map all identifiers to upper case     /Sl<width> Set line width
/Cx Preserve case in publics, externs     /Sn Suppress symbol-table listing
/coff generate COFF format object file    /Sp<length> Set page length
/D<name>[=text] Define text macro         /Ss<string> Set subtitle
/EP Output preprocessed listing to stdout /St<string> Set title
/F <hex> Set stack size (bytes)           /Sx List false conditionals
/Fe<file> Name executable                 /Ta<file> Assemble non-.ASM file
/Fl[file] Generate listing                /w Same as /W0 /WX
/Fm[file] Generate map                    /WX Treat warnings as errors
/Fo<file> Name object file                /W<number> Set warning level
/FPi Generate 80x87 emulator encoding     /X Ignore INCLUDE environment path
/Fr[file] Generate limited browser info   /Zd Add line number debug info
/FR[file] Generate full browser info      /Zf Make all symbols public
/G<c|d|z> Use Pascal, C, or Stdcall calls /Zi Add symbolic debug info
/H<number> Set max external name length   /Zm Enable MASM 5.10 compatibility
/I<name> Add include path                 /Zp[n] Set structure alignment
/link <linker options and libraries>      /Zs Perform syntax check only
It could be a random act of randomness. Those happen a lot as well.

jj2007

Attached the bare minimum.

include \masm32\include\masm32rt.inc

.data
AppName db "Masm32:", 0
Welcome db "Hello World", 0

.code
start: invoke MessageBox, 0, addr Welcome, addr AppName, MB_OK
invoke ExitProcess, 0
end start


Batch file:
\masm32\bin\ml.exe /c /coff %1
\masm32\bin\link /SubSystem:CONSOLE %~n1
%~n1.exe
pause

TmX

Quote from: jj2007 on May 30, 2010, 10:47:10 AM
Attention, TmX meant "If you want console apps, use /SUBSYSTEM:CONSOLE"
If you use /SUBSYSTEM:WINDOWS, the executable will run but never exit, and you will need Task Manager to kill it.


typo... d'uh
thanks for the correction  :U

hutch--

andrr,

The data you need to use the correct command line options is in the masm32 help file which is where you should be looking. Clive is right, you are not building a 16 bit DOS executable and that notation has not worked for many years.

Now you have the options,

drv:\path\ml.exe /c /coff yourfile.asm

If that builds without errors then you link it with the options explained, either CONSOLE or WINDOWS.

You cannot WISH the notation you want, just look it up like everyone else does.

RE: Your desire to write pure assembler without pseudo high level notation, look in the example code under POASM\poasm1k.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

andrr

ok Thanks everybody who found the time to participate