Shop OBEX P1 Docs P2 Docs Learn Events
Carry and Zero flags — Parallax Forums

Carry and Zero flags

pjvpjv Posts: 1,903
edited 2013-07-18 17:24 in Propeller 1
Hi All;

I'm having difficulty in making the Prop behave according to the manual, so I'm suspecting I'm doing something incorrectly.

In particular, the treatment of the Z and C flags when executing a " movi/d/s dest,srce wc/z " instruction.

The manual describes the Z flag treatment, but I cannot get it to correspond.

The manual is silent on the C flag treatment, but does list an example. Again I can't get that to cooperate either.

Could anyone please confirm or refute the manual's results ?

Thanks in advance.

Cheers,

Peter (pjv)

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-07-18 16:26
    Z responds to source, C is unsigned borrow.

    Sorry, wrong insn, source zero is for min/max. movx should respond normally. I check after breakfast.
  • kuronekokuroneko Posts: 3,623
    edited 2013-07-18 16:55
    Works as expected, the first example does not set Z but the second one does. Note that the whole target register must be 0. C remains unsigned borrow.
    DAT             org     0
    
    entry           neg     a, #1
                    movs    a, #0 wz
    
            if_z    or      outa, #1
    
                    mov     a, #4
                    movs    a, #0 wz
    
            if_z    or      outa, #2
    
                    shl     outa, #16
                    mov     dira, mask
    
                    waitpeq $, #0
    
    mask            long    $00FF0000
    a               res     1
    
                    fit
    
  • pjvpjv Posts: 1,903
    edited 2013-07-18 17:24
    Thanks Marko. I missed that "whole target register" part. The way the manual reads is "the value of Value" and I interpreted that incorrectly. My thinking would be that your first example would set the Z. (that's what I need).

    You're always the trooper !

    Cheers,

    Peter (pjv)
Sign In or Register to comment.