[hatari-devel] Mahabharata demo problem ?

Eero Tamminen oak at helsinkinet.fi
Sun Jan 16 10:31:38 CET 2011


Hi,

On sunnuntai 16 tammikuu 2011, Miro Kropáček wrote:
> > If scanline register value is 320, and bpp gets set to 1 instead of 16:
> > -> width = 5120
> > 
> > And indeed when I traced changes in all of these registers:
> > b (0xff8210).w ! (0xff8210).w :trace
> > b (0xff8266).w ! (0xff8266).w :trace
> > b (0xff8260).b ! (0xff8260).b :trace

In case somebody's unfamiliar with Hatari debugger, here's an explanation 
for above:
* When the expression on both sides of the inequality comparison ("!") are
   exactly the same, the breakpoint happens when the result of that
   expression changes.
* ":trace" means that it's a "tracing" breakpoint which just prints that
   breakpoint was hit, it doesn't stop the execution.

In second breakpoint the expression is value of word at address $0xff8266.

(This is explained in the Hatari manual.)

Btw. A new thing in latest Hatari (after v1.4 release) is that you can even
script what happens on breakpoints.   Set an ":info" breakpoint and use
the "lock" command to cause info to be a debugger script executed from
a given file.

("info" command can show different kind of informations, "lock" command
causes that information to be shown whenever you enter the debugger,
like happens on breakpoints.)

Debugger scripts can do anything that one can do in the debugger otherwise,
get disassembly, set and remove breakpoints etc.


> > Whenever the window goes too wide, I see:
> >  $ff8266 = $400
> > 
> > 2. CPU breakpoint condition(s) matched 1 times.
> > WARNING: too large screen size 5120x240 -> divided by 4x1!
> > 
> >  $ff8266 = $100
> 
> If you can post real disassembly, I can help you with that, I understand
> Videl registers quite well. I'm too stupid to get the idea from this
> trace outputs :)

Well, it only says that $ff8266 was set to $400, after that the resolution
was too wide and after that $ff8266 was set back to $100.  It doesn't
even tell how much time there was between these instructions.


> I'm personally very interested, what / why they do
> here, they are/were beginners in Falcon coding, so I'm really surprised
> they didn't use Evil's demosequencer or something similar for Videl
> init. Maybe they found some neat trick!

Toons Yepyha has also similar strange resolution changes.

Here's disassembly around the point when 2-color resolution is set:

$01cc3e : 4e75                                 rts       
$01cc40 : 4a39 0002 0633                       tst.b     $20633
$01cc46 : 6708                                 beq.s     $1cc50
$01cc48 : 41e8 0024                            lea       $24(a0),a0
$01cc4c : 2010                                 move.l    (a0),d0
$01cc4e : 6756                                 beq.s     $1cca6
$01cc50 : 23c8 0002 061a                       move.l    a0,$2061a
$01cc56 : 2018                                 move.l    (a0)+,d0
$01cc58 : 31d8 8210                            move.w    (a0)+,$ffff8210.w
$01cc5c : 5448                                 addq.w    #2,a0
$01cc5e : 7400                                 moveq     #0,d2
$01cc60 : 43f8 8200                            lea       $ffff8200.w,a1
$01cc64 : 3358 0082                            move.w    (a0)+,$82(a1)
$01cc68 : 3358 0084                            move.w    (a0)+,$84(a1)
$01cc6c : 3358 0086                            move.w    (a0)+,$86(a1)
$01cc70 : 3358 0088                            move.w    (a0)+,$88(a1)
$01cc74 : 3358 008a                            move.w    (a0)+,$8a(a1)
$01cc78 : 3358 008c                            move.w    (a0)+,$8c(a1)
$01cc7c : 3342 008e                            move.w    d2,$8e(a1)
$01cc80 : 3342 0090                            move.w    d2,$90(a1)
$01cc84 : 3358 00a2                            move.w    (a0)+,$a2(a1)
$01cc88 : 3358 00a4                            move.w    (a0)+,$a4(a1)
$01cc8c : 3358 00a6                            move.w    (a0)+,$a6(a1)
$01cc90 : 3358 00a8                            move.w    (a0)+,$a8(a1)
$01cc94 : 3358 00aa                            move.w    (a0)+,$aa(a1)
$01cc98 : 3358 00ac                            move.w    (a0)+,$ac(a1)
$01cc9c : 3358 00c0                            move.w    (a0)+,$c0(a1)
$01cca0 : 3358 00c2                            move.w    (a0)+,$c2(a1)
$01cca4 : 4e75                                 rts       
$01cca6 : 50f9 0002 063d                       st        $2063d
$01ccac : 41f9 0002 0676                       lea       $20676,a0
$01ccb2 : 23c8 0002 0636                       move.l    a0,$20636
$01ccb8 : 588f                                 addq.l    #4,sp
$01ccba : 6000 0e08                            bra       $1dac4
$01ccbe : 21fc 0000 0000 9800                  move.l    #0,$ffff9800.w
$01ccc6 : 21fc 0000 0000 9804                  move.l    #0,$ffff9804.w
$01ccce : 31fc 0400 8266                       move.w    #$400,$ffff8266.w
$01ccd4 : 4e75                                 rts       
$01ccd6 : 31fc 0100 8266                       move.w    #$100,$ffff8266.w
$01ccdc : 4e75                                 rts       

2-color mode is set at $01ccce and a jump there is at $01cc4e.


Here's what's done where the code branched:

> disasm $1dac4
$01dac4 : 46fc 2700                            move      #$2700,sr
$01dac8 : 4a39 0002 0632                       tst.b     $20632
$01dace : 671e                                 beq.s     $1daee
$01dad0 : 3039 0002 0634                       move.w    $20634,d0
$01dad6 : 6606                                 bne.s     $1dade
$01dad8 : 6100 fd16                            bsr       $1d7f0
$01dadc : 6010                                 bra.s     $1daee
$01dade : 0c40 0002                            cmpi.w    #2,d0
$01dae2 : 6706                                 beq.s     $1daea
$01dae4 : 6100 fcf0                            bsr       $1d7d6
$01dae8 : 6004                                 bra.s     $1daee
$01daea : 6100 fcd0                            bsr       $1d7bc
$01daee : 6100 fe6c                            bsr       $1d95c
$01daf2 : 4a39 0014 cdfb                       tst.b     $14cdfb
$01daf8 : 6704                                 beq.s     $1dafe
$01dafa : 6100 0198                            bsr       $1dc94
$01dafe : 103c 0008                            move.b    #8,d0
$01db02 : 6100 f8ba                            bsr       $1d3be
$01db06 : 6100 f8a6                            bsr       $1d3ae
$01db0a : 46fc 2300                            move      #$2300,sr
$01db0e : 4a39 0002 063d                       tst.b     $2063d
$01db14 : 671a                                 beq.s     $1db30
$01db16 : 2f39 0002 0636                       move.l    $20636,-(sp)
$01db1c : 3f3c 0009                            move.w    #9,-(sp)
$01db20 : 4e41                                 trap      #1
$01db22 : 5c8f                                 addq.l    #6,sp
$01db24 : 3f3c 0007                            move.w    #7,-(sp)
$01db28 : 4e41                                 trap      #1
$01db2a : 548f                                 addq.l    #2,sp
$01db2c : 4a80                                 tst.l     d0
$01db2e : 67f4                                 beq.s     $1db24
$01db30 : 2039 0001 db3e                       move.l    $1db3e,d0
$01db36 : 6100 f0e4                            bsr       $1cc1c
$01db3a : 4267                                 clr.w     -(sp)
$01db3c : 4e41                                 trap      #1
$01db3e : 0000 8870                            ori.b     #$70,d0
$01db42 : 4a10                                 tst.b     (a0)
$01db44 : 6b48                                 bmi.s     $1db8e
$01db46 : 613e                                 bsr.s     $1db86
$01db48 : 0838 0001 a202                       btst      #1,$ffffa202.w
$01db4e : 67f8                                 beq.s     $1db48
$01db50 : 21c0 a204                            move.l    d0,$ffffa204.w
$01db54 : 6130                                 bsr.s     $1db86
$01db56 : 0838 0001 a202                       btst      #1,$ffffa202.w
$01db5c : 67f8                                 beq.s     $1db56
$01db5e : 21c0 a204                            move.l    d0,$ffffa204.w
$01db62 : 6122                                 bsr.s     $1db86
$01db64 : 0838 0001 a202                       btst      #1,$ffffa202.w
$01db6a : 67f8                                 beq.s     $1db64
$01db6c : 21c0 a204                            move.l    d0,$ffffa204.w
$01db70 : 2200                                 move.l    d0,d1
$01db72 : 6112                                 bsr.s     $1db86
$01db74 : 0838 0001 a202                       btst      #1,$ffffa202.w
$01db7a : 67f8                                 beq.s     $1db74
$01db7c : 21c0 a204                            move.l    d0,$ffffa204.w
$01db80 : 5381                                 subq.l    #1,d1
$01db82 : 66ee                                 bne.s     $1db72
$01db84 : 60bc                                 bra.s     $1db42
$01db86 : 7000                                 moveq     #0,d0
$01db88 : 1018                                 move.b    (a0)+,d0
$01db8a : 4840                                 swap      d0
$01db8c : 3018                                 move.w    (a0)+,d0
$01db8e : 4e75                                 rts


Getting a trace of the whole instruction flow so that we would know
exactly what happens before this register is set isn't so easy because
setting of the 2-color mode happens very rarely so the trace would
be monstrous in size.


	- Eero



More information about the hatari-devel mailing list