Wordtris illegal VRAM writes [solved]

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Wordtris illegal VRAM writes [solved]

Post by zeroone »

Wordtris starts up with copyright screens followed by the title screen / player selection menu. If you select 1 PLAYER, the screen whites out for a moment before the game begins. For part of the white out, the LCD is disabled. Shortly after the LCD is enabled, my emulator detects VRAM writes during PPU mode 3 (rendering the pixels). This occurs from LDI (HL), A calls, a convenient way to blocks of data. It happens at points all over the screen as opposed to the edges, the latter of which would suggest a timing issue. The writes also occur over many frames. I read that when the LCD is enabled, there might be a full white out frame where VRAM is still accessible by the CPU before the PPU engages VRAM. But, as mentioned, this happens over several frames after the LCD is enabled.

Anyway, is this actually an issue with my emulator or do some games attempt VRAM writes at the wrong times? I can't visually see any problems in Wordtris when the writes are blocked.
Last edited by zeroone on Mon Dec 25, 2017 10:58 am, edited 1 time in total.
adam_smasher
Posts: 271
Joined: Sun Mar 27, 2011 10:49 am
Location: Victoria, BC

Re: Wordtris illegal VRAM writes

Post by adam_smasher »

You can configure BGB to break on invalid VRAM writes (amongst other things), and I've definitely gotten commercial games to trigger the debugger.

I suggest running Wordtris through it and seeing what happens. BGB is pretty accurate.
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Wordtris illegal VRAM writes

Post by zeroone »

adam_smasher wrote:You can configure BGB to break on invalid VRAM writes (amongst other things), and I've definitely gotten commercial games to trigger the debugger.

I suggest running Wordtris through it and seeing what happens. BGB is pretty accurate.
Thanks for the suggestion, but I can't seem to figure how to do that. Here is the link to the BGB debugger readme. From that description, I'm not even sure how to trap a write to a range of addresses. Also, it doesn't seem to allow me to mask registers. How do I trap on a particular PPU mode?
adam_smasher
Posts: 271
Joined: Sun Mar 27, 2011 10:49 am
Location: Victoria, BC

Re: Wordtris illegal VRAM writes

Post by adam_smasher »

To get BGB to break on invalid VRAM accesses, right click -> Options... -> Exceptions -> Inaccessible VRAM -> Break on access. There's some other useful options in there too.

IIRC the syntax for a range of addresses is e.g. FF00-FFFF.
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Wordtris illegal VRAM writes

Post by zeroone »

adam_smasher wrote:To get BGB to break on invalid VRAM accesses, right click -> Options... -> Exceptions -> Inaccessible VRAM -> Break on access. There's some other useful options in there too.

IIRC the syntax for a range of addresses is e.g. FF00-FFFF.
Thanks.

And, that answered my original question: Wordtris does indeed do inaccessible VRAM writes.

Also, as you mentioned above, several other commercial games also appear to do similar writes. For instance, Donkey Kong Land 2 does so in the menu screens at the start of the game.
Post Reply