ZX BASIC:POKE
From BorielWiki
Contents |
[edit] POKE
[edit] Syntax
POKE <Address>, <Value> or POKE <Type> <Address>, <Value>
Stores the given (numeric) Value at the specified memory Address. If Type is omitted, it is supposed to be UBYTE (8 bit unsigned integer).
The Value is converted to the given Type and stored at the given Address. Type can be any numeric one (like float or integer). So it is possible to poke a decimal value (5 bytes) at a memory position:
POKE Float 16384, PI
Traditionally, in Sinclair BASIC, to store a 16 bit value the programmer does something like this:
10 LET i = 16384 20 LET value = 65500 30 POKE i, value - 256 * INT(value / 256) : REM value MOD 256 40 POKE i + 1, INT(VALUE / 256)
This can be done in a single sentence in ZX BASIC:
POKE Uinteger 16384, 65500
It's faster and the recommended way.
[edit] Remarks
- This statement is Sinclair BASIC compatible.
- This statement also allows parenthesis and FreeBASIC syntax

