please dont rip this site
;***************************************************************
;* Macro   LONGC           ;Long Call	;by Walter Quitt
;***************************************************************
LONGC MACRO SUBROUTINE

   bsf     CPUSTA,GLINTD       ;interrupts off
   movlw   HIGH (SUBROUTINE)
   movfp   WREG,PCLATH         ;Z unaffected
   bcf     CPUSTA,GLINTD       ;interrupts on
   lcall   LOW  (SUBROUTINE)

   ENDM

Olin Lathrop [olin at cognivis.com] of cognivis (978) 772-3129 says

;
;********************
;
;   Macro SKIP_WLE
;
;   Skip the next instruction if W was less than or equal to the value
;   it was subtracted from.  This assumes that the carry flag has been
;   preserved from the last SUBWF or SUBLW instruction.
;
skip_wle macro
  if fam_17
         btfss   alusta, c
         exitm
    endif

         btfss   status, c   ;skip if no borrow occurred
         endm
;
;********************
;
;   Macro SKIP_WGT
;
;   Skip the next instruction if W was greater than the value
;   it was subtracted from.  This assumes that the carry flag has been
;   preserved from the last SUBWF or SUBLW instruction.
;
skip_wgt macro
  if fam_17
         btfsc   alusta, c
         exitm
    endif

         btfsc   status, c   ;skip if a borrow occurred
         endm
;
;********************
;
;   Macro SKIP_Z
;
;   Skip the next instruction if the zero flag is set.
;
skip_z   macro
  if fam_17
         btfss   alusta, z
         exitm
    endif

         btfss   status, z
         endm
;
;********************
;
;   Macro SKIP_NZ
;
;   Skip the next instruction if the zero flag is not set.
;
skip_nz  macro
  if fam_17
         btfsc   alusta, z
         exitm
    endif

         btfsc   status, z
         endm
;
;********************
;
;   Macro SKIP_CARR
;
;   Skip the next instruction if a carry occurred.
;
skip_carr macro
  if fam_17
         btfss   alusta, c
         exitm
    endif

         btfss   status, c
         endm
;
;********************
;
;   Macro SKIP_NCARR
;
;   Skip the next instruction if no carry occurred.
;
skip_ncarr macro
  if fam_17
         btfsc   alusta, c
         exitm
    endif

         btfsc   status, c
         endm
;
;********************
;
;   Macro SKIP_BORR
;
;   Skip the next instruction if a borrow occurred.
;
skip_borr macro
  if fam_17
         btfsc   alusta, c
         exitm
    endif

         btfsc   status, c
         endm
;
;********************
;
;   Macro SKIP_NBORR
;
;   Skip the next instruction if no borrow occurred.
;
skip_nborr macro
  if fam_17
         btfss   alusta, c
         exitm
    endif

         btfss   status, c
         endm
;
;********************
;
;   Macro INTR_OFF
;
;   Globally disable interrupts without changing which interrupts are
;   individually disabled.  This macro together with INTR_ON can be used
;   around small sections of code that need to run with interrupts off.
;
intr_off macro
  if fam_16
         bcf     intcon, gie
    endif
  if fam_17
         bsf     cpusta, glintd
    endif
         endm
;
;********************
;
;   Macro INTR_ON
;
;   Globally enable interrupts without changing which interrupts are
;   individually enabled.  This macro together with INTR_OFF can be used
;   around small sections of code that need to run with interrupts off.
;
intr_on  macro
  if fam_16
         bsf     intcon, gie
    endif
  if fam_17
         bcf     cpusta, glintd
    endif
         endm


Simon says:

BETTER?:
 intr_off macro
   if fam_16
 foo:
          bcf     intcon, gie
          btfsc   intcon, gie
          goto    foo
     endif
   if fam_17
 bar:
          bsf     cpusta, glintd
          btfss   cpusta, glintd
          goto    bar
     endif
          endm

cut & paste of the reasoning behind the code from Thomas' code:
;If an IRQ happens when the "bcf intcon,gie" line is executing,
;the GIE bit will be cleared, but the interrupt will still occur.
;If the interrupt routine has a RETFIE instruction at the
;end, (which is the usual state of affairs),then GIE will
;be set to 1 again.

Questions:


file: /Techref/microchip/17inst.htm, 4KB, , updated: 2004/8/11 23:26, local time: 2024/10/14 10:55,
TOP NEW HELP FIND: 
3.236.112.101:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.ecomorder.com/techref/microchip/17inst.htm"> microchip 17inst</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to www.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .