09-05-2017, 01:09 PM
Just got around to this. There's a 2-frame window normally, but a 0 frame window with your code. I assumed the number would be the same, giving half the window there should be in real-time, but no. Strange.
loc_0x0:
lfs f18, 0(r2)
fsubs f17, f18, f18 ; 0
fdivs f23, f18, f18
fadds f23, f23, f23 ; make 2
fmuls f20, f18, f23 ; make 360
fdivs f21, f18, f23 ; make 90
loc_0x18:
fabs f19, f0
fcmpo cr0, f0, f17 ; check for 0
fdivs f16, f19, f0 ; sign of f0
bne+ loc_0x2C
fdivs f16, f18, f18 ; force sign to 1 if it was 0
loc_0x2C:
fcmpo cr0, f19, f18 ; f19 abs compare 180
ble+ loc_0x44
fmuls f22, f20, f16 ; 360 with same sign as f0
fsubs f0, f0, f22 ; subtract 360 if above 180, add 360 if below -180
fabs f19, f0 ; abs tracking
loc_0x44:
fcmpo cr0, f19, f21 ; f19 abs compare 90
ble+ loc_0x50
fneg f16, f16 ; sign tracking
fmuls f22, f18, f16
fsubs f0, f22, f0
loc_0x50:
fcmpo cr0, f21, f24 ; loop once
beq+ loc_0x68 ; skip on first loop
fmr f24, f21 ; copy
fmr f25, f0 ; copy result
fmr f0, f31 ; set f0 to frame 1
b loc_0x18 ; loops back
loc_0x68:
fsubs f0, f0, f25 ; difference