Deep Sea Source

Discuss the games, programs, utilities... and vaporware!
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Deep Sea Source

Post by Mobsie » Tue Oct 25, 2022 10:48 am

After a sleepless night and some drinks i have a working source code of the DeepSea game.

With working i mean you can assemble it with dasm to a running game.

I will do some clean up also comments and then post here if interesting for someone.

And maybe there will be a harder DeepSea 2😎

Cheers
Mike
User avatar
Scouter3d
Posts: 646
Joined: Mon Jun 28, 2010 7:02 am
Location: Wien
Contact:

Re: Deep Sea Source

Post by Scouter3d » Tue Oct 25, 2022 11:05 am

Cool!
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Deep Sea Source

Post by cheshirenoir » Wed Oct 26, 2022 1:24 am

Nice work Mobsie!
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Deep Sea Source

Post by @username@ » Wed Oct 26, 2022 4:16 pm

I thought it would be cool to compare how different people would approach this.

Here's my take on how to get a disassembly which can then be recompiled in about 10 minutes, in the case of Deep Sea Rescue 6K.

Using Mame you can save some time to get the ROM aligned as a single block.

Load mame in debug mode mame crvision deepsea -debug

Once loaded, save the ROM contents from the debug window save deepsea.bin,a800,1800

Open a memory window and go to BFE8 - this is the entry point to the ROM, which here is $B4E6

Skip the startup code with g B4E6 then start an execution trace with trace deepsea.trc

Now type g to continue and play the game a little.

When you're bored killing sea creatures - return to the debugger and save RAM and VRAM with save ram.bin,0:u2,400 then save vram.bin,0:u3,4000

The trace file and memdumps are solely to help identify code from data - and also give hints at where vector tables are being used etc.

Rather than troll through a huge execution trace, on windows just do sort /unique deepsea.trc > deepsea.uni

On linux you can use sort and pass that to uniq.

At this point deepsea.uni contains the unique execution addresses - so compare with a disassembly to ensure it has not treated any code as data.

As the target assembler is DASM, you may have to play with the assembly listing to match the syntax. I used powershell to correct a few - where LSR A for example should just be LSR.

$src = get-content deepsea.asm | %{$_ -replace "LSR`tA","LSR"}
$src | Out-File -Encoding ascii deepsea.asm


Attached is the listing which will assemble with dasm using dasm deepsea.asm -f3 -odeepsean.bin

If there's interest I can show how to find sound effects, sprites, music etc using mame in debug mode.

Cheers - be good - and enjoy the listing!
You do not have the required permissions to view the files attached to this post.
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Deep Sea Source

Post by Mobsie » Wed Oct 26, 2022 4:41 pm

I made me a normal asm file, begin at the start point and go on.

The function at aff0 i put direct in the code, save an jsr and an rts. Also this function was middle in nowhere.

The nonsense date, the ff, i delete all.

I incbin the data at begin to 2 different places.

The vectors at the end i put direct in the code, also some small data.

This give me a nice readable source.
772BB542-4670-4195-BE0A-D356B8E5BDB7.jpeg
1883170D-5376-4A00-AC20-6728EC28648B.jpeg
4AA9B955-5233-428B-B004-9CF92BEB25BF.jpeg
You do not have the required permissions to view the files attached to this post.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Deep Sea Source

Post by @username@ » Wed Oct 26, 2022 5:17 pm

Please feel free to correct me on this, but the end result is to have a binary compatible ROM with the original in as short a time as possible.

To do code beautification is a simple excel macro.

For me I put more value on the thing doing what it's supposed to.

It looks like you used the 8K ROM, as your origin is $A000 - was there a reason for this?

From memory these are just two duplicated pages anyways - so either will do :)

Are there any suggestions or methods you used to get a more robust listing?
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Deep Sea Source

Post by Mobsie » Wed Oct 26, 2022 6:03 pm

Hi,

i use the 6kb version but i made an 8kb at the end, no reason.
And no mirror i only incbin the data one time.

For me was not to have an source i can compile, i also want read whats going on. For example at b431 is the function which draw the mountain, or the game loop.

And for me is more easy to read without all these not used $ff or etc.

The one incbin with the graphics for example also interesting, they use the bios $fd4d function to copy, so i can easy play with it.

the graphics file:

I mark yellow the vram adress and how much byte to copy.

E459C3C0-FF18-4AA3-B8AC-44E10C13F3C6.jpeg
You do not have the required permissions to view the files attached to this post.
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Deep Sea Source

Post by Mobsie » Wed Oct 26, 2022 6:07 pm

ah i forget, i used https://www.masswerk.at/6502/disassembler.html

for all, can easy made a nice listing with the option „assembler listing“

The incbin files i create with an hex editor
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Deep Sea Source

Post by Mobsie » Thu Oct 27, 2022 8:59 am

Haha,
the scoring in this game is funny, i not saw something like this often.
10E2E2F7-92B0-4C65-9D8A-5FBBB7A0C2D6.jpeg
806137A4-02BD-4829-B41D-38277AB9F10F.jpeg
You do not have the required permissions to view the files attached to this post.
User avatar
Scouter3d
Posts: 646
Joined: Mon Jun 28, 2010 7:02 am
Location: Wien
Contact:

Re: Deep Sea Source

Post by Scouter3d » Thu Oct 27, 2022 9:19 am

As always, i am totally in awe of anyone understanding assembler :0)
Post Reply