The "banana counter", is the counter at the top left of the screen which tells you the amount of bananas you have. By default, once you exceed 99 bananas, the counter resets to 0. This is an explanation of how the counter works (or how it seems to work), and how to alter the values it uses.
In DKC, the values are located at either end of this hex string:
63 00 30 24 AD 7B 05 38 E9 64 00 - USA & Europe
63 00 30 24 AD 8B 05 38 E9 64 00 - Japan
(Notice the Japanese version is slightly different, although this seems irrelevant)
Anyway, the important values are 63 00 and 64 00. If you've got any experience with hex digits, you'll have already noticed that these represent 99 and 100 respectively (The bytes are reversed, e.g. 6300 = 0063). The way the game handles these is as follows: 63 00 is the highest amount of bananas you can have, if you get any more, the second value is the amount deducted from the counter. So if you have 99 bananas, and you get one more, you have 100 taken away:
99 + 1 - 100 = 0
For the counter to return to 0 every time, the second value must be one value higher than the first. The counter doesn't have to reset to zero though, it can reset to any value higher than zero, but lower than the first value.
These values can, of course, be changed to whatever. Four bytes indicates that the highest value could be FFFF (65535), but the game won't allow anything higher than
E7 03 (999) for either value. This means by setting each value to the maximum (E6 03 & E7 03 respectively), you could collect 998 bananas, and when you collect one more the counter would reset to zero and you'd get your extra life. If either value is set higher, you will be able to get 999 bananas, but the counter will not go any higher.
It should go without saying, that setting either value to something outwith these limitations can and will cause all kinds of havoc. Remember the DKC beta video? Where you could collect hundreds of bananas? Well now you can do the same...
-------
DKC2 & DKC3 are different enough to make this whole thing a nightmare. In DKC2, it seems possible to set the values up to 999 as well, but the game uses very screwy values for bananas. DKC3 does not seem to be able to go beyond 99 bananas, and also uses the same screwy values that DKC2 uses.
The hex value for one banana seems to be 01, which makes perfect sense, but for 10 bananas, the hex value is 10 (it may not seem it, but this makes everything very confusing). Between 9 and 10 bananas, the A to F hex values seem to be skipped, so the hex goes from 9 straight to 10.
Confused? Good.