please dont rip this site

See Pageing

On the 12-bit-core PIC (does not apply to 14-bit-core chips like the f84 and f877) and on the SX chips a subroutine to be called can only exist in the first (256 instruction) half of a 512 instruction page (the call sets bit 8 to 0, no way around that). The only way to call a subroutine anywhere in memory is to have a vector (a goto) in a lower half of a page and call that vector. James Cameron [quozl at us.netrek.org] http://quozl.netrek.org/ says:

[vector tables go] sort of like this ...
        org     0x0
        goto    main

; vector table
alpha   goto    alpha_real
beta    goto    beta_real
delta   goto    delta_real

main
        call    alpha
        [code]
        call    beta
        [etc]
        goto    main

alpha_real
        [lots of code]
        retlw

beta_real
        [lots of code]
        retlw

delta_real
        [lots of code]
        retlw

The point being that this allows the *_real entry points to exist anywhere within the bank memory. You CALL the vector table entry point, and it does a GOTO to the real entry point. It works because GOTO has the extra bit for the address that CALL does not.

If your code extended beyond 0x200, you could place a different vector table at the low end of the second page ...

        org     0x200

; vector table
alpha   bank0
        goto    alpha_real

beta    bank0
        goto    beta_real

However with this trick your code would have to take care to restore PA0 before it tries the next CALL or GOTO within 0x200 to 0x3fe ...

high    call    alpha
        bank1
        goto    high

--


See also:


file: /techref/microchip/instr/call.htm, 2KB, , updated: 2001/8/24 17:33, local time: 2008/11/21 02:32,
TOP NEW HELP FIND: 
38.103.63.55:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 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!
<A HREF="http://www.sxlist.com/TECHREF/microchip/instr/call.htm"> microchip instr call</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): 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: 
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .