Gameboy core

https://github.com/MiSTer-devel/Main_MiSTer/wiki
Locked
widge
Atari User
Atari User
Posts: 35
Joined: Wed Oct 10, 2018 6:24 pm

Gameboy core

Post by widge »

Hello,

I create a topic for the Mister Gameboy core as it seems there is only the original one for Mist.

Sorgelig released a new version today that is much improved compared to the one of March.

With the version of March I had tested 3 games:
Tetris: seemed OK
Super Mario Land: could only play the first 2-3 levels before the core would reset
Gargoyle's Quest: would only play the intro, not playable
Blargg's tests: no test would pass

Today's version:
Super Mario Land: no longer resets after a few levels
Gargoyle's Quest: playable
Blargg's tests: 12 tests pass

I have put the results for Blargg's tests there: http://emulation.gametechwiki.com/index.php/GB/C_Tests

Thanks to brNX and sorgelig for the work on this core.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Hi,

you're welcome.

Most of the games I tested now go in-game and the majority of those are playable.
There are still some video and audio issues to iron out (e.g., final fantasy legend 1 and 2 , mario picross and micro machines have corrupted graphics ).

Cheers
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

R-Type doesn't mute the sound between stages or when you restart.
BlockABoots
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 143
Joined: Sat Oct 20, 2018 3:20 pm

Re: Mister Gameboy core

Post by BlockABoots »

Have noticed the audio in Double Dragon 2 and Super Hunchback doesnt sound correct, the pitch seems to alternating and sounds odd
Last edited by BlockABoots on Mon Nov 19, 2018 4:01 pm, edited 1 time in total.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Sorgelig wrote:R-Type doesn't mute the sound between stages or when you restart.
Just tested it on BGB, a chime is also missing before muting the sound when pausing the game. Will investigate.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

Actually it's not only in pauses. Anywhere in R-Type where music is supposed to be muted, it sounds the last note.
User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 192
Joined: Wed Sep 26, 2018 6:03 am

Re: Mister Gameboy core

Post by kitrinx »

I noticed GB runs at 36khz rather than 15khz, like line doubling is always on. Is this intentional?
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Sorgelig wrote:Actually it's not only in pauses. Anywhere in R-Type where music is supposed to be muted, it sounds the last note.
Ok, found where this was happening , the original author of the sound code assumed that the 2 square wave channels only changed registers before the channels where triggered,so the volume register was stuck at the last value, this is wrong you can change any register at any given time. I fixed the looping sound but still haven't figured out why the "chime" isn't playing.
I will read up on the sound channels/generators and try to fix a few more things before submitting a PR.
kitrinx wrote:I noticed GB runs at 36khz rather than 15khz, like line doubling is always on. Is this intentional?
It probably came from the original code, maybe @Sorgelig can elaborate on that.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

kitrinx wrote:I noticed GB runs at 36khz rather than 15khz, like line doubling is always on. Is this intentional?
this is from original Gameboy core. This is not TV console so basically it's not exactly must have TV compatible frequencies.

Probably original author made it as VGA 800x600 core.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

According to info i found the Horizontal freq of original Gameboy is about 9.6KHz. It's not compatible with TV standard. Even being multiplied twice, you will get something like 19KHz and still not compatible with TV.
So, the core has 4x of original horizontal freq and about VGA compatible.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

PR sent with Audio Fixes , the length counter stop conditions were wrong, this should fix a lot of looping sound issues. Parodius' sound for instance went from totally annoying to "ok" sounding :D.

I've been using Blargg's test roms to debug the APU, the first 2 tests now pass but I am stuck at 03, if someone has knowledge about those tests, especially test 2 and 3 of 03-trigger.gb, I would be grateful if they could explain it here.

The Noise channel (4) is still often "wrong", I think the LFSR is being mistakenly switched to the 7 bit mode (the ocean waves of legend of zelda's intro sound too "metallic").

I implemented a dummy serial port that always returns "not connected" and triggers the interrupt, this fixes Alleyway and probably other games too.

Final Fantasy Legends 1 and 2 seem to be fixed after I changed the LY==LYC interrupt to trigger earlier, Mario's Picross is now also playable, but it still has some minor graphical issues (probably timing related).

Cheers
widge
Atari User
Atari User
Posts: 35
Joined: Wed Oct 10, 2018 6:24 pm

Re: Mister Gameboy core

Post by widge »

Hello,

I have 16 entities not defined when trying to compile the core.

I just open Gameboy.qpf and compile.

Is there something one has to configure before attempting to compile?

Thanks
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Hi,

yup that should be it, did you install the Cyclone V Device Support?
widge
Atari User
Atari User
Posts: 35
Joined: Wed Oct 10, 2018 6:24 pm

Re: Mister Gameboy core

Post by widge »

Yes I have installed Cyclone V support.

I think I had a path issue, I had cloned the repository in a sub sub sub directory.

When putting the repo under /git I can compile.

Thanks
widge
Atari User
Atari User
Posts: 35
Joined: Wed Oct 10, 2018 6:24 pm

Re: Mister Gameboy core

Post by widge »

Regarding tests 2 and 3 of 03-trigger.gb I have had a look at the source and here is my understanding of the test.

The length counter does not decrement if the wave channel is triggered after about half of length period.

Length period is 4194304/256Hz = 16384
Half length period is = 16384/2 = 8192 clocks

test 2 sets a length of 2 and delays by 8256 clocks (a little bit after half length period) before triggering, length is initially at 2 and stays at 2 after the trigger (I guess he loads the expected value in a).

test 3 sets a length of 2 and delays by 7900 clocks (a little bit before half length period) before triggering, length is initially at 2 but decrements to 1 after the trigger (again I guess a is the expected value here).

test_chan:
set_test 2,"Enabling in second half of length period ","shouldn't clock length"
call begin
wchn 1,-2 ; length = 2
delay_clocks 8256 ; delay until beginning of second half of length period
wchn 4,$40 ; enable
ld a,2
call end_nodelay

set_test 3,"Enabling in first half of length period should clock length"
call begin
wchn 1,-2 ; length = 2
delay_clocks 7900 ; delay until near-end of first half of length period
wchn 4,$40 ; enable
ld a,1
call end_nodelay
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Hi

thx @widge, should have probably posted here that meanwhile I understood those tests.

My latest PR passes most of Blargg's Sound tests and fixes issues with the noise channel and the channel 1 sweep unit (square 1), among other improvements we finally have "waves" in the Legend of Zelda intro, Mega man's "drums" sound good and the "pew pew" :lol: sound works in Solar Striker.

The APU still needs some bug catching, when pausing R-type the "chime" (channel 1) still doesn't ring and in some games the square and wave channels sometimes sounds off.

Cheers
widge
Atari User
Atari User
Posts: 35
Joined: Wed Oct 10, 2018 6:24 pm

Re: Mister Gameboy core

Post by widge »

Good news, the core is definitely going in the right direction :)
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

Yeah! I'm happy this core development is caught by brNX.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Hi

PR sent with fixes for the last couple of issues, it should fix most of the pitch related issues and the missing sounds.
R-Type finally has the missing chime while entering the pause screen and the shooting sound sounds correct, the sound while catching a mushroom or another power-up in Super Mario Land 2 sound correctly now, likewise when catching the coins.

@BlockABoots I also tested Double dragon 2 and super hunchback and I think they now sound correct.

The APU should now be more or less complete, I still hear a few rare crackling sound issues in some games (Gargoyle's Quest and Batman) but this problem could come from elsewhere.

Cheers
albconde
Atari maniac
Atari maniac
Posts: 96
Joined: Thu Nov 30, 2017 8:56 am

Re: Mister Gameboy core

Post by albconde »

Hi .
I have problems with the image in the last release ( 20181130) ,the image begins to blink randomly, sometimes it recovers alone and sometimes it does not.
Even sometimes it starts blinking just at load the core ,whitout load any game
User avatar
remowilliams
Captain Atari
Captain Atari
Posts: 256
Joined: Mon Apr 02, 2007 1:49 am

Re: Mister Gameboy core

Post by remowilliams »

I have observed the same blinking video (HDMI/vsync_adjust=1) in Gameboy_20181130. Running SMW it was blinking randomly every few seconds or so, entering the first tunnel and remaining there for a bit caused the blinking to go absolutely stroboscopic. This is not occurring in Gameboy_20181118.
tmerelle
Atarian
Atarian
Posts: 3
Joined: Mon Nov 05, 2018 3:04 am

Re: Mister Gameboy core

Post by tmerelle »

I confirm the stroboscopic effect on this new release.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Hi guys

I can confirm I have the same issue from the begining actually,
I am compiling the master branch from git right now to see if it is a problem on my end.
It is weird because the video code wasn't changed between versions.
brNX
Atari maniac
Atari maniac
Posts: 85
Joined: Wed Oct 24, 2018 10:22 pm
Location: Coimbra/Portugal

Re: Mister Gameboy core

Post by brNX »

Yup, compiled the time limited version using the "full" scaler, looks ok on my end.

Sorgelig can you please check what's going on on your side when you have the time, maybe a corrupt file while uploading ?
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Mister Gameboy core

Post by Sorgelig »

Probably this core got metastability issue. It's probably not good design of video part.
This problem may appear and disappear between builds even if only unrelated to video code had been changed.
I've just applied PR from Kitrinx providing more palettes.
I will compile it and will see if this build will be better.

Bay anyway, video part most likely need to be improved to provide more stable video.
Locked

Return to “MiSTer”