User`s manual
8-6
PEEK
(address)
Returns the value stored at the specified byte address (in decimal form). To
use this function, you'll need to refer to two sections of the Appendix: the
Memory Map (so you')) know where to PEEK) and the Table of Function,
ASCII and Graphics Codes (so you'll know what the values represent).
If you're using PEEK to examine object files, you'll also need a microprocessor
instruction set manual (one is included with the TRS-80 Editor/Assembler
Instruction Manual).
PEEK is valuable for linking machine language routines with LEVEL II
BASIC programs. The machine language routine can store information in a
certain memory location, and PEEK may be used inside your BASIC program
to retrieve the information. For example,
A = PEEK(17999)
returns the value stored at location 17999 and assigns that value to the
variable A.
Peek may also be used to retrieve information stored with a POKE
statement. Using PEEK and POKE allows you to set up very compact,
byte-oriented storage systems. Refer to the Memory Map in the Appendix to
determine the appropriate locations for this type of storage. See
POKE,
USR.
POKE
address, value
Loads a value into a specified memory location. POKE is not a function but a
statement complete in itself. It requires two arguments: a byte address (in
decimal form) and a value. The value must be between 0 and 255 inclusive.
Refer to the Memory Map in the Appendix to see which addresses you'd like
to POKE.
To POKE (or PEEK) an address
above
32767, use the following formula: -1 *
(65536-desired address) = POKE OR PEEK address. For example, to POKE
into address 32769, use POKE -32767, value
POKE is useful for LEVEL II graphics. Look at the Video Display Worksheet
in the Appendix. In each of the 1024 PRINT locations there are 6
subdivisions. If we call each PRINT position a byte, then the smaller boxes
are bits. We know that there are 8 bits per byte; so what happened to the
other 2? One is used to identify the byte as a graphics or ASCII code. The
other bit is not used. The remaining 6 bits contain either an ASCII, graphics
or control code.