News:

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

Main Menu

Assume with different structures?

Started by LordAdef, March 16, 2025, 02:08:06 PM

Previous topic - Next topic

LordAdef

Thanks guys for helping me out.

QuoteWhat do you mean with "equ doesn't work"?
Hi JJ,
I was trying to change the equ according to the structure, and use it in the ASSUME. Example below

QuoteAlternative Solution with create a macro and use it multiple times in source saves typing ?
QuoteAlternative Solution with create a macro and use it multiple times in source saves typing ?
Hey Daydreamer! Hi Ognil,
Yes, and I was in fact using macros for that. The point in these cases is, I want to control the size of the project.

QuoteThat's not possible with ASSUME. ASSUME is an assembly-time thing, and the assembler, when assembling your PROC, simply doesn't know in what context your PROC is called. You'd have to differentiate the cases inside the procedure and then use multiple ASSUMES inside it - definitely not a good "solution".
Hey Japheth! Yep, it's a shame... I was really hoping for a magic tool from you gurus! But, you made it clear why my equ would never work
QuoteA bit hypocritical, but I use the long version by habit - no ASSUME in ML64
Hi Sinsi, I am still on 32bits... and didn't know that. Porting will be an extra hassle

QuoteI've never heard of it being used in the way you propose.
Hi NotCforMe, well, you can point to a structure, if that is what you mean



To clarify, a pseudo code:
caller_1 proc
    assume esi: ptr structure_1
    ...
    current_structure equ  structure_1   <--
    invoke target_proc
    ret
caller_1 endp

caller_2 proc
    assume esi: ptr structure_2
    ...
    current_structure equ  structure_2    <--
    invoke target_proc
    ret
caller_2 endp

target_proc proc
     assume esi: current_structure    <--- As Japheth has already explained, my idea doesn't work
     ....
     ret
target_proc endp