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

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


Hi,

I've managed to see EXA Entracte demo under current hatari (that's a nice demo).
In general, it returns immediatly to the desktop.

I write this mail to keep a trace of my recent search with this demo and share it with you.

I explain how to see it and I give you the info where it goes wrong (I don't understand it completly but maybe it'll ring a bell for you).


So, I've done the following to see it :

> b pc=text
> c

Run "entracte.prg"

You put a breakpoint at the beginning of the demo, then disasm the first instructions.

>d
$0004e7a8 : 4879 0020 0000                     pea       $200000
$0004e7ae : 4e41                               trap      #1
$0004e7b0 : 41fa 021a                          lea $4e9cc(pc),a0
$0004e7b4 : 4dfa 0014                          lea $4e7ca(pc),a6
$0004e7b8 : 4bfa 01d6                          lea $4e990(pc),a5
$0004e7bc : 21ce 030c                          move.l    a6,$030c.w
$0004e7c0 : 21cd 0310                          move.l    a5,$0310.w
$0004e7c4 : 4e96                               jsr       (a6)
$0004e7c6 : 4e95                               jsr       (a5)
$0004e7c8 : 4ed0 jmp (a0) ; <------ Breakpoint here

Then, you put a breakpoint at the jump instruction

> b pc=$4e7c8
> c


When you reach the breakpoint, you execute it, then, disasm the code again.

> c 1
> d
$0004e9e8 : 4ff9 0008 ce48                     lea       $8ce48,sp
$0004e9ee : 203c 0040 0000                     move.l    #$400000,d0
$0004e9f4 : 0480 0008 d24a                     subi.l    #$8d24a,d0
$0004e9fa : 0480 0000 3000                     subi.l    #$3000,d0
$0004ea00 : 6b00 0130                          bmi       $4eb32
$0004ea04 : 4879 0058 ffff                     pea       $58ffff
$0004ea0a : 4e4e                               trap      #$e
$0004ea0c : 33c0 0008 ce48                     move.w    d0,$8ce48
>
$0004ea12 : 6100 018c                          bsr       $4eba0
$0004ea16 : 4e7a 0002                          movec     cacr,d0
$0004ea1a : 23c0 0004 fdca                     move.l    d0,$4fdca
$0004ea20 : 203c 0000 3111                     move.l    #$3111,d0
$0004ea26 : 4e7b 0002                          movec     d0,cacr
$0004ea2a : 6100 0128 bsr $4eb54 <----- call subroutine to compute D0

$0004ea2e : b07c 4100                          cmp.w     #$4100,d0
$0004ea32 : 6f00 00e8 ble $4eb1c <----- quit the demo
$0004ea36 : b07c 4200                          cmp.w     #$4200,d0
$0004ea3a : 6e00 00e0 bgt $4eb1c <----- quit the demo


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.

So, I've added a breakpoint at the beginning of the first test and I change the value of D0 to $4150.

b pc=$4ea2e
r d0=$4150
c

And the demo runs well to the end.



; ------ Now, let's see what happens here ;)

The problem is in the 5 last instructions test:
-   it computes a value into D0      (bsr       $4eb54)
-   then, it tests if this value is between $4100 and $4200
-   if not, it quits the demo immediatly

The subroutine codeis given just below.
From what I understand, they wait 1 VBL, then use d0 as a counter during 1 VBL, then test the value of D0.

Does this code (the bsr subroutine part) tells something to you ?


; These lines seems to wait a VBL

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

; The next ones seem to wait another VBL and increase D0 during this time.


; 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)
$0004eb62 : 41f8 0080                          lea       $0080.w,a0
$0004eb66 : f010                               DC.W      $f010
$0004eb68 : 4200                               clr.b     d0
$0004eb6a : 0210 007f                          andi.b    #$7f,(a0)
>
$0004eb6e : f010 4000                          pmove     (a0),tc
$0004eb72 : 4278 0468                          clr.w     $0468.w
$0004eb76 : 4a78 0468                          tst.w     $0468.w
$0004eb7a : 67fa                               beq.s     $4eb76
$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
$0004eb8e : 41f8 0080                          lea       $0080.w,a0
$0004eb92 : 0010 0080                          ori.b     #$80,(a0)
$0004eb96 : f010 4000                          pmove     (a0),tc
$0004eb9a : 21df fa06                          move.l (sp)+,$fffffa06.w
$0004eb9e : 4e75                               rts


Regards
Laurent





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