RECORD           Define Record Type                            MASM Directive

recordName    RECORD     fieldName:width [=expression],,,

Defines an 8-bit or 16-bit record type with one or more bit fields of
a specified width and (optionally) specified initial value.

Notes:     The width parameter specifies a number of bits, from 1
to 16. Any number of fieldName:width parameters may be
included, provided the total number of bits does not
exceed 16. fieldName:width parameters are separated by

The optional =expression parameter allows you to declare
an initial value for a field. Expression must yield an
integer and may not include a forward reference. If the
field is at least seven bits in width, expression can be
an ASCII character.

The first field declared becomes the high-order field of
the record. The last field declared becomes the low-
order field. The low-order field always ends at bit 0.
Thus, for example, if your fields add up to seven bits,
they will occupy bits 6 through 0.

If the total width of the record is eight bits or less,
the assembler uses one byte. If it is greater than
eight, the assembler uses two bytes. In all cases,
unused bits are initialized to 0 by the assembler.

The RECORD directive by itself does not create data. It merely creates
a data type. To create data of this type, use the syntax:

[name]      recordName     <[initialValue,,,]>

where name is the name of a variable and recordName is the name of a
record type previously defined with the RECORD directive.  One
initialValue may be declared for each field in the record, using
commas to separate the initial values for each field. For example,
<,,3> will initialize the 3rd field of a structure.


equipment      RECORD    disk:2, printer:2=1, RS232:1

PCequipment    equipment      <>

The above 2 lines will create an 8-bit record called PCequipment with
the RS232 field occupying bit 0 and initialized to 0, the PRINTER
field occupying bits 2-1 and initialized to 1, and the DISK field
occupying bits 4-3 and initialized to 0.  Bits 7-5 will be initialized
to 0.

See also: STRUC

RECORD Define Record Type