Re: Assembling Visual Studio generated listing files

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Sat, 8 Dec 2007 22:55:16 -0800 (PST), TahoeKid <rfdunn@xxxxxxxxxxx>
wrote:

I'm using VS 2005 and MASM 8.0.

I generated a .asm listing from a simple C++ program and the assembler
choked on it.

It would have been nice if you had something a little more precise
than 'it choked on it'.

Lacking that, here it is as simple as I can explain a step by step way
of testing asm output. If this doesn't work for you then I don't know
what you are doing wrong.

Using VC 2005 EE and MASM 8.00.50727.104.

Create simple console app, like a Hello World:

#include "stdafx.h"
#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
printf("Hello World.\n");
return 0;
}

Set project to create ASM file, alt-f7, Output Files, Assembly With
Source Code (/FAs). Do this for all Win32 configurations.

MASM setup in IDE:
Title: MASM 8.0
Command: C:\Program Files\Microsoft Visual Studio 8\VC\bin\ml.exe
Arguments: /Cp /c $(ItemPath)
Initial directory: $(targetdir)
Use output window: yes

Build project for debug and release builds.

Open the generated asm file in IDE from debug folder. With the focus
on the open .ASM document in the IDE, click Tools|MASM 8.0
Masm runs and chokes with syntax errors on line 25 and 29 in the debug
version of the asm output. These are the initializations of the
runtime check segments:

\Debug\simple_console.asm(25) : error A2008: syntax error : .
\Debug\simple_console.asm(29) : error A2008: syntax error : .
Microsoft (R) Macro Assembler Version 8.00.50727.104

MASM doesn't like this stuff:
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown <------------ A2008
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase <------------ A2008
; Function compile flags: /Odtp /RTCsu /ZI
rtc$IMZ ENDS

Open the generated asm file in IDE from release folder.
MASM works fine on Release build version of the asm output.

If you do this in the IDE, it's very important that the ASM file has
the focus when you launch the MASM tool or MASM will attempt to
assemble the wrong file.

Again, it is strictly not necessary to use MASM in any way with the
VC++ compiler since the objects are generated and linked by the
compiler and linker, never masm. The only time you ever really need
MASM is for driver development and then you should not be using
compiler output but you should be writing your own ASM source files
and adding them to the project for processing by masm as part of the
build cycle, not by this method. I do not have a solution for getting
MASM 8.x to understand the error lines above since they are part of
the IDE and the CRT runtime checks in the debugger and MASM is
operating as an external tool.
.



Relevant Pages

  • Re: ML.EXE and more goodies direct from Microsoft.
    ... others MASM (just became a new ... Some like HLL and others like ASM and yet others ... When I decided to give Palm ... >Palm there's Pila (Pilot assembler) and GAS. ...
    (alt.lang.asm)
  • Re: masm linking from console
    ... I probably know less about ASM than the original poster to this thread. ... Irvine covers all the material one would expect in an intro book, ... I picked Irvine's book because it seems to be the only decent text on MASM. ... I personally think MASM is a good first assembler ...
    (alt.lang.asm)
  • Re: book on assembly language
    ... >> books on C and spotted a couple of randal hydes's Books, ... >> asm syntax which I have grown to love. ... MASM and TASM are dead horses. ... > he thinks that MASM is a "real" assembler, ...
    (alt.lang.asm)
  • Re: Help! The problem about armasm.exe
    ... The listing asm file should be use the ARM ... Can you tell me why your assembler can't assemble the .asm files generated ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: ML.EXE and more goodies direct from Microsoft.
    ... > leaning toward the idea of a one true assembler and that everybody will ... others MASM (just became a new ... Some like HLL and others like ASM and yet others ... > programming paradigm, etc for that platform. ...
    (alt.lang.asm)