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 18:33, local time: 2008/7/5 08:32,
TOP NEW HELP FIND: 
38.103.63.17: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://piclist.org/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?

  PICList 2008 contributors:
o List host: MIT, Site host massmind.org, Top posters @20080705 Apptech, Jinx, Xiaofan Chen, Alan B. Pearce, David VanHorn, Bob Axtell, William \Chops\ Westfield, Cedric Chang, olin piclist, Gerhard Fiedler,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Shultz Electronics, Larry Williams, David VanHorn, Bryan Whitehouse, Timothy Weber, David Challis. Peter Todd. on-going support is MOST appreciated!
* Contributors: Neil Narwani, David Cary, Elemer AM Nyiry, Philip J Taylor, Gus Calabrese of Omegadogs.com, Gautama Venegas, Patrick B. Murphy, William Chops Westfield, Peter Todd, Leslie Ellis
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .