piclist 2001\01\11\090535a >
Thread: Anyone have a solid strategy for code that spans pages?
www.piclist.com/techref/microchip/devices.htm?key=pic
face picon face BY : Olin Lathrop email (remove spam text)



> 2. Longer routines that make no (or very few) calls to the rest of the
> program can jump to another page. The routine can be called from page0
> only, but takes up just two words of page0.
>
> page0:
>
> LONGSUB:BSF     PCLATH,3
>         GOTO    LONGSUB_CONT

This only works on machines with 2 code pages.  More than two requires
setting additional PCLATH bits.

> 3. Simplified access to routines in another page. Uses extra stack level.
> Call Anysub0 from page0, call Anysub1 from page1.
>
> page0:
>
> ANYSUB0:BSF     PCLATH,3
>         CALL    ANYSUB1
>         BCF     PCLHATH,3
>         RETURN

There is no need to use an extra stack level.  Just GOTO the target routine
and let it return to the caller directly.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, RemoveMEolinspamspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestspam_OUTspam@spam@mitvma.mit.edu


<005401c07bd5$d66b4a60$260bf6cd@pc> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Anyone have a solid strategy for code that spans pages?

month overview.

new search...