Shop OBEX P1 Docs P2 Docs Learn Events
Z flag question — Parallax Forums

Z flag question

ratronicratronic Posts: 1,451
edited 2007-04-08 22:29 in Propeller 1
In the asm code examples for the beginner about 8 post down talks about using a mask. All 3 examples use
mov t1, #1·· ·wz·········· Is the z flag always set to 0 because of a 1 was just put in the destination register?


·······························Thanks, Dave.····································

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fix it if ain't broke·
D Rat

Comments

  • JossJoss Posts: 32
    edited 2007-04-03 21:58
    Yes. The Z flag is set to 0. You could move a 0 into a variable and Z would always be set to 1.

    It's really killing 2 birds with one stone in the code. It sets the Z flag for later use with the mux instructions and readies a '1' bit in the variable for shifting to the desired pin.

    Regards
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-04-03 21:58
    Mov destination, value

    "If the WZ effect is specified, the Z flag is set (1) if Value equals zero." From manual.

    So yes if destination is one Z flag will be zero.

    Graham
  • ratronicratronic Posts: 1,451
    edited 2007-04-03 22:05
    Thanks Graham, I just needed some body in the now to confirm what I was reading, I tested it led on P16 i just wanted make sure I was doing it right!·· Thanks Dave.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it if ain't broke·
    D Rat
  • KaioKaio Posts: 253
    edited 2007-04-06 22:07
    ratronic,

    you can verify such questions very easy if you are using POD. Put your statement as second in AsmDebugDemo.spin in DAT section and load PropDebugger.spin to your Propeller. It shows you the flag registers after executing the instruction while pressing F6.

    Thomas
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-07 00:28
    Z is true if it is false that the variable is true (not zero)

    And as Mike noted... you don't have to use wz when you first drop in to the assembly because it is cleared for you.

    I had that in my first go at a blinker... which is blinking at the rate... I haven't measured it but I estimate about once every 17 seconds....and there doesn't seem to be anything I can do about it.

    So... it is not absolutely true everything is faster in assembly... only those things that you properly code!!!!


    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-07 00:32
    or maybe z is false if it is true that the variable is false?

    one of them has to be right[noparse]:)[/noparse]
  • ratronicratronic Posts: 1,451
    edited 2007-04-08 22:29
    Thank you for the info!

    RJO_ I really enjoyed your piece on passm for non pragrammers, I would certianly like to see some more subjects covered! The other stuff is entertianing and funny too.

    Kaio I need a little more info about getting the register values to show up as your testing your program,

    maybe Rjo_ could write it to put some entertainment to it!.· Thanks everybody, Dave.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it if ain't broke·
    D Rat
Sign In or Register to comment.