News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

AMSpiriT, a new CPC emulator for Windows

Started by Dmanu78, 19:50, 23 April 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dmanu78

Hello,

I hesitated for a long time before posting in this forum, which seems to be THE reference forum in the CPC world with a high level of expertise.

I hope you will be understanding with my product. 

I started to develop 4 years ago a new emulator for Amstrad CPC (464, 664 and 6128). I have posted versions in some French forums but I think it is now time to officially present you AMSpiriT, a new CPC emulator for Windows (7+).

It's still a young emulator and it lacks a lot of features but it's starting to mature and I think it's worth to share it with you.

Just a short presentation. AmspiriT was developed from scratch, just from a blank page, a pen and official technical documentation. The source code is unique, without incorporating any external source. It was made entirely "by hand"...    Its design is deliberately very "light", uncluttered (raw?) with very few options and some explicit icons. Like a real CPC, I want an emulator that works simply.     
It is currently built for Windows (it uses DirectX and the X-Audio 2 API).
I should mention that this is my first project to write an emulator.

Some technical details:
- Fully written in c++ (Microsoft visual studio 2019)
- Accurate emulation of the Z80A: written in T-States. Passes the most famous z80 tests (Zexall, z80 fulltest from Raxsoft).   
- Accurate CRTC emulation (type 0/1 for the moment). Based on @Longshot's fabulous Compendium (LOGON SYSTEM), the CRTC emulation has been recently rewritten to include all the specifics written in this guide. It emulates the extreme breaks at R0 = 0 (1µs) as well as the "interlace" mode (register R8) with great accuracy. I spent a lot of time to stabilize this part which is the "core" of the CPC emulation.
- A precise emulation of the Gate Array with a pixel display speed of 16Mhz which allows a realistic behavior like the advance of a pixel in "Mode 2". 
- Emulation of the AY-3-8912 for sound generation.
- Partial emulation of the FDC. Amspirit only reads ".DSK" files (and some protected dsk files).
- Precise emulation of tape files with a counter and sound generation during playback, like a real 464 CPC. It reads *.CDT, and *. WAV FILES. 

Finally, it also has a native debugger that allows me to debug AmspiriT. I share it with you. It's not the most user-friendly on the market but it does the job for basic debugging.

Like many emulator authors, I tried to do my best from various documentations scattered on the web and tested many demos and games before presenting this version to you. 

Due to technical choices, AmspiriT needs a lot of CPU resources to run the emulation at full speed. At least a Core 2 Duo at 2 Ghz is required. At the moment it is not very optimized yet. 

You can find the download link below. It's in a French forum, don't worry. If you're curious, I've narrated the whole genesis of the creation of this emulator in this post from the beginning...to the latest developments now.   
https://forum.system-cfg.com/viewtopic.php?f=24&t=11535

Feel free to contact me if you have any problems and let me know what you think. :)

Have fun. 8)

Some copy screens below : ;)




 S&KOH demo.


Overflow Previews 1
 

Demo "Batman Forever"


PhX Demo


Monochrome screen emulation.


Mercenary loading tape screen.

grouik1er


Gryzor

Gonna try it after Easter, thanks for letting us know! Is there a list of features to be added in the future?

ComSoft6128

#3
Mmm,

When recording videos for YT I only use a 6128 or 6128 Plus never an emulator so this question is for the benefit of the wider CPC community - could your emulator record the CPC output as MP4 files in HD?

Cheers,

Peter

krusty_benediction

Congratulations, this is a very impressive knowledge acquisition and restitution.
Being a Linux user, I have not been really able to test (wine launch the emulator but does not seem to detect key events), however it seems that you do not handle snapshots. This is a very handy feature for people doing crossdev.

pelrun

Quote from: krusty_benediction on 07:09, 25 April 22it seems that you do not handle snapshots.
Gotta leave something for a future release :D

Dmanu78

Thank you for your interest. :)

Indeed, there are still many features missing (snapshot indeed and many other things) and evolutions will come later.

I don't have a precise roadmap on future evolutions but I'm currently focusing on the precision of the "Core" emulation (couple CRTC/Gate Array), which remains my priority. With the precious help of the compendium, my short term work will be to make the CRTC type 2 emulation (the unloved CRTC) as accurate as possible, as well as the CRTC type 4 (pre-ASIC emulated CRTC). This last emulation will help me later to prepare a future emulation of the CRTC type 3 within the "CPC plus" models.

I also have a strong demand to open AmspiriT to other environments (including linux). Currently, it uses Windows APIs and is not completely compatible with Wine indeed.  Similar issue has been reported to me. Thanks in advance for your patience... ;)

If you are interested, I will post regular updates on the progress of my work.. :)

Dmanu78

After a few weeks (months?) of silence, I am pleased to announce a new release of AMSpiriT in its version 0.677b.

So, what's new in this latest version?

Nothing very spectacular visually. In truth, I have spent a lot of time perfecting the quality of the Core emulation for CRTC 0 and 1, but the most important development is that AMSpiriT can now fully emulate the CRTC 2, in compliance with the new findings published in the Longshot's compendium.

Some improvements have been added to this version:
- disk and tape writing operations are now implemented. You will be able to make backups of your favourite creations. :)
- Slight improvement of the CTM emulation in order to manage "wave" effects
- Possibility to make screenshots via the F2 and F3 function keys

And a few fixes have been implemented :
- Various corrections in the emulation of CRTCs 0 and 1
- Small fixes in the FDC emulation (engine management).
 
In summary, most of the work was still focused on the accuracy of the emulation thanks to the technical assistance of CPC enthusiasts (and especially Longshot whom I would like to thank warmly for his precious advice)

As usual, this new version is available at the following address (for Windows x86 & x64 only) :
https://forum.system-cfg.com/viewtopic.php?f=24&t=11535

Feel free to contact me if you have any problems and let me know what you think. :)
Have fun. 8)

Gryzor

Ah nice, Tower Defense thinks it's an original CPC and not an emulator :) Thanks for letting us know!

Dmanu78

Hi :)

I would like to inform you that a new version of AMSpiriT v0.704b is now available for download on the usual link:
https://forum.system-cfg.com/viewtopic.php?f=24&t=11535

It is a "minor" version bringing mainly some fixes on the CRTC and Gate Array emulation and bringing some ergonomic improvements (menu in English).

The emulator core is now entirely based on the contents of @Longshot's "Compendium" which has just been released in its v1.3 version:
http://logonsystem.fr

This long and difficult task of rewriting the emulation engine was not useless.

As you now know, @Longshot has compiled in its "Shakerland" portal the results of its famous SHAKER "Acid test" software on several well-known emulators.
https://www.cpcwiki.eu/forum/emulators/shakerland-portal/

This software allows you to test hundreds of different combinations of "z80, Gate-Array and CRTC" operation.

The result of this huge synthesis work is available.
https://shaker.logonsystem.fr/

It is thus an honour for me to see AMSpiriT listed among the 4 emulators tested. The synthetic result of Shakerland goes far beyond I expected. It is a real pride to reach such a degree of accuracy in the world of CPC emulation which contains plenty of very good emulators.
Of course, this result is above all to the credit of @Longshot and his fabulous research work. Without these valuable results, AmspiriT could never have achieved such a high result.

Of course, there are still many improvements to be made, Amspirit is still a young emulator (it is "only" 4 years old) but I think its technical bases are now robust. The best is yet to come :)

Skunkfish

Wow, fantastic results - I'm yet to give this emulator a try but I think I will definitely have to!
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

Joseman

Hi!

Great great work!!

I was trying to load (on tape) Wild Streets, but the emulator hangs as soon you load the file.

Here is the file: https://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=1784

Keep up the good work!!

Axelay

Hi

Nice work!

Looking at it for the first time, I see some interesting debugger features in the manual, but no mention of how to start it in developer mode?

Does the emulator support joystick fire button 3?  I haven't got something to test if it does right now, but the configuration popup for keyboard mapping of the joystick only lists the 2 fire buttons.

You mentioned in the manual wanting to hear other peoples 'cpu reserve' figures, I am getting around 25 on my Core i5 4460.

Dmanu78

Hi

Thanks for your feedback. ;)

The accuracy of the AmspiriT emulation is no accident of course. The initial choice to emulate the z80 in T-states has its importance in some shaker tests. The decision to emulate the GA at 16 Mhz also had a significant impact on the visual tests on the appearance and duration of the Hsync signal, on the 1-pixel shift in mode 2 etc... This also explains why Amspirit is so resource-intensive. Emulation accuracy requires a lot of power.

@alexay : Thanks for the result. With a number of 25 Amspirit emulates the CPC at full speed. The smaller the number is, the harder it will be to stabilize the 4 Mhz frequency.
So, it seems that Amspirit needs at least a Core i3 to work properly.

I did a minimalistic development on the keyboard and joystick mapping, it's not my first priority yet, but I'll make some improvement later on of course.

@Joseman. Ah yes indeed. Thanks for information. It's a nice bug. My support for the CDT format is still partial. In this particular case, I'm not supporting block ID 15 "Direct Recording". This will be fixed in a next version.






roudoudou

Quote from: Dmanu78 on 21:18, 24 October 22Hi
Thanks for your feedback. ;)
The accuracy of the AmspiriT emulation is no accident of course. The initial choice to emulate the z80 in T-states has its importance in some shaker tests. The decision to emulate the GA at 16 Mhz also had a significant impact on the visual tests on the appearance and duration of the Hsync signal, on the 1-pixel shift in mode 2 etc... This also explains why Amspirit is so resource-intensive. Emulation accuracy requires a lot of power.
about Gate Array, what did you assume with the memory he needs to read?
one byte every 2 millionth second? 
My pronouns are RASM and ACE

eto

Quote from: Axelay on 08:43, 24 October 22You mentioned in the manual wanting to hear other peoples 'cpu reserve' figures, I am getting around 25 on my Core i5 4460.
Will that be one core at 100% or 25% across all cores?

Devlin

here's my CPU chart after a few minutes of having loaded and run Mercenary, and idling at the start with the spinning of the pyramid thing in view.
CPC464 & CPC6128 + USIfAC II + Revaldinho 512k(universal cpld ver) - Schneider CRT TV
Administrator of Amstrad Discord : https://discord.gg/ksWvApv

Dmanu78

@roudoudou. Yes, each byte of the video memory is read every 1/2.000.000s by Gate Array. And even more, each bit of the video memory is managed every 1/16.000.000s (= 1 pixel Mode 2), like the real GA (I guess)

@eto: This number applies to a single CPU core. Every 1/16 Mhz the emulator executes the main loop (= simulates the operation of the Gate Array) and when the processing is finished, there is a pending loop until the next 1/16 Mhz signal later. Thus, the value displayed represents the number of times the processor loops through 2 time intervals of 1/16Mhz on itself before re-executing the main loop. The higher the number, the more stable the emulator will be.

@Devlin Thanks for sharing. In addition to the GUI part, Amspirit uses 2 distinct threads to emulate the Amstrad CPC. You can see on the CPU card the load of these 2 threads.

McArti0

In 0.590 version Register 8 and 4 CRTC, and NTSC 60Hz setting work fine, but in v0.704 not.  :'(
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

roudoudou

Quote from: Dmanu78 on 22:24, 25 October 22@roudoudou. Yes, each byte of the video memory is read every 1/2.000.000s by Gate Array. And even more, each bit of the video memory is managed every 1/16.000.000s (= 1 pixel Mode 2), like the real GA (I guess)
A priori (i asked some electronic engineer), GA reads two bytes consecutively (so not 2MHz but 4MHz). One byte is used while the other one is stored in a buffer, waiting to be used. In Z80 ticks, it's RRWW (read,read,wait*,wait*), not RWRW. This schem allow simplification because the Z80 will R/W memory before and after this 16bits word.

*wait => doing something else ;)
My pronouns are RASM and ACE

roudoudou

DManu, if you wanna support "less than pixel vertical scroll", maybe not up to 1/64 pixel but for interlaced mode...

there is an old proof of concept of interlaced mode made by Grim in 2011 (and another screen in R-Type 2012)
https://www.cpc-power.com/index.php?page=detail&num=9564
My pronouns are RASM and ACE

CheshireCat

Quote from: roudoudou on 09:39, 26 October 22DManu, if you wanna support "less than pixel vertical scroll", maybe not up to 1/64 pixel but for interlaced mode...

there is an old proof of concept of interlaced mode made by Grim in 2011 (and another screen in R-Type 2012)
https://www.cpc-power.com/index.php?page=detail&num=9564
OMG, I really need to write that article explaining why Grim's "interlaced mode" is nothing more than a waggling due to a constant loss of vertical synchronization...
Use SJASMPLUS, the very best Z80 assembler !
Bugless, highly modifiable, Sources clear & well organized :D

Dmanu78


@roudoudou I am surprised. I thought that the GA read the 2 bytes consecutively on 2 Mhz
I found this schematic reproducing the signals of a CPC 464, you can see that during the tWait* signal the Gate Array reads the video memory over a period of 2 Tstates, but maybe I am misinterpreting. 


In practice this remains the internal working of the GA and I think it has no impact on the video rendering displayed by the emulator but it's interesting anyway. 

@McArti0 yes indeed, I rewrote the CTM (Monitor) emulation this summer and forgot to support the 60 Hz mode. This will be fixed in a future version of course. Thanks for this feedback. 

Generally speaking, if Amspirit emulates rather well the z80, the Gate Array and the 3 CRTC, the emulation of the other components remains partial and especially the FDC (Floppy Disk) and the CTM. There is still a lot of work to do... ;)

roudoudou

Quote from: Dmanu78 on 23:56, 26 October 22@roudoudou I am surprised. I thought that the GA read the 2 bytes consecutively on 2 Mhz
I found this schematic reproducing the signals of a CPC 464, you can see that during the tWait* signal the Gate Array reads the video memory over a period of 2 Tstates, but maybe I am misinterpreting. 


In practice this remains the internal working of the GA and I think it has no impact on the video rendering displayed by the emulator but it's interesting anyway. 

@McArti0 yes indeed, I rewrote the CTM (Monitor) emulation this summer and forgot to support the 60 Hz mode. This will be fixed in a future version of course. Thanks for this feedback.

Generally speaking, if Amspirit emulates rather well the z80, the Gate Array and the 3 CRTC, the emulation of the other components remains partial and especially the FDC (Floppy Disk) and the CTM. There is still a lot of work to do... ;)
your schem show the 4MHz clock, 1st and 2nd are right on 4MHz consecutive ticks :)
i wasn't talking about average time reading, which is 2 MHz!
maybe it's only rhetorical, we both say the same thing anyway => 2 video bytes video are read consecutively, that's the point, CPU cannot read between odd/even address!
My pronouns are RASM and ACE

Axelay

Quote from: Dmanu78 on 21:18, 24 October 22I did a minimalistic development on the keyboard and joystick mapping, it's not my first priority yet, but I'll make some improvement later on of course.



Thanks, just thought I'd ask because I have a project that will support 3 fire buttons at some point.  Would be nice to have the option of a 3rd joystick fire button rather than having to bang space instead!

I was going to ask about the FDC emulation as well, because most of my games that have used Targhan's FDC routines didn't work very reliably or at all, even with standard DATA format, but it sounds like you still have work to do on that side.

Powered by SMFPacks Menu Editor Mod