Searching \ for 'PIC16Cxx Page auto switching macros . Any comment' 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/power/priswitch.htm?key=switching
Search entire site for: 'PIC16Cxx Page auto switching macros . Any comment'.

No exact or substring matches. trying for part
PICList Thread
'PIC16Cxx Page auto switching macros . Any comment '
1997\06\08@233728 by Dmitry Kiryashov

flavicon
face
Hello all active piclist readers ! ;)

Below the macros MCALL to auto switch according bits in PCLATH register.
If ROUTINE addr and PCLATH bits have the same value this macros don't
perform any dump bit switching . This macros not been tested, so any
comment
welcome . The MGOTO macros have the same structure and principle .

---cut---
;PIC16Cxx Page auto switching macro, MCALL part
;LAST_ADDR is global value, to save addr of last ROUTINE was call
;
PAGE_BITS       EQU     H'18'   ;PAGE_BIT_1 + PAGE_BIT_0
PAGE_BIT_1      EQU     H'10'   ;
PAGE_BIT_0      EQU     H'08'   ;
LAST_ADDR       SET     0
;

MCALL   macro   ROUTINE

       LOCAL   C_LABEL, PCLATH_MASK

PCLATH_MASK     SET     ( high ( C_LABEL ^ ROUTINE) ) & PAGE_BITS
LAST_ADDR       SET     PCLATH_MASK & ( high ROUTINE )

       if ( ( PCLATH_MASK & PAGE_BIT_1 ) == PAGE_BIT_1 )
       if ( ( LAST_ADDR & PAGE_BIT_1 ) == PAGE_BIT_1 )
       BSF     PCLATH,4
       else
       BCF     PCLATH,4
       endif
       endif

       if ( ( PCLATH_MASK & PAGE_BIT_0 ) == PAGE_BIT_0 )
       if ( ( LAST_ADDR & PAGE_BIT_0 ) == PAGE_BIT_0 )
       BSF     PCLATH,3
       else
       BCF     PCLATH,3
       endif
       endif


C_LABEL SET     $
       CALL    ROUTINE

       endm
---cut---

One comment from me - LAST_ADDR must be global value.

WBR Dmitry.

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