flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Multi-BYTE local with new MASM proc emulation?

Author
Thread Post new topic Reply to topic
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier 18 Jun 2005, 07:05
I'm trying to use the new MASM macros to emulate their proc syntax. Everything seems to work, but I can't figure out how to declare multiple BYTE buffers as a 'local'. My first attempt--after looking at how the local macros work--was as in test_proc3. The code assembled to adjust the stack as shown. Both .buffer:BYTE,20 and .buffer:DWORD,5 yield the wrong result. test_proc2 yields the correct results.

The way I read the proc.inc file was: varname:vartype,var

How can I do this using the new local format?
Code:
test_proc       proc
local           .buffer:DWORD,5                 ;SUB ESP,4  <- Should be 14h

        ret
test_proc       endp

test_proc2      proc
local           .buffer:DWORD                   ;SUB ESP,14
local           .buffer1:DWORD
local           .buffer2:DWORD
local           .buffer3:DWORD
local           .buffer4:DWORD

        ret
test_proc2      endp

test_proc3      proc
local           .buffer:BYTE,20                 ;SUB ESP,4  <- Should be 14h
        ret
test_proc3      endp
    


Thanks!

I'm really enjoying the new power of the FASM.

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 18 Jun 2005, 07:05
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8394
Location: Kraków, Poland
Tomasz Grysztar 18 Jun 2005, 10:55
The syntax for local are the multiple varname:vartype declarations separated with commas, you have wrongly interpreted the "match" line (read more about the "match" in the manual).

However, you can do it this way:
Code:
local buffer:BYTE 20 dup (?)    

or better for larger local structures:
Code:
locals
  buffer db 20 dup (?)
endl    

Note also that there's no need to put the dot in the beginning of name for the locals.
Post 18 Jun 2005, 10:55
View user's profile Send private message Visit poster's website Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier 18 Jun 2005, 12:00
Privalov,

Thanks!

Quote:
you have wrongly interpreted the "match" line


I'm not suprised! Trying to wrap my mind around macros!

Code:
local buffer:BYTE 20 dup (?)    


As it should be!

Thanks again!

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 18 Jun 2005, 12:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.