Shop OBEX P1 Docs P2 Docs Learn Events
Assembler Compare cheat sheet — Parallax Forums

Assembler Compare cheat sheet

scottascotta Posts: 168
edited 2007-02-05 21:42 in Propeller 1
This is a table of assembler compare routines for:
>
<
>=
<=

You may wish the result of a compare to:

Jump if true
Jump if false


Use the following cheat sheet to get it correct the first time:




'********************************************************************************************************************
'*************** JUMP IF STATEMENT IS FALSE*****************************************************************************
'********************************************************************************************************************
:lt_jf
cmp t1,t2 WC,WZ
IF_NC_OR_Z jmp #:lt_jf_false 'if t1 < t2 then jump false
:lt_jf_true
DoStuff

:lt_jf_false
DoStuff





:gt_jf
cmp t1,t2 WC,WZ
IF_C_OR_Z jmp #:gt_jf_false 'if t1 > t2 then jump false
:gt_jf_true
DoStuff

:gt_jf_false
DoStuff






:le_jf
cmp t1,t2 WC,WZ
IF_NC_AND_NZ jmp #:le_jf_false 'if t1 <= t2 then jump false
:le_jf_true
DoStuff

:le_jf_false
DoStuff






:ge_jf
cmp t1,t2 WC
IF_C jmp #:ge_jf_false 'if t1 >= t2 then jump false
:ge_jf_true
DoStuff

:ge_jf_false
DoStuff





'********************************************************************************************************************
'*************** JUMP IF STATEMENT IS TRUE*****************************************************************************
'********************************************************************************************************************
:lt_jt
cmp t1,t2 WC,WZ
IF_C_AND_NZ jmp #:lt_jt_true 'if t1 < t2 then jump true
:lt_jt_false
DoStuff

:lt_jt_true
DoStuff





:gt_jt
cmp t1,t2 WC,WZ
IF_NC_AND_NZ jmp #:gt_jt_true 'if t1 > t2 then jump true
:gt_jt_false
DoStuff

:gt_jt_true
DoStuff






:le_jt
cmp t1,t2 WC,WZ
IF_C_OR_Z jmp #:le_jt_true 'if t1 <= t2 then jump true
:le_jt_false
DoStuff

:le_jt_true
DoStuff






:ge_jt
cmp t1,t2 WC
IF_NC jmp #:ge_jt_true 'if t1 >= t2 then jump true
:ge_jt_false
DoStuff

:ge_jt_true
DoStuff

Comments

  • scottascotta Posts: 168
    edited 2007-02-05 21:31
    A quick note:

    If you are using signed numbers, just replace CMP with CMPS

    Scott
  • bassmasterbassmaster Posts: 181
    edited 2007-02-05 21:42
    thanks, I bookmarked this. While we are at it, I would like·to make a quick tray help app, with this and a·true ascii chart inside of it, so I dont have to look up at my wall chart ( after 10 years of this you would think I had it memorized!)... I can whip out a app in a few hours tonight if anyone wants one.

    Click on the tray icon for a propeller cheat sheet!.

    If anyone is interested in more features, Ill add them. I already have libraries I have written to do this so it wont take long.




    Post Edited (bassmaster) : 2/5/2007 9:46:36 PM GMT
Sign In or Register to comment.