Donkey Kong Lays an Easter Egg
By Don Hodges
Posted July 1, 2009
In 1983, the arcade smash hit Donkey Kong was ported to the Atari 400/800 home computer systems by Landon Dyer. It was at the time the best home computer/console port for this game.
Mr. Dyer, in between pulling his hair out while working on this game, included what is known as an "Easter Egg" in the game's code. If a certain sequence of moves or scores were done correctly, the designer's initials would appear somewhere on the screen. He writes on his blog, "Thereís an easter egg, but itís totally not worth it, and I donít remember how to bring it up anyway (something like: Die on the ísandpileí level with 3 lives and the score over 7,000)."
The Digital Press web site has a whole section dedicated to Easter eggs, and they are even offering cash rewards to those who can find out how to trigger them. Even Landon Dyer himself did not remember how to trigger this Easter egg in Donkey Kong for the Atari home computers. It was suggested on the Digital Press site that the initials would appear in the bonus score box.
26 years later, I am pleased to announce that I have discovered the way to trigger this long lost Easter egg. Here is how to do it:
1. Play a game and get a score of 33,000 through 33,900. This score must become the new high score. [Some other scores will work as well, see below.]
2. Kill off all of your remaining lives. However, your last life must be killed off by falling too far - by walking or jumping off a girder that is too high to land safely. If the last life is killed any other way, the egg will not appear.
3. Set the game difficulty to 4 by pressing the Option button 3 times. The icon for this difficulty is a firefox.
4. Wait a few minutes, and the demo screen where Kong jumps across the screen will appear.
5. The title screen will then appear, and Landon Dyer's initials [LMD] will be at the bottom center of the screen:
Other base scores that will work are 37,000 ; 73,000 ; and 77,000. The hundreds digit can be anything, as can the hundred thousands digit.
It doesn't matter what difficulty the game is played on to set the high score. But to see the egg, the current difficulty must be set to 4 (firefox).
How on Earth did I figure this out?
I started by getting a very good emulator for the Atari system - MESS [Multiple Emulator Super System]. Once in to the game, I activated the game's debugger and did a complete disassembly of the entire 64K RAM bank. This file is over 25,000 lines long.
I faced a few false starts - I first believed the initials were to appear in the bonus score box. So I looked there but found nothing. I also closely observed the input routines, so see if a special sequence of joystick moves were required. This search came up empty as well.
I kept digging around and eventually discovered the subroutine for drawing text to the screen. Right after the data for the "GAME OVER" text data , I found the following:
8D3E: FE ; location code to follow 8D4F: 50 BC ; screen location #50, #BC 8D41: 16 17 0E ; "L M D" [designer's initials!] 8D44: FF ; end code
It was quickly after this that I traced back to the command which would display this line. It was preceded by a test based on several factors, which were all then discovered. Each of the factors are logically ANDed to each other, and the end result has to be equal to 3 to trigger the egg.
861C: A5 D2 lda $D2 ; load number of lives 861E: 2D 01 0E and $0E01 ; mix with high score, ten thousands 8621: 2D 02 0E and $0E02 ; mix with high score, thousands 8624: 25 CB and $CB ; mix with difficulty 8626: 2D 31 0E and $0E31 ; mix with Mario's last state 8629: C9 03 cmp #$03 ; result == 3 ? 862B: D0 07 bne $8634 ; no, skip Easter egg ; Easter egg 862D: A0 3E ldy #$3E 862F: A9 8D lda #$8D ; Easter egg text location at #8D3E 8631: 20 B8 AB jsr $ABB8 ; print Easter egg to screen ; resume program 8634: ...
It turns out that the number of lives is set to #FF (255 decimal, or 11111111 binary) after a game is over. This provides a starting point with all of the bits turned on. Most of the bits turn to zero with the first AND at line #861E. For the high score, since the numbers 3 and 7 both have the same lower 2 bits turned on, they both work as far as this routine is concerned. [3 = 0011 binary and 7 = 0111 binary].
The game's difficulty is counted starting at zero, so level 4 has an internal value of 3 which is needed for the correct answer.
Finally, line #8626 mixes in Mario's last state. The memory location referenced (#0E31) changes based on how Mario is moving. It is set to 3 when Mario falls and dies.
Comments & Conclusions
Of all the game hacking that I have done, this has to be one of the most rewarding and enjoyable. I played quite a bit of this game back in the day at a friend's house. It really was the best port of Donkey Kong that could be played at home.
Another puzzle solved. What will I do next with all of my spare time?
- end original article -
7/5/2009 - There has been some speculation about this Easter egg "not being worth it". Maybe for some people, but for me, it was worth $75 in reward money from the Digital Press web site and their Easter Egg Contest. This contest, by the way, still has many bounties waiting to be claimed.
Someone even put a how-to video up on Youtube: [not very well made, IMO; to save time you might want to skip ahead to the last 10 seconds after watching the beginning.]
Next article : 4 A GOOD TIME JSR 91BD - Super Pacman's Easter Egg
|In accordance with Title 17 U.S.C. Section 107, some of the material on this site is distributed without profit to those who have expressed a prior interest in receiving the included information for research and educational purposes. For more information go to: http://www.law.cornell.edu/uscode/17/107.shtml. If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner.|