The MASM Forum

General => The Campus => Topic started by: ahsat on April 01, 2024, 11:13:53 AM

Title: Assembler problems
Post by: ahsat on April 01, 2024, 11:13:53 AM
The 32 bit assembler that comes with Visual Studio 2022 seem to have problems with the MASM32 SDK.

If I assemble with the assembler that comes with the SDK, all is well as demonstrated below:
d:\masm32\AnyBase32>D:\masm32\bin\ml.exe /c /coff AnyBase.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: AnyBase.asm

***********
ASCII build
***********

If I assemble with the one that comes with Visual Stufio 2022, I get this:D:\masm32\AnyBase32>ml.exe /c /coff AnyBase.asm
Microsoft (R) Macro Assembler Version 14.39.33522.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: AnyBase.asm

***********
ASCII build
***********

\masm32\include\windows.inc(24749) : error A2042:statement too complex
\masm32\include\winextra.inc(11052) : error A2026:constant expected
\masm32\include\winextra.inc(11053) : error A2026:constant expected

Does anyone know what is wrong?

I want to use the debugger in Visual Studio, and I don't know how to make it use the assembler that comes with the MASM32 SDK.
Title: Re: Assembler problems
Post by: jj2007 on April 01, 2024, 11:42:14 AM
Quote from: ahsat on April 01, 2024, 11:13:53 AMDoes anyone know what is wrong?

Quote from: jj2007 on August 29, 2017, 08:25:15 PMIt seems that ML 14.0 is unusable for serious work

Use UAsm (http://www.terraspace.co.uk/uasm.html#p2) and OllyDbg (http://www.ollydbg.de/version2.html). Don't waste time with that behemoth of Visual Crap.
Title: Re: Assembler problems
Post by: NoCforMe on April 01, 2024, 11:51:49 AM
Use the MASM32 assembler, not the VC mess as JJ posted.

Microsoft (R) Macro Assembler Version 6.14.8444

is the one that works for me. (32-bit)
Title: Re: Assembler problems
Post by: ahsat on April 01, 2024, 12:44:13 PM
Quote from: jj2007 on April 01, 2024, 11:42:14 AMUse UAsm (http://www.terraspace.co.uk/uasm.html#p2) and OllyDbg (http://www.ollydbg.de/version2.html). Don't waste time with that behemoth of Visual Crap.
How would you do that with the Visual Studio debugger. As best I know, Visual Studio stuff insists on using the MS assembler.

Do you possibly know how to configure Visual Studio to use a different assembler?
Title: Re: Assembler problems
Post by: ahsat on April 01, 2024, 12:46:05 PM
Quote from: NoCforMe on April 01, 2024, 11:51:49 AMMicrosoft (R) Macro Assembler Version 6.14.8444
How do I use that with the Visual Studio debugger?
Title: Re: Assembler problems
Post by: sinsi on April 01, 2024, 12:55:43 PM
The VS debugger doesn't care about how an EXE was produced, as long as you have a PDB file it will open any Windows EXE. You could probably use the MASM32 version of ML, there should be an option somewhere (Projet Properties I think).
Title: Re: Assembler problems
Post by: jj2007 on April 01, 2024, 07:22:44 PM
Quote from: ahsat on April 01, 2024, 12:44:13 PM
QuoteUse UAsm (http://www.terraspace.co.uk/uasm.html#p2) and OllyDbg (http://www.ollydbg.de/version2.html). Don't waste time with that behemoth of Visual Crap.
How would you do that with the Visual Studio debugger. As best I know, Visual Studio stuff insists on using the MS assembler.

Simple answer: don't use the VS debugger. Generations of coders have fallen in love with OllyDbg (http://www.ollydbg.de/version2.html), and there are good reasons for that. Just open your executable in OllyDbg.exe, then
- hit F7 to advance one instruction
- hit F8 to advance one instruction without diving into a call whatever
- hit F9 to run the code until it hits a problem or an int 3 instruction that you inserted in an interesting location.
Title: Re: Assembler problems
Post by: NoCforMe on April 01, 2024, 08:31:06 PM
How does the VS debugger compare to Olly? Any features that Olly doesn't have?
Title: Re: Assembler problems
Post by: C3 on April 01, 2024, 10:40:04 PM
Quote from: ahsat on April 01, 2024, 12:44:13 PM
Quote from: jj2007 on April 01, 2024, 11:42:14 AMUse UAsm (http://www.terraspace.co.uk/uasm.html#p2) and OllyDbg (http://www.ollydbg.de/version2.html). Don't waste time with that behemoth of Visual Crap.
How would you do that with the Visual Studio debugger. As best I know, Visual Studio stuff insists on using the MS assembler.

Do you possibly know how to configure Visual Studio to use a different assembler?

With the Visual Studio use the Assembler that comes in Visual C++ workload. You can use both 32-bit and 64-bit tools that are included with that. Also its very nice debugger what is in the Visual Studio.

There are frequent upgrades for Visual Studio about once a month. Also its very handy to search missing pieces from C/C++ headers that ins't already in Hutch's SDK.

If you are up-to something else, like UASM and OllyDbg/x64dbg you might want to do what JJ said. Its a choise of two different "workloads".
Title: Re: Assembler problems
Post by: C3 on April 01, 2024, 10:56:15 PM
Quote from: NoCforMe on April 01, 2024, 08:31:06 PMHow does the VS debugger compare to Olly? Any features that Olly doesn't have?

It's not that hard to check whats in the VS Debugger(?). Can't remember all differences, I haven't used Olly or x64dbg, x32dbg for a while. I have also forgotten tools like GDB etc. where isnt a GUI to use.
Title: Re: Assembler problems
Post by: jj2007 on April 01, 2024, 11:13:06 PM
Quote from: C3 on April 01, 2024, 10:56:15 PMCan't remember all differences

Can you remember at least one difference that would make it better than Olly?
Title: Re: Assembler problems
Post by: C3 on April 01, 2024, 11:20:17 PM
Quote from: jj2007 on April 01, 2024, 11:13:06 PM
Quote from: C3 on April 01, 2024, 10:56:15 PMCan't remember all differences

Can you remember at least one difference that would make it better than Olly?


Integration with MS other tools, C/C++,VB,.NET. Get's all symbols when needed in debugging those and MS libraries. Also when I have to pick up some new skills and translate them to MASM its giving me some advantage. Like I'm currently doing with GDI+.

Heres the proof, I had used it more than once.

20/07/2014  17:10           115,034 Disasm201.zip
12/07/2005  21:41         1,116,546 odbg110.zip
18/07/2010  21:04         1,266,059 odbg200.zip
24/11/2016  01:43         6,965,278 odbg201.zip
08/10/2011  12:33         2,328,395 odbg201d.zip
Title: Re: Assembler problems
Post by: ahsat on April 02, 2024, 12:50:29 AM
Quote from: jj2007 on April 01, 2024, 07:22:44 PMGenerations of coders have fallen in love with OllyDbg (http://www.ollydbg.de/version2.html)
I have never heard of OllyDbg, but I will sure give it a try. I have never like Microsoft tools very much. They are always overly complicated and controlling.

I keep telling you guys, I am very much out of date with my knowledge of modern development tools.
Title: Re: Assembler problems
Post by: ahsat on April 02, 2024, 12:57:56 AM
Quote from: NoCforMe on April 01, 2024, 08:31:06 PMAny features that Olly doesn't have?
I don't know. I have never tried OllyDbg or heard of it until just now. I have only used VS for a few days. I certainly will give OllyDbg a try. Usually almost anything is better than Microsoft tools.
Title: Re: Assembler problems
Post by: ahsat on April 02, 2024, 01:06:12 AM
Quote from: C3 on April 01, 2024, 10:56:15 PMIt's not that hard to check whats in the VS Debugger(?)
Be sure to read the original post and the last line of the first post in this thread. I would be fine with the assembler that comes with VS if it worked.
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 01:33:26 AM
Quote from: ahsat on April 02, 2024, 01:06:12 AM
Quote from: C3 on April 01, 2024, 10:56:15 PMIt's not that hard to check whats in the VS Debugger(?)
Be sure to read the original post and the last line of the first post in this thread. I would be fine with the assembler that comes with VS if it worked.

I know that thing, Hutch designed that the SDK will work on drive C:\ what if you move your folder from D:\ to C:\
Title: Re: Assembler problems
Post by: jj2007 on April 02, 2024, 01:58:55 AM
Quote from: C3 on April 01, 2024, 11:20:17 PMIntegration with MS other tools, C/C++,VB,.NET

Ok, thanks, so I won't need it :thumbsup:

Quote from: C3 on April 02, 2024, 01:33:26 AMHutch designed that the SDK will work on drive C:\ what if you move your folder from D:\ to C:\

Actually, Hutch designed it so that there is a root folder \Masm32. That can be C:\Masm32, D:\Masm32, X:\Masm32, whatever. That's why I get the creeps when n00bs start their code with include C:\Masm32\... that's just plain wrong.
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 02:01:06 AM
Quote from: jj2007 on April 02, 2024, 01:58:55 AM
Quote from: C3 on April 01, 2024, 11:20:17 PMIntegration with MS other tools, C/C++,VB,.NET

Ok, thanks, so I won't need it :thumbsup:

I need only C/C++ because Microsoft Learning (MSDN) is presented in C or C++ and I need it to translate that to MASM. I cant do properly neither VB or .NET. But C and C++ is easier if you know already MASM.
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 02:06:10 AM
Quote from: jj2007 on April 02, 2024, 01:58:55 AM
Quote from: C3 on April 01, 2024, 11:20:17 PMIntegration with MS other tools, C/C++,VB,.NET

Ok, thanks, so I won't need it :thumbsup:

Quote from: C3 on April 02, 2024, 01:33:26 AMHutch designed that the SDK will work on drive C:\ what if you move your folder from D:\ to C:\

Actually, Hutch designed it so that there is a root folder \Masm32. That can be C:\Masm32, D:\Masm32, X:\Masm32, whatever. That's why I get the creeps when n00bs start their code with include C:\Masm32\... that's just plain wrong.

I had problem with this concept with setup of 64bit environment. It works better if you keep the folder on drive C:\
I may be a noob, and I use this as include:

INCLUDE <c:\masm64\include64\masm64rt.inc>
Title: Re: Assembler problems
Post by: jj2007 on April 02, 2024, 02:10:45 AM
Quote from: C3 on April 02, 2024, 02:06:10 AMI use this as include:

INCLUDE <c:\masm64\include64\masm64rt.inc>

Try \masm64\...

(the <quotes> are not needed, either)
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 02:11:46 AM
Quote from: jj2007 on April 02, 2024, 02:10:45 AM
Quote from: C3 on April 02, 2024, 02:06:10 AMI use this as include:

INCLUDE <c:\masm64\include64\masm64rt.inc>

Try \masm64\...

(the <quotes> are not needed, either)


I had problems with the includes if its that way. Got things to work in Visual Studio after that what I posted.
Title: Re: Assembler problems
Post by: jj2007 on April 02, 2024, 03:07:27 AM
Quote from: C3 on April 02, 2024, 02:11:46 AMI had problems with the includes if its that way.

Only if your Masm32 installation is on a different drive than VS, and if VS doesn't allow to specify a drive for building assembly projects. Which would be dumb, of course.
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 03:09:28 AM
Quote from: jj2007 on April 02, 2024, 03:07:27 AM
Quote from: C3 on April 02, 2024, 02:11:46 AMI had problems with the includes if its that way.

Only if your Masm32 installation is on a different drive than VS, and if VS doesn't allow to specify a drive for building assembly projects. Which would be dumb, of course.

You should try Visual Studio to verify this  :dazzled:

Ok I tried to remove angle brackets and drive letter. It works. But there WERE a problem with this on some version.

Ok, one edit more. This will work on Visual Studio 2022 but not on Visual Studio 2019.
Title: Re: Assembler problems
Post by: ahsat on April 02, 2024, 03:15:25 AM
Quote from: C3 on April 02, 2024, 01:33:26 AMwhat if you move your folder from D:\ to C:\
I don't put anything on drive C: that I don't have to. Since the 80s Microsoft has, one way or another, destroyed drive C: too many times. It is easier, today, just to give drive C: to Microsoft, like the want you to, and put my stuff on another drive. It is much easier to restore Windows than it is to restore all of my stuff along with it.
Title: Re: Assembler problems
Post by: NoCforMe on April 02, 2024, 04:23:28 AM
Quote from: C3 on April 01, 2024, 10:56:15 PM
Quote from: NoCforMe on April 01, 2024, 08:31:06 PMHow does the VS debugger compare to Olly? Any features that Olly doesn't have?
It's not that hard to check whats in the VS Debugger(?).
It certainly is that hard if you don't have Visual Studio, and moreover have no intention of ever installing it. Can you give us at least one or two features of it?
Title: Re: Assembler problems
Post by: C3 on April 02, 2024, 04:35:45 AM
Quote from: NoCforMe on April 02, 2024, 04:23:28 AM
Quote from: C3 on April 01, 2024, 10:56:15 PM
Quote from: NoCforMe on April 01, 2024, 08:31:06 PMHow does the VS debugger compare to Olly? Any features that Olly doesn't have?
It's not that hard to check whats in the VS Debugger(?).
It certainly is that hard if you don't have Visual Studio, and moreover have no intention of ever installing it. Can you give us at least one or two features of it?
Sorry! My memories are so faint as I have used it more than 5 years ago. But I'd like to emphasize that VS Debugger works extremely fine under all MS developement tools/languages.
Title: Re: Assembler problems
Post by: daydreamer on April 02, 2024, 05:34:21 AM
Quote from: ahsat on April 02, 2024, 03:15:25 AM
Quote from: C3 on April 02, 2024, 01:33:26 AMwhat if you move your folder from D:\ to C:\
I don't put anything on drive C: that I don't have to. Since the 80s Microsoft has, one way or another, destroyed drive C: too many times. It is easier, today, just to give drive C: to Microsoft, like the want you to, and put my stuff on another drive. It is much easier to restore Windows than it is to restore all of my stuff along with it.
I agree,could even use external drive which can be moved between my different computers so i can testrun on different cpus + use different graphics programs for make nice icons in my programs
One thing i dont know if possible is run ml and linker in usb connected android tablet internal/external sd card ? With pc

Title: Re: Assembler problems
Post by: kkurkiewicz on April 02, 2024, 06:49:07 AM
Quote from: ahsat on April 01, 2024, 12:44:13 PMDo you possibly know how to configure Visual Studio to use a different assembler?
If you're using Visual Studio 2019 or 2022, try reading this (https://programminghaven.home.blog/2020/02/16/setup-an-assembly-project-on-visual-studio-2019/).
Title: Re: Assembler problems
Post by: ahsat on April 02, 2024, 07:10:39 AM
Quote from: kkurkiewicz on April 02, 2024, 06:49:07 AMIf you're using Visual Studio 2019 or 2022
Thank you very much.