BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – DEBUG
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 165
but typing the name of the variables in quotes (for the display) can get a
little tedious. A special formatter, the question mark (?), can save you a lot
of time. The code below does exactly the same thing (with less typing):
x VAR Byte
y VAR Byte
x = 100
y = 250
DEBUG DEC ? x ' Show decimal value of x
DEBUG DEC ? y ' Show decimal value of y
The display would look something like this:
x = 100
y = 250
The ? formatter always displays data in the form "symbol = value"
(followed by a carriage return). In addition, it defaults to displaying in
decimal, so we really only needed to type: DEBUG ? x for the above
code. You can, of course, use any of the three number systems. For
example: DEBUG HEX ? x or DEBUG BIN ? y.
It's important to note that the "symbol" it displays is taken directly from
what appears to the right of the ?. If you were to use an expression, for
example: DEBUG ? x*10/2+3 in the above code, the display would
show: "x*10/2+3 = 503".
A special formatter, ASC, is also available for use only with the ? formatter
to display ASCII characters, as in: DEBUG ASC ? x.
What if you need to display a table of data; multiple rows and columns?
The Signed/Unsigned code (above) approaches this but, if you notice, the
columns don't line up. The number formatters (DEC, HEX and BIN) have
some useful variations to make the display fixed-width (see Table 5.12).
Up to 5 digits can be displayed for decimal numbers. To fix the value to a
specific number of decimal digits, you can use DEC1, DEC2, DEC3, DEC4
or DEC5. For example:
x VAR Byte
x = 165
DEBUG DEC5 x ' Show decimal value of x in 5 digits
D
ISPLAYING FIXED-WIDTH NUMBERS.