Genesis / Megadrive core ported to MiST

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

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

chaos
Atari nerd
Atari nerd
Posts: 46
Joined: Thu Dec 18, 2014 10:09 am
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby chaos » Thu Oct 11, 2018 11:05 am

MasterOfGizmo wrote:
Sorgelig wrote:is not really correct way to copy lowbit color to highbit color.


Doing that will result in non-linearity. So both solutions aren't perfect.


Hi guys.

If I may chime in - doing this will not result in non-linearity, it just changes the gain. That is, doing:

Code: Select all

wire [3:0] in;
wire [7:0] out;
assign out = {in[3:0], in[3:0]};

is the same as multiplying in by some constant, so only gain changes, but the output is still linear in regards to input.

When I was testing dithering for minimig on the MiST board, I also noticed that the video output is not completely linear, but it isn't caused by dithering or applying gain to the output signals (which minimig doesn't have anyway). Could be that the resistors on VGA outputs are to blame (resistors aren't 100% proper value, so some non-linearity could be produced for different bits of RGB signals).

The video output is fixed a little by using 8mA drive strength on the VGA pins, so maybe try using the same setting for the Megadrive core.
** my minimig builds: http://somuch.guru/ **

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Thu Oct 11, 2018 11:57 am

chaos wrote:If I may chime in - doing this will not result in non-linearity, it just changes the gain. That is, doing:


Too cool, who's reading here. MikeJ also noticed this thread.

Of course appending the same twice is linear. But he wanted to append the high bits of a longer word to expand it by less than the same ammount of bit.

sorgelig wrote:You must add upper bits to lower "unused" bits


Expanding 4 genesis bits to 6 MIST bits that way causes non-linearity. E.g.

Code: Select all

4 bits  6 bits
0 0000  0000&00  0
1 0001  0001&00  4  (0+4)
2 0010  0010&00  8  (4+4)
3 0011  0011&00  12  (8+4)
4 0100  0100&01  17  (12+5)  <-- the step is bigger here
5 0101  0101&01  21  (17+4)
6 0110  0110&01  25  (21+4)
...
15 0110  1111&11  63           <-- but we end at full gain here



While just setting the lower bits two zero maintains linearity but doesn't reach full voltage level.

But you are right, the MIST itself isn't linear ...
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

chaos
Atari nerd
Atari nerd
Posts: 46
Joined: Thu Dec 18, 2014 10:09 am
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby chaos » Thu Oct 11, 2018 1:09 pm

MasterOfGizmo wrote:Too cool, who's reading here. MikeJ also noticed this thread.

Yes, it's been a while ;)

Of course appending the same twice is linear. But he wanted to append the high bits of a longer word to expand it by less than the same ammount of bit.

Yes that is true, since the proper result can't be represented with the limited bits available - you are effectively rounding (actually, flooring to be exact) the result in this case. Subjectively, I would argue that the result is still closer to the desired outcome, since the original can't be stepped in 1-bit increments (after expanding from 4 to 6 bits), it would be really hard to notice that non-linearity of 1 bit-level. Besides that, most of these early consoles / computers didn't really have gamma-corrected video outputs anyway, meaning that the steps between two adjacent color levels aren't correct anyway.

Objectively, there are reasons to go with either solution, but I think this is all pretty subjective anyway, so either solution should be OK. I do remember on the original OCS minimig on MiST with 4->6 bit video conversion done by appending two zero bits, that I noticed that the brightness was lower than on the DE1 board, which used full range.

BTW, anything new with the tg68k core? did Mikej publish his updated core already? I'm pretty much out of the loop these days, but I remember trying to run the Shapeshifter MAC emulation on minimig and noticing that the tg68k core misses an instruction or two to make that work. Would be cool to run Shapeshifter on minimig someday.
** my minimig builds: http://somuch.guru/ **

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Thu Oct 11, 2018 1:34 pm

Mike has done some cleanup and imho also added chk2 (which may actually fix some amiga games). He says he'll publish that version on github soon.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Thu Oct 11, 2018 4:10 pm

Just tried all the new stuff, Jim Power is fixed, however the music is strange.
Unfortunately Lotus I palette still wrong, need to debug that.
And while some sounds/instruments are still buggy, silent games has music now! Xenon2's Bomb the Bass is enjoyable.
So Till, Sorgelig, Jotego, it's great job!

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Thu Oct 11, 2018 9:04 pm

slingshot wrote:however the music is strange.

Just fixed that. My attempt to simplify the tg68k interface broke it.

slingshot wrote:And while some sounds/instruments are still buggy, silent games has music now! Xenon2's Bomb the Bass is enjoyable.


This now totally confuses me. I am so used to the previous sounds and voices in the games i've been testing that the new ones now sound alien to me.
Last edited by MasterOfGizmo on Thu Oct 11, 2018 9:22 pm, edited 1 time in total.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Thu Oct 11, 2018 9:21 pm

But this is now fetching jt12 from its repository which had the last commit in june, Is that really the latest version?
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

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

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Thu Oct 11, 2018 9:57 pm

MasterOfGizmo wrote:But this is now fetching jt12 from its repository which had the last commit in june, Is that really the latest version?

use clock_enable branch

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Thu Oct 11, 2018 10:24 pm

Sorgelig wrote:
MasterOfGizmo wrote:But this is now fetching jt12 from its repository which had the last commit in june, Is that really the latest version?

use clock_enable branch


Seems that is not enough, your version in MiSTer is good, with that FIFO. But hope Jotego's repo will have that soon, so I don't have to remove the submodule again.

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Thu Oct 11, 2018 10:33 pm

Sorgelig wrote:use clock_enable branch


Ah, i see. The submodule already referenced that. So i likely have that latest version as i also have sound in xenon II.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 5:43 am

slingshot wrote:Unfortunately Lotus I palette still wrong, need to debug that.


If it's a similar CPU problem i only need the exact instruction being used there.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 6:47 am

slingshot wrote:Unfortunately Lotus I palette still wrong, need to debug that.


Haha, that one is funny. To check how and when the palette is being written I wanted to test it with the gens-ii emulator. And guess what? It looks exactly as wrong as on the MIST :-)

And gens-ii does not have the swapped tiles in jimpower so it does not have the word/longword issues and the palette is probably not CPU related.

On the other hand if even a quite advanced emulator like gens-ii exhibits this then it's likely something known to those developers who's emulators display correctly.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 9:31 am

MasterOfGizmo wrote:
Haha, that one is funny. To check how and when the palette is being written I wanted to test it with the gens-ii emulator. And guess what? It looks exactly as wrong as on the MIST :-)


Wow :)
Where can this gens-II be downloaded? What I found is gens-gs-II only, or gens-gs, but the former has only a source repo, which is hard to compile, the later works with Lotus. Is it possible to dump the CRAM in the wrong emu? Then it can be compared to a known good dump from Exodus, to see if it's also a data upload error.
About the sound issue: seems the opram initialization is wrong, so in j12_opram.v, every ram[x] = .. line should be change to ram[x] = { ~7'd0, 37'd0 };

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 11:00 am

It's gens-gs-ii from https://github.com/gameblabla/gens-gs-ii

When i don't touch anything the first time a broken image appears the palette was set to

Code: Select all

00: 0000 0eee 0222 0666 006c 028a 04aa 0e44
10: 0e66 00ae 0e88 04ae 0eaa 06ce 0ecc 08ee
20: 0000 0eee 0020 0040 0026 0444 0666 004a
30: 0888 006c 006e 008e 00ae 0aaa 06ae 0ccc
40: 0000 0eee 00e0 0040 0024 0222 0048 0444
50: 0008 006a 0666 0068 008c 0888 00ae 0aaa
60: 0000 0eee 0222 0000 0000 0000 0000 0000
70: 0000 0000 0000 0888 0eee 0000 000a 0ccc


The image at that time was:
lotus_gen-gs-ii.png
You do not have the required permissions to view the files attached to this post.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 11:04 am

slingshot wrote:About the sound issue: seems the opram initialization is wrong, so in j12_opram.v, every ram[x] = .. line should be change to ram[x] = { ~7'd0, 37'd0 };


Why don't you fork jt12 and use that as the base of the submodule? Then you could then fix these things yourself and submit pull requests.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

DanyPPC
Captain Atari
Captain Atari
Posts: 449
Joined: Tue Feb 21, 2017 7:02 am

Re: Genesis / Megadrive core ported to MiST

Postby DanyPPC » Fri Oct 12, 2018 11:22 am

Lotus II is one of the games that use a 256 x 224 resolution.

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 11:36 am

DanyPPC wrote:Lotus II is one of the games that use a 256 x 224 resolution.


This is Lotus I. I also wondered if this may be mode 4 or the like where the palette works differently. But imho then also the whole tile handling would differ and the screen contents would not look correct at all.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 12:51 pm

MasterOfGizmo wrote:
DanyPPC wrote:Lotus II is one of the games that use a 256 x 224 resolution.


This is Lotus I. I also wondered if this may be mode 4 or the like where the palette works differently. But imho then also the whole tile handling would differ and the screen contents would not look correct at all.


It's Mode 5 for sure. I'll check the palette in Exodus later on, since it doesn't like to run in Wine.

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

Re: Genesis / Megadrive core ported to MiST

Postby Sorgelig » Fri Oct 12, 2018 1:23 pm

Exodus is buggy itself. Even in Win10 it hangs very hard after some time of idling, so i have to use task manager to force kill it.
Unfortunately, this is the only Genesis emulator with debugger i could find.

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 1:25 pm

MasterOfGizmo wrote:
slingshot wrote:About the sound issue: seems the opram initialization is wrong, so in j12_opram.v, every ram[x] = .. line should be change to ram[x] = { ~7'd0, 37'd0 };


Why don't you fork jt12 and use that as the base of the submodule? Then you could then fix these things yourself and submit pull requests.


Don't need, the latest commit in jt12 seems to be OK.

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 1:27 pm

Sorgelig wrote:Exodus is buggy itself. Even in Win10 it hangs very hard after some time of idling, so i have to use task manager to force kill it.
Unfortunately, this is the only Genesis emulator with debugger i could find.

Sometimes it has an internal counter overrun, and waits for a keypress in the console :)

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

Re: Genesis / Megadrive core ported to MiST

Postby slingshot » Fri Oct 12, 2018 2:12 pm

MasterOfGizmo wrote:It's gens-gs-ii from https://github.com/gameblabla/gens-gs-ii

When i don't touch anything the first time a broken image appears the palette was set to

Code: Select all

00: 0000 0eee 0222 0666 006c 028a 04aa 0e44
10: 0e66 00ae 0e88 04ae 0eaa 06ce 0ecc 08ee
20: 0000 0eee 0020 0040 0026 0444 0666 004a
30: 0888 006c 006e 008e 00ae 0aaa 06ae 0ccc
40: 0000 0eee 00e0 0040 0024 0222 0048 0444
50: 0008 006a 0666 0068 008c 0888 00ae 0aaa
60: 0000 0eee 0222 0000 0000 0000 0000 0000
70: 0000 0000 0000 0888 0eee 0000 000a 0ccc


The image at that time was:
lotus_gen-gs-ii.png


Ok, that is the palette from the previous screen. So it fails to upload the new one for the game. I noticed that at this place the palette change is instant in Exodus, so maybe uses DMA for CRAM update. Could be a missed VINT?

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 2:54 pm

slingshot wrote:I noticed that at this place the palette change is instant in Exodus, so maybe uses DMA for CRAM update. Could be a missed VINT?


Indeed gens doesn't see any write to the cram after the image with the black car shadow at the bottom. So yes, it's still the palette of that image. but the fact that one emulator has the exact same symptom to me sounds like something undocumented like shadow registers or some undocumented vdp dma feature. I'd be somewhat surprised if fpagen misses a vint the same way a software emulator does.

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.
Last edited by MasterOfGizmo on Fri Oct 12, 2018 3:00 pm, edited 1 time in total.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1215
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Genesis / Megadrive core ported to MiST

Postby MasterOfGizmo » Fri Oct 12, 2018 2:55 pm

slingshot wrote:Don't need, the latest commit in jt12 seems to be OK.


Yes, now we are getting somewhere soundwise ... excellent.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

seastalker
Captain Atari
Captain Atari
Posts: 200
Joined: Sun May 15, 2016 3:44 pm

Re: Genesis / Megadrive core ported to MiST

Postby seastalker » Fri Oct 12, 2018 7:21 pm

Admittedly I don't know all the technical information about it but had a thought as to the debate of the linear vs non-linear dilemma [See MasterofGizmo's "Expanding 4 genesis bits to 6 MIST bits that way causes non-linearity." discussion]

I know it's not exactly the same, but as I don't mind having separate cores for PAL, NTSC, and RGB I'm fine with having two cores satisfying both options and let people decide which they prefer. If it's a bother to maintain two cores, maybe a selectable option in the .ini or gui toggle would work? Again, I don't know what that entails, so I am equally fine with developers' choice of what's best. Just an idea. :)


Return to “MiST”

Who is online

Users browsing this forum: No registered users and 2 guests