It is currently Mon Feb 18, 2019 1:36 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Thu Jan 24, 2019 10:54 pm 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 484
Location: Rive nord de Montréal
Two days ago, I attended a meetup of C++ Montréal. The presentation was about the presenter's (Frédéric Hamel) attempt to make a fairly accurate Gameboy (DMG) emulator in C++11. I have to say, it's quite a strange feeling to hear about things and people you only saw in the internet, never in the "real world"; for instance, he gave credits to the Pan docs, the higan emulator, and blargg's excellent suite of test ROMs.

But that's not the subject at hand.

The presenter explained near the end that when his emulator was good enough he tested some games, and upon trying a "brick game", he found that game to behave strangely: the paddle would stick to the edge and pause instantly. He then spent alot of time comparing with other emulators, while reverse engineering the game at the same time. Eventually, he found out the bug: the serial link data register ($FF01) should have a "default" value of $FF instead of 0. In the process however, he discovered that the game actually use the Game Link data, and judging by the code that use said data, the game could actually use some external rotary controller, analogous in operation to the Vaus controller for Arkanoid. By looking at his emulator's commit history, that "brick" game is Alleyway.

Now the question: is that news to you all? The speaker mentioned that he didn't find any information whatsoever about that on the internet. I tried myself and indeed, I found nothing about Alleyway's mysterious external controller, not even on tcrf. Maybe at some point Nintendo considered making a Vaus-like controller to be sold along with Alleyway, but then the idea was scrapped before the launch of the game? Understandable, because it could be awkward to hold the Gameboy with one hand and a rotary controller with the other.

_________________
((λ (x) (x x)) (λ (x) (x x)))


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 11:04 am 
Offline

Joined: Tue Nov 23, 2004 9:35 pm
Posts: 725
I recall that the Nt Mini's Game Boy core has a very similar bug to what you describe for Alleyway, it is probably the same bug but it has been a long time since I last tried it.

_________________
Nerdly Pleasures - My Vintage Video Game & Computing Blog


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 11:29 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8136
Location: Seattle
... Looking at gnuboy (an ancient abandoned emulator), they have this gem:
Code:
        case RI_SC:
                /* FIXME - this is a hack for stupid roms that probe serial */
                if ((b & 0x81) == 0x81)
                {
                        R_SB = 0xff;
                        hw_interrupt(IF_SERIAL, IF_SERIAL);
                        hw_interrupt(0, IF_SERIAL);
                }
                R_SC = b; /* & 0x7f; */
                break;
which I really bet is referring to the same thing



Quickly hacking around with this, the controller seemed to have a wheel and a button. The controller must have been canceled pretty early in development, because this isn't playable.

The API implemented by Alleyway goes:
* Values between 0 and 0xF0 are treated as valid. (0xF1 through 0xFF defer horizontal control to the joypad)
* Values less than 0x3F are clipped to 0x3F
* Values above 0x97 are clipped to 0x97
And the problematic one:
* When the value changes from ≥0x80 to ≤0x7f, the game acts as though the start button has been pressed. But this is in the middle of the above ADC range.


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 2:28 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 812
lidnariq wrote:
* When the value changes from ≥0x80 to ≤0x7f, the game acts as though the start button has been pressed. But this is in the middle of the above ADC range.

That's apparently supposed to start the game, isn't it?


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 2:30 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8136
Location: Seattle
I mean, it acts just like pressing start at any other time...


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 2:51 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 812
There are two bytes. The analog value can cross 7Fh <--> 80h without acting as start button. The other byte has a button in bit7, which works like a combination of start (for leaving title screen, and for pause) and button a (for letting the ball appear).


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 3:07 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8136
Location: Seattle
Oh, a 16 bit report? That would explain why I was getting nonsense.


Top
 Profile  
 
PostPosted: Fri Jan 25, 2019 11:56 pm 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 484
Location: Rive nord de Montréal
16bit report? That's... intense. Like, sure, the ADC in the controller is probably 10 bits in resolution, but 7 bits would be sufficient, right?

_________________
((λ (x) (x x)) (λ (x) (x x)))


Top
 Profile  
 
PostPosted: Sat Jan 26, 2019 12:03 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8136
Location: Seattle
Well, it's one byte of ADC and one byte of button.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group