ams-hackers / gbforth

👾 A Forth-based Game Boy development kit
https://gbforth.org
MIT License
128 stars 24 forks source link

Input not working #334

Closed ibispi closed 1 year ago

ibispi commented 3 years ago

My friend doesn't use Github, so I'm here to send a message in his name:

"Hello, I git cloned the repo and built the examples:

f@extensa:~/spool/gbforth_$ make examples
./gbforth --no-kernel examples/hello-world-asm/hello.fs examples/hello-world-asm/hello.gb
./gbforth --pad-ff examples/hello-world/hello.fs examples/hello-world/hello.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/sokoban/sokoban.fs examples/sokoban/sokoban.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/simon/simon.fs examples/simon/simon.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/aces-up/aces-up.fs examples/aces-up/aces-up.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/happy-birthday/happy-birthday.fs examples/happy-birthday/happy-birthday.gb
redefined [char]  redefined s"  redefined nothing  redefined wait  ./gbforth --pad-ff examples/10-print/10-print.fs examples/10-print/10-print.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/brainfuck/brainfuck.fs examples/brainfuck/brainfuck.gb
redefined [char]  redefined s"  ./gbforth --pad-ff examples/synth/synth.fs examples/synth/synth.gb

but when I try to run them, e.g. with:

vba examples/aces-up/aces-up.gb

input is non responsive (i.e. I can press «Enter» or any other key on the keyboard, nothing happens). It is not an emulator problem because when I load other ROMs («original» or homebrew) they work fine. I run Debian Buster."

Cheers

tkers commented 3 years ago

Interesting. I quickly tried running the examples in VBA 2.1.4 (on MacOS 11.2) and it all looks fine. Is it just the input that is non-responsive, and is the screen being updated correctly (for example when running 10-print.gb)?

Are you able to share the output of one of the .gb files? Maybe for some reason it did not compile correctly.

ibispi commented 3 years ago

My friend replies with:

"The screen is updated correctly (e.g. in 10-print.gb I see the screen updated one line at the time ≃ every second). I attach a sokoban.gb, which I cannot get to work (I see the first screen but input is non responsive).

I am running both gbforth (from git) and vba (installed from the repos) on debian buster."

sokoban.zip

ibispi commented 3 years ago

An update:

"Ah! I have tried the game with GameBoy Online and it works! So it seems it is something VBA related. To make sure I tried to compile the latest VBA but did not manage to fulfill the dependencies, so I cannot say if the latest version fixes this. It is still weird as other ROMs run fine on my VBA, but I do not know how to help diagnose this!"

tkers commented 1 year ago

This took a long time, but I just pushed e131cc807b884b69f4512d1be6b223cfefd3a8ae to improve emulator compatibility for the input.fs lib.

I was not able to verify this for VBA, but I did see that this change resolved the same issue for Peanut GB, so I'm marking this issue fixed for now.

Apparently HILO interrupts are not always implemented correctly because few games rely on it in the first place, so now the KEY word waits for VBLANKs to check for input. Thanks to @gekkio for pointing me in the right direction!