Program size discrepncies in 08M2/20M2 ad PE5/6

AllyCat

Senior Member
Hi,

I've recently been writing a program using quite complex, high resolution mathematics (preview here) and as hippy indicated some weeks ago, it's much easier to write neat and reliable program code for this using Macros in PE6. So I compiled a test version for the 20M2 (as on my breadboard) which was reported as 1450 bytes (and runs and simulates correctly). However, I always like to check if my code can run on an 08M2 (only two pins are required for SDA and SCL in this application) so I compiled again, to be told the program size is 1632 bytes. :confused:

Now I know that some of the Program/EEPROM space in an 08M2 is "shared" (and in some configurations I am using the EEPROM), but I can't find any correlation between the "missing" 182 bytes and my use (if any) of the EEPROM space. So I put that aspect "on the back burner" for a rainy day.

However, I've now found the PE6 Simulator interminably slow (at least on my PC, for Simulations rather than debugging) so I copied the pre-processor output file back into PE5 (whose simulator runs about 6 times faster on my PC). The Pre-processor "REM"s out the #picaxe type, but if I reinstate that, PE5 produces very similar sizes of 1632 and 1641 bytes for the 08M2 and 20M2 respectively (which is what I would expect since the internal address space and pinning are quite similar). So that figure of 1450 bytes for the 20M2 in PE6 is looking rather "suspicious", is there something I should be looking out for?

Eventually I will post the full program code, and it's quite likely to get close to completely filling a single slot of a 14/20M2, so I'm rather concerned about that discrepancy of nearly 200 bytes. Any ideas?

Cheers, Alan.
 

Technical

Technical Support
Staff member
The 18M2+/14M2/20M2 have extra memory optimisations that are utilised by later compilers (such as storing internal gosub address tables separately without taking up so much conventional 'program memory space'), so do indeed optimise the program better. It's actually nothing to do with PE5/6, it's just if you are using an older or newer compiler. 08M2 does not have this extra memory capacity so the values will be the roughly same whichever version compiler you use.

However the program will run identically whichever compiler you use. PE5 and the older compilers have been discontinued for several years now, so you should not expect 100% identical behaviour with the obsolete system.
 
Last edited:

steliosm

Senior Member
Technical, are the command line compilers are still supported? If they are, would updating the compilers in PE5 IDE result in having a 'updated' version, at least for compiling code?
 

Technical

Technical Support
Staff member
The compilers evolve each year and are not checked for backwards compatibility for obsolete software.
 

AllyCat

Senior Member
Hi,

The 18M2+/14M2/20M2 have extra memory optimisations that are utilised by later compilers ..(... without taking up so much conventional 'program memory space')...
Thanks Technical, that's interesting. So it looks as if a program intended for an 08M2 might need to be around 500 bytes smaller (if the EEPROM is being used) than one developed on/for a 14M2, even excluding the availability of the second slot on the larger chips?

I do/will use PE6, particularly for my current project, but I also like to keep PE5 in its "original" form (not updated compiler) for several reasons. Then, I use the "latest" version of AxePad for a "quick check" on the compatibility with the later compilers (but of course with no simulation capability).

In addition to checking the compatibility of my programs with the "obsolete" Editor (and not raising the readinternaltemp saga again), I find the PE5 Simulator so much faster than PE6. The code of my current project simulates in 52 seconds in PE5 and 5.6 minutes in PE6. That's with a "delay" of 100 ms set, because anything lower makes the UI very slow to respond, or subjectively even totally "lock up" my PC; 5 minutes is a long time to wait if you're debugging the last few lines of a computation. And the equivalent "finished project" program, referred to in my links, takes 30 minutes to simulate in PE5, so I guess around 3 hours in PE6 (hence I have no plans to try to debug that).

Cheers, Alan.
 

Technical

Technical Support
Staff member
When simulation long programs and only actually interested in a few lines it is often useful to use '#ifdef/ifndef simulating' to cut out large sections of code not necessary to test at that time.

08M2 and 14M2 have 2048 of addressable memory for the PICAXE program, e.g. memory that can be used to store the end users program. However as the base PIC of the 14M2 actually has a lot more memory capacity than the 08M2, this allows two program slots and also allows the compiler to make use of extra memory outside the 2048 envelope for some very specific non-addressable elements of the program (for instance the internally generated gosub address lookup table). This effectively allows the 14M2 program to safely overflow the 2048 bytes, but only in certain situations when the program contains non-addressable elements that the compiler can safely allocate out. Simply cut and paste 'pause 50000' hundreds of time until the memory is full and there will be no difference between the two parts as there is nothing to optimise.
 

Technical

Technical Support
Staff member
The compiler is updated whenever there is a bug fix / new feature added. If you keep PE6 up to date then you have the latest compiler.
 

steliosm

Senior Member
The compiler is updated whenever there is a bug fix / new feature added. If you keep PE6 up to date then you have the latest compiler.
Still I can't make any sense. I'm not talking about PE6. Do the command line compilers get updated as well?
 

AllyCat

Senior Member
Hi,

What about AxePad which, as said above, I mainly use for compatibility (and third party) program checking? The (compiler) version I'm using is clearly more "up to date" than PE5, but should I be taking any further action to update the compiler?

Thanks, Alan.
 

Technical

Technical Support
Staff member
There is only one set of compilers (which are used by all software, including PE6 and Blockly app). Therefore if you have the latest PE6 or Blockly then you already have the latest compilers installed too.

If you want to try updating the compilers within older unsupported software like PE5 etc. simply copy the compilers out of the PE6 compilers subfolder and into the PE5 subfolder. It may work, may not, we haven't tried.
 

hippy

Technical Support
Staff member
No; those appear to be version 3.1 compilers according to the descriptions. Those shipped with PE6 are version 3.4. As Technical says; copy the compilers from the PE6 or Blockly subfolder.
 
Top