14M2 upper RAM access to 511

premelec

Senior Member
Manual states RAM 28 to 511 on 14M2 [peek & poke] - how is the upper part - 256-511 - accessed - by word variable? By SFR switch? Thanks...
 
Last edited:

inglewoodpete

Senior Member
I don't know the answer but the description under Peek for M2s could be improved:

"For M2 parts:
The function of the poke/peek commands is amended on M2 parts.
The M2 parts have up to 512 bytes of user RAM.
The peek and poke commands are used to read and write to all 256 bytes of the
user RAM...."

...but the 08M2 has 128 bytes and the 18M2 has 256. Part of the trouble is that it is so hard to find the specs in the documentation.
 

premelec

Senior Member
The mystery deepens... I saw that and did a forum search as well - I think I saw the answer somewhere... I'm going to try find the on line command def which might have the answer... :)
 

westaust55

Moderator
use the bptr and @bptr pointer with indirect addressing.

The value of bptr can still be above 255 until the top of ram is reached, up to 0511 on M2 devices.
bptr is a 9-bit variable for the M2 devices - if you increment bptr it rolls over to 0 after 511.


EDIT:
Also just found past advice from Technical;
Just use peek/poke on any address up to 511
or @bptr with bptr = 0 to 511
 

premelec

Senior Member
Thanks westaust - I was hoping I didn't have to use a word variable... I'll give it a go... Out of curiosity - are there other 9BIT designated reserved variables in the system? [is there a name for a 9bit variable? BYTE = by eight - perhaps BYNI = by nine... :)
 
Last edited:

premelec

Senior Member
@ Tech the ref above says:
"The higher variables can be accessed via the peek/poke commands or @bptr variable."

Probably should be @bptr only for higher - though @bptr 28 through 255 OK - [?]
 

premelec

Senior Member
Probably academic at this point - e.g. can any word variable be used in Peek & Poke or only @bptr... which is evidently made to roll over at 511 for 14M2... I've got enough info to do what I need to do with the 14M2... 2 byte variable with 9 bit limit as tech says...

When I simulate in editor 5.5.6: [also in Editor 6.0.7.0]

#picaxe 14M2
top:
w0 = @bptr
@bptr = @bptr + 1
goto top

W0 rolls over at 255 not 511
 
Last edited:
Top