flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > local struc problem

Author
Thread Post new topic Reply to topic
pepe



Joined: 26 Feb 2015
Posts: 18
pepe 16 Mar 2024, 13:16
Hello, 've been trying to find answer to this but failed so far, so decided to ask.

given this code:
Code:
struc S x, y
{
   .x db x
   .y db y
   .cs db 0
}


something S 42,43

macro CS pS
{
local Src
virtual at pS
   Src S ?,?
end virtual
local a,b
load a byte from Src.x
load b byte from Src.y
;...

}

CS something     


If i make Src local, i get error 'undefined symbold Src.x', code works if i comment the line 'local Src'.
But in that case Src is global, as in, cannot use the CS macro more than once ,with different pointer.

What would be the correct way to define a structure locally and use its members?

thanks,
pepe
Post 16 Mar 2024, 13:16
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 16 Mar 2024, 13:45
load a byte from Src#.x
load b byte from Src#.y
Post 16 Mar 2024, 13:45
View user's profile Send private message Visit poster's website Reply with quote
pepe



Joined: 26 Feb 2015
Posts: 18
pepe 16 Mar 2024, 14:30
thanks for the quick reply, that definitely did it. Smile
i guess i understand now why...


pepe
Post 16 Mar 2024, 14:30
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.