Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need Help With UNION TYPES

11 views
Skip to first unread message

Wildman

unread,
Sep 4, 2012, 12:56:18 PM9/4/12
to
I am not clear on the order that the "part" elements
are stored in a UNION. Below is an example:

TYPE SegOff
Segment AS WORD
Offset AS WORD
END TYPE

UNION Address
Whole AS DWORD
Part AS SegOff
END UNION

DIM A AS Address
A.Whole = VARPTR(SomeVariable)

My question is does A.Part.Segment contain the segment of
SomeVariable and does A.Part.Offset contain the offset?
I have seem examples where the high order word is stored
first, like my example and I seen an example where the
low order word is stored first like this:

TYPE SegOff
Offset AS WORD
Segment AS WORD
END TYPE

Which way is correct? Some clarification would be
appreciated.

WangoTango

unread,
Sep 4, 2012, 7:04:51 PM9/4/12
to
In article <Soq1s.401$pl4...@newsfe12.iad>, best...@yahoo.com says...
Is this suppose to be a holder for a X86 segmented (1MB) architecture
SEG:OFF addressing scheme? If that is the case, the SEG:OFF may be 2 16
bit values, but it does *NOT* mean that you can concatenate the two
values and get a 32 bit absolute address. Which means that your
"Whole" should have an absolute address in it and your "SegOff" is just
two parts of that absolute address. Remember, multiple segment:offset
pairs can map into the same linear/absolute address. I think of the
segment as page number, and those pages are just 16 bytes long.
Naturally, if you may be referring to something else entirely, and I am
wasting your time. Also, if you are in a flat memory addressing scheme
you are correct and I am just wasting your time again. :)



Wildman

unread,
Sep 5, 2012, 12:23:31 AM9/5/12
to
On Tue, 04 Sep 2012 19:04:51 -0400, WangoTango wrote:

> <snip>

Yes, I am talking about a flat memory scheme or real mode an in PB/DOS.
Perhaps I should have used VARPTR32 in my example.

Thanks for the reply tho. That did answer my question.
0 new messages