Syntax error in PE6

rq3

Senior Member
This small chunk of code

Code:
   [COLOR=Blue]bintoascii [/COLOR][COLOR=Black]Kolls,[/COLOR][COLOR=Purple]b0[/COLOR][COLOR=Black],[/COLOR][COLOR=Purple]@bptrinc[/COLOR][COLOR=Black],[/COLOR][COLOR=Purple]@bptrinc[/COLOR][COLOR=Black],[/COLOR][COLOR=Purple]@bptrinc[/COLOR][COLOR=Black],[/COLOR][COLOR=Purple]@bptrinc                                   [/COLOR][COLOR=Green];massage for decimal point[/COLOR]
has been working fine, and passes syntax in PE5, and versions of PE6 earlier than the latest (which I just installed). In the latest PE 6.0.8.6 it fails syntax check. Note that this is one line out of 381, the code has been successfully stuffed into a 20M2, and the device worked as intended. My earlier version of PE 6 was 6.0.8.3, which accepted this line with no problems.

The error reads:
bintoascii Kolls,b0,@bptrinc,@bptrinc,@bptrinc,@bptrinc ;massage for decimal point
^
Syntax error on line 240 at/before position 56

Error: @bptrinc cannot be used as for variable!



Rip
 

hippy

Technical Support
Staff member
My understanding is that there are issues with using @bptrinc in the BINTOASCII command so that use is no longer allowed; "@bptrinc cannot be used as for variable!".

If one wanted to force it, one can explicitly code for it inline or, perhaps most usefully, in a macro -

Code:
#Macro WordToAscii(wvar,n1,n2,n3,n4,n5)
  n1 = wvar / 10000       + "0"
  n2 = wvar / 1000  // 10 + "0"
  n3 = wvar / 100   // 10 + "0"
  n4 = wvar / 10    // 10 + "0"
  n5 = wvar         // 10 + "0"
#EndMacro

#Macro ByteToAscii(bvar,n1,n2,n3)
  n1 = bvar / 100   // 10 + "0"
  n2 = bvar / 10    // 10 + "0"
  n3 = bvar         // 10 + "0"
#EndMacro

WordToAscii(w0,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc)
ByteToAscii(b0,@bptrinc,@bptrinc,@bptrinc)
 

Technical

Technical Support
Staff member
@bptrinc was never 'officially supported' within pseudo commands such as bintoascii, as it could lead to unexpected/incorrect results.
It is therefore correct that this earlier bug (allowing it to be used) has been removed in 6.0.8.4
 

AllyCat

Senior Member
Hi,

Is there an "Official" list of Pseudo commands? I remember being quite surprised that SWAP came into that category (and had a "bug" with @bptrinc).

It is of course possible to "guess" most of them by the (large) number of bytes that each adds to the Program Code after a syntax check.

Cheers, Alan.
 

BESQUEUT

Senior Member
It is of course possible to "guess" most of them by the (large) number of bytes that each adds to the Program Code after a syntax check.
This is clearly documented in the online help and in the pdf.

But no warning about "pseudo commands" in the @ptr/@bptr description :

@ptr/@bptr is a variable name that can be used in any command (ie as where a ‘b1’ variable would be used).
 
Last edited:

AllyCat

Senior Member
Hi,

But SWAP isn't (and neither is PWMDUTY, etc.). :rolleyes:

It would be nice to have a simple list without having to search through the online commands, or put every one individually into a syntax check.

Cheers, Alan.
 

inglewoodpete

Senior Member
It must be an issue in some conditions. I have used BinToASCII with @bptrinc in several programs without apparent problems.

Anyway, the macros that hippy recommends are almost as neat and take very little extra space.
 

Technical

Technical Support
Staff member
The main specific issues are when @bptrinc is used as both target and result, or when dec and inc are mixed (yes people do do that sometimes!). We'll have a look at possibly relaxing the check to allow other scenarios where it would be ok.
 

rq3

Senior Member
The main specific issues are when @bptrinc is used as both target and result, or when dec and inc are mixed (yes people do do that sometimes!). We'll have a look at possibly relaxing the check to allow other scenarios where it would be ok.
Yes, that would be nice. While the example I provided was only for my own edification, I do actually use Picaxe chips in a commercial product. I would be less than pleased to see that code I had been shipping to customers is now "not allowed". Without knowing what is "not allowed", I have no way to have confidence in my own code. There needs to be a table, or chart, of potential issues with ALL of the Picaxe BASIC interpreter commands.

Rip
 
Top