Re: [hatari-devel] EXA demo Entracte : Improvement in search

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


I don't understand something :

According to hatari debug mode, I can read :

cpu video_cyc= 1034 10@ 1 : 0004EB82 4a78 0468 TST.W $00000468 cpu video_cyc= 1038 14@ 1 : 0004EB86 6600 0006 BNE.W #$0006 == $0004eb8e (F) cpu video_cyc= 1046 22@ 1 : 0004EB8A 5240 ADD.W #$00000001,D0 cpu video_cyc= 1048 24@ 1 : 0004EB8C 60f4 BT .B #$fffffff4 == $0004eb82 (T)

If(s the CPU speed loop of EXA demos.
The code runs into the instr cache.

I've taken the 4th iteration (they all take the same time except the first one, which seems OK to me).

If I can rely on the debugger, I read 14 cycles for this iteration.


If I compute the loop by hand, I get :

tst.w $0468.w {2, 2, 8,1,0,0, 12,1,2,0}, // TST.W (xxx).W bne $1cd2a {6, 0, 6,0,0,0, 8,0,1,0}, // Bcc.W (not taken) addq.w #1,d0 {2, 0, 2,0,0,0, 4,0,1,0}, // ADDQ.W #<data>,Dn
bra.s     $1cd1e         {6,    0,     6,0,0,0, 12,0,2,0},    // Bcc (taken)

Which is 8+6+2+6-2 cycles = 20 cycles.

(-2 cycles because of the Head/tail -2 between the first and second instructions)


So, it seems that the loop run faster under hatari than it should, but D0 value is lower than $4100 (it should be higher, no ?)

Laurent







Le 05/02/2017 à 20:14, Laurent Sallafranque a écrit :
Oups, right ;)



Le 05/02/2017 à 19:56, Nicolas Pomarède a écrit :
Le 05/02/2017 à 19:43, Laurent Sallafranque a écrit :
I've got the same value for D0, ie $3e65.

What I find strange is that D0 increase in a loop that waits the time of
a VBL, and it only increase 15 973 times during a VBL ($3e65) ?
I would have expected a much higher value.
At least, the add is a word add, so it may overflow many times during
the test, which also means that the accuracy will have to be very
precise if we must reach this $4100 to $4200 area after many "overflow
loops"

it's normal to have sthg around $4000 : VBL has ~320000s cycle at 16 MHz and the loop takes between 18-20 cycles (it's not just a addq, you have 4 instructions in the loop)

320000/20 = 160000 = $3e80, so $4100-$4200 is correct, there's no overflow









Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/