4: BASIC Stamp Architecture – Aliases and Modifiers
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 53
This feature is how the "string" capabilities of the DEBUG and SEROUT
command expect to work. A string is simply a byte array used to store
text. See the "Displaying Strings (Byte Arrays)" section in the DEBUG
command description for more information.
An alias is an alternative name for an existing variable. For example:
SYMBOL Cat = B0 ' Create a byte-sized variable.
SYMBOL Tabby = Cat ' Create another name for the same variable.
-- OR --
Cat VAR BYTE ' Create a byte-sized variable
Tabby VAR Cat ' Create another name for the same variable.
In this example, Tabby is an alias to the variable Cat. Anything stored in
Cat shows up in Tabby and vice versa. Both names refer to the same
physical piece of RAM. This kind of alias can be useful when you want to
reuse a temporary variable in different places in your program, but also
want the variable’s name to reflect its function in each place. Use caution,
because it is easy to forget about the aliases; during debugging, you might
end up asking ‘how did that value get here?!’ The answer is that it was
stored in the variable’s alias.
On the BS2, BS2e, BS2sx and BS2p, an alias can also serve as a window into
a portion of another variable. This is done using "modifiers." Here the
alias is assigned with a modifier that specifies what part:
Rhino VAR WORD ' A 16-bit variable.
Head VAR Rhino.HIGHBYTE ' Highest 8 bits of Rhino.
Tail VAR Rhino.LOWBYTE ' Lowest 8 bits of Rhino.
Given that example, if you write the value %1011000011111101 to Rhino,
then Head would contain %10110000 and Tail would contain %11111101.
Table 4.3 lists
all the variable modifiers. PBASIC2 lets you apply these
modifiers to any variable name and to combine them in any fashion that
makes sense. For example, it will allow:
Rhino VAR WORD ' A 16-bit variable.
Eye VAR Rhino.HIGHBYTE.LOWNIB.BIT1 ' A bit.
1
2
e
2
sx
2
p
2
2
e
2
sx
2
p
2
A
LIASES AND
V
ARIABLE
M
ODIFIERS
.
Содержание BASIC Stamp 1
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...