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

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


Laurent Sallafranque schrieb:

> The problem is in the 5 last lines : the code test for a min and max 
> value for register DO.
> if D0 is not between $4100 and $4200, the code goes to $4eb1c  and this 
> quit the demo immediatly.

To me this simply looks like a CPU speed test, counting the number of
loop iterations between two VBLs. I'd assume that the demo requires a
certain CPU speed to run correctly and so it wants to quit on (for
example) over-clocked CPUs.

I think the 68030 cycle accuracy of Hatari is not good enough here for
this test to pass.

> ; Here is the code of the compute D0 subroutine
> 
> $0004eb54 : 2f38 fa06                          move.l $fffffa06.w,-(sp)
> $0004eb58 : 41f8 fa07                          lea $fffffa07.w,a0
> $0004eb5c : 7000                               moveq     #0,d0
> $0004eb5e : 0188 0000                          movep.w   d0,0(a0)

This disables the MFP interrupts. Probably so they won't interfere with
the measurement loop below.

> $0004eb62 : 41f8 0080                          lea       $0080.w,a0
> $0004eb66 : f010                               DC.W      $f010
> $0004eb68 : 4200                               clr.b     d0

Note that your disassembler is wrong here, the last two lines should be
pmove tc,(a0), i.e. reading the MMU's Translation Control register.

> $0004eb6a : 0210 007f                          andi.b    #$7f,(a0)
> $0004eb6e : f010 4000                          pmove     (a0),tc

This disables the MMU address translation, maybe because it also could
influence the loop?

> $0004eb72 : 4278 0468                          clr.w     $0468.w
> $0004eb76 : 4a78 0468                          tst.w     $0468.w
> $0004eb7a : 67fa                               beq.s     $4eb76

Wait for a VBL to occur, as you already wrote.

> $0004eb7c : 4278 0468                          clr.w     $0468.w
> $0004eb80 : 7000                               moveq     #0,d0
> $0004eb82 : 4a78 0468                          tst.w     $0468.w
> $0004eb86 : 6600 0006                          bne       $4eb8e
> $0004eb8a : 5240                               addq.w    #1,d0
> $0004eb8c : 60f4                               bra.s     $4eb82

Wait for the next VBL, while incrementing D0.

> $0004eb8e : 41f8 0080                          lea       $0080.w,a0
> $0004eb92 : 0010 0080                          ori.b     #$80,(a0)
> $0004eb96 : f010 4000                          pmove     (a0),tc

Restore address translation.

> $0004eb9a : 21df fa06                          move.l (sp)+,$fffffa06.w

Restore MFP ints.

> $0004eb9e : 4e75                               rts

Regards
Christian
-- 
Christian Zietz  -  CHZ-Soft  -  czietz@xxxxxxx
WWW: http://www.chzsoft.de/
PGP/GnuPG-Key-ID: 0x52CB97F66DA025CA / 0x6DA025CA



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