PIC vs 68K compiler (was: CCS - conversions)
Harold Hallikainen email (remove spam text)
The use of RAM paging, as has been pointed out here, is due to the
limited instruction size and the desire to get the whole address in that
instruction so that instructions take a single word.
It seems, however, that most RAM locations are actually used for local
dynamic (as opposed to static) variables, which could be allocated when
going into a subroutine, and released when going out of the routine.
These could be located on a (larger) stack and referenced by the stack
pointer or a base pointer. Inside a routine, we might have an
instruction that allocates so many bytes of variables, moves the stack
and moves the stack pointer down the appropriate amount. References to
local variables would then just be stack+1, stack+2, etc. This would
allow very short instructions, since only a few bits would be needed to
uniquely identify the local dynamic variable on the stack.
To release the local variables, we could just increment the stack
pointer by the appropriate amount, or the "allocate local variables"
instruction might store the number of locations used on the stack. Then
the amount to be released could be pulled off the stack.
This could be a larger stack that is shared with subroutine and
interrupt addresses, or could be a stack in data ram (like the 6809)
(perhaps using FSR in those machines with more than one FSR).
It'd be interesting to maybe use bank 0 of RAM on a machine with an
extra FSR for global and static variables, then use bank 1 for dynamic
variables on a stack referenced by FSR. We'd never have to bank switch!
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]
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