Author Topic: Donkey Kong Program Code  (Read 16216 times)

0 Members and 1 Guest are viewing this topic.

Offline tcdev

  • New Member
  • *
  • Posts: 5
Re: Donkey Kong Program Code
« Reply #45 on: January 03, 2014, 05:06:19 AM »
Thanks Jeff, much appreciated as it will certainly make my life easier too - your previous listing has certainly given me a big head-start. I get that much of the code is of little interest to those whose primary impetus is to master playing the game and, to be fair, I could have ported the game without understanding a single line of code (well, almost). I must say that I'm daunted by the jumping code that I've just implemented... it's going to be a strain to understand exactly how it works, and very tempting to leave it and come back to it later...  :-[

Hopefully my listing will be a conglomeration of the work done by yourself, myself and a few select others and we'll finally have 100% (or very close) code coverage. I do know someone who is interested in designing additional levels for the game (much like the Foundry) but perhaps not on the original hardware. I'll leave that to them as I'm personally not interested in changing the original behaviour.

For those that haven't seen, I've posted a short video of the game running on the Neo Geo so far on my blog... http://ngpace.blogspot.com.au/... and soon I hope to post an new video with Mario climbing, jumping and falling.

Offline xelnia

  • Global Moderator
  • Spring Jumper
  • *
  • Posts: 1306
  • Stop using 0.106
    • Twitch
Re: Donkey Kong Program Code
« Reply #46 on: January 06, 2014, 06:37:22 PM »
Tonight I finally found my Tutankham disassembly and I'm quite embarrassed to say that it's not quite as complete as I remembered.  :-[

I'm still very interested in taking a look!
"Do not criticize, question, suggest or opine anything about an upcoming CAG event, no matter how constructive or positive your intent may be. You will find nothing but pain and frustration, trust me. Just go, or don't go, and :-X either way!" -ChrisP, 3/29/15
Twitch TV  Streamer DKF Blogger DK Killscreener Crazy Kong Killscreener

Offline georgie3

  • New Member
  • *
  • Posts: 1
Re: Donkey Kong Program Code
« Reply #47 on: October 01, 2014, 05:31:10 PM »
Thanks Jeffw and others for your efforts, the commented disassembly code in reply #43 looks like very high quality. I teach computer architecture and assembly language programming and would like to show my students what real hand-crafted assembly code looks like.

Offline furrykef

  • New Member
  • *
  • Posts: 19
Re: Donkey Kong Program Code
« Reply #48 on: October 04, 2014, 09:37:55 PM »
I think we should put this disassembly up on a wiki, so it will be easier to collaborate on it. I can do this myself if necessary.

I also suggest we move this thread into the General forum, since it doesn't have that much to do with strategy and it's more likely to be read there.
I might never make it to a kill screen, but I found Donkey Kong's hidden music!

Donkey Kong Genius

  • Guest
Re: Donkey Kong Program Code
« Reply #49 on: October 05, 2014, 12:26:24 AM »
Welcome to the Donkey Kong Forum! A page has been designed for exactly this purpose, feel free to contribute on the DK wiki code assembly page.
« Last Edit: October 05, 2014, 12:28:07 AM by Donkey Kong Genius »

Offline furrykef

  • New Member
  • *
  • Posts: 19
Re: Donkey Kong Program Code
« Reply #50 on: October 06, 2014, 12:13:32 AM »
So there is! Thanks for pointing it out.

Man, some of the stuff in here is insane. The RST's with their "return to higher subroutine" trick, which also appears in some normal procedures... I'd never encountered that before, though I haven't done a whole lot of ASM in my life. But I wouldn't expect a subroutine to return to the caller's caller.
I might never make it to a kill screen, but I found Donkey Kong's hidden music!

Donkey Kong Genius

  • Guest
Re: Donkey Kong Program Code
« Reply #51 on: October 06, 2014, 06:56:46 AM »
Sure thing. I wish I knew more about this stuff myself but one must have the time and motivation and weigh the practical usage.

Donkey Kong Genius

  • Guest
Re: Donkey Kong Program Code
« Reply #52 on: October 07, 2014, 08:27:07 AM »
So there is! Thanks for pointing it out.

Man, some of the stuff in here is insane. The RST's with their "return to higher subroutine" trick, which also appears in some normal procedures... I'd never encountered that before, though I haven't done a whole lot of ASM in my life. But I wouldn't expect a subroutine to return to the caller's caller.

I just realized that Jeff had posted a more recent version of the code a few posts earlier. This version of the text is now on the wiki as opposed to the text of the code that was previously posted by Jeff near the beginning of this thread. Update complete.

Donkey Kong Genius

  • Guest
Re: Donkey Kong Program Code
« Reply #53 on: October 07, 2014, 08:44:23 AM »
In fact if anyone is presently interested in seeing the differences between the first file that Jeff posted and this most recent update can view this page. It will take about 45 seconds to load. I don't know if this will always be a live link especially if other edits are made on the page but for now it might be neat to see how Jeff altered his previous text.

http://wiki.donkeykonggenius.com/~donkeyko/mw/index.php?title=Donkey_Kong_Code&curid=14&diff=1099&oldid=27

Offline SpiderWaffle

  • New Member
  • *
  • Posts: 6
Re: Donkey Kong Program Code
« Reply #54 on: July 28, 2015, 11:44:10 PM »
I wondering if anyone has looked into how wild and bomb barrels are handled. For instance, are they possible both possible ever barrel including blues (starting 3rd?) with equal 1/16 for wild and 1/? for bomb?

This could obviously help for general runs if say it was found bombs could only occur every other barrel, but I'm interested for purposes of making a 1-1.

currently the goal is to get the 8th barrel (blue) down to make a fireball ASAP via kong having no pauses, and then the blue being a bomb, but I'm not sure if the code even allows that to happen.

Offline Adam_Mon

  • Elite Member
  • *
  • Posts: 351
Re: Donkey Kong Program Code
« Reply #55 on: July 28, 2015, 11:57:27 PM »
I wondering if anyone has looked into how wild and bomb barrels are handled. For instance, are they possible both possible ever barrel including blues (starting 3rd?) with equal 1/16 for wild and 1/? for bomb?

This could obviously help for general runs if say it was found bombs could only occur every other barrel, but I'm interested for purposes of making a 1-1.

currently the goal is to get the 8th barrel (blue) down to make a fireball ASAP via kong having no pauses, and then the blue being a bomb, but I'm not sure if the code even allows that to happen.

Welcome mate!

For those that aren't aware Spiderwaffle here is doing a TAS run for 1-1.
I don't know much about how the bombs and wilds occur so anyone in the know please chime in  8)
love it.

Offline f_symbols

  • Spring Jumper
  • *
  • Posts: 776
  • wht u mean
Re: Donkey Kong Program Code
« Reply #56 on: July 29, 2015, 06:39:31 AM »
I wondering if anyone has looked into how wild and bomb barrels are handled. For instance, are they possible both possible ever barrel including blues (starting 3rd?) with equal 1/16 for wild and 1/? for bomb?

This could obviously help for general runs if say it was found bombs could only occur every other barrel, but I'm interested for purposes of making a 1-1.

currently the goal is to get the 8th barrel (blue) down to make a fireball ASAP via kong having no pauses, and then the blue being a bomb, but I'm not sure if the code even allows that to happen.


Bombs are made from Stork poop  Kappa

Any barrel can be a wild barrel (except the 2nd and 3rd at the start of a barrel board?)
Blue barrels are only released every 8th Barrel

In order for a "wild" to be a "bomb":

You need to get a "wild" first (1/16, excluding potential tiredness-WB-frequency-changes discussed on CAGDC ( <Pigger> )).  Each barrel has a "counter" that tracks vertical position on the screen (this is used to determine when to roll around the edges, off the screen and where wilds bounce next).  There are only so many barrel slots, and they get recycled as barrels leave the screen, however, the "height" value is not cleared. 

A barrel needs to be pulled as a "wild" AND its' "height" value needs to be equal to or less than the 6th girder; If both parameters are met, Kong will drop a "wild" and when the game tries to determine which girder it hit last (using the counter), it gets a value for something other than the 6th girder, so the barrel logic says that is the next girder it needs to hit and free-falls to that location, before transitioning to a wild.  A full bomb requires a y-counter value that is equal to or less than the 2nd girder.   <confused>

Bonus:  A bomb-wild, transitional barrel, can only occur if the barrels' internal counter is something other than the lowest girder; so you can only get a transitional bomb-wild if you smashed a barrel on a girder above you, or if a wild left the screen above you (basically you need the vertical counter to be somewhere in the middle of the screen).  Kong will drop a "bomb" that will fall to one girder lower than the y-counter and then transition to a regular wild barrel.

Below is a good example of the bomb-wild transition.  In the replay you can see a wild barrel bounce off of the 4th girder (left side) while I have the hammer, after the hammer runs out, Kong drops a "wild" that is expressed as a bomb, but changes to a wild when it reaches that "next" lowest girder, dependent on the barrel slots' conserved vertical height value (in this case its the 3rd girder). 

http://www.twitch.tv/f_symbols/c/5883357

Bombs are more common than bomb-wilds (barrels tend to leave on the bottom 2 girders, early in the screen).  Both types are more common later in the screen than in the beginning (bombs and transitionals), because y-positional values succumb to entropy.

Also, welcome sir!  Kreygasm

1-1 Hype
« Last Edit: July 29, 2015, 08:39:34 AM by f_symbols »
DK Remix Killscreener Twitch TV  Streamer DK Killscreener DKF Blogger DK 1 Million Point Scorer