OK, so I found the random number generating function within Pac-Land and decided to have a bit of fun...
The routine itself is at $cdfa in the Bally-Midway version of the game and $cdea in the Namco (world) version. It's only 24 bytes in length. It's called during every vblank and then from a further 16 different points within the game code. Every time it's called it returns a random number in the range 0-$ff in register A. The random number isn't seeded with a random initial value so this means if you could actually manage to start two different games exactly the same number of vblanks after power-on the games would play identically.
The logic for the ghosts in the planes to decide whether to drop a baby ghost or a Galboss is :-
1) call the random number generator
2) if the result in register A is zero then call it again immediately, if not then drop a baby ghost
3) clear upper 7 bits of returned random number in register A
4) test bit 0 of A, if it's zero then drop a Galboss, if it's one then drop a baby ghost
So that means there's a 1 in 512 chance of a plane dropping a Galboss.
Of course with a bit of creating patching we can even the odds a little and make them drop a Galboss every time
I'm glad that I've figured out the random number generator function and all references to it, this means I can now well and truly figure out what is based on random numbers and what is based on other facts such as player score etc.
The routine itself is at $cdfa in the Bally-Midway version of the game and $cdea in the Namco (world) version. It's only 24 bytes in length. It's called during every vblank and then from a further 16 different points within the game code. Every time it's called it returns a random number in the range 0-$ff in register A. The random number isn't seeded with a random initial value so this means if you could actually manage to start two different games exactly the same number of vblanks after power-on the games would play identically.
The logic for the ghosts in the planes to decide whether to drop a baby ghost or a Galboss is :-
1) call the random number generator
2) if the result in register A is zero then call it again immediately, if not then drop a baby ghost
3) clear upper 7 bits of returned random number in register A
4) test bit 0 of A, if it's zero then drop a Galboss, if it's one then drop a baby ghost
So that means there's a 1 in 512 chance of a plane dropping a Galboss.
Of course with a bit of creating patching we can even the odds a little and make them drop a Galboss every time
I'm glad that I've figured out the random number generator function and all references to it, this means I can now well and truly figure out what is based on random numbers and what is based on other facts such as player score etc.