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: www.piclist.com/techref/microchip/devices.htm?key=pic
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

flavicon
face
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
       NOLIST
       IF      (AddTo>>.9) == 0
    LIST
; Page 0
        BCF    STATUS,PS0
        BCF    STATUS,PS1
       NOLIST
         ENDIF
        IF     (AddTo>>.9) == 1
    LIST
; Page 1
         BSF   STATUS,PS0
         BCF   STATUS,PS1
       NOLIST
         ENDIF
         IF    (AddTo>>.9) == 2
    LIST
; Page 2
          BCF  STATUS,PS0
          BSF  STATUS,PS1
       NOLIST
         ENDIF
         IF    (AddTo>>.9) == 3
    LIST
; Page 3
          BSF  STATUS,PS0
          BSF  STATUS,PS1
       NOLIST
         ENDIF
       errorlevel      -306
         LIST
         GOTO  AddTo
         NOLIST
       errorlevel      +306
       LIST
       ENDM


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.

Tom

{Original Message removed}

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