BASIC Stamp Architecture – Aliases and Modifiers
Page 54
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
Symbol
Definition
LOWBYTE
low byte of a word
HIGHBYTE
high byte of a word
BYTE0
byte 0 (low byte) of a word
BYTE1
byte 1 (high byte) of a word
LOWNIB
low nibble of a word or byte
HIGHNIB
high nibble of a word or byte
NIB0
nib 0 of a word or byte
NIB1
nib 1 of a word or byte
NIB2
nib 2 of a word
NIB3
nib 3 of a word
LOWBIT
low bit of a word, byte, or nibble
HIGHBIT
high bit of a word, byte, or nibble
BIT0
bit 0 of a word, byte, or nibble
BIT1
bit 1 of a word, byte, or nibble
BIT2
bit 2 of a word, byte, or nibble
BIT3
bit 3 of a word, byte, or nibble
BIT4 … BIT7
bits 4 though 7 of a word or byte
BIT8 … Bit15
bits 8 through 15 of a word
The commonsense rule for combining modifiers is that they must get
progressively smaller from left to right. It would make no sense to specify,
for instance, the low byte of a nibble, because a nibble is smaller than a
byte! And just because you can stack up modifiers doesn’t mean that you
should unless it is the clearest way to express the location of the part you
want get at. The example above might be improved:
Rhino VAR WORD ' A 16-bit variable.
Eye VAR Rhino.BIT9 ' A bit.
Although we’ve only discussed variable modifiers in terms of creating
alias variables, you can also use them within program instructions:
Rhino VAR WORD ' A 16-bit variable.
Head VAR Rhino.HIGHBYTE ' Highest 8 bits of rhino.
Rhino = 13567
DEBUG ? Head ' Show the value of alias variable Head.
DEBUG ? Rhino.HIGHBYTE ' Rhino.HIGHBYTE works too.
STOP
Modifiers also work with arrays. For example:
MyBytes VAR BYTE(10) ' Define 10-byte array.
MyBytes(0) = $AB ' Hex $AB into 0th byte
DEBUG HEX ? MyBytes.LOWNIB(0) ' Show low nib ($B)
DEBUG HEX ? MyBytes.LOWNIB(1) ' Show high nib ($A)
2
e
2
sx
2
p
2
Table 4.3: BS2, BS2e, BS2sx and
BS2p Variable Modifiers.
Содержание 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...