ml /c file.asm
The error will tell you.
there is no error at all it said that it assemled an input file and thats all
hmmmm,
What version of ML.EXE ?
What command line ?
What code ?
Where did you call it from etc etc etc ....
With the old version of ML.EXE in MASM32 you use the command line,
ml /c /coff yourfile.asm
version masm 10
i use command line
code ml /c /coff does't work
You are not telling us enough, millions of people over 12 years DO get it to work.
Post the code you are attempting to build so we don't have to guess what you are doing.
my command line:
ml /c myfile.asm
no obj is created
Hi andrr,
The problem is that you need to send here your source code, the file with .asm extension.
my first program
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc ; always first
.code
start:
mov eax ,3
end start
Your source code is missing an exit statement, the ExitProcess API function :
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc ; always first
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
.code
start:
mov eax , 3
invoke ExitProcess,0
END start
To build the code :
\masm32\bin\ml /c /coff Test.asm
\masm32\bin\polink /SUBSYSTEM:WINDOWS Test.obj
how to understand this string:
masm32\bin\polink /SUBSYSTEM:WINDOWS Test.obj
is it always to write /SUBSYSTEM:WINDOWS Test.obj?
why not to use link instead of polink?
Quote from: andrr on May 30, 2010, 10:03:16 AM
is it always to write /SUBSYSTEM:WINDOWS Test.obj?
No. /SUBSYSTEM:WINDOWS is for GUI apps.
If you want console apps, use /SUBSYSTEM:WINDOWS
Quote from: andrr on May 30, 2010, 10:03:16 AM
why not to use link instead of polink?
Polink creates smaller executables
i would have thought that was a console mode program
at any rate - he is missing some of the includes and includelibs needed
.xlist
.xcref
include \masm32\include\masm32rt.inc
.list
.CODE
_main proc
mov eax,3
print uhex$(eax),13,10
inkey
exit
_main endp
end _main
then, to build in console mode...
\masm32\bin\ml /c /Fl /coff %1.asm
\masm32\bin\Link /SUBSYSTEM:CONSOLE /OPT:NOREF %1.obj
Hi andrr,
You can use MS link instead of Polink. Both of the tools are compatible.
how to write with pure assembler without invoke and print and inkey
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
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.
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
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?
good tips Clive - now you are going to make me read the manual - lol
: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.
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
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
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
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
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
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.
ok Thanks everybody who found the time to participate