Searching \ for 'Clarification on variables' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=clarification+variables
Search entire site for: 'Clarification on variables'.

Truncated match.
PICList Thread
'Clarification on variables'
1998\03\19@043818 by James & Ili

flavicon
face
Hello,
       I'm just trying to grasp the concept of 2 byte variables.
       Suppose I had a counter and I wanted to count into a
2 byte variable, could I use code like this?

       incf    count, f

or would I have to use something like

       incf    count.low, f
       skpnc
       incf    count.high, f

Would the Carry bit be the one to check or would I check the
Digit Carry?
Pardon my ignorance on this matter.

James & Ili
Irving, TX. 75038

1998\03\19@043818 by James & Ili

flavicon
face
Hello,
       I'm just trying to grasp the concept of 2 byte variables.
       Suppose I had a counter and I wanted to count into a
2 byte variable, could I use code like this?

       incf    count, f

or would I have to use something like

       incf    count.low, f
       skpnc
       incf    count.high, f

Would the Carry bit be the one to check or would I check the
Digit Carry?
Pardon my ignorance on this matter.

James & Ili
Irving, TX. 75038

1998\03\19@071942 by Andrew Warren

face
flavicon
face
James & Ili <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I'm just trying to grasp the concept of 2 byte variables. Suppose I
> had a counter and I wanted to count into a 2 byte variable, could I
> use code like this?
>
> incf    count, f

   James & Ili:

   No; "INCF" works on single registers only.

> or would I have to use something like
>
> incf    count.low, f
> skpnc
> incf    count.high, f

   You have the right idea, but that particular method won't work,
   since "INCF" doesn't affect the Carry flag.

   Instead, you can use the Zero flag:

       incf    countlo
       skpnz
       incf    counthi

   -Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

1998\03\19@071942 by Andrew Warren

face
flavicon
face
James & Ili <PICLISTspamKILLspamMITVMA.MIT.EDU> wrote:

> I'm just trying to grasp the concept of 2 byte variables. Suppose I
> had a counter and I wanted to count into a 2 byte variable, could I
> use code like this?
>
> incf    count, f

   James & Ili:

   No; "INCF" works on single registers only.

> or would I have to use something like
>
> incf    count.low, f
> skpnc
> incf    count.high, f

   You have the right idea, but that particular method won't work,
   since "INCF" doesn't affect the Carry flag.

   Instead, you can use the Zero flag:

       incf    countlo
       skpnz
       incf    counthi

   -Andy

=== Andrew Warren - .....fastfwdKILLspamspam.....ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

1998\03\19@105149 by Jorge Ferreira

flavicon
face
       The carry bit is the one to test as it goes high just after the count.lo
w
overflows from 0xff to 0x00 and that is the time to increment count.high.

       Jorge F



At 23:51 98.03.18 -0600, you wrote:
{Quote hidden}

===============================================================
cumprimentos / best regards
     Jorge Ferreira          //EraseMEjorgegfspam_OUTspamTakeThisOuTmail.telepac.pt
------ Make sure brain is in gear before engaging mouth -------
===============================================================

1998\03\19@105149 by Jorge Ferreira

flavicon
face
       The carry bit is the one to test as it goes high just after the count.lo
w
overflows from 0xff to 0x00 and that is the time to increment count.high.

       Jorge F



At 23:51 98.03.18 -0600, you wrote:
{Quote hidden}

===============================================================
cumprimentos / best regards
     Jorge Ferreira          //jorgegfspamspam_OUTmail.telepac.pt
------ Make sure brain is in gear before engaging mouth -------
===============================================================

1998\03\19@153812 by Michael S. Hagberg

flavicon
face
no the carry is NOT affected by the incf instruction. the zero flag is
affected by the incf instruction.

if you refer to a label as count.low this is a bit, like
ram_location_4.bit_3
to refer to ram byte locations don't use '.' change them to '_' like
count_low and count_high.

   incf    count_low,f
   skpnz
   incf    count_high,f

btw, i know some assemblers let you use skip, skpnz ect. but i have been
mislead by the way it creates the code more than once. now i only use the
microchip instruction set. i did setup equ statements for the status flags
Z,C,DC. that way i can use a statement like btfsc status,z.

michael

{Original Message removed}

1998\03\20@073824 by Caisson

flavicon
face
> Van: James & Ili <@spam@jandiKILLspamspamMPSI.NET>
> Aan: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
> Onderwerp: Clarification on variables
> Datum: donderdag 19 maart 1998 6:51
>
> Hello,
>         I'm just trying to grasp the concept of 2 byte variables.

Remember how you first added 1 to 9. That doesn't fit into one digit. What
did you do ?  You carried the result to the next digit.  Thats all there is
to
it really ... Subtraction is the same.  Just take your 'carry' or 'borrow'
into
the next digit.  If your 'digit' is a byte, so be it.  it does not change
the
concept.

>         Suppose I had a counter and I wanted to count into a
> 2 byte variable, could I use code like this?
>
>         incf    count, f

Yes, but that would only cover the lower-half of your 2-byte variable ...

> or would I have to use something like
>
>         incf    count.low, f
>         skpnc
>         incf    count.high, f

Something like that.  Use 'skpnz' in place of 'skpnc'

> Would the Carry bit be the one to check or would I check the
> Digit Carry?

The Carry bit shows a overflow for 8-bit Subtraction & Addition.
The Digit-carry does the same for the lower nibble (bits 0 thru 3)

Both Carry & Digit-carry are un-affected by Increment/Decrement
instructions

The Zero-flag changes, among others, on a Increment or Decrement.

> Pardon my ignorance on this matter.

If you wouldn't be 'ignorant' I couldn't boast my knowledge ;-)

By the way, we _all_ start ignorant ...  altough some people can't
remember that far back.

> James & Ili
> Irving, TX. 75038

Greetz,
 Rudy Wieser

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