Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to load a .gb file? #24

Open
cyberic99 opened this issue Mar 5, 2019 · 8 comments
Open

is it possible to load a .gb file? #24

cyberic99 opened this issue Mar 5, 2019 · 8 comments
Labels

Comments

@cyberic99
Copy link

I'd like to load a .gb file, simulate keypresses, and log the register writes.

is it possible or doable with the help of plugins?

Thx

@mmitch
Copy link
Owner

mmitch commented Mar 6, 2019

No, because gbsplay only supports the sound hardware of a Gameboy. Nothing related to screen or buttons is included (well, I think we have vsync/hsync, but that is timing only).
Also, gbsplay does a file format check and will only accept GBS files (they include a special header). I don't know if a full .gb dump and a .gbs are the same file format or not.

You should look for a "real" Gameboy emulator that emulates the whole Gameboy like VisualboyAdvance-M or Gnuboy.

@cyberic99
Copy link
Author

cyberic99 commented Mar 8, 2019

Thx

I thought it was possible, because ot his commit:
a8aec38

I have been able to accomplish that with Sameboy.

@mmitch
Copy link
Owner

mmitch commented Mar 8, 2019

Ok, I don't know anything about that in detail. @ranma?

@ranma
Copy link
Collaborator

ranma commented Mar 10, 2019

There is rudimentary support for .gb roms, but I only really tested it with one of the Pokemon roms, YMMV.
As mmitch said, there is no emulation for input or the graphics hardware, but if you're lucky the title screen music should work.

@cyberic99
Copy link
Author

Thank you for your replies

there is no emulation for input

Would it be possible to press a button, using a custom plugin?

it seems that the gameboy only reads a register at FF00 to know if somme buttons are depressed

@aaaaaa123456789
Copy link

I don't know if a full .gb dump and a .gbs are the same file format or not.

They aren't. A .gb file is raw ROM data; the header is part of the ROM itself, not some separate header. It has a fixed entry point ($0100) and it starts executing from there.

it seems that the gameboy only reads a register at FF00 to know if somme buttons are depressed

It's a bit more complicated than that:

  1. Set $FF00 to either $20 or $10 to respectively indicate that you want to read the D-Pad or the buttons
  2. Wait 3us
  3. Read the data for the selected inputs in the lower four bits of $FF00
  4. Now set $FF00 to the value you didn't use in step 1
  5. Wait another 3us
  6. Read the data for the remaining inputs in the lower four bits of $FF00
  7. Combine the values obtained in steps 3 and 6 for a full input read-out

Not to mention that it's not just input that you'd need to emulate. You'd have to emulate the whole state of the device up to the point when the first track plays. GBS files have their own special cut-down routines for playing a selected song after being given an ID externally. An actual ROM would attempt to initialize most of the GB's hardware, and most likely fail at it.

@ranma
Copy link
Collaborator

ranma commented Jun 27, 2020

Some examples of GB roms that work:
http://www.pouet.net/prod.php?which=56367
http://www.pouet.net/prod.php?which=82460
and probably others from http://www.pouet.net/prodlist.php?platform%5B%5D=Gameboy

VGM files converted from VGM into a GB rom with https://vgmrips.net/wiki/Dmvgm

(For some you need to override the default silence timeout)

@cyberic99
Copy link
Author

great, thanks for your answers and the progress on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants