Searching \ for '16C84 Indirect Addressing' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16C
Search entire site for: '16C84 Indirect Addressing'.

Truncated match.
PICList Thread
'16C84 Indirect Addressing'
1997\04\03@201105 by )

flavicon
face
I think I already know the answer to this, but.....

Are the following valid:

               incf    INDF,F          ;Increment register pointed to
by INDF and save in register
                                       ;pointed to by INDF

or

               subwf   INDF,F          ;Subtract W from register
pointed to by INDF and place
                                       ;result in register pointed to
by INDF

I need to do some operations on some consecutive registers, and was
hoping (foolishly) that the above would be valid. The comments are how I
would want the operation to behave. Is this another variation on
something like "incf W,W", that will compile fine, but generate useless
code?


Frank Richterkessing
Experimental Methods Engineer
GE Appliances

spam_OUTFRANK.RICHTERKESSINGTakeThisOuTspamAPPL.GE.COM

1997\04\03@222429 by Steve Hardy

flavicon
face
> From: "Richterkessing, Frank H (GEA, 055132)"
>               <.....FRANK.RICHTERKESSINGKILLspamspam@spam@APPL.GE.COM>
>
> I think I already know the answer to this, but.....
>
> Are the following valid:

Yes, looks OK to me except the comment is wrong.  INDF itself does not
do the pointing.  Rather, a register called FSR contains the address of
the register to operate on.  FSR is otherwise just an ordinary
register, however its value is automatically accessed when you refer to
INDF.

{Quote hidden}

e.g. use the following

       movlw   reg1
       movwf   fsr             ; set fsr to point to reg1.
       incf    indf,f          ; increment reg1 (via indirection)
       incf    fsr,f           ; point to next reg after reg1
       incf    indf,f          ; increment the next reg after reg1.

I have often wished the assembler would support the following
syntax (but it doesn't):

       incf    [fsr],f

instead of

       incf    indf,f

Regards,
SJH
Canberra, Australia

1997\04\03@222640 by TONY NIXON 54964

flavicon
picon face
Looks Ok to me.

You can even dispense with the (,f) as the compiler will understand
that you do not want the result placed in W.

Tony


Just when I thought I knew it all,
I learned that I didn't.

1997\04\03@223104 by Andrew Kovalev

flavicon
face
> Are the following valid:
>
>                 incf    INDF,F          ;Increment register pointed to
>                                                       ;by INDF and save in reg
ister
>                                         ;pointed to by INDF
>                 subwf   INDF,F          ;Subtract W from register
>                                                       ; pointed to by INDF and
place
>                                         ;result in register pointed to by
INDF
Partially. Would work fine. Comments are not quite right!
I would say
       INCF    INDF,F          ; inc reg pointed by FSR and safe to reg pointed
by FSR
                                       ; or in mnemonics form
       SUBWF   INDF,F          ; @FSR = @FSR-w
                                       ; ensure F=1
>
> I need to do some operations on some consecutive registers, and was
> hoping (foolishly) that the above would be valid. The comments are how I
> would want the operation to behave. Is this another variation on
> something like "incf W,W", that will compile fine, but generate useless
> code?

Not at all. That is what FSR for. INDF mnemonics just help to access
register
pointed by FSR.
Example:
       movlw           0x20
       movwf           FSR             ; init pointer
       incf            INDF, 1 ; inc 0x20 reg
       incf            FSR, 1  ; inc pointer
       incf            INDF, 1 ; inc 0x21 reg (conscutive)

> Frank Richterkessing

                            sincerely yours, Andrew.

1997\04\03@223437 by John Payson

picon face
> Are the following valid:
>
>                 incf    INDF,F          ;Increment register pointed to
> by INDF and save in register
>                                         ;pointed to by INDF

Should be fine, though some assemblers prefer IND.

>                 subwf   INDF,F          ;Subtract W from register
> pointed to by INDF and place
>                                         ;result in register pointed to
> by INDF

Ditto.

1997\04\04@033049 by Andrew Warren

face
flavicon
face
Steve Hardy <PICLISTspamKILLspamMITVMA.MIT.EDU> wrote:

> I have often wished the assembler would support the following
> syntax (but it doesn't):
>
>         incf    [fsr],f
>
> instead of
>
>         incf    indf,f

Steve:

That's why I equate register 0 to "USEFSR" instead of "INDF".  It's
not EXACTLY what you're looking for, but it does give the same hint
to anyone who reads my source code.

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam.....ix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...