Author Topic: Another CPC emu, with bunch of questions (about Z80 timings and FDC)  (Read 13196 times)

0 Members and 1 Guest are viewing this topic.

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 469
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 163
  • Likes Given: 187
If dumpers want to check their dumps, there is a way: convert your DSK file to an HFE file and use it on a real CPC equipped with an HxC.
So, if the HFE file doesn't work, you'll have proof that the problem lies for sure in the DSK dump. Because you're using the real FDC chip inside the CPC.

But there's a limitation to this method: it won't work with protections that use weak sectors as the HxC doesn't support them.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
There was an update beginning of December...




Sugarbox | Yet another CPC emulator…




It's worth to follow this site up more often.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Thanks for mentioning it, TFM! Indeed it progresses nicely. I like this:


Quote
XBox controller can be used as joystick

But I'd like to see it making progress in the GUI front...

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Fell free to mention every thing you want !
After all, today is christmas...


And I try to have a complete to-do list, with everything needed by everyone (in what I'm good for, which does not include nice icons, for example ).

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
I'm sure that for nice icons an such things (I can't do that either) you will find help here. We got some great graphics creators on the forum.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
There are so many good icon resources out there it'd be pointless to really discuss it :D But anything would be better than a big 3D box with off-centre text.


Keep it up! :)

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
In general there are two philosophies: For some it is important how a program looks like, and for others it's important what a program can do. Personally I'm one of the latter category.


So - just IMHO - it's good to have a well emulator, the surface / interface can be improved later. What counts is what you got under the hood. But as stated - just IMHO.

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Both are important, ever since 1988 or so. Of course functionality is more important, but once you get that, UI should be looked after. Especially when it's so easy.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.335
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2261
  • Likes Given: 3478
Both are important, ever since 1988 or so. Of course functionality is more important, but once you get that, UI should be looked after. Especially when it's so easy.
Good UI is not always easy.

True it's easy to put some buttons and labels and text boxes, but making it in a way that makes it natural to use is not so easy.

True that accurate emulation is very important.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Oh, don't get me wrong, I know that UI/UX is a whole science unto itself, and it takes a lot of thought to have an emulator have the features you want, where the user wants them. But yes, I was taking about the looks of it, a few properly sizes and aligned buttons and a handful of nice, self-explaining icons.

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
A new version is available... here : Sugarbox 0.15 is out. | Sugarbox


Sorry for Gryzor, but no new sexy interface at this time. I promise I'll think about it for next release (don't forget that it's still in beta phase !)


Feel free to ask any question, or to report anything that goes wrong.


Here the log :


- CRTC detection tests are correctly passed (For CRTC 1 at least)
- Z80 : Lots of improvement in Interrupt and general timings
- Z80 : OUT write it’s value with delay to the port (this make some demo works..)
- Z80 : When an interrupt is pending, EI / HALT works correctly (this make « L’arche du capitaine blood » original dump to work correctly)
- CRTC : Fix the adress computation : Only correct bits are compared. This correct the « The demo » demo.
- CRTC1 : Fix adjustement computation, when R5 > R9 (adjustement counter was only increased when VCC=R4)
- Gate Array : Corrected a bug in the MMR, that prevented Phortem demo to run
- Gate Array : IO handled at 4mhz to have precise timings for color changed- Ink changed should be pixel correct
- PPI8255 : CPC+ Feature of non-reset of Port ABC when writing control register implemented. This allow CRTC detection to be complete
- PPI8255 : Corrected a bug in PPI Control register, when bit7=0 (Shadow of the beast hanging bug in « press fire » screen is corrected)
- PPI8255 : Port B only readable.- FDC : Read Track correction, LATIS (Hercule2 – Translock) now ok
- FDC : Detection of end disk improved, even when GAP3 is wrong
- FDC : Disk with only MV – CPC now loads correctly- Monitor : Correction of a bug that prevented a detection of HBL in some case of the PLL ->Arkanoid I no longer crash the emulator
- Monitor : Rewrite the honrizontal synchronization mechanism.
- Monitor : Correction of HSync. CRTC R0=64 can be used now without hsync problems (The demo work better)
- Monitor : Improved handling of Hsync position via R2
- Monitor : Correct the garbage that occasionnaly appear on reset
- Monitor : Add handling of multiple HSync with correct synchronisation
- Reset is now fully implemented
- Settings : CRTC type is changed correctly
- Settings : Change does no longer reboot the CPC
« Last Edit: 22:52, 19 January 14 by Lone »

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Just checked it out! It works like a charm! And I like the interface: Found everything immediately.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Don't worry, functionality comes first :)

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Well, I like it simple. If it get too complex my GPU overheats and I see colored clouds and can't do anything for a while.  ;)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Hello there,


New version is available (0.16b) with some corrections, on the CRTC and FDC mainly.


It's now working with Windows XP, if Direct X is installed.


Testing it is a good way to discover the great job of all thoses demomakers !


Here it is : Sugarbox v0.16b | Sugarbox




Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Great job, glad to see it's progressing!

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Hi there,


New version available ! v0.17
Special feature are a better GUI, and a solution for the XInput XP problem : This version should run on windows XP, even without a correct XInput install.


Here's the link : Sugarbox v0.17b | Sugarbox
Here's the log :



- Gate array : MMR Corrected : If a 128k config is set, only 128k are available.
- Gate array : Corrected access to MMR and MMR through PAL
- Gate array : Mode 3 is handled
- Monitor : Change the function used for adjustement on HSync : Use a square root instead of a log, to make some demos more stable ("Camembert 4" demo for example)
- Timings : Adjust some timings for out command. "From scratch" demo now display correct colours at the correct place
- FDC : Reset is (really) fixed. It no longer set the FDC in a state that prevent it to be used
- FDC : Add delay during track change
- General : Load the Xinput lib in the code, to avoir non runing app on some XP systems.
- General : Screenshot option added
- General : Speed limit is more configurable, from 50% to no-limit
- General : Some code optimisations
- General : Screen size can change (from "full PAL display" to "standard CPC screen")
- General : Directories problems have been solved. It is now possible to drag'n'drop dsk file to a sugarbox shortcut (or to associate dsk with sugarbox)
- Sound : Volume slider added
- Sound : Mute option added
- Sound : Record is flushed, so the file is not only written at the end of the recording
- GUI : Current track number is displayed
- GUI : Add a "scanline" option
- GUI : Add nice icon for sound and disks
- GUI : Added Screenshot, settings and reset icons
- Startup : Associating "dsk" with sugarbox offer the possibilitty to load disk directly


Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
WoW! That was a lot of work!!! Keep the project going!  :) :) :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.368
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3061
  • Likes Given: 5578
Great steps with the GUI :)

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Hello there,


New version is out.


SNA files are handled, and bug are fixed.
CRTC is a bit improved, and run almost all demos I can found.
By the way, if something is not working, drop me a line !


Here is the version :


Sugarbox v0.18 | Sugarbox




Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
New version is out.

I enjoyed playing with this.

Would be nice to hear a bit about how you are finding the development of an emulator - such as: how did you write it, was it easier/harder than you thought and what's been the biggest challenge etc...?

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Well...


In fact, writing an emulator was in my mind since I discover the first one, in the early '98, i believe. I didn't have enough time and competence, but I keep thinking about it since that day. Obvious target would be the CPC, as it's a "simple" computer, and, most of all, my first one when I was a child.


Since that day, I improved my coding skill through my work, and my experiments. Then, at the end of year 2012, I began to have a bit more time : My wife was pregnant, so she slept the whole evenings on the sofa, and all my current projects where finished, or at least I lost the motivation to continue them (I was running a really small blog on coding ).


So, I wrote the first lines, which was not that hard, as I was thinking of "how I would do if I want to" since about 14 years...


The whole process was not really difficult since that day, since LOTS of informations are available on the net (see the grimware, the cpcwiki and all data gathered by arnoldemu since that day).


Also, with twins at home, I have more time than I can afford to think, as giving 10 or 12 bottles a day (half of it incombed to me) let me think about it, at least when I was trying not to fall asleep.


Running basic was, at this time, easier than expected. Then come the two challenging parts I faced : Having an emulator that runs protected games, and all demos.
On these two parts, really few informations are available. Believe me or not, I became a real pro about googling particular subjects, to find the two sentences that can give me missing informations.


With a bit of support of really dedicated guys (Simon Owen, for example, send me couple of hints that were really precious about FDC support), I finally managed to make it run almost properly... But I still have lot's of question that didn't find an answer yet !




Speaking of the emulator itself, it's written in plain C++, plain Win32, Gdi. I added XLib for XBox controller support (as I wanted to play game with it), and added a debugger with lots of specific feature (like, breakpoint on CRTC register value).


I see it as experiment, so the code is not really nice, with lots of "Todo" mark, lots of things that should be rewritten, and so on... As I don't have enough time to do everything, I have to use priority to order what I would like to add and fix. Which is, basically, running on amstrad 6128 with CRTC 1, all the demos I find, and all protected softwares (and Futur OS, of course)


Then I will add CRTC 0, 2, 3, 4 support, second drive, CPC+ support, special hardware, etc...


I plan to add Direct X or other support when other parts will work correctly, as it's not necessary at this time (emulator running at 400% on my a bit modern i7 processor).


Sometime, also, I add GUI improvement, as it's fun to code (I had good time writing the sound slider for example), and make the emulator easier to use.


Also, I write on my todo list almost every comment made on it (not so many I can confess), which give me idea on what I can add.


I finally get a real CPC, but I'll have to fix the drive to use it (and believe it or not, finding this 5.25" drive cabble is not so easy by now...). I plan also to write specific tests, (on the CRTC of course !) to use the scientifi method on it : Hypothesis, experiments, conclusions. All these projects should keep me busy for the ten next years, I think !


Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Thank you for the insight, nice to hear about it.

I'd love to write an emulator one day and you're experience has reinforced this for me :)

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.335
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2261
  • Likes Given: 3478
I found about 90% of my answers through writing tests and running them on real machines.
I have a collection of tests for ay, 8255, keyboard, crtc, plus features, fdc.

But when I find information I do share it and document it.

Still there are some questions I haven't answered yet:

- exactly what state is the crtc type 3 and 4 in after reset; are all registers reset to 0 like on the others or something else?

There are a few more questions I need to answer.


I didn't release these tests yet because I wanted to make sure my emu passed them LOL.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 97
  • Country: fr
  • Liked: 181
  • Likes Given: 74
Here is a new version, at least ! v0.19 is freshly compiled !


Lot's of effort on FDC support, with IPF, RAW, SCP and CT-RAW support (and a completely new paradigm).
Also some other features....




Here's the link : Sugarbox v0.19 | Sugarbox