bas7advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
POKE Statement Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
POKE writes a byte into a memory location.
POKE address,byte%
Usage Notes
■ If the argument is a single- or double-precision floating-point
value or a long integer, it is converted to a 2-byte integer.
■ The POKE statement complements the PEEK function.
■ Before using POKE to directly manipulate data stored in far memory,
use the DEF SEG statement and the SSEG function to set the current
segment address. For example:
' Set the current segment address to the address of a$.
DEF SEG = SSEG(a$)
' Determine the string's location within the segment.
Offset1 = SADD(a$)
' Write the byte stored in
POKE Offset1, PEEK(Offset2)
║ Note: BASIC moves string locations during run time. Therefore,
║ the DEF SEG statement must be executed immediately before
║ using the POKE statement.
Warning
■ Use POKE carefully. If used incorrectly, it can cause BASIC or the
operating system to fail.
POKE and Expanded Memory Arrays
■ Do not use POKE to manipulate expanded memory arrays. If you start
QBX with the /Ea switch, any of these arrays may be stored in
expanded memory:
- Numeric arrays < 16K in size
- Fixed-length string arrays < 16K in size
- User-defined-type arrays < 16K in size
■ If you want to use POKE to manipulate an array, first start QBX
without the /Ea switch. (Without the /Ea switch, no arrays are
stored in expanded memory.)
■ For more information on using expanded memory, see
◄Using Expanded Memory►.
Programming With OS/2 Protected Mode
■ Any address referred to by POKE must be open for writing. If POKE
refers to a memory address for which your process does not have write
permission, the operating system may generate a protection
exception, or BASIC may generate the error message, "Permission
denied."