Searching \ for ' FW: [PIC]: Anyone have a solid strategy' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'Anyone have a solid strategy'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] FW: [PIC]: Anyone have a solid strategy '
2001\01\10@015351 by Tom Mariner

Hello Dave,

You are on the right track with the macros. On any of the Microchip devices
with multiple pages of RAM or ROM, we always use macros that state your
present address ($) and the address of the routine you wish to access, then
let the assembler figure out the proper page bits to set and / or clear.
Unfortunately with the code space, the macro has to always set and / or
clear using the the same number of instructions since it gets upset if
differing number of addresses are used. For example, if one called a routine
from the same page, no instructions would be needed, but the macro has to
generate them. Actually, in versions of the compiler long gone, the task was
easier since the assembler would make another pass through the code to see
if the addresses had been modified. Here's a crude example of something that
might work:

;Long Jump
; If on Different Pages, Do Page Set,
LJump   MACRO   AddFrom,AddTo
       IF      (AddTo>>.9) == 0
; Page 0
        BCF    STATUS,PS0
        BCF    STATUS,PS1
        IF     (AddTo>>.9) == 1
; Page 1
         BSF   STATUS,PS0
         BCF   STATUS,PS1
         IF    (AddTo>>.9) == 2
; Page 2
          BCF  STATUS,PS0
          BSF  STATUS,PS1
         IF    (AddTo>>.9) == 3
; Page 3
          BSF  STATUS,PS0
          BSF  STATUS,PS1
       errorlevel      -306
         GOTO  AddTo
       errorlevel      +306

The same type of "Bankswitch From, To" works great with the RAM since it
doesn't rely on your knowing or caring which bank the variables are in. This
method can, in fact set and clear variable numbers of bank bits (including
none) since it doesn't self modify the address space.

Hope this helps.


{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...