Author Topic: Cause of the Kill Screen?  (Read 3894 times)

0 Members and 1 Guest are viewing this topic.

Offline YesAffinity

  • Spring Jumper
  • *
  • Posts: 578
    • Awards
Cause of the Kill Screen?
« on: September 21, 2015, 04:32:43 pm »
This has probably been explained before, but I searched around the forum, and didn't find anything.  Sorry if this is re-hashing an old question.

So the explanation for the cause of the kill screen is as follows:

Unlike most kill screens, this kill screen is not the result of integer overflow, but rather a designing oversight.The amount of time allowed for any given screen is determined algorithmically during play by the level the player is on. The timer is calculated 100×(10×(level + 4)), and has a maximum value of 8000. When the level reaches 22, the game reads 100×(10×(22+4):) or 100×260. However, the 8-bit counter rolls over at 256, meaning the game calculates 100×4. This causes the timer to be set so low that there is barely seven seconds for the player to complete the level, simply not enough time for the screen to possibly be completed.

That kinda makes sense.  But what doesn't make sense to me is: why does the kill occur when the counter is at 3700?  First 100 appears on the timer, then the timer counts "down" to 3900, 3800, 3700, and hangs at 3700.  It seems that 3700 displays as if it were 000, which as we all know, typically displays for longer than a standard counter "tick".

I'm sure there's more to it, as it relates to what displays on the counter.  Would someone please explain?
Matthew 21:22

DK Arcade PB (verified): 970,200 KS
DK Start PB (verified): 126,600
DK L1-1 PB (verified): 11,400
DK PB 1st Man: 622,000

Donkey Kong Direct Feed How-To - http://donkeykongforum.net/index.php?topic=1413.0
^Now outdated, see instead: http://donkeykongforum.net/index.php?topic=2471.0
Member for 9 Years DK Killscreener Blogger Twitch Streamer

Offline Sock Master

  • Elite Member
  • *
  • Posts: 379
    • Awards
Re: Cause of the Kill Screen?
« Reply #1 on: September 21, 2015, 06:17:19 pm »
Someone would have to dig pretty deep into the code to make a full explanation.

The game actually keeps several "timer" numbers internally.    It computes a base value based on level and then feeds that result to compute other internal timer values.   If one step of the chain fails from an overflow, it'll pass a corrupted value down the line to use as an input for computing the other timers.

The one for the bonus number is for display purposes.  Internally it's encoded in binary coded decimal (an 8 bit number is defined to be from 00 to 99).  The encoding is actually a restricted form of hexadecimal ($00 to $ff).   The programming expects the bonus timer number to be valid, though..  and gets confused if the digits go above 9 (which is possible in hexadecimal).    I think the corrupted bonus timer value at kill screen displays like a 'normal' looking number at first but after it decrements the routine gets confused by the out of range digits and then flips to strange digits.    (Decrementing a $D (%1101) might turn it into a $3 (%0011) in binary coded decimal math.  I'm not sure of the exact steps inside the CPU.)

The other timer, the internal one you don't see has an overflow as described in your post but otherwise works normally except in this case it was initialized as a very small value.

If you mess around with the programming, you can get the game to display a large bonus timer, yet run out of time before it ever reaches zero.   Or the other way around and have it count down to zero and then stay at zero for another 30 barrels before death happens.

In the game itself the two aren't synced up perfectly.   The bonus timer reaches zero a little bit before the last barrel is even grabbed by DK.   That's why the bonus runs out several seconds before you're actually out of time.
« Last Edit: September 21, 2015, 07:14:33 pm by Sock Master »
"Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinkin' badges!"
Member for 8 Years snek IGBY 2016 DKF Team Member Twitch Streamer

Offline YesAffinity

  • Spring Jumper
  • *
  • Posts: 578
    • Awards
Re: Cause of the Kill Screen?
« Reply #2 on: September 21, 2015, 07:35:11 pm »
Great explanation, Sock Mater, thanks for detailing it so thoroughly.

Now here's some conspiracy theory to consider:

The kill screen ends on 3700.  The 1UP score that displays by default at game startup is 3700.

L1 starts with 2 board, L2 has 3 boards, L3 has 4 boards, L4 has 5 boards, and L5+ has 6 boards.  The "final" level has 1 board.  Why not start L1 with 1 board?  I guess that could be explained by rationalizing that if L1 started with barrels and was only 1 board, and L2 started with barrels and was 2 boards and so on, you would have 2 barrel boards in a row, and that probably would be silly and wouldn't work out in the scheme of increasing difficulty from L1 to L5.

Just some food for thought.  <popcorn>
Matthew 21:22

DK Arcade PB (verified): 970,200 KS
DK Start PB (verified): 126,600
DK L1-1 PB (verified): 11,400
DK PB 1st Man: 622,000

Donkey Kong Direct Feed How-To - http://donkeykongforum.net/index.php?topic=1413.0
^Now outdated, see instead: http://donkeykongforum.net/index.php?topic=2471.0
Member for 9 Years DK Killscreener Blogger Twitch Streamer

Offline Sock Master

  • Elite Member
  • *
  • Posts: 379
    • Awards
Re: Cause of the Kill Screen?
« Reply #3 on: September 21, 2015, 08:29:54 pm »
Conspiracy or coincidence.   The default scores were inherited from Radarscope.

Another question is why they left scores ending with "50" in there when Donkey Kong does not have anything that scores 50 points.

The 3700 does make an interesting coincidence.   The x700 is from x100 being decremented 4 times...  x100 x000 x900 x800 x700.   But how unlikely is that?  There are 4 barrels next to Donkey Kong.   The kill screen ends with DK's barrel pile running down exactly.   Does the timer/counter overflow just happen to equate 4 barrels mathematically at the kill screen?

2 boards I guess is pretty easy.  The game tells a story.  The shortest complete version of the story is DK taking Pauline up the girders, then Jumpman knocking DK down to save Pauline on the rivets board.
If you were to complete the kill screen, the game continues it's 6 board pattern.

I'm pretty convinced that the 2,3,4,5,6 board progression was actually the original intention and the 4,4,4,4,4 progression of the Japanese version is actually the hack.   Everything for 2,3,4,5,6 progression is already programmed and organized for in ROM in the Japanese version.   I suspect Ikegami and Nintendo had conflicting opinions about the game and I don't think Nintendo got the source code, so any changes they made were hacked on.
"Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinkin' badges!"
Member for 8 Years snek IGBY 2016 DKF Team Member Twitch Streamer

Offline ChrisP

  • Spring Jumper
  • *
  • Posts: 1763
  • I'm going to jump next to your leg.
    • Donkey Blog
    • Awards
Re: Cause of the Kill Screen?
« Reply #4 on: September 21, 2015, 08:49:52 pm »
I'm pretty convinced that the 2,3,4,5,6 board progression was actually the original intention and the 4,4,4,4,4 progression of the Japanese version is actually the hack.   Everything for 2,3,4,5,6 progression is already programmed and organized for in ROM in the Japanese version.   I suspect Ikegami and Nintendo had conflicting opinions about the game and I don't think Nintendo got the source code, so any changes they made were hacked on.

Cool! When I initially looked at the board layout table I thought "in the Japanese code, why did they repeat 1-2-3-4 again and again 5 times over?" Initially I thought it had to do with difficulty ramping, but then I realized that wasn't necessary since there are other bits and pieces that take care of this. My thought was "they must have left 20 slots there in order to leave room to be flexible with the layout." IE, "hey Nintendo, hack this part if you want to."

The real smoking gun for me is that the code specifically allows for up to 6 stacked monkeys, and even text for "125m" and "150m", which would never happen in the Japanese layout.

I made this thread some time ago about the subject:
https://donkeykongforum.net/index.php?topic=1215.0
« Last Edit: September 21, 2015, 09:02:25 pm by ChrisP »
http://donkeykongblog.blogspot.com

4 Quarters :-* - 800K Avg. Per Qtr. :o - No Restarts 8) - No Proof :'(

7/26/2013   Coin 35,946   710,800   18-1
7/28/2013   Coin 35,947   903,700   22-1
8/16/2013   Coin 35,948   694,100   17-6
8/17/2013   Coin 35,949   893,100   22-1

3,201,700: the $1 World Record?
Member for 11 Years DK Masters - Rank D DKJR Killscreener IGBY 2016 DKF Team Member IGBY 2015 DKF Team Member IGBY 2014 DKF Team Member Blogger Twitch Streamer DK Killscreener CK Killscreener

Offline Sock Master

  • Elite Member
  • *
  • Posts: 379
    • Awards
Re: Cause of the Kill Screen?
« Reply #5 on: September 21, 2015, 09:29:24 pm »
Yup! exactly stuff like that.  I think Nintendo of Japan wasn't too happy with the game, maybe that it was too hard or nobody would ever see all 4 boards?  So they made it easier and quicker to see all 4 boards.

Most of the code is assembled properly but at the end of the ROM are the hacked on routines where someone who didn't have source code (or maybe not the tools) to reassemble it, added extra routines.   I never looked closely at DKjr, but it's hard to believe they would have actually written the whole game that way.
"Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinkin' badges!"
Member for 8 Years snek IGBY 2016 DKF Team Member Twitch Streamer

Offline xelnia

  • Administrator
  • Spring Jumper
  • *
  • Posts: 2817
  • Stop using 0.106
    • Twitch
    • Awards
Re: Cause of the Kill Screen?
« Reply #6 on: September 21, 2015, 10:17:27 pm »
Another question is why they left scores ending with "50" in there when Donkey Kong does not have anything that scores 50 points.

I have a theory on this one. Number wordplay ("goroawase") is common in the Japanese language and anyone who has spent some time with Pac-Man or other NAMCO games would recognize the scoring value of 7650. The pun for 7-6-5 is na-mu-ko. So, it's an inside joke for NAMCO. Well, so what? DK is Nintendo, not NAMCO.

I think there are two possibilities: 1) Nintendo was trying to show some respect for its fellow competitor (boring), or 2) Ikegami was trying to put a little jab at Nintendo into the game, implying NAMCO is #1 (<stirpot>).

The other default numbers probably have some significance. Attract modes with score tables usually include default initials, sometimes those of the programmers/designers involved with the game. Maybe the Ikegami team realized they could never get away with explicitly putting their names on the game, so they hid their names in the default scores (like they hid their message in the game's code).
"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
Member for 11 Years snek CK Killscreener IGBY 2016 DKF Team Member IGBY 2015 DKF Team Member IGBY 2014 DKF Team Member DK Killscreener Blogger Twitch Streamer

Offline Sock Master

  • Elite Member
  • *
  • Posts: 379
    • Awards
Re: Cause of the Kill Screen?
« Reply #7 on: September 22, 2015, 08:38:51 am »
Neat!  If that is so, and a 7650 high score just by coincidence would be very unlikely, the other scores probably have meanings too.

It is strange that a game contracted by Nintendo, programmed by Ikegami, would slip "Namco" as the top score.  Nintendo probably had no idea - they would have edited it out if they had known.

At the time, Namco had already released Galaxian, Rally-X and Pac-Man so they were hugely successful.
"Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinkin' badges!"
Member for 8 Years snek IGBY 2016 DKF Team Member Twitch Streamer