Post subject: New Z80 Core
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
I've been working on this for quite a while, but the new T-cycle based z80 core is finally coming together. I'm about 95% done with only some clean up and bug fixes, particularly for flags, to go. This is a modern core which should allow for much easier maintanance (containing about 10K fewer lines of code), expandable to other systems (which might include wait states or other interrupt sources), as well as natural accounting of the WZ register which hobbled the current core. It also contains numerous bug fixes from the old core that ZEXALL didn't catch. It won't show up in the Dev builds for at least another couple weeks, but I thought I would make an announcement for anyone considering making a TAS for systems using the Z80 (GG/SMS, Coleco, TI83) in case anyone is interested in waiting for it. I'm fixing the trace logger at the same time so the new core might help a bit more with code analysis. This is also the first step in modernizing those systems' emulator cores, but that's a longer term project. For now it will just be a CPU core replacement. If anyone has any questions/comments/concerns feel free to post them here. EDIT: I should mention that performance hasn't suffered either, as I can still run SMS at 4x on my laptop.
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
Would this benefit a Genesis core? Since it uses a Z80? And Hoorah for accurate Sega stuff!
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Experienced player (691)
Joined: 11/23/2013
Posts: 2238
Location: Guatemala
Can we also see a new MSX core soon too?
Here, my YouTube channel: http://www.youtube.com/user/dekutony
Fortranm
He/Him
Editor, Experienced player (879)
Joined: 10/19/2013
Posts: 1122
Thanks for your work! Are you interested in writing a Coleco Adam core?
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
hegyak wrote:
Would this benefit a Genesis core? Since it uses a Z80? And Hoorah for accurate Sega stuff!
I guess it might help a little, but the z80 is probably only about 10% of the work associated with a genesis core. You'd also need the 68000, the sound and graphics chips, and all the infrastructure putting it together. I'd be willing to work on the 68000 but someone else would have to do everything else, I'm not that interested.
Kurabupengin wrote:
Can we also see a new MSX core soon too?
MSX uses a similar graphics chip to coleco and SMS, and I do plan on reworking that chip to be more accurate and making it it's own independent coponenent. So, in that sense a majority of the work towrads an MSX emulator will be done, but I personally don't plan to implement the rest.
Fortranm wrote:
Thanks for your work! Are you interested in writing a Coleco Adam core?
I'm targetting the colecovision core currently, so maybe I'll look into Adam but I'm not sure. Generally speaking, anyone wanting a new core will need to find someone else to do it. If anyone is really interested, I can get them going on the BizHawk infrastructure part, as my current framework is pretty much copy-pastable to a new core, you'll basically just have to do graphics and sound and the connecting bits. I've personally learned a ton so far in doing this kind of development, and you can get to a working core with quite little programming knowledge, so if anyone thinks they are interested give it a shot!
Joined: 3/11/2012
Posts: 149
Location: WI
hegyak wrote:
Would this benefit a Genesis core? Since it uses a Z80? And Hoorah for accurate Sega stuff!
Are you suggesting something other than the existing GPGX core, which is already one of the best Genesis cores?
Alyosha wrote:
I guess it might help a little, but the z80 is probably only about 10% of the work associated with a genesis core. You'd also need the 68000, the sound and graphics chips, and all the infrastructure putting it together. I'd be willing to work on the 68000 but someone else would have to do everything else, I'm not that interested.
Not sure if you're aware, but there was already a C# Genesis core a few years back with that stuff, but it was highly buggy. It got replaced by GPGX. As to how complete/bad it was, someone has a video of it on YouTube here: https://www.youtube.com/watch?v=eufJpZJjgfA
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Sappharad wrote:
Not sure if you're aware, but there was already a C# Genesis core a few years back with that stuff, but it was highly buggy. It got replaced by GPGX. As to how complete/bad it was, someone has a video of it on YouTube here: https://www.youtube.com/watch?v=eufJpZJjgfA
I was aware of the code but haven't seen it running before, thanks for the video link. That code was removed a while back for being inferior and outdated compared to GPGX. I don't see any point in doing an in house genesis core when close to cycle accurate ones like GPGX are available. Maybe the only reason to do it would be to put a good 32X core on top of it, but that probably isn't a workable approach, I can't imagine such a thing running above like 10 fps.
Challenger
He/Him
Skilled player (1702)
Joined: 2/23/2016
Posts: 1064
Nice work with this new core. Although I don't understand about programation, those SMS/GG runs made on the current Z80 core (aka since BizHawk 1.11.9) could sync on the new core?
My homepage --Currently not much motived for TASing as before...-- But I'm still working.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Challenger wrote:
Nice work with this new core. Although I don't understand about programation, those SMS/GG runs made on the current Z80 core (aka since BizHawk 1.11.9) could sync on the new core?
I'm not sure about sync yet. I'll be looking into it once all the ZEXALL tests pass. My guess is that runs will still sync unless they rely on very obscure behaviour, which many games seem to mercifully avoid.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Making it through zexall was way easier then I thought. The new core now passes that test and I have upgraded SMS/GG, ColecoVision, and TI-83 to use the new core. I have tested pretty thoroughly, but I would appreciate anyone interested in these systems to download the latest Dev build and try out your favorite game and make sure everything is in order. I'll be continuing my own testing as well to make sure there are no regressions, as well as checking how well existing TASes sync.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
I've made some more improvements to the core and fixed a few bugs. Sync of older runs will not be possible if they use the R register at all. The new core corrects several bugs in the old core and this primarily impacts the R register (which counts up every instruction call) and is sometimes used as a souce for RNG. At this point we could really really benefit from having console testing of SMS and coleco to precisely test behaviour, but I don't see that as likely to happen any time soon.