BASIC stamp manual v2.2

4: BASIC Stamp Architecture – Aliases and Modifiers
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 91
If you looked closely at that example, you probably thought it was a
misprint. Shouldn’t myBytes.LOWNIB(1) give you the low nibble of byte 1
of the array rather than the high nibble of byte 0? Well, it doesn’t. The
modifier changes the meaning of the index value to match its own size. In
the example above, when myBytes() is addressed as a byte array, it has 10
byte-sized cells numbered 0 through 9. When it is addressed as a nibble
array, using myBytes.LOWNIB(), it has 20 nibble-sized cells numbered 0
through 19. You could also address it as individual bits using
myBytes.LOWBIT(), in which case it would have 80 bit-sized cells
numbered 0 through 79.
What if you use something other than a “low” modifier, say
myBytes.HIGHNIB()? That will work, but its effect will be to start the
nibble array with the high nibble of myBytes(0). The nibbles you address
with this nib array will all be contiguous, one right after the other, as in the
previous example.
myBytes VAR Byte(10) ' Define 10-byte array.
myBytes(0) = $AB ' Hex $AB into 0th byte
myBytes(1) = $CD ' Hex $CD into next byte
DEBUG HEX ? myBytes.HIGHNIB(0) ' Show high nib of cell 0 ($A)
DEBUG HEX ? myBytes.HIGHNIB(1) ' Show next nib ($D)
This property of modified arrays makes the names a little confusing. If you
prefer, you can use the less-descriptive versions of the modifier names;
BIT0 instead of LOWBIT, NIB0 instead of LOWNIB, and BYTE0 instead of
LOWBYTE. These have exactly the same effect, but may be less likely to be
misconstrued.
You may also use modifiers with the 0th cell of an array by referring to
just the array name without the index value in parentheses. It’s fair game
for aliases and modifiers, both in VAR directives and in instructions.
On all BS2 models, if you’re working on a program and wondering how
much variable space you have left, you can use the Memory Map feature
of the editor (CTRL-M). See the "Memory Map" section of Chapter 3 on
page 50.
THE MEMORY MAP