Calling subroutines in a 16C57 Paged Memory?
David Cary email (remove spam text)
Dear Ian Hynes,
I agree that the paging mechanism on the PIC is annoying.
That's why I always use the
BANKISEL ; Select Bank for indirect access via FSR and INDF
BANKSEL ; Select RAM bank
PAGESEL ; Select ROM page (for GOTO and CALL)
macros (aren't they built into your assembler ?)
rather than trying to roll my own macros.
Ian Hynes <NETSTRA.COM.AU> on 2001-04-05 06:06:47 AM wrote: elek
>Bank_0 MACRO ;Page & Bank select macros.
> bcf FSR,5
> bcf FSR,6
> bsf FSR,5
> bcf FSR,6
This just looks wrong to me. The FSR doesn't have any page select bits; it's
(the lo 8 bits of) a pointer. (The hi bits are set in a different register using
> call test01 ;Call a routine in Page #1
> nop ;We should finish up here.
> goto $
My assembler (MPASM) Does the Right Thing when I say
(When I look at the ``.lst'' file, I see that PAGESEL expands to some BSF and/or
BCF instructions, similar to your macros).
Did you know that the bits that control which bank of RAM one can access are
*different* from the bits that control which page of ROM one can GOTO ?
I would write
which works correctly no matter where those items are located.
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email mitvma.mit.edu with SET PICList DIGEST in the body listserv
See also: www.piclist.com/techref/microchip/memory.htm?key=memory
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the