> He will never go over 32K he is using special edition.
The special edition today has a limit of 32k C code, correct. Going over 32k flash is still possible, for example with another license in the future, with assembly code or even just with a lot of C constants/strings.
For now, it appears though that 32k are enough, so I would really use the 4000 and C000 area.
When using a device with 512k I do recommend to use the banked memory model (even for users of the special edition). The banked calling convention is not much more expensive, and the used edition can change over time, just as the supported code size limitation can change.
Also note that the default prm only uses 16k of the unpaged memory with a comment how to use the rest. There is no such limit for the banked code.
> The PPAGE register should never be changed.
It gets automatically changed when using certain features, far calls, far data access. So never changing it means to understand what all must not be done. Using the 0x8000 is just more dangerous than using the 0x4000 area, and it rules out to use the 80% of the chip for code.
>While it might work out that 4000/C000 is ok, if per chance a large
>function falls on the page boundary could cause losing some amount
> of that 32K, which is why is suggested the 8000/C000 arrangement.
> If he can truly use not banked memory would this not be better?
If the prm file lists two 16k blocks, then the linker will not allocate anything across the boundary, regardless if the two areas are together or not.
Also there is an option to fill the gaps generated, but its not default and I doubt that those gaps are any real problem anyway.
Using the 0x4000 and 0xC000 for unpaged is the simple and safe general setup. Using the 0x8000 area for unpaged is an advanced optimization I would not recommend using unless the programmer really understand all the possible problems this introduces.
Just as note, I wonder if it should not actually be
>
ROM_FE8000 = READ_ONLY 0xFE8000 TO 0xFEBFFF;
Using
>
ROM_8000 = READ_ONLY 0x8000 TO 0xBFFF;
implies PPAGE == 0, which is legal in the architecture, but of course not what was intended.
So while normally placing code with the far calling convention into non paged code will work fine, I would guess it actually fails for the
READ_ONLY 0x8000 TO 0xBFFF area (not sure, I did not try it out).
Using non banked code there should work, I guess.
>If none of his code is in paged memory, then hes should use >__NEAR_SEG for all his code. Yes?
Using explicitly __NEAR_SEG in the small memory model does not change much as it is default. Using it in banked changes the calling convention so non __near qualified function pointers wont work when pointing to a function allocated in that section.
Not mentioning the __NEAR_SEG causes that some code gets not as efficient as possible in the banked memory model when the code is really allocated non banked, but this is optimization. Is you are not aware of how this all works, do not use __NEAR_SEG.
Given the
> #pragma CODE_SEG __NEAR_SEG BANKED
in a previous post, this shows how incorrectly added __NEAR_SEG's do cause troubles, hence the recommendation not to use __NEAR_SEG unless it is consciously.
Daniel