Telling LYs? (test ROM)

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Telling LYs? (test ROM)

Post by tepples »

This program tests a Game Boy emulator's input entropy.

The Game Boy has an interrupt that can fire when a button changes from not pressed to pressed. This interrupt can fire at any time in the frame: top, middle, bottom, or in the vertical blanking between frames. A program can see exactly when the interrupt fired by inspecting a hardware register called LY, which presumably stands for LCD Y Position. For instance, it could wait for a press at the title screen and then seed a random number generator from LY.

But simple emulators always fire the joypad interrupt at the same time each frame, such as the start or end of vertical blanking. The lack of variance in LY is telling about whether an emulator was used; hence the name.

How to use

Starting at the title screen, press all four directions on the Control Pad and all four buttons (A, B, Select, and Start), one after another in any order. The arrow at the right side tells exactly when, relative to the LCD frame, your button changed from not pressed to pressed.
After having pressed six buttons
After having pressed six buttons
tellinglys.png (1.07 KiB) Viewed 21561 times
Once you have pressed all eight keys, a screen for passing or failing appears.

Test results
  • Game Boy (DMG), Game Boy Color (CGB): Pass
  • Game Boy Player (DOL-017): Pass
  • BGB 1.5.7: Pass
  • mGBA 0.8-5388-f92059be: Fail (though replies to issue #1232 dispute whether it's a bug at all)
Attachments
tellinglys-0.01.zip
(34.59 KiB) Downloaded 875 times
Alyosha_TAS
Posts: 173
Joined: Wed Jun 15, 2016 11:49 am

Re: Telling LYs? (test ROM)

Post by Alyosha_TAS »

Ha! That's clever. I like trickery like this.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

I've noticed Super Game Boy behaves oddly. Press one button repeatedly, and the arrow moves down about once a second. It's as if SGB is polling the controller once per Super NES vblank (60.10 Hz, once every 1364*262-2 = 357366 vblanks) and immediately relaying it to the ICD2 chip sitting between the SGB CPU and the Game Pak connector.

Super NES vblank rate: once every 4*341*262-2 = 357366 master clocks, or 60.10 Hz
SGB vblank rate: once every 5*456*154 = 351120 master clocks, or 61.17 Hz

I was told in gbdev Discord that Game Boy Player Startup Disc polls the GameCube controller at 1000 Hz, and the GBA CPU produces video at 2^24/(4*308*228) = 59.73 Hz. This provides about log[2](1000 / 59.73) = 4.07 bits of entropy in the sub-frame timing of a button press as a lower bound for any GBA game or GBC-only game. DMG/GBC dual compatible games would have to find some other entropy source to seed the RNG on SGB, as a player who doesn't completely suck at rhythm games can time the initial Start press at the title screen to within a 66 ms (4 frame) window.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

Version 0.02 features a less cheeky failure message.
Attachments
tellinglys-0.02.zip
(35.41 KiB) Downloaded 626 times
nocash
Posts: 1405
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Telling LYs? (test ROM)

Post by nocash »

To be open to all users, maybe you could add a configuration screen for selecting the preferred error message.
  • Inappropriate behaviour
  • Incorrect behaviour
  • Your emulator sucks
  • You are full of shit
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Telling LYs? (test ROM)

Post by zzo38 »

nocash wrote:To be open to all users, maybe you could add a configuration screen for selecting the preferred error message.
  • Inappropriate behaviour
  • Incorrect behaviour
  • Your emulator sucks
  • You are full of shit
Or a single byte in ROM which can be patched to select one.

However, I find such things unnecessary, and do not really care, as long as you can see that it is successful or fail. (If I had to select though, "Incorrect behaviour" or or even just "Fail" seems good to me)
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
ISSOtm
Posts: 58
Joined: Fri Jan 04, 2019 5:31 pm
Location: France, right of a pile of consoles
Contact:

Re: Telling LYs? (test ROM)

Post by ISSOtm »

I think that last post was sarcasm.
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3
nocash
Posts: 1405
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Telling LYs? (test ROM)

Post by nocash »

You have never played Leather Goddesses of Phobos, didn't you?
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

Not to be confused with Sam Barlow's FMV mystery game Telling Lies, released on August 23, 2019.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

After seeing another GitHub user cite the issue I filed against Mesen-S in an issue that the user filed against Snes9x, I've started a tracking bug on GitHub to keep track of issues related to this family of test ROMs.
In [url=https://twitter.com/A_i/status/1165031439106072576]this Tweet[/url], Annapurna Interactive (@A_i) wrote:did you know that every single time someone comments/tweets/etc "no papa" or "Todd Howard" in regards to our latest release, we delay our next game by a day
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Telling LYs? (test ROM)

Post by tepples »

Ported to GBA?
Yes papa
AGB-001 passing?
Yes papa
mGBA Qt?
Still no papa
Open the issue tracker
it's a dupe
Attachments
tellinglys-gba-0.01.zip
(14.61 KiB) Downloaded 71 times
Post Reply