Loading a word value into 'ptr' using Peek (28X2)

inglewoodpete

Senior Member
I am using the scratchpad of a 28X2 (AXE401 Shield) for more than one function.

The easiest way to access this data is to use the ptr (as @ptr, @ptrinc) variable. In order to use different areas of the scratchpad for each data table, I want to preserve the ptr in user RAM before and after use, using the Peek and Poke commands.

The scratchpad in the 28X2 has 1024 bytes, so I need to store the ptr's 10 bits as a word in user RAM.

The complier (PE vers 5.5.1) rejects the following command:

Code:
#PICAXE 28X2
Peek 44, Word Ptr
Code:
Peek 44, Word Ptr
                 ^
Error: Word variable required!
...but accepts:
Code:
#PICAXE 28X2
Peek 44, ptrh, ptrl
Obviously, I know the workaround but is this a compiler bug?
 
Last edited:

westaust55

Moderator
PE 5.5.5 gives the same error.

No solution from myself, but some possible insight.

I suspect it is like a recent case (16 Jan 2013) where the OP was trying to use:
SWAP b2,@bptrinc​
It was something that Rev Ed had not envisaged and Technical advised it will be allowed for in the next release of the PE.

When one considers that using '@bptr' is akin to peeking/poking the particular address that is the defined by the value in bptr, I could understand that Rev Ed may not have envisaged the prospect of requiring to save/restore the btr pointer value.
 
Top