poke - write a byte to memory
writes a specified byte of data into the specified memory location.
The byte written is specified by M and must be in the range 0 to 255.
The memory location written is specified by N and must be in the range
-32768 to 32767.
The argument N may be any numeric expression with
an integer value in the range -32768 to 32767.
The memory location read is at an offset of N from the beginning of the
current segment as defined by the current value of the seg variable.
is the complementary function to the
option base 1
dim src%(50), dst%(50)
srcoff% = varptr(src%)
srcseg% = seg
dstoff% = varptr(dst%)
dstseg% = seg
for i% = 1 to 100
def seg = srcseg%
temp% = peek(srcoff%)
10 def seg = dstseg%
20 poke dstoff%, temp%
srcoff% = srcoff% + 1
if srcoff% = 0% then srcseg% = srcseg% + 1%
dstoff% = dstoff% +1
if dstoff% = 0% then dstseg% = dstseg% + 1%
illustrates an unusual way of copying an array
In line 20,
to store the value of temp%
at the address of dst%
statement in line 10 has been used to correctly set the high-order bits of the
Of course, there are better ways to copy arrays.
This method is shown only to illustrate the
peek, varptr, def seg, seg
An "Overflow" error occurs if N is outside the range -32768 to 32767.
When implemented in a 32-bit environment, Basmark QuickBASIC requires that the
high-order 16 bits be predefined by means of the
statement, leaving the low-order 16 bits as an offset returned by
and used as an argument by
The high order 16 bits of the address are stored in the
The Basmark QuickBASIC Programmerís Manual