> I didn't quite understand the use of
> these procedures. Can you give an
> example please?

It's just a way of hiding the asm part from the user and access arbitrary 
memory locations in a clean and readable way. Example: Outputting bytes from 
memory locations 0x80 to 0xa0:

for 0x20 using counter loop
  serial_hw_data=dereference[0x80+counter]
end loop

 
> This POSTINC1 sounds quite useful & fast. I wonder if
> it should be
> used in sd & hard disk libraries with "if
> defined(POSTINC1)".

It does in fact save quite a lot on execution time and also some code space, 
but I wouldn't use it outside ASM blocks too much as long as Kyle had not 
promised not to use it... 

On PIC12,PIC16... there's only a INDF register for indirect memory access. 
PIC18 additionally has registers POSTINC, POSTDEC, PREINC and PLUSW which also 
do indirect memory acces, but modify the FSR value before or after that. Each 
INDF "module" comes in a group of all of FSRxL, FSRxH, INDFx, POSTINCx, 
POSTDECx, PREINCx and PLUSWx.

There are PICs that only have one INDF, and those that have three. The PICs 
with only one INDF do not have POSTINC, POSTDEC, PREINC or PLUSW. Kyle already 
said he might be using more than one INDF one day. If we did agree that INDF1 
is reserved to the compiler and INDF2 is for users, great. But from what I know 
today, we should regard all INDF related registers as reserved.


> > >Do I understand well when I say this pseudo-var
> would just be a getter or setter for POSTINC ?
> >
> > ... Or, indeed add some overhead, like starting a new
> little lib like...
> > (untested, has to be extended to support 12 and 14bit
> cores, I think)
> >
> > procedure dereference’put ( word in pointer, byte in
> value ) is
> >   assembler
> >     movff pointer, FSR0L
> >     movff pointer+1, FSR0H
> >     movff value,INDF0    
> >   end assembler
> > end procedure
> >
> > procedure dereference’get ( word in pointer ) return
> byte is
> > var byte value
> >   assembler
> >     movff pointer, FSR0L
> >     movff pointer+1, FSR0H
> >     movff INDF0,value    
> >   end assembler
> >   dereference=value
> > end procedure
> >
> > This may take 15 instruction cycles where direct
> access to POSTINC takes only one or two, but it can be made
> quite versatile. It would be an approach to start using
> pointers without compiler support.
> >
> > Greets,
> > Kiste
> 

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to