Jump to content
IGNORED

I disassembled Donkey Kong 16k


Captain Cozmos

Recommended Posts

I am digging deeply on this one, I know it has been a fan request.

When I looked at the other source code I worked on, it was the 24k version and in 2022.
So, I decided to work on the 16k which has the Pascal entries removed.

If someone can fill me in, did the 24k have a hidden level or was that just the Super Game version?


So far, I have seriously broken this thing down.
I have the scoring, timer, Objects, Sound Table, NPC Movement table, screen setup, NMI.

So far I thing Centipede is my best work, this may top it.

My beef with it now is that I want to release in a way that if you change anything around that it will still run after assembling.

Right now, 98% is done and as soon as it is I will release the code.


This is how a portion of the Elevator Object looks like.

               dw ELEVATOR_PATTERNS
                dw ELEVATOR_01
                dw ELEVATOR_02
                dw ELEVATOR_03
                dw ELEVATOR_04
                dw ELEVATOR_05
                dw ELEVATOR_06
                dw ELEVATOR_07
                dw ELEVATOR_08
                dw ELEVATOR_09
                dw ELEVATOR_10
                dw ELEVATOR_11
                dw ELEVATOR_12
                dw ELEVATOR_13
ELEVATOR_01:                       ; 2X WIDE 2X HEIGHT 4 PATTERNS

                db 002,002
                db  49h, 4Eh
                db  6Ch, 6Ch
ELEVATOR_02:

                db 002,002
                db  6Dh, 6Eh
                db  6Fh, 70h
ELEVATOR_03:

                db 002,002
                db  71h, 72h
                db  73h, 74h
ELEVATOR_04:

                db 002,002
                db  75h, 76h
                db  77h, 78h
ELEVATOR_05:

               db 002,002
                db  6Ch, 6Ch
                db  49h, 4Eh
ELEVATOR_06:                           ; 2X WIDE 1X HEIGHT 2 PATTERNS

                db 002,001
                db  6Ch, 6Ch
ELEVATOR_07:

                db 002,001
                db  75h, 76h
ELEVATOR_08:

                db 002,001
                db  71h, 72h
ELEVATOR_09:

                db 002,001
                db  6Dh, 6Eh
ELEVATOR_10:

               db 002,001
                db  6Fh, 70h
ELEVATOR_11:

                db 002,001
                db  73h, 74h
ELEVATOR_12:

                db 002,001
                db  77h, 78h
ELEVATOR_13:

                db 002,001
                db  49h, 4Eh

 

 

As you can see by the comment.

An object table is set up with how wide in patterns by the height in patterns

Then the pattern themselves points to the relevant pattern in the VRAM

As in a row of 1x6 A's would look like db 65,65,65,65,65,65

Like anyone else, I have always done this manually.
But, using the BIOS routines, once you have the tables set up then you should be able to place the patterns anywhere on screen.

When I did this with my pattern examples I had to do all that work by hand as well as explain to the system how and where to display it.
We will see if the BIOS is better but once we figure out how to do this I hope it can finally be entered into the official record because I can find zero examples of how to do any of this very well.

 

 

Here is the Donkey Kong table

 

 

                 db  1Fh       ;  Something I omitted in the Elevator object.
                 db  18h

                dw DONKEY_KONG_PATTERNS
                dw D_KONG_CENTER
                dw D_KONG_LEFT
                dw D_KONG_RIGHT
D_KONG_CENTER:

                db 006,004
                db  1Fh, 20h, 21h, 22h, 23h, 1Fh
                db  24h, 25h, 26h, 27h, 28h, 29h
                db  1Fh, 2Ah, 2Bh, 2Ch, 2Dh, 1Fh
                db  2Eh, 2Fh, 30h, 31h, 32h, 33h
D_KONG_LEFT:

                db 006,004
                db  34h, 35h, 36h, 37h, 1Fh, 1Fh
                db  38h, 39h, 3Ah, 3Bh, 1Fh, 1Fh
                db  3Ch, 3Dh, 3Eh, 3Fh, 40h, 1Fh
                db  41h, 42h, 43h, 44h, 45h, 1Fh
D_KONG_RIGHT:

                db 006,004
                db  7Bh, 7Bh, 93h, 92h, 91h, 90h
                db  7Bh, 7Bh, 97h, 96h, 95h, 94h
                db  7Bh, 9Ch, 9Bh, 9Ah, 99h, 98h

 

The first two numbers, 1fh,18h, is the address where the object is placed on the screen

The object routine automatically wraps the next line directly under the last for alignment.

 

 


03 Cozmos

Edited by Captain Cozmos
  • Like 2
Link to comment
Share on other sites

On 9/14/2023 at 7:52 PM, Captain Cozmos said:

I am digging deeply on this one, I know it has been a fan request.

When I looked at the other source code I worked on, it was the 24k version and in 2022.
So, I decided to work on the 16k which has the Pascal entries removed.

If someone can fill me in, did the 24k have a hidden level or was that just the Super Game version?


So far, I have seriously broken this thing down.
I have the scoring, timer, Objects, Sound Table, NPC Movement table, screen setup, NMI.

So far I thing Centipede is my best work, this may top it.

My beef with it now is that I want to release in a way that if you change anything around that it will still run after assembling.

Right now, 98% is done and as soon as it is I will release the code.


This is how a portion of the Elevator Object looks like.

               dw ELEVATOR_PATTERNS
                dw ELEVATOR_01
                dw ELEVATOR_02
                dw ELEVATOR_03
                dw ELEVATOR_04
                dw ELEVATOR_05
                dw ELEVATOR_06
                dw ELEVATOR_07
                dw ELEVATOR_08
                dw ELEVATOR_09
                dw ELEVATOR_10
                dw ELEVATOR_11
                dw ELEVATOR_12
                dw ELEVATOR_13
ELEVATOR_01:                       ; 2X WIDE 2X HEIGHT 4 PATTERNS

                db 002,002
                db  49h, 4Eh
                db  6Ch, 6Ch
ELEVATOR_02:

                db 002,002
                db  6Dh, 6Eh
                db  6Fh, 70h
ELEVATOR_03:

                db 002,002
                db  71h, 72h
                db  73h, 74h
ELEVATOR_04:

                db 002,002
                db  75h, 76h
                db  77h, 78h
ELEVATOR_05:

               db 002,002
                db  6Ch, 6Ch
                db  49h, 4Eh
ELEVATOR_06:                           ; 2X WIDE 1X HEIGHT 2 PATTERNS

                db 002,001
                db  6Ch, 6Ch
ELEVATOR_07:

                db 002,001
                db  75h, 76h
ELEVATOR_08:

                db 002,001
                db  71h, 72h
ELEVATOR_09:

                db 002,001
                db  6Dh, 6Eh
ELEVATOR_10:

               db 002,001
                db  6Fh, 70h
ELEVATOR_11:

                db 002,001
                db  73h, 74h
ELEVATOR_12:

                db 002,001
                db  77h, 78h
ELEVATOR_13:

                db 002,001
                db  49h, 4Eh

 

 

As you can see by the comment.

An object table is set up with how wide in patterns by the height in patterns

Then the pattern themselves points to the relevant pattern in the VRAM

As in a row of 1x6 A's would look like db 65,65,65,65,65,65

Like anyone else, I have always done this manually.
But, using the BIOS routines, once you have the tables set up then you should be able to place the patterns anywhere on screen.

When I did this with my pattern examples I had to do all that work by hand as well as explain to the system how and where to display it.
We will see if the BIOS is better but once we figure out how to do this I hope it can finally be entered into the official record because I can find zero examples of how to do any of this very well.

 

 

Here is the Donkey Kong table

 

 

                 db  1Fh       ;  Something I omitted in the Elevator object.
                 db  18h

                dw DONKEY_KONG_PATTERNS
                dw D_KONG_CENTER
                dw D_KONG_LEFT
                dw D_KONG_RIGHT
D_KONG_CENTER:

                db 006,004
                db  1Fh, 20h, 21h, 22h, 23h, 1Fh
                db  24h, 25h, 26h, 27h, 28h, 29h
                db  1Fh, 2Ah, 2Bh, 2Ch, 2Dh, 1Fh
                db  2Eh, 2Fh, 30h, 31h, 32h, 33h
D_KONG_LEFT:

                db 006,004
                db  34h, 35h, 36h, 37h, 1Fh, 1Fh
                db  38h, 39h, 3Ah, 3Bh, 1Fh, 1Fh
                db  3Ch, 3Dh, 3Eh, 3Fh, 40h, 1Fh
                db  41h, 42h, 43h, 44h, 45h, 1Fh
D_KONG_RIGHT:

                db 006,004
                db  7Bh, 7Bh, 93h, 92h, 91h, 90h
                db  7Bh, 7Bh, 97h, 96h, 95h, 94h
                db  7Bh, 9Ch, 9Bh, 9Ah, 99h, 98h

 

The first two numbers, 1fh,18h, is the address where the object is placed on the screen

The object routine automatically wraps the next line directly under the last for alignment.

 

 


03 Cozmos

For those who aren't following, I am also working on researching the OS7 Graphics package.

 

@Captain Cozmos, can you please send me what you have in the disassembly? I am trying to debug mobile object handling (I have semi-mobile object handling working, as I have been able to plot 10 pre-shifted targ riders across the screen with minimal effort)

 

-Thom

Link to comment
Share on other sites

56 minutes ago, Kamshaft said:

If you are intending to release your research to the public, let me know.  I'll post the code on my site for everyone to learn.

 

And if you do intend on releasing the code, do you have comments added in there?

 

Good work!

You can see the os7lib here in github, for z88dk: https://github.com/tschak909/os7lib

 

-Thom

Link to comment
Share on other sites

I have been going through Frenzy and DK to correspond parts of the manual.

The goal is to document the routine and the Data and show exactly how the routine works as a guide.

I have run into a snag because Frenzy uses Mode 1 according to what I can tell.
All the documentation out there says there is an error using the PUT_MOBILE routine in Mode 1
It then gives instruction to use part of the routine in your program and gives a listing to put in your code.

In the case of Frenzy, that code is not present in it's listing so I am suspecting that they discovered the error "after" Frenzy was written and released.
If that is the case then how did they get around the bug.

Mystery's, Mystery's, Mystery's

  • Sad 1
Link to comment
Share on other sites

  • 1 month later...

Since I know you're still working on this, may I please present this info?

 

1. The elevators in the CV Donkey Kong -- be it 24K or 16K -- go at the same speed regardless of the skill level selected. For the original arcade DK (and the Coleco Adam DDP port), the elevators went at 25 percent of full speed for the first level, then 50 percent for level 2, 75 percent for level 3 and then normal speed for level 4 and up. Hence, could you please try to tweak the speed for the CV port to match up with the level?

 

2. The arcade DK also had the background music cut out when the timer warning plays (last 10 seconds), but on both CV ports the BGM continues while this occurs (at 0900 for 24K, and 01000 for 16K).

 

~Ben

Edited by ColecoFan1981
Link to comment
Share on other sites

  • 1 month later...
3 minutes ago, ColecoFan1981 said:

Hi Coz,

 

In the future, please try to look into disassembling DK's sequel, Donkey Kong Junior.

 

I am wondering if the CV port of the sequel also has any unused PASCAL calls in it?

 

~Ben

No. It didn't.

 

This is precisely why I did my analysis tool, and video: 

-Thom

  • Thanks 1
Link to comment
Share on other sites

At the end of the day I did not see any benefit to using the PASCAL statements which were nothing more than a way to pass register variables.

I suspect that was their way to find programmers that did not know assembly?
But, there was no speed gain or performance of any kind when I removed all the pascal stuff from Smurf Rescue.
Maybe it started out like a good idea but everything that 909 found is all there is that I could confirm.

 

After the holidays I may get back into the disassembles.
Personally I would like to know what they actually changed from the 24k to the 16 DK.
Pascal statements alone will not account for the 8k diff.

As with the two Smurf variants I know of.  The proto did much the same but the programing itself was more honed and both have the pascal.

If I had to make a business decision, I would rather have a 16k two chip game rather than a 3 chip 24k any day of the week.  Especially when it is a pack in game that every console comes with.
The 1st version was to get the system out the door for 1982 Christmas then have the original programmer make it more compact.  As long as the 24k version worked, no one cared about how honed it was.
 

Edited by Captain Cozmos
  • Thanks 1
Link to comment
Share on other sites

21 minutes ago, Captain Cozmos said:

At the end of the day I did not see any benefit to using the PASCAL statements which were nothing more than a way to pass register variables.

I suspect that was their way to find programmers that did not know assembly?
But, there was no speed gain or performance of any kind when I removed all the pascal stuff from Smurf Rescue.
Maybe it started out like a good idea but everything that 909 found is all there is that I could confirm.

 

After the holidays I may get back into the disassembles.
Personally I would like to know what they actually changed from the 24k to the 16 DK.
Pascal statements alone will not account for the 8k diff.

As with the two Smurf variants I know of.  The proto did much the same but the programing itself was more honed and both have the pascal.

If I had to make a business decision, I would rather have a 16k two chip game rather than a 3 chip 24k any day of the week.  Especially when it is a pack in game that every console comes with.
The 1st version was to get the system out the door for 1982 Christmas then have the original programmer make it more compact.  As long as the 24k version worked, no one cared about how honed it was.
 

Coz,

 

The main differences I found in the newer 16K ROM version of DK were:

* Bonus timer is five digits long and goes all the way up to 99,000... but it also rolls over to 00,000 (100,000), and you don't die because of it, either.

* BGM stops whenever Mario dies (falling; collision with enemies; collision with DK on boards 2 and 4; time up), same as in the arcade original.

* The "black hole" glitch on board 1 actually takes you to board 2 instantly (points for time remaining are added to the score), instead of (in the 24K version) having to wait 12 seconds until Mario appears on the topmost girder by DK.

* On boards 3 and 5, Mario no longer falls through the left elevator when jumping onto it from his starting position.

 

~Ben

Edited by ColecoFan1981
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...