There is some stuff in that uses this type.

I've done some messing around with them:

foo RECORD a:8,b:8,d:8
bar foo <0ffh,88h,44h>
mov eax, MASK d
004020BF B8 FF 00 00 00 mov eax,0FFh

mov eax, NOT MASK b
004020C4 B8 FF 00 FF FF mov eax,0FFFF00FFh

mov eax, MASK a
004020C9 B8 00 00 FF 00 mov eax,0FF0000h

mov eax, SIZEOF bar
004020CE B8 04 00 00 00 mov eax,4

mov eax, TYPE bar
004020D3 B8 04 00 00 00 mov eax,4

mov eax, bar
004020D8 A1 90 20 40 00 mov eax,dword ptr [bar (402090h)]

mov eax, WIDTH d
004020DD B8 08 00 00 00 mov eax,8

Okay it is bitstring type. Microsoft put in MASM for a reason. Any idea what it may be? In other words I'm trying to figure out what RECORDs are supposed to be good for.

I'm also only using 24 bits of my dword. Is there any way of getting the size of only the used bits? One way I can think of:

foo RECORD a:8,b:8,d:8
bar foo <0ffh,88h,44h>
ws EQU wa+wb+wd
mov eax, ws
004020E7 B8 18 00 00 00 mov eax,18h

But that is a bit lengthy.

Posted on 2004-03-12 10:18:38 by ThoughtCriminal
RECORDs are a good way to access hardware/software bit fields in a self-documenting manner. The x86 supports bits as an integral type. The MASK keyword works in co-operation with RECORDs to access the data correctly. IMHO, the lack of enumeration support makes the notation more trouble than it is worth -- I do it manually.
Posted on 2004-03-12 10:50:30 by bitRAKE
I think it existed in the original Intel ASM-86 assembler.

In the old days, we could call RECORD a "packed" data type. It allowed you to specify bit fields in a byte or word type. With the coming of the 32-bit 386s, RECORD was expanded to allow "packing" of data into 32-bit DWORDs.

As there were no "extract or store bit field" instructions on the '86, you were supposed to handle the stuff with MASK and WIDTH operators. It would have been nice to have a "shift factor" operator for "right justifying" an extracted (masked) field, or positioning a value for insertion into the field. Instead, you need to calculate the shift factor by adding WIDTHs.
Posted on 2004-03-12 19:58:16 by tenkey