Bells & Whistles
In a scale of 1 to 10, I would rate this game a 5 - The scores are of an average difficulty to Locate.
To start with you need to have compiled your own mame.exe with the debugger enabled go to www.mame.net/compile.html or www.mameworld.net/dosmame to find out what is needed and how to compile mame
Most games are different in how they store their highscores,a lot of the early games use video ram to store the top score on screen (the score you see when playing the game) and from my experiance the earlier games are often the hardest to find. Some games use ascii code to display the highscore names and these are the simplest ones to find. so I`ll start with an easy game to start with and when this page is updated i`ll do a more difficult game.
So on to the game, and the chosen game this is :- Bells & Whistles (Konami 1991), the name of the rom is :- blswhstl , I have used mame32 debugger to grab the screenshots but would normally use dos mame.
So make sure that you have enabled the debugger in mame (dos mame is much better than mame 32 for finding highscores) and start the game. When you have presses any key to start the game the debugger will display so press the escape key to continue. You should see something like the screen shot below, note that this game has the top score on screen from the start.
Now that the game has started let it run untill the highscore table is displaying (I use f10 to speed the game up until the table is on then f10 to slow the game down again),When the highscore table is on screen press the ` key on your keyboard (left of number 1) to enter the debugger and then the f5 key to view the game screen. see screenshot below.
Notice that it has ten highscores, scores no.2 , 5 and 7 will be the easiest to find because they have all alphabet characters in the three letter name, all the others have a . in the name.All the names are displayed using ascii code(see ascii and hex conversion tables at bottom of page) so to find the highscore table in the games ram memory press f5 to get back into the debugger and then press the insert key(left of the letter Q) on your keyboard untill the cursor is in the bottom left box(3 times) and type s (to search) and then type 54 4f 4d (TOM in ascii code) then the return key.Also note that computer memory displays as hexadecimal (not decimal).Hexadecimal (hex for short) is a base 16 system where in decimal the numbers ten to fifteen are 10,11,12,13,14,15 in hex they are 0a,0b,0c,0d,0e,0f - untill you reach sixteen which is 10 in hex.seventeen,eighteen & ninteen is 11,12,13 and so on up to 1f (31 in decimal) and number thirty two is 20 in hex and so on.see hex table at bottom of page.
The first search will find the ascii code 54 4f 4d in the games rom (read only memory) this is the games default highscore table that is displayed whenever the game is loaded. Any rom code cannot be changed or overwritten so the game copies this code into ram (random access memory) which can be overwritten. ram memory stores things like your score,number of lives, which level your on etc.. any memory addresses that need to be changed during the game. In the above screenshot in the bottom left box you can see the memory addresses 000000 - 0000cf , 00 being memory address 000000 and 01 being address 0000cf (bottom right of the box).
we arn`t concerned with rom memory so press s again (to continue search) and the return key.this should find the ascii code 54 4f 4d again,only this time the code is in the ram memory.This is the actual highscore table the game displays.See screenshot below.
Notice the word ram1+300c in yellow in the bottom left box this is the games ram(1)memory.the cursor should be flashing on the number 5 like in the screenshot above, this is the first digit in 54 4f 4d that you searched for. If you look at the highscore you will see that it is 57300 and this is twenty digits left of the cursor (5730) the remaining 0 digit in the score is not displayed because every point you get in the game is in units of 100 so the last 0 in the score never changes and hence will always be 0. So to find where the highscore data starts move the cursor with the left arrow key untill it is on the first 0 on that line and type 1234 so the line looks like this:-
207000: 1234 5730 4d5e 4f2e - 0000 5250 544f 4d2e
then press the escape key to re-enter the game and wait until the highscore diplays again only this time you will notice the highest score is 123457300, there is no room for any more digits so the highest score can be no more than 999999990. Press the ` key to get back into the debugger where everything should be as you left it. note that sometimes the debugger shows a different screen, if this is the case press the f6 key untill you see cpu #0 68000 in yellow letters in the top right box, this means that we are looking at cpu number 0, most games have more than one cpu, one cpu will be the main game engine while another will be the games sound or graphics etc. 99% of highscores will be in cpu #0.
What we have learnt from changing 0000 into 1234 is that the highscore data starts at add$ 207000 (address value 207000). Next turn your attention to the line :-
207040: 0000 3800 475e 422e - 0000 3700 545e 532e
This is the bottom two scores & names of the highscore table the 0000 3800 475e 422e part of it is the score 38000 and the initials G.B and the 0000 3700 545e 532e is the score 37000 and initials T.S the 2e at the end of each initials part is unimportant it just signifies the end of the initials when the highscore table is displayed. So the highscore data starts at add$207000 and ends at add$20704f see screenshot below.change the 1234 back to 0000 so the top score is back to 57300.
Now that we`ve found the highscore table data we need to find the top score displayed during a game. the easiest way to find this is to find the memory address that stores the player one score during a game. Once we`ve found this we can change the score to whatever value we like so that we can beat the highscore easily and find the highscore memory address (which will be the same as your player one score). To do this press escape to be back into the game and start a one player game, then get your score to something like 1600 and then press the ` key to get back into the debugger.
To look for your score its best to start looking at the start of the ram memory( add$204000), so press the insert key twice so the cursor is in the bottom of the screen and type d 204000 and press the return key.Now the bottom left box is displaying the start of ram. press the insert key 3 times untill it is in this box and type s to search,then delete the 54 4f 4d by moving the cursor as far left as it will go and use the delete key untill the box is clear. Then type 0160 (the last 3 digits of your score,remember it doesen`t display the last 0) and press return.
Notice the cursor flashing on 0 and the next 3 digits are 0160 your score of 1600. the 0000 before the cursor is also your score so your score starts at the fourth 0 before the cursor (add$204044) and ends on the next 0 after the cursor (add$204047).In this game you get lucky finding the highscore memory address,notice the 0000 5730 on the same line after cursor (add$204048 - $20404b),well thats the highscore. if you add a few digits to the 0000 before the cursor say so it looks like this 1234 0160 and press escape to get back in the game you will notice that your score is 123401600 and so is the highscore (you may have to shoot something for this to work).So after pressing escape and getting back to the game kill yourself and put your name in the highscore table (should be top score). Let the game run for a short while so it goes into attract mode, you will see your highscore in the gameplay and your top score & name when the game displays the highscore table.
So now we know the memory addresses of the highscore table and the top highscore its time to reset the game so that they return to their default values.Press the f3 key to reset the game and wait untill the game starts again.All scores have reset.
Press the ` key to get into the debugger,you should see something like the below screenshot
Notice that player 1 score has gone to 0000 0000 and the highscore is back to 0000 5730, we don`t need to have the player 1 score data in the highscore.dat file but we need the highscore values. so the highscore starts at add$ 204048 and ends at $20404b and the value of the start of the highscore (add$204048 ) is 00 and the value in the last value (add$20404b) is 30 so write these down.
Next we need to know the values of the start and end of the highscore table data so press the insert key untill the cursor is at the bottom of the screen and type d 207000 (the start of the highscore table memory address).
see screenshot below.
You should see the highscore data in the bottom left box, the start of the highscore table is at add$207000 and is value 00, the end is at add$20704f and is value 2e so write this down.
We now know all the data we need to add support for bells & whistles to the highscore.dat file. the way the highscore.dat file works is :-
First it needs to know the rom name,then the start and end addresses of the relevent information and what the values of the start & end addresses are.Then when the game starts it waits untill all the start & end values are in place and then overwrites the saved information on top.
The highscore.dat information will look like this:-
;******tmnt.c (bells & whistles)
The first line is just a reference to the game and driver, any line starting with ; will be ignored by the computer.
the second tells the computer what the game rom name is.
the third line tells the computer which cpu to look in once the game has started (cpu#0), what the start memory address is (207000), how many bytes to the end address in hexadecimal(more on this below), and the start and end values of the start and end addresses.
the fourth line is the same as above but this time its for the highscore, (cpu#0),start address (204049), how many bytes to the end address (3) and the start and end address values.the colon is to seperate each entry.
To find out how many bytes there are between the start and end addresses i use the calculator in windows 98 and would click on hex and type in 20704f - 207000 and get an answer of 4f. you always add one onto the result.So 20704f minus 207000 = 4f + 1 = 50.if you are confused by this clear the calculator and type the result +1, so 4f + 1 = 50 (hexadecimal remember)
To enter it into the highscore.dat file, open up the highscore.dat with a text editor like wordpad and enter the details like this:-
Then save the dat file and open the directory you save your mame highscores in, then load up bells & whistles in mame (doesn`t matter if debugger is enabled or not) and let it run for a while but don`t start a game.then exit the game and see if a blswhstl.hi file has appeared in your highscore directory.if it has then the data you put in the highscore.dat file is correct.
Now all you have to do it test that the game`s scores are saving correctly.So load up the game with debugger enabled and when you press any ket to start the game the debugger will open up, type d 204045 (the start memory address of player one`s score) and press the insert key to get to the bottom left window, once the cursor is flashing in that window press the escape key to enter the game.
Start a one player game and get a few points just like before (about 1600 will do) then press the ` key to get into the debugger and make your score to just lower than the highscore is (don`t forget the highscore is just next to the player one score in memory)so a score of about 55000 will do see screenshot below.
After you have put the 55 in add$204046 to make your score to 55000 press the escape key to go back in the game and beat the highscore (easy now).Once you have beaten the highscore kill yourself and enter your name in the highscore table, then exit the game and load it up again (without debugger enabled) then let game play through the attract mode to see if the top score on the game screen is the saved one and if the highscore now displays the new top score.if all`s well give yourself a pat on the back,you have just added highscore support for bells & whistles.
All thats left is to load up the game again and have a proper game to see that everything is ok and that if you beat the highscore the game moves the already saved one down to 9th place or if you don`t beat the highscore your score is placed below it (assuming you get a score high enough to be on the highscore table).
Below is a ascii conversion table showing you what ascii letter is in hex.
Below is a hexadecimal conversion table showing you what what hex value is in decimal.
Well thats all for now, please give me an email with any questions or feedback
Back To Main Page