1000BiT Homepage
WHERE OLD COMPUTERS ARE WELCOME





× 1000BiT Logo

× Logo

 

Peek and Poke

Peek and Poke

These are two commands that I have always found present in the various Basic versions of home and personal computers of the 80s.
"Peek" reads a memory location, "Poke" instead allows writing a value to a memory location.

So they seem two very trivial instructions, indeed, why not use a variable to manage a memory location?
In reality, these two small instructions gave the programmer great power and also a great responsibility, because if you used the wrong way you could create real disasters.
The value set in a certain memory location is not simply a number, but it could be an instruction because the assembler is the only language in which data and instructions coexist in the same space, there is no distinction between them.
That's why these two instructions are so powerful!
Before using them it was, therefore, necessary to study thoroughly the computer on which it was working, basically I intend to know how the memory was used by the Basic or operating system, so as not to use already used addresses or just because you wanted to change a certain behavior of the latter.
For example in the Apple II the addresses on page 0 (the first 255 bytes of memory in short) were the most used both by the Basic and the operating system, as they were the fastest because read with a single CPU cycle, for all others, are needed two cycles.
Of course, there were very few free and the challenge was to find them!
However going to "touch" the right addresses you could do some strange things, typing: POKE 214, 255 each command is interpreted as RUN and to solve it is necessary to switch off the machine.
The fact of being able to change any memory address with any value from code is really fascinating, this feeling of having total control of the machine, regardless of who built it, I'm afraid it has been lost, but who knows maybe it's good.



Posted by Webmaster : 05/05/2018 14:46:24 | Login to enter your comment |

Comments