Click to See Complete Forum and Search --> : The POKE commands


stmacy
09-12-2007, 01:21 PM
Series 3a/c programming question.

What's the difference between POKEB and POKEW? Descriptions of these commands are given as:

POKEB
POKEB address%,intv%
Store the integer value intv% (less than 256) in the single byte at address%.

POKEW
POKEW address%,intv%
Store the integer int% across two consecutive bytes, with the least significant byte in the lower address, that is address%.

So POKEB can only be used on integers up to 255? That seems it, but just to make sure I'm getting this I'd thought I'd ask.:)

A note is written that, "Casual use of the POKE commands can result in the loss of data in the Psion". Can someone give an example of being "casual"? If I'm always using the PEEK/POKE commands with addresses of variables I've declared I shouldn't cause myself a problem, or would I? Just curious...:D

osg
09-14-2007, 06:10 AM
POKEB - pokes only one BYTE into memory
POKEW - pokes WORD - I suppose TWO bytes into memory (I don't have 3c)

3c doesn't have protected memory, therefore poking into some system variables might crash the system or corrupt data. You won't cause any damage if you poke only to your allocated memory or variables.