BPTR is broke for POKE

techElder

Well-known member
Even though I set out to solve some problems with PUSH/POP, I've not been able to find a perfect all-in-one solution.

What I haven't solved is the bptr problem.

bptr isn't a WORD, and it isn't always a BYTE. Since it can address 512 RAM locations it must have at least 9 bits.

On the processors involved, if you want to POKE bptr, you can't save it as a WORD. It does pass syntax checking for POKE address, WORD bptr, but it will only save 8 bits (255 instead of 511.)

I don't know why the compiler was designed to make the exception (for processors are involved) for bptr in the syntax check and not handle the important detail of saving the 9 bits.

If you POKE it as a byte, then you can only save the lowest 8 bits, too. That is fine if you are only addressing 256 RAM locations, but not fine for 512 RAM locations (14M2, 18M2 and 20M2.)

When the 14M2, 18M2 and 20M2 processors are involved, I've been saving bptr into an interim WORD variable to get all 9 bits saved. Not ideal.
 

lbenson

Senior Member
Have you tried it on a real chip? As I pointed out in post 17 of the PUSH/POP thread, while POKEing bptr failed for me on a 14M2 in the simulator (only 8 bits saved), it worked on the real chip. I didn't test the 20M2 or the 18M2.
 

techElder

Well-known member
I didn't have extra PICAXES to try the code on. I'll see if I can dig something up from storage, but I'm thinking not.

That should be a quality issue for RevEd to fix or warn about or at least, document.
 
Last edited:

hippy

Technical Support
Staff member
That should be a quality issue for RevEd to fix or warn about or at least, document.
We can only fix, warn about or document the issues we are aware of it. We do undertake extensive testing but it is impossible to exhaustively test everything so some things may always slip through the net.

Please accept our apologies if this is one of those cases. I will raise it as an issue for investigation.
 

techElder

Well-known member
I don't mean to sound negative, just getting this documented in the right place.

No apologies necessary. :D
 

Flenser

Senior Member
Speaking about accurate documentation. Wouldn't it be best if the subject of this post was updated to indicate this is something confirmed when using BPTR for POKE in the simulator only and not the chips?
 
Top