Deep Sea Source
Deep Sea Source
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
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
- cheshirenoir
- Posts: 279
- Joined: Sun Jun 02, 2019 5:17 am
Re: Deep Sea Source
Nice work Mobsie!
- @username@
- Posts: 323
- Joined: Tue Oct 22, 2013 6:59 pm
- Location: Scotland
Re: Deep Sea Source
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!
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.
Re: Deep Sea Source
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.
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.
You do not have the required permissions to view the files attached to this post.
- @username@
- Posts: 323
- Joined: Tue Oct 22, 2013 6:59 pm
- Location: Scotland
Re: Deep Sea Source
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?
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?
Re: Deep Sea Source
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.
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.
You do not have the required permissions to view the files attached to this post.
Re: Deep Sea Source
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
for all, can easy made a nice listing with the option „assembler listing“
The incbin files i create with an hex editor
Re: Deep Sea Source
Haha,
the scoring in this game is funny, i not saw something like this often.
the scoring in this game is funny, i not saw something like this often.
You do not have the required permissions to view the files attached to this post.
Re: Deep Sea Source
As always, i am totally in awe of anyone understanding assembler :0)
http://www.8bit-homecomputermuseum.at Find me here...