Shop OBEX P1 Docs P2 Docs Learn Events
Assembly details — Parallax Forums

Assembly details

BuddhaBuddha Posts: 25
edited 2006-07-02 01:52 in Propeller 1
The "Early Propeller Chip Documentation, Rev 0.1" file states that the AND instruction (and several others) set the C flag to the "parity of result". The Assembly Elements document doesn't mention the flag changes for these instructions at all.

Is C actually set in the manner that the low-level documentation suggests? And, if so, is it even or odd parity? [noparse]:)[/noparse]

Thanks for your time!

Comments

  • cgraceycgracey Posts: 14,133
    edited 2006-06-30 02:27
    It will be set if there was an odd number of 1's and cleared if there was an even number of 1's. I think that is called even parity.
    Buddha said...
    The "Early Propeller Chip Documentation, Rev 0.1" file states that the AND instruction (and several others) set the C flag to the "parity of result". The Assembly Elements document doesn't mention the flag changes for these instructions at all.

    Is C actually set in the manner that the low-level documentation suggests? And, if so, is it even or odd parity? [noparse]:)[/noparse]

    Thanks for your time!
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • BuddhaBuddha Posts: 25
    edited 2006-07-02 00:16
    Chip, thanks for the information! But now I have another question... [noparse]:)[/noparse]

    The assembly docs state that the CMPX instruction performs "Compare-extended D to S+C" and CMPSX performs "Compare-signed-extended D to S+C".

    The sign-extension part is throwing me off a little bit. Does this mean that it's actually a 33-bit operation, where S+C can overflow to 33 bits, and D is sign-extended an extra bit before the comparison?

    If it's not a 33-bit operation, then what does the "sign-extended" portion mean? Where does the sign get extended to? [noparse]:)[/noparse]

    Thanks for your time!
  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-02 00:37
    Refer to the "Propellor Guts" document section on ADD, SUB, and CMP for details and examples. Basically, there are variations of the ADD, SUB, and CMP instructions for unsigned 32 bit arithmetic and signed 32 bit arithmetic and extensions to 64 bit multiple precision and greater than 64 bit. The meaning of the Z and C flags varies depending on whether you're dealing with signed quantities or unsigned quantities and whether it's the low order long, middle long or high order long of a multiple precision operation. I've attached a copy of the "Propellor Guts" document since I'm not sure whether it's in a specific public location or just attached to various forum threads.
  • BuddhaBuddha Posts: 25
    edited 2006-07-02 01:52
    Mike, thanks for the heads up! I had been looking at that document before, but didn't realize it had the in-depth overview of those instructions.
Sign In or Register to comment.