Shop OBEX P1 Docs P2 Docs Learn Events
CMP is PASM question — Parallax Forums

CMP is PASM question

jmspaggijmspaggi Posts: 629
edited 2010-04-18 01:17 in Propeller 1
Hi,

I'm trying to compare a value with 2. So I'm goind:

           rdbyte Temp, TopAddr
           cmp Temp, #2
IF_A    jmp #Above




My problem is that whatever Temp value is, it's always jumping.

First loop, Temp value is 3, so it's correct. 2nd loop, it's 2, and
3rd loop it's 1. But it's always jumping. I think I'm doing something
wrong with the way I'm using CMP. Can someone please correct me?

Thanks,

JM

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-04-18 00:34
    Depending on what condition you're going to use, add wc,wz to your compare instruction. IF_A would require both of them.
  • jazzedjazzed Posts: 11,803
    edited 2010-04-18 00:36
    @JM,
    For a conditional to work correctly, the instruction that might set the condition must specify the wc and/or wz effect.
      cmp Temp, #2 wc,wz
      if_a jmp #Above
    
    


    Presumably, niether Carry nor Zero flags have been set and that causes if_a to execute. if_a is same as if_nc_and_nz.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • jmspaggijmspaggi Posts: 629
    edited 2010-04-18 01:17
    Ok! I see!

    Thanks all for your prompt replies!

    There is still some reflex I need to develop [noparse];)[/noparse]

    I will continue to debug to find my other issues.

    JM
Sign In or Register to comment.