Genesis / Megadrive core ported to MiST

https://github.com/mist-devel/mist-board/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Moderator Team

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 7:36 pm

MasterOfGizmo wrote:
Are we sure DMA to CRAM works at all? Do other games use that?

Also i read here and there that DMA to CRAM happens with an auto increment of 0.


Turned out, it doesn't use DMA. The routine which fills CRAM before the wrong display is at 000078f0. It's not the same routine which fills CRAM at other places. Now trying to find out, why these instructions don't trigger a data upload in the VDP.

Upd: I think I found it. It uses MOVE w. D0, $4(A6), which writes one word to the control port. So it start to set up the transfer. However it doesn't write another word, so the transfer address and code's second half is just what was left there. At the end, the CODE field ends in 13h. But the VDP doesn't trigger a CRAM write only for "00011" (which is documented in the VDP Wiki). So have to find out, how to handle these undocumented codes.

Upd2: the code seems to be broken in more aspects, too, e.g. without the second write, it won't set up the address. Also strange if the CODE is not correct, and no DMA FILL in progress, it just asserts FF_DTACK_N? Why? And if DMA FILL is in progress, shouldn't it just ignore CODE, and use the value for FILL?
Last edited by slingshot on Fri Oct 12, 2018 8:26 pm, edited 2 times in total.

User avatar
jotego
Atari maniac
Atari maniac
Posts: 98
Joined: Wed May 04, 2016 10:02 am
Location: Valencia (Spain)
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby jotego » Fri Oct 12, 2018 8:12 pm

I have just released v0.40 of JT12 (master branch). Much improved. Many broken games should have correct sound now.

Slingshot, please use external FIFO to prevent system-level timing misalignments with YM2612.

I have received a lot of community support this time. The new version of FPGAgen by Slingshot was a big stimulus to get back to work. Alexey -from MiSTer- has helped a lot to debug the stuff. But there were also other contributors. Sometimes it's confusing as people have different nicknames in different networks but you can get an idea by looking at the issues section in the repository.

There are still a few things left to do. Some of them important, like finishing off the LFO section, some of them just nice to have. We'll get there.

Enjoy!

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 8:20 pm

jotego wrote:I have just released v0.40 of JT12 (master branch). Much improved. Many broken games should have correct sound now.

Slingshot, please use external FIFO to prevent system-level timing misalignments with YM2612.


Great news! I've ditched my FIFO, all games I've tested work without that. Do you have some examples which games are not working without the FIFO?

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Fri Oct 12, 2018 8:28 pm

slingshot wrote:Great news! I've ditched my FIFO, all games I've tested work without that. Do you have some examples which games are not working without the FIFO?

Famous Jim Power :)
For me it plays the music with different instruments every time i press reset. With FIFO it plays correct instruments every time.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Fri Oct 12, 2018 8:30 pm

slingshot wrote:Upd: I think I found it. It uses MOVE w. D0, $4(A6), which writes one word to the control port. So it start to set up the transfer. However it doesn't write another word, so the transfer address and code's second half is just what was left there. At the end, the CODE field ends in 13h. But the VDP doesn't trigger a CRAM write only for "00011" (which is documented in the VDP Wiki). So have to find out, how to handle these undocumented codes.

Upd2: the code seems to be broken in more aspects, too, e.g. without the second write, it won't set up the address. Also strange if the CODE is not correct, and no DMA FILL in progress, it just asserts FF_DTACK_N? Why? And if DMA FILL is in progress, shouldn't it just ignore CODE, and use the value for FILL?

According to info, it's OK to write only first part to Control port. In this case previous version of second part will be used.

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 8:46 pm

Sorgelig wrote:
slingshot wrote:Upd: I think I found it. It uses MOVE w. D0, $4(A6), which writes one word to the control port. So it start to set up the transfer. However it doesn't write another word, so the transfer address and code's second half is just what was left there. At the end, the CODE field ends in 13h. But the VDP doesn't trigger a CRAM write only for "00011" (which is documented in the VDP Wiki). So have to find out, how to handle these undocumented codes.

Upd2: the code seems to be broken in more aspects, too, e.g. without the second write, it won't set up the address. Also strange if the CODE is not correct, and no DMA FILL in progress, it just asserts FF_DTACK_N? Why? And if DMA FILL is in progress, shouldn't it just ignore CODE, and use the value for FILL?

According to info, it's OK to write only first part to Control port. In this case previous version of second part will be used.


Yes, seems to be OK, since Lotus uses it. Just the question how to interpret leftover bits from previous CODE setup? And DMA FILL shouldn't get priority if it is already started?
Btw, this fixes Lotus I, but breaks Till's hello world (is it using DMA FILL?)

Code: Select all

if CODE(3 downto 0) = "0011" -- CRAM Write
or CODE(3 downto 0) = "0101" -- VSRAM Write
or CODE(3 downto 0) = "0001" -- VRAM Write

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Sat Oct 13, 2018 2:33 am

How to add include path in ghdl??
it cannot find arpa/inet.h and i don't see where this *** ghdl is looking for includes

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Sat Oct 13, 2018 3:26 am

well.. it seems there is no way to run ghdl in mingw...

User avatar
jotego
Atari maniac
Atari maniac
Posts: 98
Joined: Wed May 04, 2016 10:02 am
Location: Valencia (Spain)
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby jotego » Sat Oct 13, 2018 5:15 am

Slingshot, where are you posting your synthesized core? I see your github repository, is it there? By the way, if you enable the issues tab in github, we can post there problems specific to system level FPGAgen. For one, PSG sound is too loud relative to FM. We can open an issue in my repository about how to amplify the FM output if want.

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 9:41 am

jotego wrote:Slingshot, where are you posting your synthesized core? I see your github repository, is it there? By the way, if you enable the issues tab in github, we can post there problems specific to system level FPGAgen. For one, PSG sound is too loud relative to FM. We can open an issue in my repository about how to amplify the FM output if want.


I've put a new release with jt12 0.4 to https://github.com/mist-devel/mist-bina ... 181013.rbf
Yes, I noticed the FM sound is a bit silent, but my audio equipment (USB-powered speakers) is not too high-end.

Forgot to mention: this requires a new firmware for controls.
I'm aware of many issues, but you can post them here, too, just opening another tracker for them is not necessary.
Last edited by slingshot on Sat Oct 13, 2018 10:22 am, edited 2 times in total.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Sat Oct 13, 2018 10:10 am

jotego wrote:For one, PSG sound is too loud relative to FM.

it's FM sound too quiet as i've told already :)
Genesis core is most quiet core among others.

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 10:23 am

Sorgelig wrote:
jotego wrote:For one, PSG sound is too loud relative to FM.

it's FM sound too quiet as i've told already :)
Genesis core is most quiet core among others.


Good for late night :)

User avatar
jotego
Atari maniac
Atari maniac
Posts: 98
Joined: Wed May 04, 2016 10:02 am
Location: Valencia (Spain)
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby jotego » Sat Oct 13, 2018 10:58 am

slingshot wrote:
Sorgelig wrote:
jotego wrote:For one, PSG sound is too loud relative to FM.

it's FM sound too quiet as i've told already :)
Genesis core is most quiet core among others.


Good for late night :)


There is a block in jt12 called jt12_limitamp. Very simple, it doubles the amplitude of the input while preventing overflow. You could add it to your VirtualTop before the DAC output. I remember we had volume control in early versions of FPGAgen.

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 11:33 am

jotego wrote:There is a block in jt12 called jt12_limitamp. Very simple, it doubles the amplitude of the input while preventing overflow. You could add it to your VirtualTop before the DAC output. I remember we had volume control in early versions of FPGAgen.


Since no such thing in the MiST OSD as volume control gauge, it cannot be used. Also other cores don't have it, so no point of having volume control for only one core. Will try the jt12 amplifier.
PS: Just re-uploaded the beta, hopefully with a final fix to annoying reset problems.

hyperterminal
Atari freak
Atari freak
Posts: 53
Joined: Sun Jul 09, 2017 1:43 pm

Re: Genesis / Megadrive core ported to MiST

Postby hyperterminal » Sat Oct 13, 2018 3:50 pm

Anybody got a good mist.ini for setting up the controls in the Genesis core for the SNES buffalo controller?

The one uploaded at github.com doesn't work for me. The start button doesn't work so that I cannot start any game.

Code: Select all

[genesis]
joystick_remap=0583,2060,1,2,4,8,10,20,40,40,1400,2800,200,80 ; remap buttons for SNES buffalo controller
joy_key_map=1000,E2
joy_key_map=2000,E6
joy_key_map=4,51
joy_key_map=8,52

I tried to play Outrun but could only see the attract mode. The music seems to have the correct speed now.

NegSol
Captain Atari
Captain Atari
Posts: 236
Joined: Sat Dec 05, 2015 9:22 pm

Re: Genesis / Megadrive core ported to MiST

Postby NegSol » Sat Oct 13, 2018 5:43 pm

Maybe try Joystick swap off and Only 3 buttons off (worked for me with the buffalo controller).

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 5:44 pm

hyperterminal wrote:Anybody got a good mist.ini for setting up the controls in the Genesis core for the SNES buffalo controller?

The one uploaded at github.com doesn't work for me. The start button doesn't work so that I cannot start any game.

Code: Select all

[genesis]
joystick_remap=0583,2060,1,2,4,8,10,20,40,40,1400,2800,200,80 ; remap buttons for SNES buffalo controller
joy_key_map=1000,E2
joy_key_map=2000,E6
joy_key_map=4,51
joy_key_map=8,52

I tried to play Outrun but could only see the attract mode. The music seems to have the correct speed now.


What the joystick test in the OSD menu shows for the start button? And works as joystick 1 or joystick 2?

NegSol
Captain Atari
Captain Atari
Posts: 236
Joined: Sat Dec 05, 2015 9:22 pm

Re: Genesis / Megadrive core ported to MiST

Postby NegSol » Sat Oct 13, 2018 5:46 pm

Buffalo controller should work (see my comment above).

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 6:12 pm

NegSol wrote:Buffalo controller should work (see my comment above).


Ok, we wrote at the same time :)

hyperterminal
Atari freak
Atari freak
Posts: 53
Joined: Sun Jul 09, 2017 1:43 pm

Re: Genesis / Megadrive core ported to MiST

Postby hyperterminal » Sat Oct 13, 2018 6:21 pm

Thank you for your help. The joystick test in the OSD menu shows the Buffalo controller as controller 1. When I press "start" it shows "Sta". There is no second controller attached, only a keyboard.

The d-pad and the other buttons aren't working either, only in the joystick test in the OSD menu. I tried different games with 3 or 6 button mode, but no success. Other cores like the NES core work fine.

Maybe something else in the ini is causing these problems? This is my complete mist.ini:

Code: Select all

[mist]
joystick_remap=0583,2060,1,2,4,8,10,10,20,20,400,800,40,80
led_animation=0
scandoubler_disable=0
ypbpr=0
keep_video_mode=1
reset_combo=2
keyrah_mode=1
mouse_boot_mode=0
joystick0_prefer_db9=0
joystick_disable_shortcuts=0
joystick_ignore_hat=0
joystick_ignore_osd=0
key_menu_as_rgui=0
[genesis]
joystick_remap=0583,2060,1,2,4,8,10,20,40,40,1400,2800,200,80
joy_key_map=1000,E2
joy_key_map=2000,E6
joy_key_map=4,51
joy_key_map=8,52

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 6:22 pm

hyperterminal wrote:Thank you for your help. The joystick test in the OSD menu shows the Buffalo controller as controller 1. When I press "start" it shows "Sta". There is no second controller attached, only a keyboard.

The d-pad and the other buttons aren't working either, only in the joystick test in the OSD menu. I tried different games with 3 or 6 button mode, but no success. Other cores like the NES core work fine.

Seems you forgot to update the firmware.

hyperterminal
Atari freak
Atari freak
Posts: 53
Joined: Sun Jul 09, 2017 1:43 pm

Re: Genesis / Megadrive core ported to MiST

Postby hyperterminal » Sat Oct 13, 2018 6:54 pm

That solved the problem. I feel so stupid. Didn't notice the new core required a firmware update.

NegSol
Captain Atari
Captain Atari
Posts: 236
Joined: Sat Dec 05, 2015 9:22 pm

Re: Genesis / Megadrive core ported to MiST

Postby NegSol » Sat Oct 13, 2018 7:42 pm

easy mistake to make :) no worries

slingshot
Captain Atari
Captain Atari
Posts: 169
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Sat Oct 13, 2018 10:12 pm

slingshot wrote:Yes, seems to be OK, since Lotus uses it. Just the question how to interpret leftover bits from previous CODE setup? And DMA FILL shouldn't get priority if it is already started?

So to answer myself, I found this long post about the CODE bits:

http://gendev.spritesmind.net/forum/vie ... 1&start=47

Seems the current implementation can have some corrections. Maybe the most important (and should make Lotus I work) is to clear CODE(5) after a DMA operation finished.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2546
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Sun Oct 14, 2018 12:13 am

I've found some time ago from emulator that DMA flag is not correctly implemented. It should mask CODE(5) write instead of ignore it (that's what is written in this article). But changes in the behavior gives some bugs. Need to explore more.


Return to “MiST”

Who is online

Users browsing this forum: No registered users and 3 guests