Notes:Ghostbusters (Genesis)


 * All addresses here pertain to the first version.

Hunt for the Drill
Most strings in the game are actually accessed through a table, with a GetString function that starts at $160CC. The string table starts at $21396, and consists of a series of pairs of words. The first word is a pointer to the actual string data, stored as indirect pointers; add $21396 to get the actual location of the string. The second word serves unknown purpose. The string index is loaded to d4 and is base 1 (so the first string would be at d4=1). With this, the DRILL string is number $26. String indices are always byte-sized.

The array of weapon/item name string indices for the two shops is at $76610 and goes up through $7661F. Two elements of the array are dummied out (set to 0); one of these may be where the Drill went and the other separates the weapons from the items...

Likewise, the array of description string indices (which parallel) is at $76620 and goes up through $7662D.

The shop main loop (used for both weapons and item shops) begins at $11F98. (TODO entry points) Shops use a helper routine at $11F98 to print strings (it takes the same d4 argument as GetString above).

Longword $FFFE0C is the amount of money you have, as BCD (so a value of $00004000 equals you having $4000 in-game, and $00012000 means you having $12000 in-game).

During shopping, byte $FFFF17 contains the present index into the item/weapon name string index array. This is used to index into a joint weapons/items information array that begins at $20258. Each entry is a pointer to a structure of the form struct weapons_items_data { uint16 [two bytes that have something to do with item limits] uint32 RAM_address_of_byte_determining_how_many_of_this_thing_you_have uint16 [a word that has to do with item pricing] uint32 VDP_command_longword_to_place_icon_tiles_in_VRAM                 // these two effectively hard-code the product's location on-screen uint32 VDP_command_longword_to_draw_price uint32 ROM_address_of_icon_tiles                                        // 9 tiles (so 9*32 = 288 bytes, arranged left-to-right, then top-to-bottom } The routine returns the price of the next one of the current product in d0, the RAM address in a1, and the pointer to the structure in a0. To the shop code, nothing is free; a price of 0 means the item is sold out.

And now for the item list. The byte $FFFF17 in the shop routine contains the currently selected: 0 - energy regeneration 1 - explosives 2 - bubble projectiles 3 - phaser shells 4 - 3-way shots 5 - energy tanks 6 - special suits 7 - barriers 8 - (invalid) 9 - (invalid) $A - gyoza $B - peking duck $C - infrared scope $D - bomb (The string index lists have an extra byte at the beginning and end; the data structure list does not.) In all three lists, the two invalid slots have value zero, so no leftover pointer exists for the drill... and there does not appear to be any leftover data for the drill lying around in the middle of the other data.

TOMORROW:
 * check for the actual code for the items to see if there's leftover code for the drill
 * if that fails, check RAM structures