View Single Post
Old 31 May 2021, 11:15   #9
buzzybee
Registered User
 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 526
Quote:
Originally Posted by robinsonb5 View Post
If you don't actually need the absolute values once the comparison is done (and assuming the acceleration values are always less than half the range of a word), you could both add and subtract the values; if the absolute value of the second operand is larger than the first, then at least one of the two calculations will cross zero and set the carry flag. (untested, so beware of typos - but the logic should be sound.)

Code:
    move.l objectListAcc(a2),d7    ; get x- and y-acceleration
    move.w d7,d0                ; fetch y-acceleration in world 
    move.w viewPosition+vPyAccConvertWorldToView(pc),d6
    sub.w d6,d0 ; convert to y-acceleration in view
    swap    d7
    move.w    d7,d6
    add.w    d0,d6
    scc    d6
    sub.w    d0,d7
    scc    d7
    or.w    d7,d6 ; D6 is set if either the add or sub generated a carry.
Will test that later. Thanks a lot!
buzzybee is offline  
 
Page generated in 0.05092 seconds with 11 queries