Blank main menu in Spot (that 7up game) [Solved]

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
MegaBoyEXE
Posts: 12
Joined: Tue Jul 04, 2017 9:22 am

Blank main menu in Spot (that 7up game) [Solved]

Post by MegaBoyEXE » Wed Jan 17, 2018 10:30 pm

I was testing some games in my emu, and found a weird issue with that 7Up game named Spot.
After the scrolling text in title scene, the screen goes blank and a little hand sprite is suposed to appears after a very short wait time, followed by remaining graphics in Main Menu.

In my emulator the screen goes blank, but it never comes back. The hand sprite never shows up, consequently no main menu.
I can press the reset button combination to make the game reset itself, but nothing changes.
Most emulators I tested does not have any issues. The only one that had the same behaviour was a very old version from GBE+ (the 1.0 available on shonumi's github).

From my investigation, looks like it enters an infinite loop of enabling IRQs, then servicing Vblank, then a few calls later it enable IRQ again, service vblank again and keep repeating this, without ever completing the main menu loading routines.

I can break the loop by forcing my code to request a Vbank IRQ at the end of each frame, forcing it to be serviced.
By doing this, the little hand finally appears and game plays normally after that.

I'm sure I'm missing something pretty dumb, but there are so many games that runs fine that is very weird to get trapped like that.
Maybe this has something to do with STAT IRQ blocking? Or anyone knows if there's something tricky with this game that I should be aware?
Last edited by MegaBoyEXE on Thu Jan 18, 2018 9:57 pm, edited 1 time in total.

Shonumi
Posts: 315
Joined: Sun Jan 26, 2014 9:31 am

Re: Blank main menu in Spot (that 7up game)

Post by Shonumi » Thu Jan 18, 2018 10:25 am

MegaBoyEXE wrote: Most emulators I tested does not have any issues. The only one that had the same behaviour was a very old version from GBE+ (the 1.0 available on shonumi's github).
It works in the latest code in GBE+. I haven't released a Windows version since 1.0 (1.2 is coming in April though), but I have definitely fixed it since then. I just don't know which commit it was. I could do some bisecting to find out what change made it work.

EDIT: Just to be clear, there are actually 2 different 7-Up games. "Spot: The Cool Adventure" and "Cool Spot". I assume we're talking about the 1st one, but both games work in my emulator.
MegaBoyEXE wrote: Maybe this has something to do with STAT IRQ blocking?
Probably not. I have implemented 0% of any STAT IRQ blocking behavior, and it runs fine as far as I can tell. I'm still holding off on implementing STAT IRQ stuff since it's low priority for me. Anyway, I'll see what I can find on this game.

SuperWill24
Posts: 31
Joined: Sat May 13, 2017 7:54 pm

Re: Blank main menu in Spot (that 7up game)

Post by SuperWill24 » Thu Jan 18, 2018 11:35 am

This exact problem happens on the GCW Zero emulator "OhBoy". So I have to use Gambatte to run the game. :(

"Just to be clear, there are actually 2 different 7-Up games. "Spot: The Cool Adventure" and "Cool Spot". I assume we're talking about the 1st one, but both games work in my emulator."

There are actually three. The first one you talk about was released as McDonaldLand in my region is not what this topic talks about. What this topic is referring to is a different game which is different than those two, just known as Spot (also known as "Spot: The Video Game").

Shonumi
Posts: 315
Joined: Sun Jan 26, 2014 9:31 am

Re: Blank main menu in Spot (that 7up game)

Post by Shonumi » Thu Jan 18, 2018 11:45 am

How many freaking "Spot" games did they think we needed in the 90s? I've never seen a carbonated beverage with that many games :P

Anyway, the 3rd "Spot" game is in fact still broken in GBE+. I'll investigate what's going on.

MegaBoyEXE
Posts: 12
Joined: Tue Jul 04, 2017 9:22 am

Re: Blank main menu in Spot (that 7up game)

Post by MegaBoyEXE » Thu Jan 18, 2018 6:25 pm

Shonumi wrote:How many freaking "Spot" games did they think we needed in the 90s? I've never seen a carbonated beverage with that many games :P

Anyway, the 3rd "Spot" game is in fact still broken in GBE+. I'll investigate what's going on.
Didn't knew there were more of them. The one I'm talking about is the "ROM ONLY" version from 1990.
This one: https://www.youtube.com/watch?v=fe2dJNYlJyU
The weird stuff would happen in sec 20 to 21 in the video, exactly when the little hand appears, except that in my emu it just goes blank and nevers appears.

By the way, the music still plays in normally while the screen is blank, and I can press all buttons to do a soft reset, so it's not a crash or a freeze. Also, no stack overflow/underflow either.

Shonumi
Posts: 315
Joined: Sun Jan 26, 2014 9:31 am

Re: Blank main menu in Spot (that 7up game)

Post by Shonumi » Thu Jan 18, 2018 9:24 pm

Alright, I figured out what it was, at least in GBE+. I still have a lot of holdovers from when I first started, which means timing is off in GBE+ every now and then. Slight inaccuracies don't affect overall compatibility except in limited cases. Spot happens to be an edge case where it's sensitive to timings.

For the DMG, when entering VBlank (Line 144 to be precise) the VBlank IRQ doesn't fire right away. There's a brief, 4 cycle delay. It's not much, but it's enough to squeeze in one instruction at a minimum every time. When the blank screen pops up in Spot, only VBlank and LYC=LY STAT IRQs fire. I think the STAT one is related to playing the audio, and VBlank handles whatever generic processing. Anyway, the important part is the loop the game gets stuck in outside of those IRQs. It's basically manually polling LY=0x90 by reading LY into A, then CP 0x90, and jumping back over and over.

In GBE+ this was never true because VBlank fires instantly (no 4 cycle delay). When reading LY into A, it never picked up a value of 0x90. But if there is a 4 cycle delay, sometimes this loop manages to read LY right before VBlank triggers an IRQ. Registers A and F get pushed and popped to the stack accordingly, so whenever the VBlank IRQ quits, the loop still breaks.

I'd recommend AntonioND's The Cycle Accurate GameBoy Docs for more information (Page 30 is relevant here). Note that GBC stuff has different-ish timings regarding VBlank IRQ firing.

MegaBoyEXE
Posts: 12
Joined: Tue Jul 04, 2017 9:22 am

Re: Blank main menu in Spot (that 7up game) [Solved]

Post by MegaBoyEXE » Thu Jan 18, 2018 9:54 pm

Shonumi wrote:In GBE+ this was never true because VBlank fires instantly (no 4 cycle delay). When reading LY into A, it never picked up a value of 0x90. But if there is a 4 cycle delay, sometimes this loop manages to read LY right before VBlank triggers an IRQ. Registers A and F get pushed and popped to the stack accordingly, so whenever the VBlank IRQ quits, the loop still breaks.

I'd recommend AntonioND's The Cycle Accurate GameBoy Docs for more information (Page 30 is relevant here). Note that GBC stuff has different-ish timings regarding VBlank IRQ firing.
Same here, this delay did fixed too. That explains why when I was forcing a vblank IRQ request while already at vblank mode in PPU did worked.
Thanks for taking your time to check this. I used AntonioND doc to implement my Timer, which passes all mooneye-gb Timer related tests (except for TMA and TIMA reload ones which I really didn't understand what I'm supposed to do).
I was trying to fix this weird issue before releasing a new alpha version of my emu because it now includes sound support and that would make it a more feature complete emu.
The next version iteration would be to improve PPU accuracy, where this doc enters.

At least we managed to get a little more accurate!
Thanks again for your always kindly help and support, Shonumi!

Post Reply