Author Topic: How can I use @ProcName ?  (Read 1402 times)

jj2007

  • Member
  • *****
  • Posts: 13946
  • Assembly is fun ;-)
    • MasmBasic
Re: How can I use @ProcName ?
« Reply #15 on: March 10, 2023, 06:37:48 AM »
source code will look ugly.

That's a matter of taste, of course.

Print "We are in ", ProcName$()

Vortex

  • Member
  • *****
  • Posts: 2790
Re: How can I use @ProcName ?
« Reply #16 on: March 10, 2023, 07:04:27 AM »
@ProcName during assembly time :

Code: [Select]
include     \masm32\include\masm32rt.inc

sum PROTO :DWORD,:DWORD,:DWORD


PROCX MACRO procname:REQ,args:VARARG

    procname PROC args

    @ProcName TEXTEQU <procname>

ENDM


.data

f1  db '10 + 20 + 30 = %u',13,10,0

.data?

.code

start:

    invoke  sum,10,20,30
    invoke  crt_printf,ADDR f1,eax

    invoke  ExitProcess,0


PROCX sum,x:DWORD,y:DWORD,z:DWORD

% echo @ProcName

    mov     eax,x
    add     eax,y
    add     eax,z
    ret
   
sum ENDP

END start

mineiro

  • Member
  • ****
  • Posts: 947
Re: How can I use @ProcName ?
« Reply #17 on: March 11, 2023, 12:30:14 AM »
Thank you sir Vortex.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

LiaoMi

  • Member
  • *****
  • Posts: 1055
Re: How can I use @ProcName ?
« Reply #18 on: March 12, 2023, 03:24:55 AM »

ChatGPT  :biggrin:  :biggrin:  :biggrin:

In Microsoft Macro Assembler (MASM), @ProcName is a predefined symbol


Hello LiaoGPT!

What version you used to test that?

(I hope you don't believe what bot say  :biggrin: :biggrin:)

Hi HSE,

so many creative ideas we found in the wrong words  :biggrin:

UASM Reference 2.56
2.17) Additional Built-In Variables
@ProcLine, indicates the current source code line number relative to the start of the current
procedure.
@ProcName returns the name of the current procedure.
@Platform <0|1|2|3|4> indicating the currently platform target as WIN32, WIN64, ELF32, ELF64,
OSX MACHO64 to support improved cross platform assembly.
IF @Platform EQ 0
xor eax,eax
echo 'im 32bit windows'
ELSEIF @Platform EQ 1
xor rax,rax
echo 'im 64bit windows'
ELSEIF @Platform EQ 2
xor ebx,ebx
echo 'im 32bit linux'
ELSEIF @Platform EQ 3
xor rbx,rbx
echo 'im 64bit linux'
ELSEIF @Platform EQ 4
xor rbx,rbx
echo 'im 64bit OSX'
ENDIF
@LastReturnType, indicates the last function return type following an invoke call. Values are:
enum returntype {
RT_SIGNED = 0x40,
RT_FLOAT = 0x20,
RT_BYTE = 0,
RT_SBYTE = RT_BYTE | RT_SIGNED,
RT_WORD = 1,
RT_SWORD = RT_WORD | RT_SIGNED,
RT_DWORD = 2,
RT_SDWORD = RT_DWORD | RT_SIGNED,
RT_QWORD = 3,
RT_SQWORD = RT_QWORD | RT_SIGNED,
RT_REAL4 = RT_DWORD | RT_FLOAT,
RT_REAL8 = RT_QWORD | RT_FLOAT,
RT_XMM = 6,
RT_YMM = 7,
RT_ZMM = 8,
RT_PTR = 0xc3,
RT_NONE = 0x100
};

jj2007

  • Member
  • *****
  • Posts: 13946
  • Assembly is fun ;-)
    • MasmBasic
Re: How can I use @ProcName ?
« Reply #19 on: March 12, 2023, 03:35:47 AM »
UASM Reference 2.56
2.17) Additional Built-In Variables
@ProcLine, indicates the current source code line number relative to the start of the current
procedure.
@ProcName returns the name of the current procedure.

Hi LiaoMi,

Can you give us a short but complete working example of @ProcName usage?

HSE

  • Member
  • *****
  • Posts: 2498
  • AMD 7-32 / i3 10-64
Re: How can I use @ProcName ?
« Reply #20 on: March 12, 2023, 03:36:05 AM »
Hi LiaoMi!

UASM Reference 2.56
@ProcName returns the name of the current procedure.

 :thumbsup: mineiro mention that.

After that I found that reserved word is in source code, apparently there is an offset storage, but I don't know how that can work   :biggrin:

HSE
Equations in Assembly: SmplMath

LiaoMi

  • Member
  • *****
  • Posts: 1055
Re: How can I use @ProcName ?
« Reply #21 on: April 07, 2023, 04:57:57 AM »
UASM Reference 2.56
2.17) Additional Built-In Variables
@ProcLine, indicates the current source code line number relative to the start of the current
procedure.
@ProcName returns the name of the current procedure.

Hi LiaoMi,

Can you give us a short but complete working example of @ProcName usage?

Hi jj2007,

for me, like for others, constants do not work  :undecided: ..

http://masm32.com/board/index.php?topic=6821.msg73189#msg73189
johnsa
« Reply #6 on: January 08, 2018, 03:20:23 AM »
Quote
@ProcName is in,  the stack alignment issue is sorted and a bunch of other pending changes. 2.46.6 packages are up :)