Search code examples
visual-studio-2010assemblysyntaxcompilationmasm

MASM errors on Build in VS10


The attached code is a supplied source for a SaveGame cleaner. The only thing that is not clear is the entry point, which has been set as main. But the decompiler at [http://www.onlinedisassembler.com/odaweb/] gave something like _start. The first codeblock is

; SaveTool V 1.13
_______________________________________________________________________________________

[true 1    false 0    NULL 0]


[FilterStrings: B$  'Save Files', 0, '*.ess', 0
                0,0,0]
*Error  6   error A2044: invalid character in file  SaveCleaner.asm 12  1*  SaveCleanerNextline
   [UserFileFilter: 0 #50] [ChoosenFile: 0 #64]


[OFN_FILEMUSTEXIST 01000  OFN_PATHMUSTEXIST 0800     OFN_LONGNAMES 0200000
 OFN_EXPLORER 080000      OFN_HIDEREADONLY 04]


[OFN_FLAGS        OFN_FILEMUSTEXIST+OFN_PATHMUSTEXIST+OFN_LONGNAMES+OFN_HIDEREADONLY+OFN_EXPLORER]


[OpenFileNameStructure:  len  hwndFileOwner: 0  OF_hInstance: 0  FilterStrings
                         0  0 1 FullChoosenFile 200 ChoosenFile
                         80  NULL  OpenFileTitle  OFN_FLAGS
                         nFileOffsetinChoosenFile: W$ 0  nFileExtensioninChoosenFile: 0
                         DefaultExtension: D$ NULL
                         HookCustomData:  NULL  HookProcPtr: NULL  HookTemplateName: 0 0   0 0 ]

[OpenFileTitle:        'Open .ess file' 0]
*Error  6   error A2044: invalid character in file  SaveCleaner.asm 12  1      SaveCleanerNextline*
[FullChoosenFile: 0 #64] [<16 algn: 0]
   __________________________________________________________________________________________

The complete codeblock is too large for posting here so it can be downloaded (right click) at [http://www.ozemail.com.au/~lmstearn/files/SaveTool-source.asm] The config has been set correctly to compile the code but comes up with a mass of errors.

SaveCleaner.asm(142): error A2008: syntax error : SaveCleaner.asm(156): error A2044: invalid character in file SaveCleaner.asm(158): fatal error A1012: error count exceeds 100; stopping assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): >error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\SaveCleaner.obj" /I >"C:\masm32\lib" /I "C:\masm32\include" /I "C:\masm32\macros" /W3 /errorReport:prompt >/TaSaveCleaner.asm" exited with code 1.

What is missed in the VS setup?


Solution

  • It looks that your asm source is a RosASM source code and you will have no chance to compile it under MASM / Visual Studio.

    RosASM is a win32 assembler that used a quite original design that let it store the source code inside the compiled executable (in a dedicated section) and many other features like an integrated IDE, integrated debugger, some powerful macros, a resource editor, a dialog editor, an original source navigation style that does not need scrolling bar, the possibility to divide the source in chapters called "titles"... Quite a surprising tool that need some practice to get comfortable with it, that I still use for asm win32 programming.

    RosASM

    I have checked that the code assembles with RosASM, but I get neither an error nor a result as I do not have the corresponding game.

    The original RosASM web site is now vanished, but there is a dedicated forum recently back online and I maintain an archive site where you can get binaries, and a lot of examples and fully functional applications (even a working NES emulator) made with RosASM that could help you to learn RosASM usage. FYI, SpASM is RosASM ancestor and BUASM was a revamping of RosASM that is unfinished.

    Concerning the executable entry point, you can get it by looking at the Proc Main int the TITLE MAIN, that reads:

    Proc Main:
    
        call 'KERNEL32.HeapCreate' 0 0 0 | mov D$Heap eax
    
        call 'Kernel32.GetModuleHandleA' 0  | mov D$hInstance eax
        call 'USER32.DialogBoxParamA'  eax IDD_MAINDIALOG &NULL DialogProc &NULL
    
        call 'KERNEL32.HeapDestroy' D$Heap
        call 'KERNEL32.ExitProcess' 0
    EndP
    

    HTH.