Final Countdown - Amiga - Disassembling zob

 Last time we looked at the structure of the executables zob and space. Using a custom tool, we could see that zob is mostly a small (300 bytes) code block, while space has a small code block (612 bytes) and a larger data block (40kb) which is probably compressed code. 

If we disassemble zob, this is what we see. I started to analyze some of it but didn't get far. 

_lbC000000
    movem.l d0-d7/a0-a6, -(a7)  ;; save all registers at addr of A7
    lea     ($dff180).l, a6     ;; $dff180 is a memory register, COLOR00
    lea     (_lbL0000C6,pc), a0 ;; load PC+offset (given by label) into A0
    lea     ($120).l, a1
    move.l  (a0)+, d0
    move.l  (a0)+, d1
    move.l  (a0)+, d5
    movea.l a1, a2
    adda.l  d0, a0 
    adda.l  d1, a2
    move.l  -(a0), d0 
    eor     d0, d5 

_lbC000024
    lsr.l   #$1, d0 
    bne     _lbC00002A

    bsr     _lbC0000A0 

_lbC00002A 
    bcs     _lbC00005E 

    moveq   #$8, d1
    moveq   #$1, d3
    lsr.l   #$1, d0
    bne     _lbC000036

    bsr     _lbC0000A0

The second instruction loads the address of the COLOR00 register into A6. This register controls de background color.

In the third instruction the code references an address (or displacement) that the disassembler called _lbL0000C6, relative to the program counter. There are other labels that are referenced in this block of code and are not in the code itself, specifically the two calls to subroutine (bsr) at _lbC0000A0 and the jumps to _lbC00005E and _lbC000036. We have to analyze the block of code to see what addresses correspond to these labels.

Comments

Popular posts from this blog

How many instructions per frame?

Reference on D88 disk image format