I am posting this really to help newbies and have no bug reports or complaints other than perhaps the description of the use of virtual in the manual should be clarified somewhat. Really I have nothing but praise for fasm ; it's been a godsend for my compiler development.
After writing hundreds of lines of fasm code I finally got around to delving into some of the fancier macro facilities such as struc and virtual. The fasm manual suggests the use of the virtual directive to create the equivalent of the C union directive and indeed it can be used to do this. However the manual is somewhat misleading about how this is done. After reading the manual I thought I could use virtual to create two pointers to the same place in memory something like this
virtual at chars
char0 db ?
char1 db ?
end virtual
chars db '01234'
With this code, char0, points to '0' and char1 points to '1'. This is actually preferrable to what I thought the manual was telling me, since it offers more flexibility. I had thought that everything in the virtual declaration would be forced to point to the value of the at operand, and hence, as in an actual union declaration, char0 and char1 would both point to the '0' byte
The correct way to do it is,
virtual at chars
char0 db ?
end virtual
virtual at chars
char1 db ?
end virtual
chars db '01234'
Just thought I'd offer this in case anyone else runs into this newbie mistake.
_________________ -- -------------------------------------------------------
"I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus
---------------------------------------------------------
|