News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

What is $-msg

Started by Shintaro, November 18, 2022, 08:14:35 PM

Previous topic - Next topic

Shintaro

Quote from: jj2007 on November 19, 2022, 11:22:28 AM
Actually, the version I posted above was far too complicated:

include \masm32\include\masm32rt.inc
CodeSize MACRO algo
  % echo @CatStr(<** &algo is >, %($-algo), < bytes long **>)
ENDM

.code
start:
_mov:
  mov eax, 123
  CodeSize _mov

_m2m:
  m2m eax, 123
  CodeSize _m2m
  .err      ; prevent building (optional)
  exit
end start


Output:
** _mov is 5 bytes long **
** _m2m is 3 bytes long **

Yea, I am going to avoid code today. So please don't think I am ignoring what you have posted. I'll have a look in about 24 hours.
I haven't had a bad time like this for quite a while. I remember it when I was a support tech having days like this, "Passion fingers" - Everything I touch I F*&%, I used to just go home.
"Wyrd bið ful āræd. Fate is inexorable."

Shintaro

Quote from: jj2007 on November 19, 2022, 11:22:28 AM

  m2m eax, 123
  CodeSize _m2m
  .err      ; prevent building (optional)
  exit
end start


Thanks for the response and sorry for the slow response on my part.
I take it in the above code you meant:


mov ax, 123

Also I am using 16bit code not 32 bit code

I am using MASM 5.1. And as such 'echo' is not enabled until MASM 6.0. The 5.1 equivalent is 'OUT'.

CodeSize MACRO  algo
% OUT @CatStr(<** &algo is >, %($-algo), < bytes long **>)
ENDM



I could not get %OUT to work. It would print the %OUT information after MASM was run, but not when the exe was run, odd.

Why is it executing the MACRO after running MASM?

I even changed the code so that an exe was the desired file rather than a com. Same result.

Also, what is the use of the '@' I am struggling to find example of it. Inbuilt macro?

Cheers.
"Wyrd bið ful āræd. Fate is inexorable."