Assembler Compare cheat sheet
scotta
Posts: 168
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
>
<
>=
<=
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
If you are using signed numbers, just replace CMP with CMPS
Scott
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