The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: n00b! on June 12, 2008, 07:36:17 PM

Title: textequ and equ
Post by: n00b! on June 12, 2008, 07:36:17 PM
Hi,
here are my two questions:

1. How can I convert this nicely to MASM?
"#define SIZE (sizeof(ULONG) * 4)"

2. I did not find useful stuff about this...
So for what is it, in what relation stands it to equ and how can I use it?

Thanks in advance!
Title: Re: textequ and equ
Post by: hutch-- on June 12, 2008, 11:29:13 PM
noob,

I may be leading you up the garden path as my C is getting very rusty but a ULONG multiplied by 4 == 16.

SIZE is a reserved word in MASM so you would need another name.


mySIZE equ <SIZEOF DWORD *4>


Here is a simple test piece to show it works.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

    mySIZE equ <SIZEOF DWORD*4>

    .code

start:
   
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    call main
    inkey
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    mov eax, mySIZE
    print str$(eax),13,10

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start