From Learn @ Cemetech
Jump to navigationJump to search

These directives can be used to define a structure - a consecutive group of variables with a fixed format.


   .struct name

Allowed inputs

You may only use .var and conditional directives inside a structure's definition. You can nest structures - for example:

   .struct Point3D
       .var Point2D, P
       .var db,      Z
   .var Point3D, You
       ld a,(You.P.X)

You may not, however, nest a structure onto itself. You might feel tempted, for example, to do the following:

   .struct TreeNode
       .var word, Value
       .var TreeNode, RightBranch
       .var TreeNode, LeftBranch

The problem is that that particular structure has an infinite size! If you wish to implement that sort of data structure, you'd use pointers to the branch nodes.


See Also