optimize 2 ;should be set to on because bpm is a basic float value so AB2 must know
                   ;to do all float calculations in IEEEE singel floating point and not in ffp 
timeindex_midi.l  = 768*5000   ; 5000 Bars a 768 Ticks
timeindex_audio.l = 0          ; should be calculated
samplerate.l      = 48000      ; max samplerate
bpm.f             = 255        ; max bpm



; setup data for ASM
Poke.l ?timeindex_midi,timeindex_midi
Poke.l ?timeindex_audio,timeindex_audio
Poke.f ?bpm,bpm
Poke.l ?samplerate,samplerate

;The above pokes are not need if you access var in this way
fmove.l timeindex_midi@(a5),fp0           ; let direct access the basic var


; calculate with FPU
fmove.l timeindex_midi,fp0                ; fp0 = timeinedx_midi.l
fmove.l #5,fp1          : fmul.x fp1,fp0    ; fp0 * 5
fmove.l #16,fp1         : fdiv.x fp1,fp0    ; fp0 / 16
fmove.s bpm,fp1         : fdiv.x fp1,fp0    ; fp0 / bpm.f
fmove.l samplerate,fp1  : fmul.x fp1,fp0    ; fp0 * samplerate.l
fmove.l fp0,timeindex_audio               ; timeindex_audio.l = fp0


; Calculate with blitz
a.f = timeindex_midi
a.f * 5 / 16 / bpm * samplerate
timeindex_audio = a




NPrint "Blitz2: ",timeindex_audio,"  / FPU ASM: ",Peek.l(?timeindex_audio)


VWait 500
End

samplerate:      Dc.l 0
bpm:             Dc.l 0
timeindex_midi:  Dc.l 0
timeindex_audio: Dc.l 0