Sub decode(w As Int, bits As Int, f As TFf) As TFf
Dim a,b,c,d As Int
If bits=13 Then
If Bit.And(w,0x0010)=0 Then 'is always 0
Else
' Delphi code
' i:= ( (w AND $000f) OR ((w AND $0020) shr 1) OR ((w AND $1F80) shr 2) ) * 25 - 1000;
a=Bit.And(w,0x000F)
b=Bit.And(w,0x0020)
b=Bit.unsignedShiftRight(b,1)
a=Bit.Or(a,b)
b=Bit.And(w,0x1F80)
b=Bit.unsignedShiftRight(b,2)
a=Bit.Or(a,b)
a=Bit.And(a,0x07ff) 'for whatever
f.alt=a*25-1000
End If
Return f
End If
End Sub