Debugging 27 Year Old Code

Remember those days? About twenty seven years ago? You were on a role with Donkey Kong, playing at some high level—level twenty two, actually. And boom, time is up, you’d be dead. That is, Jumpman (“Mario,” to you DSi wielding youngsters) would be dead. Dead as a doornail, how unfair! My, then, therapist told me, that it was not as important as I thought it was, the moron. That I would forget it eventually, and go on with my life, double moron. How can I forget? I still cry myself to seep every night over how unfair life is. But now, thanks to Don Hodges, the world (“my world” as my current therapist refers to it) is back in harmony again. Thanks Don, for fixing Donkey Kong. I can sleep in peace, now.

This is what the (overflow) bug looks like:

0F7F   17 RLA        ; Rotate Left the bits in A
0F84   80 ADD A,B    ; A = A + B
0F85   80 ADD A,B    ; A = A + B
0F86 C628 ADD A,#28  ; A = A + #28 (40 decimal)
0F88 FE51 CP #51     ; Is A >= #51 (81 decimal) ?
0F8A 3802 JR C,#0F8E ; No, then skip ahead to #0F8E
0F8C 3E50 LD A,#50   ; Yes, then A = #50 (80 decimal)