COMPUTE! ISSUE 57 / FEBRUARY 1985 / PAGE 10
TI POKE?
I own a TI-99/4A and would like to know if there is an equivalent for
POKE in TI BASIC or TI Extended BASIC.
Paul Parks
There is no equivalent for POKE or
PEEK in standard TI BASIC. This is one example of how TI BASIC differs
considerably from other personal computer BASICS. The language
designers may have felt that PEEK and POKE commands-which allow
programmers to examine and modify individual memory locations-were
somehow risky tools to put in the hands of inexperienced programmers.
Of course, many inexperienced programmers progress beyond that stage
and would find uses for these commands. Constructing a blockade between
the programmer and the lower levels of the machine can severely limit a
user's control.
Fortunately, TI's
Extended BASIC does provide an equivalent for POKE, the CALL LOAD
statement. For example, to place the value 100 in location 20000, you'd
use CALL LOAD(20000,100). The equivalent to PEEK is CALL PEEK. To place
the value from location 20000 into the variable X, you'd use CALL
PEEK(200000,X).
Remember that
memory for the video display is maintained separately from the
microprocessor (and, without expansion, BASIC programs are actually
stored in the video memory area), so CALL LOAD and CALL PEEK give you
access only to the processor memory or to any attached expansion
memory. The ROM in the Mini Memory cartridge also provides for CALL
LOAD and CALL PEEK, and in addition provides CALL POKEV and CALL PEEKV,
which allow you to store and retrieve data from video memory.
TI also supplies
an impressive library of built-in subroutines that accomplish many of
the things that PEEK and POKE are used for on other computers. For
example, to read the TI joysticks, you can type:
100
CALL JOYST(1,X,Y)
Other valuable
features are CALL CHAR, RESEQUENCE, and NUMBER. These provide builtin
character redefinition, renumbering, and automatic line-numbering
utilities.