The MASM Forum

Miscellaneous => Irvine Book Questions. => Topic started by: TheGodOfKratos on April 14, 2017, 09:49:03 AM

Title: What are the double question marks preceding memory addresses in Visual Studio?
Post by: TheGodOfKratos on April 14, 2017, 09:49:03 AM

When using a macro to create lots of LOCAL variables in Visual Studio 2017, in the listing file generated by ml.exe, I see the variable names preceded by a double question mark and then just a 4 digit number. What do these double question marks mean and is it possible to reference these individual variables by name?
https://pastebin.com/Zx8TDgSp (https://pastebin.com/Zx8TDgSp)
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: jj2007 on April 14, 2017, 03:13:15 PM
They are local names generated by the macro.
You can use them simply by their name: the real one, not the ??1234 crap.

include \masm32\include\masm32rt.inc

bla macro arg
Local foo
  foo CATSTR <long>, <arg>
  % echo My local variable FOO is now foo
  exitm foo
endm 

.data
longvar dd 12345678h

.code
start:
  inkey hex$(bla(var))
  exit

end start


Btw programming in VS is a bad idea. Welcome to the forum :icon14:

P.S.: https://pastebin.com/Zx8TDgSp
QuoteThis page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff.
::)
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: TheGodOfKratos on April 15, 2017, 12:38:13 AM
Hi,

Thanks for your response. I've been using Visual Studio to program in languages like C, C++, and C# since I was in diapers. Okay, maybe not that long but it's been a few years. I think it's one of the best all around IDEs on planet Earth. So, I'm very curious to know why I shouldn't be using it for assembly language programming? Or should I stop using it for any purpose? :)

Also, I should have given context for my original question. The example code I posted is from Kip Irvines book on x86 Assembly Language programming, 7th edition. It's the strangest example of using the REPEAT directive I've ever seen. He says he uses the REPEAT directive to create an array of 52 DWORDS but why, if your intent is to create an array, would you declare all 52 DWORDS as LOCAL? And why would you create an array in 52 steps? It's just whacky.

:icon_eek:

I set the expiration for a week on the example code below:

https://pastebin.com/qpyzegpF (https://pastebin.com/qpyzegpF)

Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: hutch-- on April 15, 2017, 01:13:20 AM
Kip Irvine's book is a different animal to production 32 bit assembler, its designed to get students through a semester at college. EASY is the catch word but it is not compliant with the Intel 32 bit Application Binary Interface and could not be used for useful code.
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: jj2007 on April 15, 2017, 02:05:08 AM
Quote from: TheGodOfKratos on April 15, 2017, 12:38:13 AMI've been using Visual Studio ... since I was in diapers.

Valid excuse :icon_mrgreen:

For n00bs trying hello world proggies, \Masm32\qEditor, RichMasm (http://masm32.com/board/index.php?topic=5314.0) or one of the IDEs that you find in the subforums are easier to use than that behemoth of VS. But since you are used to it, go ahead ;-)

QuoteIt's the strangest example of using the REPEAT directive I've ever seen. He says he uses the REPEAT directive to create an array of 52 DWORDS but why, if your intent is to create an array, would you declare all 52 DWORDS as LOCAL? And why would you create an array in 52 steps? It's just whacky.

YES. Something like this should do:WEEKS_PER_YEAR = 52

WR_WEEK STRUCT
  rainfall dd ?
  humidity dd ?
WR_WEEK ENDS

WeatherReadings STRUCT
  location BYTE 50 dup(?)
  weeks WR_WEEK WEEKS_PER_YEAR dup(<?>)
WeatherReadings ENDS


I attach an advanced example, which creates (random) readings for n cities, writes them to a data file, reads them back and displays them e.g. as
...
week #50        25      59
week #51        22      58

City #2         rain    umidity
week #0         24      83
week #1         16      43
week #2         19      26
week #3         10      55
week #4         16      96


Quote from: ragdog on April 15, 2017, 02:18:37 AM
What your mean is i think "mangled C++ names"

No, he doesn't mean "mangled C++ names".
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: ragdog on April 15, 2017, 02:18:37 AM
Visual Studio works good for masm32 programming  :t

https://asmhighlighter.codeplex.com/
(http://download-codeplex.sec.s-msft.com/Download?ProjectName=asmhighlighter&DownloadId=88831)

https://scriptbucket.wordpress.com/2011/10/19/setting-up-visual-studio-10-for-masm32-programming/

QuoteWhen using a macro to create lots of LOCAL variables in Visual Studio 2017, in the listing file generated by ml.exe, I see the variable names preceded by a double question mark and then just a 4 digit number. What do these double question marks mean and is it possible to reference these individual variables by name?

What your mean is i think "mangled C++ names"
But i cannot see your pastebin code

Greets,
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: aw27 on April 15, 2017, 02:54:27 PM
Quote from: ragdog on April 15, 2017, 02:18:37 AM
Visual Studio works good for masm32 programming  :t

Notepad++ is also great for highlighting ASM.
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: ragdog on April 15, 2017, 05:55:42 PM
QuoteNotepad++ is also great for highlighting ASM.

It give enought Editors with support Syntax highlighting. ::)
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: aw27 on April 15, 2017, 07:01:58 PM
Quote from: ragdog on April 15, 2017, 05:55:42 PM
QuoteNotepad++ is also great for highlighting ASM.

It give enought Editors with support Syntax highlighting. ::)

True, but some of them are not "great" as well.
Title: Re: What are the double question marks preceding memory addresses in Visual Studio?
Post by: ragdog on April 15, 2017, 07:09:06 PM
Quote from: aw27 on April 15, 2017, 07:01:58 PM
Quote from: ragdog on April 15, 2017, 05:55:42 PM
QuoteNotepad++ is also great for highlighting ASM.

It give enought Editors with support Syntax highlighting. ::)

True, but some of them are not "great" as well.

That's a matter of opinion.  :P