News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to show ECHO and StdOut text and configur runtime masm include in VS?

Started by kingdelee, October 15, 2024, 07:41:48 PM

Previous topic - Next topic

kingdelee

when I build below code in VS, it shows:
Severity Code Description Project File Line Suppression State Details
Error A2006 undefined symbol : StdOut
         
when I add "C:\masm32\include" in VS Project->Property->VC++ Directoreis->Include Directories:
D:\workspace\lib\Irvine32_Library\Lib32;C:\masm32\include;$(IncludePath)

it shows:
Severity Code Description Project File Line Suppression State Details
Error A1000 cannot open file : \masm32\include\windows.inc a010_struct C:\masm32\include\masm32rt.inc 38
      

I make
Tool->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity->Detailed
it doesn't work

Could you tell me how to show ECHO and StdOut  text and configur runtime masm include in VS?

Thank you


INCLUDE Irvine32.inc

INCLUDE masm32rt.inc

.data
msg db "Hello, MASM!", 0
.code
main PROC
ECHO hello world
invoke StdOut, addr msg
mov eax, 1

    exit
main ENDP
END main

C3

I have left all Visual Studio includes and library includes as they are when the Project is created. You might get the thing to work if you set path's correctly in Visual Studio Project Settings.

I use this single line include on the skeleton programs. Just examine \masm32\include\masm32rt.inc what it contains. This assumes that MASM32 SDK is located in C-drive, but you can use Drive letter before back slash.

title skeleton masm32 include only ;actually it does VERY MUCH.. fill the bones with your code
include \masm32\include\masm32rt.inc

;add rest of your code here...
;remember choose between Console or Windows program and you are doing 32/64bit assembly...

I have not done much work with Irvines. But some knowledge about how to get things running.

TITLE CONSOLE TESTER
INCLUDE <c:\masm64\include64\masm64rt.inc>

.CONST

.DATA

    hello db "Hello World",0

.DATA?

.CODE

entry_point proc

    invoke StdOut,addr hello
    invoke ExitProcess,0

    ret

entry_point endp

END

Heres that Hello World you were looking for with MASM64.

sinsi

I am assuming that your source drive is not C:

The MASM32 files assume that your source code is on the same drive as it is.
Even if you explicitly include C:\masm32\include\masm32rt.inc,
that include file has another include in it \masm32\include\windows.inc.
The default drive is your source code drive which is not C: by the looks of it.

Either put your source on C: or move the MASM32 folder to your source drive (probably easier).
Tá fuinneoga a haon déag níos fearr :biggrin:

kingdelee

Quote from: sinsi on October 16, 2024, 12:05:32 AMEither put your source on C: or move the MASM32 folder to your source drive (probably easier).


masm32 I install it in C:\masm32, masm32rt.inc is in C:\masm32\include

I make a VS new solution and project, then configur it like this:





when I build it shows error like this:







kingdelee

Quote from: C3 on October 15, 2024, 11:35:19 PMI have left all Visual Studio includes and library includes as they are when the Project is created. You might get the thing to work if you set path's correctly in Visual Studio Project Settings.


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


Could you show me what you configur VS includes and lib settings when you build a solution?
But the way, why your masm is x64? where to download it ?
My masm is x32

I try to write it like this, it show :
Severity Code Description Project File Line Suppression State Details
Error A2026 constant expected Project5 C:\masm32\include\winextra.inc 11052
Severity Code Description Project File Line Suppression State Details
Error A2026 constant expected Project5 C:\masm32\include\winextra.inc 11053
INCLUDE <C:\masm32\include\masm32rt.inc>





C3

Quote from: kingdelee on October 16, 2024, 05:55:38 PM
Quote from: C3 on October 15, 2024, 11:35:19 PMI have left all Visual Studio includes and library includes as they are when the Project is created. You might get the thing to work if you set path's correctly in Visual Studio Project Settings.


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


Could you show me what you configur VS includes and lib settings when you build a solution?
But the way, why your masm is x64? where to download it ?
My masm is x32

I try to write it like this, it show :
Severity    Code    Description    Project    File    Line    Suppression State    Details
Error    A2026    constant expected    Project5    C:\masm32\include\winextra.inc    11052       
Severity    Code    Description    Project    File    Line    Suppression State    Details
Error    A2026    constant expected    Project5    C:\masm32\include\winextra.inc    11053       
INCLUDE <C:\masm32\include\masm32rt.inc>






Those angle brackets in INCLUDE are leftover from some version of ML/ML64 what didn't work without, I guess it would be clearer to use without.

For the topic of Visual Studio setup, leave all Project Settings alone if you are creating for Executable. Just setup:

- Setup up Project Customization to MASM
- Entry Point, if not using default (Project Settings)
- Are you doing Console or Windows (Project Settings)
- Choose between 32 and 64bit program

Few of your pictures didn't work, but what I id see, do not add Additional Library Directories, at least not with "\masm32\bin".

These are few required steps do, but there is a ton of options for Assembler and Linker, so just take your time and do some workout with those. When doing Project Setup, remember that are you doing debug or release, or both settings.

MASM64 SDK is available from: MASM64 SDK Forum Page

Setup of 32bit and 64bit SDK is similar. But there are some major differencies under the hood.

NoCforMe

Quote from: kingdelee on October 16, 2024, 05:24:27 PM
Quote from: sinsi on October 16, 2024, 12:05:32 AMEither put your source on C: or move the MASM32 folder to your source drive (probably easier).
masm32 I install it in C:\masm32, masm32rt.inc is in C:\masm32\include

One problem I see from your screenshot is that C:\masm32\bin is not a library folder; it's where the executables live. Dunno if that's the source of your problems or not, but it's wrong.
Assembly language programming should be fun. That's why I do it.

tenkey

If the .inc files are on C:, the correct library directory is C:\masm32\lib.

But that's not the first problem.

The first problem is that you are using the Visual Studio 2022 supplied 32-bit assembler, instead of the older MASM32 SDK supplied ml.exe (Microsoft's MASM 6.14).

In winextra.inc, the newer assembler doesn't like:
    alrt_eventname WCHAR  [EVLEN + 1] dup(?)
    alrt_servicename WCHAR [SNLEN + 1] dup(?)
The older assembler has no problem with square brackets, [ ].

The easy solution is to replace the brackets with parentheses, ( ).
Both assemblers will accept the modification with no change in meaning:
    alrt_eventname WCHAR  (EVLEN + 1) dup(?)
    alrt_servicename WCHAR (SNLEN + 1) dup(?)

An alternative solution is to not use Visual Studio for 32-bit assembly.

NoCforMe

Quote from: tenkey on October 18, 2024, 04:07:56 PMThe easy solution is to replace the brackets with parentheses, ( ).

I'll give up my square brackets when they pry them from my cold, dead fingers.

Do you know how much of my code I'd have to change in order to do that? Not gonna happen.

QuoteAn alternative solution is to not use Visual Studio for 32-bit assembly.

That's more like it.
Assembly language programming should be fun. That's why I do it.

tenkey

Quote from: NoCforMe on October 18, 2024, 06:08:11 PM
Quote from: tenkey on October 18, 2024, 04:07:56 PMThe easy solution is to replace the brackets with parentheses, ( ).

Do you know how much of my code I'd have to change in order to do that?

No, I don't. I did not encounter [...] dup(?) in your Game of Life.
Instead, I encountered:
GameArray        DB $gridSize * $gridSize DUP(?)

zedd151

winextra.inc error A2026 constant expected
To all interested parties, that very issue with winextra.inc had been brought up before. Has nothing to do with Visual Studio per se, but rather the more recent versions of the binaries. The include files were written and tested  using much older versions of the binaries.

Ventanas diez es el mejor.  :azn:

NoCforMe

Quote from: tenkey on October 19, 2024, 12:08:28 AM
Quote from: NoCforMe on October 18, 2024, 06:08:11 PM
Quote from: tenkey on October 18, 2024, 04:07:56 PMThe easy solution is to replace the brackets with parentheses, ( ).

Do you know how much of my code I'd have to change in order to do that?

No, I don't. I did not encounter [...] dup(?) in your Game of Life.
Instead, I encountered:
GameArray        DB $gridSize * $gridSize DUP(?)

Ah, my bad: I missed that the assembler only rejects square brackets used to enclose an expression used as a DUP quantity (which I've never done--didn't even know this was allowable syntax). I only use square brackets to enclose address expressions, which are allowable like they always used to be.

Given that this is the case, that offending include file ought to be changed to use parentheses instead of square brackets. (Probably will never happen, though ...)
Assembly language programming should be fun. That's why I do it.