Anyone have a solid strategy for code that spans pages?
On Tue, 9 Jan 2001 22:44:06 +1100, you wrote:
Been there.... This particular problem, of subroutines called from
lots of places, is easily solved efficiently - for each page-1 routine
have a page-select and goto to it in page zero. adds a minor time
penalty but space is usually more important.
After the first call of a subroutine, this adds no page-swap code
overhead for subsequent calls, so is 'profitable' for any routines
called more then once.
It can also be useful for all page 1 subroutines to exit via a common
point that clears the page 1 bit first. This avoids the page 0 call
having to worry about whether the routine is in page 0 or 1 - things
tend to move about as code grows & changes...!
e.g. page 0 : ..
p0sub1 bsf pclath,page1bit
errorlevel -306 ; supress warning, you know what you're doing...
errorlevel +306 ; re-enable warning to catch real errors.
page 1 :
Having a consistent naming convention is important to avoid major
Obviously it helps a lot to group subroutines by page to reduce the
number of page-bit swaps, e.g. all subs called by p1sub1 above live in
For routines called only once, returning via the 'clear page bit' exit
point is still useful as the calling code doesn't need to clear it.
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
In reply to: <000301c07a31$78dcdb20$9cbb2acb@ranma>
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the