Disassembling games - Fire Shark

trm

Who loves you, and who do you love?
Feedback
2 (100%)
Credits
2,877CR
As I've posted before I've got a Fire Shark board with problems. Attacking the hardware hasn't enlightened me much because of interesting design choices, and the 'well intentioned' POST is actually causing me lots of problems so I decided the best plan was to disassemble the game code, see how it works and then modify it to ultimately produce a test ROM a la Galaxians so that people with a duffer could burn a pair of ROMs and run something to help with diagnostics.

Well, I lost my first disassembly due to full retard mode and shuffling my main Windows install. So I restarted on Friday night from scratch and I've now got an almost fully commented disassembly of the non-game code - the self-test routines and diagnostics, as you can see if you look in the ukvac FB group https://www.facebook.com/groups/ukvac

At the moment I have a full understanding of what the POST does and how it does it, but it's all contained in an IDApro IDB file. Would anybody want to see an export of this that can be viewed without IDA?

Do you want to see how a game works?

(The IDA HTML dump is 70 MB so I need to investigate why it's soooo huge!)

My second objective is to produce some custom ROMs that you can plug into a non-working board that'll do their best to boot, report any faults as accurately as possible and ultimately do their best to run no matter the fault and give you an active board to probe about, instead of something that HALTs as soon as a fault is identified. From looking at the HW in MAME I think these ROMs will help anybody with a same-platform game so hopefully they'll be useful for other games on this HW and not just Fire Shark/Same Same.

So, any interest in this? Is anybody interested in the steps I've taken to patch out the helpfulness of the original code, keep the game running even though the HW has issues, and then the process of designing, creating and packaging the test ROMs?

I'm doing this whether I'm the only person to benefit or whether it appeals to 90% of VACcers but I figure that other than the awesome staff
smiley4.gif
, people come here because we have technical shizzle that's found infrequently on the internet so let me know whether you'd be interested in some pretty hardcore geek posts on what I've done, why, and how it's worked.

Oh yeah, and I've got an itch that needs scratching about porting a cool game to 68k hardware that a crappo footy-style game runs on. Kind of like a Pac2013.

TL;DR: Interest check in following in the vein of cmonkey but with a different architecture and game. Or choosing a game to see the (hopeful, I'm no macro so no promises) port from r@r3 hardware to common & sucky that people can do by burning ROMs and decimating the original HW price ;)
 

trm

Who loves you, and who do you love?
Feedback
2 (100%)
Credits
2,877CR
Right, clearly enough interest so it's a go
smiley1.gif


I'm watching the Suzuka GP and then I'll have a quick once-over of my work so far then find some way of exporting my current progress.
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,659CR
Is the plan to reverse the entire game, as I am doing with Pac-Land, or merely to reverse the boot process/service menu to be able to create custom diagnostic roms?
 

trm

Who loves you, and who do you love?
Feedback
2 (100%)
Credits
2,877CR
So far I've reversed the boot process so I understand enough to patch out the "stop if RAM error detected" behaviour, so I can troubleshoot the board whilst it's running by seeing real activity.

I did this, burnt new ROMs and it's working great. I can now start and play the game whilst poking around to see where the fault lies. I'm going to code up some more useful test routines shortly.

But as I was doing this I found I was enjoying getting back into it so I started thinking about taking the whole game back to commented source so I could look at porting it onto similar-ish commodity hardware - inspired by Macro's Pac on WC90 hack. That's my current focus but I'm trying to drill in to where the customs are used and how tricky it'll be to a) understand what hardware the game is taking advantage of and b) either find hardware that's got close-ish functionality I can convert to, or code up 68000 code to replace the custom functions.

A seemingly accurate description of the hardware capability is

"The games has 4 layers, each tile (8x8 pixel graphic unit) in each layer has one of 15 possible priority values or 0 for "off". The system has up to 256 sprites which can be any size from 8x8 pixels to 128x128 pixels specified in a separate size table. Each sprite has a priority value from 1 to 15 which is shared with the layers."

which doesn't seem a very tall order to match on something else, so I'm hoping there's a crappy 68k footy game out there which fits :)
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,659CR
If you're planning on a full code reversal/analysis then set aside about 9-12 months of your life! I'm about half way through Pac-Land and I've been doing it pretty much consistently for 4 months.

I have the utmost admiration for anyone who takes on such an immense task but the rewards can be amazing, especially if (and usually when) you find hidden tiles/sprites/levels/music/etc that have never been seen by anyone other than the original dev team.

Good luck!
smiley20.gif


EDIT : btw, the MAME driver will be invaluable to you in understanding how the CPU speaks to the customs.

cmonkey2013-10-13 22:04:26
 
  • Like
Reactions: trm

Zabanitu

User
Credits
330CR
hello,
i had to reverse the ram check routine in order to fix a SUPER BREAKOUT pcb by ATARI.
the self test indicated 2 bad ram bits, but the fluke 9010a said nothing was wrong...
in the end it was the watchdog disable command "STA $C80" that due to a faulty TTL in the memory mapper circuit was going to rewrite values in the real ram address $480 !!!

i didn't have the intention to disassemble anything.... just had to check what was going on.
sure enough disassembling a 68k or a modern game would be a pain in the arse.
even PacLand on 6809 is HArd

Code:
;
; ───────────────────────────────────────────────────────────────────────────
; File Name   :    I:Downloadsarcadesuper_breakoutsb4_dumpsb4d.txt
; Format      :    Binary file
; Base Address:    0000h Range: 2C00h - 3FFFh Loaded length: 13FFh

; ; Processor:          M6502
; ; Target assembler: SVENSON ELECTRONICS 6502/65C02 ASSEMBLER - V.1.0 - MAY, 1988

; ═══════════════════════════════════════════════════════════════════════════

; Segment type:    Pure code
        ;.segment ROM
        * =  $2C00
        JMP    ResetVect
; 
******** SNIP ***********
───────────────────────────────────────────────────────────────────────────
; START    OF FUNCTION CHUNK FOR sub_344F

ResetVect:                ; CODE XREF: ROM:2C00j    sub_344F-2ABj ...
        CLD            ; clear    decimal
        LDX    #$7F ; ''
        TXS            ; SP is    loaded with #$(1)7F
        LDA    #0
        STA    $C50
        STA    $C60
        STA    $C70        ; clears coin counter
        TAX            ; transfer A (=0) to X

loc_3C9D:                ; CODE XREF: sub_344F+851j
        STA    0,X        ; clears RAM memory from $00 to    $ff ($00-$7F)
        INX
        BNE    loc_3C9D
        LDA    #$FF
        STA    $1B        ; ram $1B = FF
        STA    $1D        ; ram $1D = FF
        LDA    $8C0        ; load SELFTEST    / SLAM switch states (bit 7 or 6)
        BPL    SelfSlam    ; branch on plus
        CLI            ; clear    Int dis. bit
        JMP    loc_2C03
; ───────────────────────────────────────────────────────────────────────────

SelfSlam:                ; CODE XREF: sub_36C9+7Cj
                    ; sub_344F+85Cj
        SEI            ; set int. disable
        LDX    #0
        STX    $C50        ; NMI pot reading
        STX    $C60        ; ?

FillRam:                ; CODE XREF: sub_344F+888j
        TXA            ; X->A (=0)
        CLC            ; clear    carry
        ADC    #4        ; add with carry
        STA    $400,X        ; 4->$400, 5->$401....
        CLC
        ADC    #1
        STA    $500,X        ; 5->$500, 6->$501....
        CLC
        ADC    #1
        STA    $600,X        ; 6->$600, 7->$601....
        CLC
        ADC    #1
        STA    $700,X        ; 7->$700, 8->$701....
        STA    $C80        ; pat the watchdog
        INX            ; X++
        BNE    FillRam        ; loop to fill screen (creates 3 columns of chars

RamChkLoop:                ; CODE XREF: sub_344F+8B2j
        TXA            ; start    to verify previously written memory pattern
        CLC
        ADC    #4
        EOR    $400,X
        BNE    RamFail
        TXA
        CLC
        ADC    #5
        EOR    $500,X
        BNE    RamFail
        TXA
        CLC
        ADC    #6
        EOR    $600,X
        BNE    RamFail
        TXA
        CLC
        ADC    #7
        EOR    $700,X
        BNE    RamFail
        STA    $C80        ; WD
        INX
        BNE    RamChkLoop    ; loop to check    memory correctly written pattern
        TXA

ClearRam:                ; CODE XREF: sub_344F+8C2j
        STA    $400,X        ; fill memory with '0'
        STA    $500,X
        STA    $600,X
        STA    $700,X
        INX
        BNE    ClearRam    ; loop to clear    memory 400-7FF
        BEQ    loc_3D47    ; memory is cleared... continue    execution

RamFail:                ; CODE XREF: sub_344F+891j
                    ; sub_344F+89Aj ...
        SEC            ; set Carry flag

loc_3D16:                ; CODE XREF: sub_344F+8EBj
        ROR    A        ; ROR A
        BEQ    EscapeSelfTest
        LDX    #8        ; 8->X
        BCC    PlayBeep    ; branch on carry clear
        LDX    #1        ; 1->X

PlayBeep:                ; CODE XREF: sub_344F+8CCj
        STX    $11        ; 1->$11 = HI PITCH TONE = BAD BIT
        LDX    #0
        LDY    #0

loop1:                    ; CODE XREF: sub_344F+8D7j
                    ; sub_344F+8DDj
        INX
        BNE    loop1        ; X++
        STA    $C80        ; WD
        INY            ; Y++
        BNE    loop1
        STX    $11        ; X (=0)->$11 -    sound mute

loop2:                    ; CODE XREF: sub_344F+8E2j
                    ; sub_344F+8E8j
        INX            ; X++
        BNE    loop2
        STA    $C80        ; WD
        INY            ; Y++
        BNE    loop2
        CLC            ; clear    Carry
        BEQ    loc_3D16    ; loop

EscapeSelfTest:                ; CODE XREF: sub_344F+8C8j
                    ; sub_344F+8F3j
        STA    $C80        ; WD
        BIT    $8C0        ; test bits 7 and 6
        BPL    EscapeSelfTest    ; branch on result plus    (N=0) -    wait until SELFTEST is released    ?
        JMP    ResetVect    ; restart game
; ───────────────────────────────────────────────────────────────────────────
Zabanitu2013-10-13 22:19:22
 
  • Like
Reactions: trm

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,659CR
Actually, you may have picked a bad game to fully reverse, at least if you're planning on having an easy path to audio in any potential rewrite. This is because the internal rom code which sits inside the HD647180 MCU hasn't been dumped yet. This is why there's no sound in the game in MAME.

So, unless you've got the facility to dump the contents of the internal rom (I believe the chip is a QFP-80) then you're faced with either implementing your own audio engine in any rewrite or you'll need to record the audio from the original game to an audio file and then put your headphones on and play it back from your iPod when you play the rewrite, to give you that authentic feel!
smiley36.gif
 
  • Like
Reactions: trm
Top