Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PEEK and POKE
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=={{anchor|EXAM|FILL}}PEEK and POKE in other BASICs== [[North Star Computers]], a vendor from the early 1980s, offered their own dialect of BASIC with their NSDOS [[operating system]]. Concerned about possible legal issues, they renamed the commands <code>EXAM</code> and <code>FILL</code>.{{Citation needed|date=October 2015}} There were also BASIC dialects that used the reserved words <code>MEMR</code> and <code>MEMW</code> instead. [[BBC BASIC]], used on the [[BBC Micro]] and other [[Acorn Computers]] machines, did not feature the keywords ''PEEK'' and ''POKE'' but used the [[question mark]] symbol (?), known as ''query'' in BBC BASIC, for both operations, as a function and command. For example: <syntaxhighlight lang="bbcbasic"> > DIM W% 4 : REM reserve 4 bytes of memory, pointed to by integer variable W% > ?W% = 42 : REM store constant 42; equivalent of 'POKE W%, 42' > PRINT ?W% : REM print the byte pointed to by W%; equivalent of 'PRINT PEEK(W%)' 42 </syntaxhighlight> 32-bit values could be POKEd and PEEKed using the [[exclamation mark]] symbol (!), known as ''pling'', with the least significant byte first ([[Endianness#Little-endian|little-endian]]). In addition, the address could be offset by specifying either query or pling ''after'' the address and following it with the offset: <syntaxhighlight lang="bbcbasic"> > !W% = &12345678 : REM ampersand (&) specifies hexadecimal > PRINT ~?W%, ~W%?3 : REM tilde (~) prints in hexadecimal 78 12 </syntaxhighlight> Strings of text could be PEEKed and POKEd in a similar way using the [[Dollar sign]] ($). The end of the string is marked with the [[Carriage return]] character (&0D in [[ASCII]]); when read back, this terminating character is not returned. Offsets cannot be used with the dollar sign. <syntaxhighlight lang="bbcbasic"> > DIM S% 20 : REM reserve 20 bytes of memory pointed to by S% > $S% = "MINCE PIES" : REM store string 'MINCE PIES', terminated by &0D > PRINT $(S% + 6) : REM retrieve string, excluding &0D terminator, and starting at S% + 6 bytes PIES </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)