CPCWiki forum

General Category => Emulators => Topic started by: Arnaud on 09:14, 16 March 19

Title: CPCEC a new emulator from cngsoft
Post by: Arnaud on 09:14, 16 March 19
Hello,
i have just discovered this new emulator (release 14/03/2019), maybe the substitute of CPCE95 i still use.

Congratz to CNCSoft  :)

http://cngsoft.no-ip.org/cpcec.htm


Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 12:11, 16 March 19
Yes , the other emulator is 10 years old , and there is another new ZX Spectrum emulator in the same web , ZXSEC

small videohttps://youtu.be/F5jC76gjt_U (https://youtu.be/F5jC76gjt_U)
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 20:30, 17 March 19
Where are the particular strength of this emulator?

Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 08:27, 18 March 19
Where are the particular strength of this emulator?
According to its author, It is made in C instead of assembler, it is much more correct internally than the previous CPCE, everything is done by keyboard, there are no menus
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 11:57, 18 March 19
According to its author, It is made in C instead of assembler, it is much more correct internally than the previous CPCE, everything is done by keyboard, there are no menus


This is cons, not strength 😁
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 13:43, 18 March 19
I tried the emulator with phX demo. Pretty encouraging ! Only the tunnel part (shown before Freddy) showed some visible artefacts. Plus FDC loading that slowed down audio, too. But all the rest was pretty accurate!

Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 18:59, 18 March 19
According to its author, It is made in C instead of assembler, it is much more correct internally than the previous CPCE, everything is done by keyboard, there are no menus


Ok, sounds it's quick then. Does it have a turbo mode?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Arnaud on 20:43, 18 March 19
Where are the particular strength of this emulator?

Drag'n drop and auto start with a dsk file on my desktop shortcut.

Really quick to start a downloaded file.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 21:35, 18 March 19
Nice!  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 20:49, 20 March 19
Version log
 
Title: Re: CPCEC a new emulator from cngsoft
Post by: dlfrsilver on 13:23, 22 March 19
Nice!  :)


the tapes are always started with turbo mode ;


it's 100% compatible with all games released on tape. Even the hardest schemes works with it. (MBC, Gremlin loader 1,2,3 for ex.).


I have tested CNGSOFT new emulator (i'm the alpha tester) against 1300 original CPC games, including 1000 games in their tapes versions.



Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 11:52, 26 March 19
20190325 -- fourth public release. Onscreen indicators (hide them with -O); fixed bugs in ZXSEC that slowed emulation down when the frameskip wasn't zero, and another bug in audio recording on WAV files.

(http://cngsoft.no-ip.org/IMAGE_2019-03-19_12-07-01.PNG)(http://cngsoft.no-ip.org/IMAGE_2019-03-19_12-14-33.PNG)
Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 20:52, 10 April 19
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:23, 07 May 19
(http://cngsoft.no-ip.org/image_2019-04-11_12-01-06.png) (http://cngsoft.no-ip.org/image_2019-04-27_14-16-01.png)
(http://cngsoft.no-ip.org/image_2019-04-14_15-25-13.png) (http://cngsoft.no-ip.org/image_2019-05-02_00-19-13.png)

* 20190419 -- eighth public release. Added options for image and sound interpolation; tape automatically rewinds itself when it reaches the end (à la FUSE); fixed a bug in TZX files that store 0 instead of 8 in the "used bits" field, another bug in CUSTOM INFO blocks in TZX files, and another one when ZXSEC loads a 48K SNA file in Plus3 mode (users should manually switch to a safe model beforehand anyway). INI files now remember the names of the last used files.

* 20190430 -- ninth public release. Softer B/W Spectrum palette; fixed bug in FDC sector size calculation if GAP datas are stored (Loriciels' discs); added simple memory contention to ZXSEC ("Amaurote", "Black Lamp", "Puzznic", "Sly Spy", "Zub"...).
Title: Re: CPCEC a new emulator from cngsoft
Post by: Arnaud on 21:30, 07 May 19
Hello,
i just tried your latest version, but i haven't found how disable the console window.

Is a way to hide the console or you still need it for debugging ?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Fabrizio Radica on 23:10, 07 May 19
Hello,
i have just discovered this new emulator (release 14/03/2019), maybe the substitute of CPCE95 i still use.

Congratz to CNCSoft  :)

http://cngsoft.no-ip.org/cpcec.htm (http://cngsoft.no-ip.org/cpcec.htm)
any solution for Autotype like JavaCPC? :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 08:48, 08 May 19
Very nice. I use CPCE a lot for development in Linux because is fast to start (and it works fine with WINE, better than WinAPE).

I see CPCEC doesn't do "proper" fullscreen and only maximizes the window. Other than that, I can see it replacing CPCE for my dev pipeline.
Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 08:44, 14 June 19
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 15:08, 25 June 19
Anyone's got a direct link? Company firewall is blocking dynamic dns servers...
Title: Re: CPCEC a new emulator from cngsoft
Post by: Chinnery on 15:35, 25 June 19
Anyone's got a direct link? Company firewall is blocking dynamic dns servers...
http://cngsoft.no-ip.org/cpcec-20190526.zip

Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 15:38, 25 June 19
Thanks man :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:18, 03 August 19
I just released a new version that (among other things) answers this question:

Hello,
i just tried your latest version, but i haven't found how disable the console window.

Is a way to hide the console or you still need it for debugging ?

* 20190731 -- eleventh public release. Added a new UI-based debugger (typing commands is no longer needed) and support for ZIP archive reading based on PUFF.C from the ZLIB project, upgraded GCC to 5.1.0 and removed all `inline` tags (they did more harm than good), and generally reworked all internals to make them OS-independent. Several details improved as well: the file selector fixes a bug in Win10, "browse tape" dialog shows the file name, Spectrum +3 automatically becomes +2A to load tapes, `auto rewind` shows up in Edit menu and fixes bugs in CSW files, and sound emulation has improved, for example "Terminus" on CPC plays sound and "Agent X II" on Spectrum is no longer noisy.

The console window is no longer a required part of CPCEC and ZXSEC; the sources still include the old debugger, but it's disabled by default.

(http://cngsoft.no-ip.org/IMAGE_2019-07-25_23-11-26.png)

(http://cngsoft.no-ip.org/IMAGE_2019-07-15_21-59-18.png)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:41, 10 August 19
Small update:
20190809 -- minor patch restoring the "silent" discarding (i.e. without error codes) of write operations in read-only discs and allowing the automatic booting of IBM-formatted discs.

While it isn't a very faithful approach to the disc write protection, this should let several copy-protected games run straight from ZIP archives instead of complaining that the disc is read-only. Besides, AFAIK the opposite case never happens: no protection fails when the disc is NOT write-protected.

(http://cngsoft.no-ip.org/image_2019-08-10_12-40-44.png)

Ideally, this screen won't happen from now on.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 16:50, 10 August 19
Yes, ideally dark blue on black won't happen again  :laugh:
Title: Re: CPCEC a new emulator from cngsoft
Post by: The_Mole_UK on 12:10, 12 August 19
Small update:
20190809 -- minor patch restoring the "silent" discarding (i.e. without error codes) of write operations in read-only discs and allowing the automatic booting of IBM-formatted discs.

While it isn't a very faithful approach to the disc write protection, this should let several copy-protected games run straight from ZIP archives instead of complaining that the disc is read-only. Besides, AFAIK the opposite case never happens: no protection fails when the disc is NOT write-protected.

(http://cngsoft.no-ip.org/image_2019-08-10_12-40-44.png)

Ideally, this screen won't happen from now on.
Can it use ParaDOS v1.2? / Remap keyboard?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:01, 12 August 19
Can it use ParaDOS v1.2? / Remap keyboard?
(http://cngsoft.no-ip.org/IMAGE_2019-08-12_19-58-14.png)
Yes, all you have to do is to swap the default ROM files (AMSDOS and the original English-keyboard firmware) with your own ones. CPCEC will accept them as long as they're compatible, i.e. firmware is a 32k file where the first 16k is the BIOS and the last 16k is the BASIC, and the DOS ROM is 16k and includes a valid high ROM ID.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:06, 24 August 19
After posting a minor bugfix several days ago I'm already preparing the next major releases. On one hand, image interpolation is now based on three independent shaders whose effects pile up on the image.

(http://cngsoft.no-ip.org/IMAGE_2019-08-18_22-53-10.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-08-22_18-35-16.PNG)

On the other hand, extended memory (up to 32 ROM 16k banks and 8 RAM 64k banks) is the first step towards Amstrad Plus support. A very early step, but I can already see some screens and hear music...

(http://cngsoft.no-ip.org/IMAGE_2019-08-22_23-15-35.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-08-22_23-15-54.PNG)

When these features are ready, I'll get back to improving the overall compatibility of both CPCEC and ZXSEC, hoping to get the CRTC and FDC quirks and the ULA contention right sooner or later.

(http://cngsoft.no-ip.org/IMAGE_2019-07-28_15-10-19.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-04-14_15-26-46.PNG)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 08:35, 03 September 19
The past weekend's release was a rushed one, fixing the ZIP archive "read-then-write" bug and adding 576 kB RAM support but disabling the still minimal PLUS ASIC emulation.

(http://cngsoft.no-ip.org/003103.PNG)

Video filters can now be configured independently, together with the scanline and interlace modes, sometimes leading to interesting effects. I like X-Masking and Double Interlace on my laptop, but I prefer Y-Masking and Whole Scanlines on my desktop.

(http://cngsoft.no-ip.org/CPCEC-20190831-4.PNG)

Plans for the near future include PLUS ASIC emulation for CPCEC, as stated in past messages, and memory contention for ZXSEC, where I'm rewriting the Z80 engine so it relies on macros that provide either "coarse" CPC timings (always aligned to 4 clock ticks and very predictable in their duration) or "fine" Spectrum timings (aligned to nothing and very volatile because of the address bus collisions) thus allowing both emulators to rely on the same Z80 files.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:48, 05 October 19
Before I get too busy with the CPC Retrodev compo, I updated CHIPNSFX, UZ80 and CPCEC with few news and many fixes:

(http://cngsoft.no-ip.org/IMAGE_2019-10-03_23-39-34.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-10-05_10-23-39.PNG)

* 20191004 -- Twelfth public release. Precise (albeit not perfect yet) memory contention and ULA noise ("snow") on Spectrum: "48K Timing Tests" passes all tests but 36 and 37, and "128K Timing Tests" fails on just six tests. "Mask 3: Venom Strikes Back" draws the attribute and border effects on their precise locations on all platforms (48K, 128K/Plus2, Plus3) and Software Creations' "Black Lamp", "LED Storm" and "Sly Spy" behave well on 128K machines. Improvements in the debugger: fixed disassembly panel invalid cursor locations, added optional tall characters, avoided debug+pause clashing, new key M toggles memory dump ROM+RAM and RAM-only modes. Improved ZIP handling (ZIP archives are no longer locked, files within archives are filtered by extension), user interface fixes.
* 20191004 -- Minor patch making the debugger options set with V and M stick between sessions.

(http://cngsoft.no-ip.org/IMAGE_2019-10-02_21-39-51.PNG)

I'd have liked to fix the CRTC bug that makes the recently released and spectacularly smooth "Pinball Dreams" unplayable but the deadline looms :-(
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:43, 18 November 19
I just released a new version of CPCEC and its little sibling ZXSEC, mainly because I had to support "Pinball Dreams" in one way or another!

(http://cngsoft.no-ip.org/IMAGE_2019-11-16_11-16-00.PNG)
(http://cngsoft.no-ip.org/IMAGE_2019-11-12_19-51-23.PNG)

Instead of trying to develop all CRTC types at once I focused on CRTC 1. "Mission Genocide", "Warhawk", "Dynamic Duo", "Prehistorik 2", "From Scratch", "Batman Forever", "Imperial Mahjong", "Octopus Pocus" and many more work flawlessly now, instead of the fragile balance where some tweaks fixed some titles and broke others. Sadly, the fragile balance has now shifted to CRTC 1 against all the other types... so there's still a lot of work to do.

(http://cngsoft.no-ip.org/IMAGE_2019-11-17_10-14-28.PNG)
(http://cngsoft.no-ip.org/IMAGE_2019-10-26_20-37-18.PNG)

New options include a basic V-Hold control (now the original "Thunder Blade" release works) and a flexible H-sync mode that allows fine-tuning Gigascreen effects such as the "Batman/Spawn" screen in "Batman Forever" together with the already extant interlaced mode options.

ZXSEC also benefits from increased precision in memory contention timings, especially on 48K. There's no longer conflict between "Starion", "Dark Star", "Black Lamp" and others that were drawing special effects on the border and the attribute map at once.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:19, 24 November 19
(http://cngsoft.no-ip.org/IMAGE_2019-11-23_21-55-33.png) (http://cngsoft.no-ip.org/IMAGE_2019-11-23_22-28-05.png)

Emulating the CRTC type 1 was the first step towards full "Pinball Dreams" support. CRTC 0 is now half done and some demos that either worked in early versions of CPCEC thanks to kludges ("Nayad" part of "5KB Demo 3") or didn't work at all ("Tantrum" part of "Face Hugger's Ultimate Megademo") are now fully operational. "Pinball Dreams" itself still resists, though.

(http://cngsoft.no-ip.org/IMAGE_2019-11-24_19-53-53.png)
Title: Re: CPCEC a new emulator from cngsoft
Post by: Ast on 23:03, 24 November 19
Hi César,


To complete your crtc 1 emulation, try to make runable Scroll Factory (http://www.pouet.net/prod.php?which=76731).


It would be a good challenge for you and a good way to make your cpcec better.


Have a good fun.

Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:03, 26 November 19
Hi César,

To complete your crtc 1 emulation, try to make runable Scroll Factory (http://www.pouet.net/prod.php?which=76731).

It would be a good challenge for you and a good way to make your cpcec better.

Have a good fun.

Good suggestion. This is how it looks like right now:

(http://cngsoft.no-ip.org/IMAGE_2019-11-26_20-37-10.PNG)
(http://cngsoft.no-ip.org/IMAGE_2019-11-25_21-44-35.PNG)
(http://cngsoft.no-ip.org/IMAGE_2019-11-26_20-36-57.PNG)

CPCEC simulates a 2 NOP delay on MCR changes (Imperial Mahjong needs either 2 or 3 NOPS to behave properly); if I set the delay to 0 or 1, the title of Scroll Factory improves:

(http://cngsoft.no-ip.org/IMAGE_2019-11-26_20-46-18.PNG)

I'm going to have to ask so many questions about the internal delays that happen between the Z80, the Gate Array and the CRTC. I better start writing them down already.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:42, 02 December 19
I released yesterday morning a new version of CPCEC, but it's a minor patch fixing bugs such as bad window rendering when the screen isn't tall enough (for example my current laptop), recording the wrong value in the bytes/second field of WAV files, or failing to keep OUT &0088,&88 from going to the Gate Array ("Knight Rider"). The FDC can now format tracks, a feature that I had dummied out until I was advised to enable it.

(http://cngsoft.no-ip.org/IMAGE_2019-11-24_14-53-35.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-11-24_14-53-51.PNG)

"Still Rising" (CRTC 0 and 1) and "Octopus Pocus" (CRTC 1) join the list of CPC demos that work. "PhX" temporarily loses sync in two different parts depending of the CRTC type. "Pinball Dreams" doesn't run on CRTC 0 or 2 yet, but it works well on CRTC 3 and 4, although only because the game expects them to behave like CRTC 1 regarding the "buffered" CRTC registers 4, 5 and 9. This goes against Shinra's document "Differences between CRTC types" stating that CRTC types 3 and 4 are like CRTC 0 and 2 in this aspect. Who's right?



Title: Re: CPCEC a new emulator from cngsoft
Post by: Ast on 23:38, 02 December 19
Hi @cngsoft (http://www.cpcwiki.eu/forum/index.php?action=profile;u=191)


I've just tested CPCEC right now. There's still some work to do on Scroll Factory's intro.


Your emulator begins better and better each day. Do you plan adding Amstrad Plus emulation ?

Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 15:12, 09 December 19
A change in the behavior of REG1 finally makes the level start SFX of "Zap't'Balls advanced edition" work properly and improves "Onescreen Colonies":
(http://cngsoft.no-ip.org/IMAGE_2019-12-07_22-43-38.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-12-09_18-44-44.PNG)

Hi @cngsoft (http://www.cpcwiki.eu/forum/index.php?action=profile;u=191)

I've just tested CPCEC right now. There's still some work to do on Scroll Factory's intro.

Your emulator begins better and better each day. Do you plan adding Amstrad Plus emulation ?
Scroll Factory is indeed still incomplete, as I showed in the past screenshots. Either the mode change happens too late or the video rendering happens too soon. I know that there's a delay between what the Z80 does and what the screen shows, but I don't know its nature and its length, or whether it's just one delay or several types of it.

Amstrad Plus is in the queue too, and in a past message I posted a screenshot of "Burnin' Rubber" running on incomplete ASIC emulation.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 15:46, 27 December 19
I hope everyone had a merry Christmas. Mine was certainly productive:

1.- The emulation of delays in the Gate Array both to update the bitdepth and to render the pixels solves all the glitches in "Scroll Factory":
 (http://cngsoft.no-ip.org/IMAGE_2019-12-24_12-31-55.PNG)  (http://cngsoft.no-ip.org/IMAGE_2019-12-24_12-31-38.PNG)

2.- These delays also enable the handling of the slightly different case of mid-char ink changes:
 (http://cngsoft.no-ip.org/IMAGE_2019-12-24_21-14-48.PNG)  (http://cngsoft.no-ip.org/IMAGE_2019-12-24_21-29-13.PNG)

3.- OUT &BC00,8: OUT &BD00,1 makes the screen shake:
 (http://cngsoft.no-ip.org/IMAGE_2019-12-26_12-59-23.PNG)

4.- Last but not least, "Pinball Dreams" is now fully supported on all CRTC types: the BG Games intro, the Gigascreen titles, the staff scroller and the game itself behave and show as expected.
 (http://cngsoft.no-ip.org/IMAGE_2019-12-26_23-19-08.PNG)

Shall I post the current files online?
Title: Re: CPCEC a new emulator from cngsoft
Post by: remax on 17:48, 27 December 19
Hoffe Kourçe
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 18:47, 28 December 19
Hoffe Kourçe
Yes of course :-) Alright then, CPCEC-20191227 is available from my website as usual.

(http://cngsoft.no-ip.org/IMAGE_2019-12-20_23-14-57.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-12-28_00-37-42.PNG)
(http://cngsoft.no-ip.org/IMAGE_2019-12-28_00-51-45.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-12-28_00-51-54.PNG)

20191227 -- fourteenth public release. Visual improvements: the green screen palette is closer to the original, the vertical filters ("Y-Masking") are compatible with the interlaced modes, mixing X-Masking and Y-Masking together shows a checkered patter. Internal improvements: the new traits of the CRTC registers 3 and 9 and the delays between the Gate Array, the Z80 and the CRTC finally can emulate "Pinball Dreams" as a whole for all the CRTC types and solve the problems in several demos ("Scroll Factory", "Still Rising", parts of "The Demo"...) and games ("Action Fighter", "Storm Warrior", "Usagi Yojimbo"), although some titles still need particular CRTCs ("PhX" CRTC0, "Onescreen Colonies" CRTC1, etc.) to work correctly.

(http://cngsoft.no-ip.org/IMAGE_2019-12-25_14-04-55.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-12-28_15-00-26.PNG)

I also released "Epimetheus +", an improved edition of my CPC Retrodev 2019 submission, with medals to pick up, smoke trails to spice the visuals up, and a softer difficulty curve for the first 20 levels.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:12, 31 December 19
Just in time for the very last three hours of the year...

(http://cngsoft.no-ip.org/IMAGE_2019-12-30_23-02-11.PNG) (http://cngsoft.no-ip.org/IMAGE_2019-12-31_21-10-34.PNG)

20191231 -- minor patch fixing a bug in the FDC (bit 6 of SENSE DRIVE STATUS must react when the user changes discs: "Fugitif") and a regression in CRTC0 (detect REG6<REG4 rather than REG6<=REG4: "5KB Megademo 3: Nayad"). Happy new year 2020!

Thanks to Dlfrsilver for bringing "Fugitif" back to my attention! Happy New Year, everyone!
Title: Re: CPCEC a new emulator from cngsoft
Post by: robcfg on 00:23, 01 January 20
Great work!


Wish you a Happy New Year!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:00, 02 January 20
The New Year's Eve update broke "Scroll Factory" and others :-( Never rush an update without testing it properly! So yesterday evening I had to make a second minor patch solving the issues caused by the first one:

(http://cngsoft.no-ip.org/IMAGE_2020-01-01_23-35-02.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-01-02_11-04-36.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-01-01_18-57-18.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-01-02_11-03-58.PNG)

20200101 -- minor patch fixing a regression in CRTC0 caused by the previous patch ("Scroll Factory", intro of "Pinball Dreams", "Overflow Preview: Part 1") and improving its heuristics ("Overflow Preview: Part 3").
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:02, 23 January 20
I'm busy and I cannot spend enough time on CPCEC, but I've been fixing bugs in the FDC TRACK FORMAT command, improving the disc timings, supporting more copy protections ... and slowly, very slowly, adding Plus hardware support.

(http://cngsoft.no-ip.org/IMAGE_2020-01-22_20-50-31.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-01-22_19-49-04.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-01-22_20-50-59.PNG)

Hardware sprites are half baked; soft scroll, DMA channels and vector interrupts aren't emulated yet; but several cartridges are already playable, beginning with the very first one: "Burnin' Rubber".
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:11, 25 January 20
Current state of affairs: the sixteen original cartridges I'm aware of are working correctly.
(http://cngsoft.no-ip.org/IMAGE_2020-01-23_19-21-49.png) (http://cngsoft.no-ip.org/IMAGE_2020-01-24_16-42-18.png)
(http://cngsoft.no-ip.org/IMAGE_2020-01-23_23-15-18.png) (http://cngsoft.no-ip.org/IMAGE_2020-01-23_23-15-35.png)
(http://cngsoft.no-ip.org/IMAGE_2020-01-24_23-21-06.png) (http://cngsoft.no-ip.org/IMAGE_2020-01-24_23-23-55.png)

I've already tested several non-commercial titles and demos and they work, too:
(http://cngsoft.no-ip.org/IMAGE_2020-01-23_19-56-50.png) (http://cngsoft.no-ip.org/IMAGE_2020-01-24_20-53-09.png)

However, "Fluff" is playable but the horizontal scroll is glitchy, and "Prehistorik 2" is missing the hard sprites and crashes on vertical scrolling.
(http://cngsoft.no-ip.org/IMAGE_2020-01-25_11-12-41.png) (http://cngsoft.no-ip.org/IMAGE_2020-01-25_11-13-35.png)

I'm sticking to http://www.cpcwiki.eu/index.php/Arnold_V_Specs_Revised but some details are more obscure than others.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 02:08, 01 February 20
After lots of problems, "Fluff" and "Prehistorik 2" for Plus work well at last!

(http://cngsoft.no-ip.org/IMAGE_2020-01-26_10-22-00.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-02-01_00-25-03.PNG)

PH2+ took forever, there were errors in the DMA emulation (used here as a timer) and in the algebra that locates sprites within the visible screen.

(http://cngsoft.no-ip.org/IMAGE_2020-01-31_22-44-23.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-01-31_22-49-57.PNG)

The next release will have to wait until I solve CPCEC's license issues with the university (remember, it was my master's degree final project). In hindsight, all the past releases should have stayed as private alphas :-(
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 12:15, 01 February 20
Sounds great.  License issues with a university project!  I hope you get that resolved soon, would never have thought that could happen.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 16:40, 17 February 20
I wouldn't expect something like this having licensing issues outside the USA to be frank but what do I know... in any case, awesome series of updates!
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 18:49, 17 February 20
I would assume that any project made as part of the university course could be property of the university, or shared, or something like that.

Same as when you work on something paid by your employer; you don't own it (unless your contract says do).
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 19:28, 17 February 20
The discussion is much more nuanced though; if it's a public University an argument can be made for public domain.
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 20:32, 17 February 20
Actually, I thought the code was GPL. So it couldn't be clearer, unless there's any copyright not covered by that.

Anyway, we're guessing and derailing a bit the thread. Apologies.

It is an excellent emulator and it gets better and better. I hope the issue gets sorted and we can all enjoy it legally.
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 22:56, 17 February 20
I would assume that any project made as part of the university course could be property of the university, or shared, or something like that.

Same as when you work on something paid by your employer; you don't own it (unless your contract says do).


In the UK University now costs a small arm and leg and unless using code provided and owned by the university I would expect to be the owner of anything produced.  Work is a different story where they are paying you, but this in the UK is the other way round you are paying them now.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:03, 01 March 20
Well, it's done. CPCEC 20200229 is out, with Amstrad Plus emulation, source files within the package, everything.

The license problems were more of a big misunderstanding than anything else. I was actually quite dumb and I should have asked the questions much sooner :-( Besides, some titles gave me trouble until very few days ago.

(http://cngsoft.no-ip.org/IMAGE_2020-02-22_10-06-54.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-02-22_10-07-14.PNG)

The less I say about demos the better, too...

(http://cngsoft.no-ip.org/IMAGE_2020-02-12_20-41-07.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-02-12_20-41-38.PNG)

Still, CPCEC and ZXSEC are coming closer towards the goal of "dogfooding": organisations ought to use their own products, don't they?

EDIT: the original upload had a mistake because of a dumb oversight (saving changes AFTER compiling the files!); I replaced the package two hours later.
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 11:10, 01 March 20
The less I say about demos the better, too...
Hi CNG, it looks (obviously) like a timing issue on SPLT register and SSRon a Plus, the soft scroll register had almost immediate effect (on the next screen "word")the split register adress is loaded in the Asic-CRTC at the end of the displayed screenfor the "face+vector balls" part, the CRTC is set to 256 bytes long so i guess your emulation do not reset to next adress until it's fully displayed (but this cannot be displayed)i guess that because the rubber bar use almost the same split routine -> with different CRTC settings but the split is triggered the same way, very conventionnal for a Plus++
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 13:32, 01 March 20
Excellent work @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) , adding Amstrad Plus abilities + distributing source-code = major win for me.

On top of what @roudoudou (https://www.cpcwiki.eu/forum/index.php?action=profile;u=1714) just said, I'm wondering if you could also focus for next release on supporting Eerie Forest by Logon System (https://www.pouet.net/prod.php?which=72271 (https://www.pouet.net/prod.php?which=72271)). There are many issues with the horizontal scrollers. I believe that once you will get this demo 100% fixed, many other productions will be able to run smoothly.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:37, 07 March 20
I haven't been able to work too much on CPCEC, but I just released a bugfix avoiding a hang in  'globbing()', extending the compatibility of snapshots (WinAPE and ACE don't handle CPC+ blocks the same way) and moving some OS-independent code from CPCEC-OS.H to CPCEC-RT.H.

(http://cngsoft.no-ip.org/IMAGE_2020-03-01_17-15-19.png) (http://cngsoft.no-ip.org/IMAGE_2020-03-01_17-16-16.png)

@roudoudou (https://www.cpcwiki.eu/forum/index.php?action=profile;u=1714), @norecess (https://www.cpcwiki.eu/forum/index.php?action=profile;u=2409), I can't wait to find why "CRTC 3" and "Eerie Forest" are acting up, though at least the damages are relatively limited: no crashes, no broken timings, just screen offsets not getting calculated and updated as intended.
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 13:48, 07 March 20
did you try my ACID test split cartridge in the ACID topic ?
all CRTC3 is doing the same split technic, very + compliant (i'm not mixing CRTC split + SSR register)
so the basics are:
set SPLIT LINE + SPLITADR before the end of the displayed line THEN...       ...out of the visible screen, modifying the SSR (or SSCR) because it has immediate effect
the SSR allow to "choose the block" then you have to substract the block value from the current block value to get the block you want because the BLOCK value is in fact a block shifting :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:12, 09 March 20
did you try my ACID test split cartridge in the ACID topic ?
all CRTC3 is doing the same split technic, very + compliant (i'm not mixing CRTC split + SSR register)
so the basics are:
set SPLIT LINE + SPLITADR before the end of the displayed line THEN...       ...out of the visible screen, modifying the SSR (or SSCR) because it has immediate effect
the SSR allow to "choose the block" then you have to substract the block value from the current block value to get the block you want because the BLOCK value is in fact a block shifting :)
Your statement about the "immediate effect" is leading me somewhere:

(http://cngsoft.no-ip.org/IMAGE_2020-03-09_19-59-00.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-09_19-59-06.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-03-09_19-59-12.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-09_19-59-20.PNG)

It's not right yet but it's beginning to take shape, we're on the right track.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:42, 14 March 20
It's the first anniversary of CPCEC.

(http://cngsoft.no-ip.org/IMAGE_2020-03-14_19-53-53.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-14_19-54-34.PNG)

Possibly not the best reason for posting a new release, but this minor patch solved several issues in "Eerie Forest" and "CRTC3", so I thought I could publish the new files.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 16:18, 01 April 20
New release of CPCEC just in time for the April showers (let's hope the rain washes the virus away) albeit a minor one focusing on Amstrad Plus special effect bugfixes:

(http://cngsoft.no-ip.org/IMAGE_2020-03-29_12-20-32.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-28_14-00-14.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-03-24_09-47-42.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-26_14-14-52.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-03-26_21-59-55.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-03-26_23-16-08.PNG)

I really need to write stereo sound into the next release, and to understand why the Gate Array's scanline counters used to trigger IRQs sometimes run faster than intended.

I published a new version of CHIPNSFX too, with some tweaks and several new songs, and I should clean UZ80 up and release a new package as well.
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 21:00, 01 April 20
This is getting better and better. Keep up the good work !  ;)
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 18:00, 02 April 20
Cool how quick this one does evolve!  :) :) :)


Are you going to support more hardware expansions? Well, I mean the easy stuff.  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:52, 05 April 20
New version 20200404: thanks to @norecess (https://www.cpcwiki.eu/forum/index.php?action=profile;u=2409) for helping me find the DMA bug that required a million ASIC PLUS kludges... they're mainly gone now with the exception of "Black Sabbath" that somehow expects IRQs to happen one scanline too soon.

(http://cngsoft.no-ip.org/IMAGE_2020-03-29_14-21-56.png)
(http://cngsoft.no-ip.org/IMAGE_2020-04-03_19-03-21.png)

Cool how quick this one does evolve!  :) :) :)

Are you going to support more hardware expansions? Well, I mean the easy stuff.  :)

I'm afraid I already struggle too much with the base hardware; expansions will have to wait until CPCEC is more solid. That being said, it already emulates up to 576k RAM (X-MEM, demo "Postscriptum") and 512k ROM (PLUS cartridges, either real or custom-made by gluing multiple 16k ROM files together)
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 13:51, 05 April 20
I'm afraid I already struggle too much with the base hardware; expansions will have to wait until CPCEC is more solid. That being said, it already emulates up to 576k RAM (X-MEM, demo "Postscriptum") and 512k ROM (PLUS cartridges, either real or custom-made by gluing multiple 16k ROM files together)
As the CPC can manage 256 Roms, please allow a super extension with 256 ROM and not a tiny amount of 16 or 32 like most of emulators ;)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:57, 06 April 20
Super minor update restoring the missing top left sprites of "Synergy 4" after I realised that a temporary buffer (in this case the sprite coordinates) enables monitoring softwares racing the beam to achieve this kind of visual effect.

(http://cngsoft.no-ip.org/IMAGE_2020-04-06_09-34-16.PNG)

EDIT: made a new package because of an oversight.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 13:09, 06 April 20
As the CPC can manage 256 Roms, please allow a super extension with 256 ROM and not a tiny amount of 16 or 32 like most of emulators ;)
Actually 64 would be enough (IMHO), that's a X-MEM + Y-MEM. Only one of my CPCs has an (internal) 2,5 MB of ROM - which I still not use completely. :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: Ast on 13:58, 06 April 20
Super minor update restoring the missing top left sprites of "Synergy 4" after I realised that a temporary buffer (in this case the sprite coordinates) enables monitoring softwares racing the beam to achieve this kind of visual effect.

(http://cngsoft.no-ip.org/IMAGE_2020-04-06_09-34-16.PNG)


it's a good thing to see my old Synergy demo working.
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 14:19, 06 April 20
Actually 64 would be enough (IMHO), that's a X-MEM + Y-MEM. Only one of my CPCs has an (internal) 2,5 MB of ROM - which I still not use completely. :)
Please, we must avoid the race to the bottom... The CPC can manage 256 ROM, let the emulator manage 256 ROM...

Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 17:20, 06 April 20
Please, we must avoid the race to the bottom... The CPC can manage 256 ROM, let the emulator manage 256 ROM...
Oh, I'm totally at your side.  ;D
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:16, 18 April 20
More bugs bite the dust and more demos are supported!

(http://cngsoft.no-ip.org/IMAGE_2020-03-16_19-26-56.png) (http://cngsoft.no-ip.org/IMAGE_2020-03-31_09-20-20.png)

"Black Sabbath", "Imperial Mahjong", "Onescreen Colonies" and "Scroll Factory" were fighting each other (i.e. I wasn't able to make them all work at once, whenever one ran well another one failed) until I realised that the two-line IRQ reset counter starts when the VSYNC begins UNLESS the HSYNC ends at the same time AND we're on a classical CPC rather than an ASIC-powered one; in that case the counter starts one scanline later.

(http://cngsoft.no-ip.org/IMAGE_2020-04-17_23-55-55.png) (http://cngsoft.no-ip.org/IMAGE_2020-04-18_00-31-03.png)

"Tire au Flan" behaves differently on a Plus, but CPCEC didn't understand its detection method: setting the PIO port A on write mode, then reading from it, should return zero on non-Plus hardware.

I have yet to come up with OS-independent stereo sound and hardware+ROM profiles. Meanwhile I've already begun reading the X11 and ALSA specs, the most standard window and audio interfaces for Linux that I'm aware of.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 20:51, 18 April 20
After spotting and fixing a dangerous bug in the ZIP archive handler, I decided that the current changes were sufficient for a new public release, albeit a minor patch, available from http://cngsoft.no-ip.org/cpcec.htm (http://cngsoft.no-ip.org/cpcec.htm) as usual:

(http://cngsoft.no-ip.org/IMAGE_2020-03-30_23-21-47.png) (http://cngsoft.no-ip.org/IMAGE_2020-04-17_23-39-33.png)

- 20200418 -- minor patch with improvements in the interrupt counter (it starts with the first HSYNC fall after the VSYNC rise -"Onescreen Colonies"- unless on PLUS where it can start when the VSYNC rise happens together with the HSYNC fall: "Black Sabbath"), the PIO Port A (it returns zero when reading it in write mode unless on PLUS where it returns 255: "Tire au Flan") and the debugger: disassembly parameters are vertically aligned and the hardware information panel is aligned to the ASCII memory dump. Fixed a bug in the ZIP archive header seeker.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:01, 19 April 20
I rebuilt the package after noticing yesterday night that I had left two things unfinished and undocumented:

(http://cngsoft.no-ip.org/IMAGE_2020-04-19_10-31-18.png) (http://cngsoft.no-ip.org/IMAGE_2020-04-19_10-31-25.png)

- 20200418 -- minor patch with improvements in the interrupt counter (it starts with the first HSYNC fall after the VSYNC rise -"Onescreen Colonies"- unless on PLUS where it can start when the VSYNC rise happens together with the HSYNC fall: "Black Sabbath"), the hardware ports (PIO port A returns zero when reading it in write mode unless on PLUS where it returns 255 -"Tire au Flan"-, PIO port B must set VSYNC in the middle of the screen when the CRTC requests it -"Chany Dream End Megademo"- and the Gate Array's 0-191 byte range requires a more rigid port logic -"Overflow Preview 3"-) and the debugger: disassembly parameters are vertically aligned and the hardware information panel is aligned to the ASCII memory dump. Fixed a bug in the ZIP archive header seeker, too.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:00, 24 April 20
CPCEC and ZXSEC are getting a SDL2 port, but it's going to take longer than expected because I must write the new GUI from scratch as the SDL functions don't provide any widgets.

(http://cngsoft.no-ip.org/SLITAZ5-COOKING-20200423-1058.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-04-24_11-18-12.png)

It already runs well on a couple of Linux systems (Slitaz and Ubuntu) and it's also useable on Windows even if that wasn't the point of making the SDL2 port to begin with.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Aeliss on 19:51, 24 April 20
Hello, do you think it will be possible to use the sdl menu with a joypad ?
It will be easier to use it from a couch without using the keyboard.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 19:32, 30 April 20
It's official, the 16th public release of CPCEC is out: SDL2 support (complete with precompiled GNU/Linux 32-bit files, custom user interface -press F10 to show the menu- and other cross-platform adaptations), Z80 fixes that reduce the mistakes of the RAXOFT test suite (Z80CCF goes down from 70 to 5 mistakes out of 152, Z80FULL drops from 10 mistakes to 8, and Z80MEMPTR drops to 4 to 0 mistakes) and the new extended ROM profile system based on simple INI files, for example:

Code: [Select]
lowest=fw315en.rom
high02=sym-roma.rom
high03=sym-romb.rom
high04=sym-romc.rom
high05=sym-romd.rom

Whose only hard requirement is that the ROM files must be in the same folder where the INI file is.

(http://cngsoft.no-ip.org/IMAGE_2020-04-24_18-38-36.png) (http://cngsoft.no-ip.org/IMAGE_2020-04-25_11-25-13.png)
(http://cngsoft.no-ip.org/IMAGE_2020-04-30_19-10-06.png) (http://cngsoft.no-ip.org/IMAGE_2020-04-29_12-06-57.png)

Hello, do you think it will be possible to use the sdl menu with a joypad ?
It will be easier to use it from a couch without using the keyboard.
You're as bound to use the keyboard sooner or later as with a real CPC, but alright, I'll consider your suggestion for future releases.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 21:44, 30 April 20
Here are some tests you can do to see if the emulation is accurate:


- Install XDDOS 2.10 ROM and see if the system starts u
- Install FutureOS and copy from disc to disc (disc or file, check both)
- "" Use OS-Infos Tool to see if the expansion RAM can be detected

Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 16:33, 05 May 20
I released a couple of bugfixes during the past days:
* 20200503 -- minor patch improving the behavior of the Z80 operations INI, IND, INIR, INDR, OUTI, OUTD, OTIR and OTIR: the 2012 RAXOFT tests (Z80CCF, Z80FULL and Z80MEMPTR) score zero errors. Slightly more precise automatic frameskip.
* 20200505 -- minor patch focused on the SDL2 toolkit: fixed a bug when confirming overwriting files, and improved file browsing across directories by pointing by default to the previous directory.

Here are some tests you can do to see if the emulation is accurate:

- Install XDDOS 2.10 ROM and see if the system starts u
- Install FutureOS and copy from disc to disc (disc or file, check both)
- "" Use OS-Infos Tool to see if the expansion RAM can be detected
FutureOS succeeded at making a copy of the ZEXALL disc from drive A: to drive B: as seen in the screenshots:

(http://cngsoft.no-ip.org/IMAGE_2020-05-04_00-28-55.png) (http://cngsoft.no-ip.org/IMAGE_2020-05-04_00-29-17.png)
(http://cngsoft.no-ip.org/IMAGE_2020-05-04_00-32-53.png) (http://cngsoft.no-ip.org/IMAGE_2020-05-04_00-32-55.png)

FutureOS crashed when I tried opening the ramdisk at drive M: ; the same happens on WinAPE when inserting the same cartridge (English)+AMSDOS+FW3.15+WithoutMenu.cpr and examining the ramdisk.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 17:18, 05 May 20
Thanks for testing. I'll have a look what's the problem with M regarding real CPC and emulators.
Your FDC routines (and others) seem to be very faithful. Great work!!!  :) :) :)

EDIT: The crash when DIRectory of M seems to depend on the data in RAM &CC. It's not a problem of the emulation, more a problem in sorting the DIR which is not used. Will fix that.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 07:28, 09 May 20
TL;DR:
(1) Congratulations cngsoft for this extraordinary work!
(2) I can offer contribution in convenience feature (telling from command line to run something, and exit when CPC resets).

I tested the emulator on Ubuntu 20.04 (actually Xubuntu). It compiles easily, runs smoothly with low CPU consumption.   :)

 8) CPCEC is on a good way to replace caprice32 as my test-run emulator and debug emulator.  8)

I usually test-run my prods with caprice32.

Pros: caprice32 is open-source with public history, lightweight, easy to build, has menus, can be instructed from command line to run some command and exit on next CPC reset since I contributed some code to that effect (Scriptable wait point command-line option CAP32_WAITBREAK · Issue #110 · ColinPitrat/caprice32 (https://github.com/ColinPitrat/caprice32/issues/110)).
Cons: imperfect fullscreen handling, ageing dependency (SDL 1), emulation probably imperfect (yet sufficient so far for my needs).

I usually debug with arnoldemu.

Pros: arnoldemu is open-source, has some powerful debugging facilities (several windows, context menu, loading external symbols).
Cons: has become difficult to build (dependency on old wxwidget) and has some annoyances, like consuming 100% CPU whenever the debugger is active, no code history and no release visible since May 13, 2017.

(Most other emulators do not fit because they are not open-source, heavyweight or only work on Windows. https://floooh.github.io/tiny8bit/ is interesting: extremely accurate, easy yet heavyweight build, can run in web pages like https://gourichon.org/cpcitor/bydate/2020/2020-05-03/ .)

CPCEC may replace both

Pros: like caprice32 CPCEC is open-source with public history (I created a git history from your zips to share on github, with proper commit messages and fixing some issues like corrupted rom in one commit), lightweight, easy to build, has menus.
Cons: imperfect fullscreen handling, can not yet be instructed from command line to run some command and exit on next CPC reset. I can contribute as I did for caprice32. Also, debugging is not as luxurious as in arnoldemu. Interestingly, tiny8bit allows to use any window resolution for status and debugging, could provide inspiration.

All in all, congrats for cpcec!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 08:29, 09 May 20
Hi again!

You did a very good job of isolating the operating-system-dependent parts and making a SDL2 variant.
CPCEC works very well on Linux, and consumes little CPU on my machine!

I guess you will update http://cngsoft.no-ip.org/cpcec.htm

Turning this

Quote
CPCEC requires a Microsoft Windows 2000 operating system or later.

Into something like this?

Quote
CPCEC can run on Windows and SDL2-supported platforms including Linux desktop.
The Windows variant of CPCEC requires a Microsoft Windows 2000 operating system or later.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 11:56, 10 May 20
It's really nice that we start to have choices of emulators.

I love the ability to dump part of the CPC memory to a host file, to check for non-corruption.

Cpce really nicely fits the "simple, accurate, and convenient" type of emulator, which is a perfect niche to run and develop.

By comparison, RetroVirtualMachine complexity of UI makes it less practical to use (especially the debugging features), but on the plus side; its outstanding graphical realism (including rotating cassette reels) and capability to hear the tape signal while the CPC decodes it, are really nice when checking a tape loader being developed really works as intended.

Congrats to all of you, you rock!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 16:44, 22 May 20
Ah, I found some drawback in CPCEC: sound is mono.  :blank:

So, when checking music and do not need a debugger I use caprice32 again.

From looking at the source code it looks like CPCEC is mono on all platforms.

As expected, setting

Code: [Select]
#define AUDIO_CHANNELS 2

in cpcec-ox.h is not enough to get stereo sound.  ::)

Still, huge congrats to CNGSoft. I used CPCEC debugger a number of times.
Title: Re: CPCEC a new emulator from cngsoft
Post by: XeNoMoRPH on 10:23, 05 June 20
Quote
20200603 -- seventeenth public release. Added stereo sound. Fixed a bug in the CPC PIO (the read-only mode of port A allowed writing), another bug in the tape analysis (CPCEC: the algorithm for TITUS caused trouble in "The Blues Brothers"; ZXSEC: Speedlock5 didn't recognize the heading noise; both systems add patches to shorten the initial delays), another one in the loading of CPC snapshots (a snapshot saved on PLUS hardware without the "CPC+" block showed a completely black palette), another one in the Z80 debugger (the command 'P0 could generate an infinite disassembly), another one on tape handling (reading a WAV file must use >128 as reference instead of >=128) and some problems in Win32 (the screen stopped updating after pausing, switching windows in and out) and SDL2 (boot message errors weren't shown; the filename sorting algorithm was slow).
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 16:06, 11 October 20
It took a long while, but CPCEC 20201010 is out. Big changes in the CRTC logic ("Chapelle Sixteen" runs at last!), new support for Dandanator cartridges (now you can play "Sword of Ianna"), partial Playcity support (enough for Targhan and Toto's teasers to work), more disc protections that run, new debugging functions (looking at graphics, following a timer, skipping scanlines and frames, etc), improvements in the user interface...

(http://cngsoft.no-ip.org/IMAGE_2020-08-13_13-00-39.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-09-06_00-02-12.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-09-10_08-31-37.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-08-16_13-46-41.PNG)
(http://cngsoft.no-ip.org/IMAGE_2020-09-24_18-20-56.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-09-25_13-54-23.PNG)

I need a rest, but I still want to make a game for the CPC Retrodev 2020 compo, so the next three weeks are going to be busy, a race against the deadline...
Title: Re: CPCEC a new emulator from cngsoft
Post by: Targhan on 23:44, 11 October 20
Wow, great job!

Quote
I need a rest, but I still want to make a game for the CPC Retrodev 2020 compo
Great, but think about your health (mental and physical) first. Take care :).
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 18:05, 13 October 20
Small update: CPCEC 20201012 adds mouse support for SDL2. Keyboard usage stays the same, the mouse support is built on top of it:
- the main menu appears when right-clicking on the window;
- navigating menus requires clicking on their captions;
- picking a menu item requires clicking on said item;
- scrolling a list requires clicking above it (or below it) once;
- choosing an item in a list requires clicking on it twice (first click selects it, second click confirms the choice);
- quitting menus and dialogs requires clicking outside their areas.

Closing widgets by clicking beyond their bounds should feel familiar: the user interface from Rainbird Software's "OCP Art Studio".
(http://cngsoft.no-ip.org/IMAGE_2020-10-13_18-14-35.png) (http://cngsoft.no-ip.org/IMAGE_2020-10-13_18-14-55.png)

It was one of the goals for the 20201010 release but it was half cooked and I forgot to finish it beforehand.
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 21:34, 13 October 20
Would it be possible to include the source files in a directory inside the ZIP and that the filenames are all lowercase?

Is not really a big deal, but every time I uncompress the ZIP, is a bit messy in Linux :)

Thanks for the emulators (both, I use cpcec and zxsec in Linux).
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 11:15, 14 October 20
I never trust a zip file, I invariably go into a new dir before unpacking them. And there's an option to unzip to lowercase the filenames.
@cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) has been maintaining a git repo at https://github.com/cpcitor/cpcec as well, which has the benefit of the full history of the zipped releases. Although it's not quite been updated with the newest release yet.
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 11:31, 14 October 20
I never trust a zip file, I invariably go into a new dir before unpacking them. And there's an option to unzip to lowercase the filenames.
@cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) has been maintaining a git repo at https://github.com/cpcitor/cpcec as well, which has the benefit of the full history of the zipped releases. Although it's not quite been updated with the newest release yet.

Hah! Looks like the unzip version of Ubuntu has the lowercase option, but I don't think I saw it in thee Debian version :(

It may be me, just ignore me  :picard:
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 11:54, 14 October 20
I never trust a zip file, I invariably go into a new dir before unpacking them. And there's an option to unzip to lowercase the filenames.
@cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) has been maintaining a git repo at https://github.com/cpcitor/cpcec as well, which has the benefit of the full history of the zipped releases. Although it's not quite been updated with the newest release yet.

Thanks @Pelrun. Indeed, and I'm planning to update the repo today.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 16:14, 14 October 20
@cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) has been maintaining a git repo at https://github.com/cpcitor/cpcec as well, which has the benefit of the full history of the zipped releases. Although it's not quite been updated with the newest release yet.

It is now up-to-date! You can get the benefits of git with:

git clone https://github.com/cpcitor/cpcec


For the record, this is made possible because @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) does things rather tidy, which makes automation possible:

* the history is generated by a script that fetches the ZIPs from the official cpcec web page and extracts the messages from the changes in file `cpcec-e.txt`.
* from now on each commit message includes the names of the ZIP file that was used to generate the commit, see for example https://github.com/cpcitor/cpcec/commit/01b09339b25784d38e31afbceff2c3c82e6e910f "This commit corresponds to archive: cpcec-20201010.zip"
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 19:31, 17 October 20
new debugging functions (looking at graphics, following a timer, skipping scanlines and frames, etc), improvements in the user interface...

I noticed, when debugging, the vertical dotted line on the emulated screen, which is very cool to "feel" the speed at which the picture is displayed while the Z80 does its best to compute.

I played with the "show graphics" (press W in the debugger). Would need some more explanation.
I'm still puzzled because even on my latest game JustGet9, knowing the address and width in bytes, I could not see my graphics.  ¯\_(ツ)_/¯

I figured out from the source https://github.com/cpcitor/cpcec/blob/master/cpcec-z8.h#L4267 those keys:
HOME/END increase/decrease "sprite width in bytes"?
LEFT/RIGHT move one byte left/right
UP/DOWN move one line up/down
PAGEUP/PAGEDOWN move 16 lines up/down

Title: Re: CPCEC a new emulator from cngsoft
Post by: Spirax on 12:24, 20 October 20
Hello.I just create an account to say thanks to cngsoft for the dandanator support on CPCEC  :o
thanks a lot for make Sword of Ianna playable on another emulator.
I will follow it on futures releases as I am developing a new cardbridge game....For the moment I can only say it works fine after I modify my own code to make it compatible with the emulator  :P As per the dandanator specs, we can use FD+FD + ld (IY+x) , abc ,
A for the config,
B for 1st slot zone
and C for 2nd slot zone

On my code for the new game I map both slots at same time using this code
Code: [Select]
    ld iy, rombank
    defb #fd, #fd
    ld (iy+0), b
    defb #fd, #fd
    ld (iy+1), c
And it was not working properlyAfter a few debug sessions I was able to found that the emulator only manage (iy+0) as tigger and not (iy+1)

so I modify my code to:
Code: [Select]
    ld iy, rombank
    defb #fd, #fd
    ld (iy+0), b
    inc iy
    defb #fd, #fd
    ld (iy+0), c
and now my new game (WIP port to CPC not announced yet) is working as supposed on CPCEC too  8)
but I would like to report it as may be good for a future release for a better dandanator emulation fidelity if you can check to use only 4 bytes as tigger for FDFDFD70 ,FDFDFD71, FDFDFD77 instead of the actual 5 bytes as FDFDFD7000 ,FDFDFD7100, FDFDFD7700

thanks a lot fo all your work
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:50, 21 October 20
Hello.I just create an account to say thanks to cngsoft for the dandanator support on CPCEC  :o
thanks a lot for make Sword of Ianna playable on another emulator.
I will follow it on futures releases as I am developing a new cardbridge game....For the moment I can only say it works fine after I modify my own code to make it compatible with the emulator  :P As per the dandanator specs, we can use FD+FD + ld (IY+x) , abc ,
A for the config,
B for 1st slot zone
and C for 2nd slot zone

On my code for the new game I map both slots at same time using this code
Code: [Select]
    ld iy, rombank
    defb #fd, #fd
    ld (iy+0), b
    defb #fd, #fd
    ld (iy+1), c
And it was not working properlyAfter a few debug sessions I was able to found that the emulator only manage (iy+0) as tigger and not (iy+1)

so I modify my code to:
Code: [Select]
    ld iy, rombank
    defb #fd, #fd
    ld (iy+0), b
    inc iy
    defb #fd, #fd
    ld (iy+0), c
and now my new game (WIP port to CPC not announced yet) is working as supposed on CPCEC too  8)
but I would like to report it as may be good for a future release for a better dandanator emulation fidelity if you can check to use only 4 bytes as tigger for FDFDFD70 ,FDFDFD71, FDFDFD77 instead of the actual 5 bytes as FDFDFD7000 ,FDFDFD7100, FDFDFD7700

thanks a lot fo all your work
Excellent bug report, thank you very much! Together with several few changes from the past days, it deserves a new release!

(http://cngsoft.no-ip.org/IMAGE_2020-10-11_18-58-33.png) (http://cngsoft.no-ip.org/IMAGE_2020-10-16_21-35-49.png)
20201020 -- minor patch fixing a bug in the Dandanator support (the "LD (IY+n),A/B/C" operations must work with any "n" value, instead of just 0: thanks to Spirax for the report) and another one in the CRTC (counter HCC is 8 bits long: "Camembert Meeting 4 Demo" stops showing a line of garbage between the top and the middle panels), adding SDL2_DOUBLE_QUEUE as an optional SDL2 compilation flag (some systems need an audio buffer longer than the default 8 frames) and using a different pixel pattern when both X-Masking and Y-Masking are enabled.

I cannot wait to know more about your ongoing Dandanator-based project, and I hope that this new version will be fully compatible with it.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 01:24, 21 October 20
Excellent bug report, thank you very much! Together with several few changes from the past days, it deserves a new release!


20201020 -- minor patch fixing a bug in the Dandanator support (the "LD (IY+n),A/B/C" operations must work with any "n" value, instead of just 0: thanks to Spirax for the report) and another one in the CRTC (counter HCC is 8 bits long: "Camembert Meeting 4 Demo" stops showing a line of garbage between the top and the middle panels), adding SDL2_DOUBLE_QUEUE as an optional SDL2 compilation flag (some systems need an audio buffer longer than the default 8 frames) and using a different pixel pattern when both X-Masking and Y-Masking are enabled.

Hi!

Congrats cngqsoft for the new release!

For the people who prefer to get code and updates via git, I updated the repo on https://github.com/cpcitor/cpcec with the new release.

To get code first time:

Code: [Select]
git clone https://github.com/cpcitor/cpcec
To update:

Code: [Select]
git fetch ; git rebase
Title: Re: CPCEC a new emulator from cngsoft
Post by: Spirax on 17:54, 21 October 20
Hello.
Thanks for the new vesrion, I have reverted my code to use ld (iy+1) as I save 4 bytes and some cicles on the routine. I have tested the new version and now is working properly with ld (iy+1), thanks

if I can sugest something for the TODO list.....
whe we released Sword Of Ianna a lot of user requested the posiblity to use snapshots for cardbridges as no any emulator support it.

I have done some test and appear as I can save a snap when I am running a dandanator cardbridge.
BUT in order to load it, you need to follow some procedure....
start the emulator
load the same dandanator cardbridge and start it
then load the snap.sna and on 95% of the cases you recover the game :;)

there is any posibility to link the snapshot saved to the cardbridge that was loaded when the snapshot was created?

please add this to a future future TODO list, I think someone will need to create a standard snapshot file for cardbridges or a new version of sna with cardbirdge options :)

on Ianna we only save on the Dandanator cardbridge the preferences, as user can redefine keys and the language selected, so on original CPC we can recover user preferences from dandanator.
on the new game I am looking to implement a quick status save, that will alow the user to save like a check point on the cardbridge on any moment on the game.
it will have passwords to access the different levels, but user can on any moment save the state or reload the previous saved status :)

After check the code with CPCEC I have added some protections to the routine to check if it was saved to the cardhbridge properly.
so if on real CPC it will report savestatus "Ok", and under emulators than don't support save (yet) it will report savestatus "Fail"
 8)
so thanks again for the emulator than allow us to test our code better  ;)

Saludos
Spirax
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 20:37, 21 October 20
Hello.
Thanks for the new vesrion, I have reverted my code to use ld (iy+1) as I save 4 bytes and some cicles on the routine. I have tested the new version and now is working properly with ld (iy+1), thanks

if I can sugest something for the TODO list.....
whe we released Sword Of Ianna a lot of user requested the posiblity to use snapshots for cardbridges as no any emulator support it.

I have done some test and appear as I can save a snap when I am running a dandanator cardbridge.
BUT in order to load it, you need to follow some procedure....
start the emulator
load the same dandanator cardbridge and start it
then load the snap.sna and on 95% of the cases you recover the game : ;)

there is any posibility to link the snapshot saved to the cardbridge that was loaded when the snapshot was created?

please add this to a future future TODO list, I think someone will need to create a standard snapshot file for cardbridges or a new version of sna with cardbirdge options :)

on Ianna we only save on the Dandanator cardbridge the preferences, as user can redefine keys and the language selected, so on original CPC we can recover user preferences from dandanator.
on the new game I am looking to implement a quick status save, that will alow the user to save like a check point on the cardbridge on any moment on the game.
it will have passwords to access the different levels, but user can on any moment save the state or reload the previous saved status :)

After check the code with CPCEC I have added some protections to the routine to check if it was saved to the cardhbridge properly.
so if on real CPC it will report savestatus "Ok", and under emulators than don't support save (yet) it will report savestatus "Fail"
 8)
so thanks again for the emulator than allow us to test our code better  ;)

Saludos
Spirax
What you say touches two topics. On one hand, CPCEC does use a small custom block for Dandanator status at the end of each snapshot, a small 16-byte chunk labelled "DNTR" that includes the last four bytes sent to the configuration ports, plus the last four bytes that are currently in use: the "RET mode" delays the activation of the new configuration bytes, so we need to keep the old ones somewhere. However, as you say, the user still needs to insert the appropriate Dandanator cartridge before loading the snapshot. If no cartridge is present, CPCEC automatically inserts the last known Dandanator cartridge; it isn't a great guess, but it let me play "Sword of Ianna" during several days on two machines (a desktop and a laptop) until I completed it. I'm wary of including paths and filenames within this custom block because nothing keeps the user from moving or renaming cartridges and snapshots, and thus making the included paths and filenames useless.

On the other hand, the Dandanator being able to save data on its own cartridges (Flash EEPROM, isn't it?) is a topic that the official documentation explains poorly and that, for fear of destroying data, I didn't implement; I'll wait for more explicit docs on the matter. The even poorer documentation on Spectrum (right now, all I know is that the ZX Dandanator monitors writes to the lowest 16k page; I have no idea on what those writes mean and do) is the reason why ZXSEC lacks Dandanator support, too.

So as you can see things are still limited and the CPC Dandanator support is restricted to read-only operation, not unlike the Playcity emulation that merely emulates plays and triggers NMIs because they're the only parts I could read about and test.
Title: Re: CPCEC a new emulator from cngsoft - unable to save files to disc
Post by: Nich on 22:14, 21 October 20
Is it just me, or has anyone else found a major problem with CPCEC, in that it doesn't save files to disc images?

To test this, reset the CPC, insert a DSK file into drive A, and type in a line in BASIC such as:

Code: [Select]
10 PRINT"Hello world"
Then save it to disc:

Code: [Select]
SAVE"hello"
No error messages like "disc is write protected" appear, and the status display at the bottom left of the screen flashes to indicate that there is disc drive activity.

Now try cataloguing the disc:

Code: [Select]
CAT
In my case, even though there were no error messages, the file has not been saved to the disc image!

 [ You are not allowed to view attachments ]

I've tested it in both Windows and Linux (under Wine) and this bug occurs in the latest version (20201012) and several previous releases.
Title: Re: CPCEC a new emulator from cngsoft - unable to save files to disc
Post by: cpcitor on 22:22, 21 October 20
Is it just me, or has anyone else found a major problem with CPCEC, in that it doesn't save files to disc images?

I've observed this, too, and can reproduce with release 20201012.

Actually, when you press F7 to insert a disk, you can press TAB to show another menu with options "Read Only" and "Read/Write".

If you choose "Read/Write" (it is tricky to know which you actually choose), then you get the expected behavior.

That said, you're right. The default behavior (running cpcec diskimagefilename.dfk) is buggy (no write but no error), the UI is non-discoverable. CPCEC is work in progress, open source and you can contribute. :-)
Title: Re: CPCEC a new emulator from cngsoft
Post by: Dandare on 23:17, 21 October 20
On the other hand, the Dandanator being able to save data on its own cartridges (Flash EEPROM, isn't it?) is a topic that the official documentation explains poorly and that, for fear of destroying data, I didn't implement; I'll wait for more explicit docs on the matter. The even poorer documentation on Spectrum (right now, all I know is that the ZX Dandanator monitors writes to the lowest 16k page; I have no idea on what those writes mean and do) is the reason why ZXSEC lacks Dandanator support, too.

Hi, Thanks for supporting the CPC Dandanator in your emulator.
CPC Dandanator documentation includes the Z80 assembler code for erasing a block and writing a block in flash memory. Further documentation on the expected commands can be found on the SST39SF040 datasheet, since the code simply follows the JEDEC commands as defined there. A quick preview of the code:


Code: [Select]
; ---------------------------------------------------------------------------------------- 
; CPC Dandanator! Mini HW v1.2/1.3 - Eeprom Write SST39SF040
;
; Typical Usage ->    LD A, SectN               ; Loop 128 sectors
;               CALL SSTSECTERASE         ;   |
;               LD A, SectN               ;   |
;               LD HL, RAMSOURCE4KBLOCK      ;   |
;               CALL SSTSECTPROG         ;   |
;               JP DDNTRRESET
;
; Dandare - May 2018
; ----------------------------------------------------------------------------------------     


; ----------------------------------------------------------------------------------------
; ERASE SECTOR
;     A  = Sector number (39SF040 has 128 4k sectors)
;
;    ****  MUST BE RUN FROM RAM, DI, AND WITH EXTERNAL EEPROM (ZONE0) PAGED IN in 0x0000
;   ****  NO OTHER ZONE PAGED IN, Commands Enabled
;   ****  Also Write Operations must be enabled and serial operations disabled
;
; ----------------------------------------------------------------------------------------
SSTSECERASE:PUSH AF                  ; Save Sector Number
         AND 3                  ; Get Sector within Page
         SLA A                  ; Move to A13,A12 in DE
.....


On the other hand, there is a specific ZX Dandanator document for emulator implementation that I wrote back in 2016 (Last updated in 2018) that I have distributed to anyone interested in supporting ZX Dandanator in his/her emulator.  This document explains pulse timings, commands types, and technical details on the implementation, focusing on the most relevant aspects to include in an emulator. I'll be happy to share it with you if you are interested.


A sample of this document (In Spanish) is shown below:


Code: [Select]
El ZX Dandanator! Mini recibe comandos de control a través de escrituras en el espacio ROM (0x0000-0x3FFF).
Sin embargo, por compatibilidad futura y soporte de ZesarUX, se le asignan las direcciones comprendidas entre 0x0000 y 0x0003.
 
Estos comandos, que pueden ser simples o múltiples/especiales (más detalle sobre esto luego)
están compuestos una serie de pulsos consecutivos generados por esas escrituras (ld (0x0001),a -  por ejemplo.
El valor de A es ignorado aunque se usa en el emulador ZesarUX).
El HW del Dandanator espera recibir pulsos separados por, al menos 7us y nunca más de 32us,
aunque se recomienda una separación nominal de entre 10 y 15us.
Para determinar el valor del comando enviado, el microcontrolador arranca un timer de 32us en el momento
de recibir cada pulso y, si recibe otro pulso antes de que el timer se complete, va sumando ese pulso a un contador.
Cuando se produce un “timeout”, es decir, cuando pasan 32us sin recibir otro pulso, se consideran los pulsos
contados como el comando recibido. En la imagen siguiente, el comando es “20”. (captura de analizador lógico)
...
Los comandos especiales están conformados por 3 comandos simples consecutivos más un pulso de confirmación.
Deben atender a unos criterios de temporización y direccionamiento estrictos de la siguiente manera:
 
·      Cada comando recibido está sujeto a las mismas normas explicadas con anterioridad sobre la distancia entre pulsos y el timeout.
·      De manera adicional, desde el momento de detección de cada comando (tras su timeout) se dispone de un máximo de 512us
para enviar el siguiente dato del comando especial. Si no se hace, se ignora el comando recibido.
 
·      Por compatibilidad con ZesarUX, el primer byte del comando debe enviarse a la dirección 0x0001,
el segundo a la dirección 0x0002, el tercero a la dirección 0x0003 y el pulso de confirmación,
con cualquier valor en el dato, a la dirección 0x0000.


....




Additionally, the full source code for the PIC microcontroller in the ZX Dandanator is available at the project's homepage, including the "commands.h" file describing all possible received commands.


An excerpt of this commands.h file:
Code: [Select]

// Special Command code to execute (all special commands are 4-steps: Command Code, Command Data 1, Command Data 2, Fast Execute)
// Command Code, Data 1 and Data 2
// Data1, Data2 and Fast Execute MUST be on next consecutive 512us windows to Command (4 windows total). Otherwise Special Command will be ignored
// All data must arrive in pulses separated by at least 8us and no more than 30us.
// Detecting a command is done by timing out the pulses. After 32us without a pulse, the command, consisting in the number of received pulses, is processed.


// COMMANDS :
//---------------------------------------------------------------------------------------
// Command 0    : Not implemented (can't be)
// Command 1-32 : Bank Switch to 0-31 (1-32 pulses)
// Command 33   : Bank Switch to Internal ROM (Internal is recognized as Bank 33)
#define CMD_INTERNALROM_DISABLECMD 34
// Command 34   : Bank Switch to Internal ROM & Disable further Commands
// Command 35   : Reserved
#define CMD_RESET 36
// Command 36   : Generate a Reset
#define CMD_NMI 37
// Command 37   : Generate a NMI
// Command 38   : Reserved
#define CMD_SET_RESETSLOT 39
// Command 39   : Set Reset Slot. Current Slot is selected in case of an Spectrum-Triggered Reset. Cleared on ANY reset (even PIC-Triggered resets).
//--------------------------------------------------------------
#define CMD_SP_FASTCHANGE 40
// Special Command 40   : Fast Change & Action
//                      : Data 1 : Bank Number (1-33,35) - 35 means previous bank   
//                      : Data 2 : Action to perform
//                               : bit 3 - Disable Commands
//                               : bit 2 - Lock Commands   
//                               : bit 1 - NMI
//                               : bit 0 - Reset
//                               : bits 4-7 - Reserved MUST be 0
//--------------------------------------------------------------
Title: Re: CPCEC a new emulator from cngsoft - unable to save files to disc
Post by: cngsoft on 00:18, 22 October 20
Is it just me, or has anyone else found a major problem with CPCEC, in that it doesn't save files to disc images?
To test this, reset the CPC, insert a DSK file into drive A, and type in a line in BASIC such as:
Code: [Select]
10 PRINT"Hello world"Then save it to disc:
Code: [Select]
SAVE"hello"No error messages like "disc is write protected" appear, and the status display at the bottom left of the screen flashes to indicate that there is disc drive activity.
Now try cataloguing the disc:
Code: [Select]
CATIn my case, even though there were no error messages, the file has not been saved to the disc image!

I've tested it in both Windows and Linux (under Wine) and this bug occurs in the latest version (20201012) and several previous releases.
I believed I had already answered this question to you in a past email, but I see that I never did. Ah well: CPCEC discards writes by default unless you ask CPCEC to create a disc from the menu, or you insert the disc with F7 (drive A) or Shift-F7 (drive B) and -depending on the Windows version- you disable the "read only" checkbox or you choose "open for writing" on the Open button submenu. Microsoft hid the file dialog options inside the "Open" button after Windows XP, but Wine's implementation keeps the options visible:

(http://cngsoft.no-ip.org/PANTALLAZO-2020-10-21_23-19-50.png)

The SDL version, as @cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) states, provides these options through an extra menu that pops up when hitting TAB.

That being said, I should really consider dividing this dual behavior into three parts:
1.- explicit read-only, writing isn't allowed and triggers Write Protected errors;
2.- implicit read-only, writing isn't allowed but triggers nothing;
3.- explicit read-write, writing is allowed.
Cases 1 and 3 fit regular activity, while case 2 is ideal for protected discs that need the write protection off. I even spoke about it here in this same thread.
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 01:10, 22 October 20
I have a usb pad type controller, is it possible to use it on this emulator?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Skunkfish on 17:43, 22 October 20
I just hooked up a gamepad to test and it seemed fine (two of the 6 buttons got recognised as X & Z), although there's nothing really in the way of settings.
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 19:21, 22 October 20
@Skunkfish (https://www.cpcwiki.eu/forum/index.php?action=profile;u=348) did you have to configure anything in the emulator to make the pad work?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Skunkfish on 23:56, 22 October 20
Nope, just plug and play...
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 02:08, 23 October 20
Following the previous talk about disc write protections, and after noticing that the recently added mouse support for SDL2 lacked wheel scrolling, I made a new minor release:

20201022 -- minor patch adding mouse wheel support to the SDL2 user interface and an option to set whether disc write conflicts in CPCEC and ZXSEC are strict (they raise errors) or relaxed (they do nothing).

The choice of disc write error mode is saved in the configuration file and sticks between sessions. By the way, and since we're speaking about things that the user can see (or cannot), Norecess' recent (and spectacular!) experiments with CPCEC's interfaces (both user and debugger) are making me ponder the convenience of further separating machine emulation and user interaction for the sake of "hackability" and extensibility.

@tjohnson (https://www.cpcwiki.eu/forum/index.php?action=profile;u=2129) : the joystick configuration is up to the operating system, I merely ask either the Windows API or the SDL2 library to tell me which joysticks are available and I choose the first one that is active.

EDIT: extremely small update 20201024 -- minor patch solving a problem in the SDL_WINDOWEVENT_EXPOSED event, inverting the black/white bits in ZXSEC's graphics viewer and pointing CPCEC's viewer at RAM rather than ROM.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 12:48, 08 November 20
Following the previous talk about disc write protections, and after noticing that the recently added mouse support for SDL2 lacked wheel scrolling, I made a new minor release:

20201022 -- minor patch adding mouse wheel support to the SDL2 user interface and an option to set whether disc write conflicts in CPCEC and ZXSEC are strict (they raise errors) or relaxed (they do nothing).
(...)
EDIT: extremely small update 20201024 -- minor patch solving a problem in the SDL_WINDOWEVENT_EXPOSED event, inverting the black/white bits in ZXSEC's graphics viewer and pointing CPCEC's viewer at RAM rather than ROM.

Thanks again cngsoft for the new releases!

For the people who prefer to get code and updates via git, I updated again the repo on https://github.com/cpcitor/cpcec with each new release.

To get code first time:

Code: [Select]
git clone https://github.com/cpcitor/cpcec
To update:

Code: [Select]
git fetch ; git rebase
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 13:10, 08 November 20
@tjohnson (https://www.cpcwiki.eu/forum/index.php?action=profile;u=2129) : the joystick configuration is up to the operating system, I merely ask either the Windows API or the SDL2 library to tell me which joysticks are available and I choose the first one that is active.
Not sure what happened 1st time but my gamepad works fine now, it's just like playing on a GX4000
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:16, 13 December 20
After releasing several minor versions with bugfixes and tweaks, a new major version is here:

20201212 -- nineteenth public release. The Windows version can use DirectDraw instead of GDI, and the SDL2 version uses Textures instead of Surfaces: performance rises when hardware acceleration is available. Just in case, however, command line parameter `-!` and the menu option "Video: Software render" can be used to disable the hardware acceleration in systems where it's missing or performs worse than pure software. CPC bugfix: PSG handles register 14 separately, as expected by "Gremlins (v1)". Spectrum bugfix: 128K ghost ports are properly emulated, the demo "Tiratok" plays music at last. New debug command "Y": fill memory with byte. XRF lists the available codecs on Windows when launched without parameters.

(http://cngsoft.no-ip.org/787447229773512766.png) (http://cngsoft.no-ip.org/787447301287313488.png)
(http://cngsoft.no-ip.org/785580906676224020.png) (http://cngsoft.no-ip.org/785581190467289168.png)

The software render is enabled by default, as the hardware mode is less likely to work on all machines, and in some cases (such as my desktop computer) it's actually less efficient than pure software. Disabling the software mode, then restarting the emulator, will show whether the video hardware provides 2D acceleration or not. You can always restore the software mode from the menu, or with the command line parameter "-!" if CPCEC becomes unlaunchable in the worst case.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 14:43, 20 December 20
Hello, this is a great emulator and I am using it to play Alcon2020 today with the PlayCity and such.
Using my controller though it only appears to let me move with the analog stick and not the d-pad and using analog stick with digital controls is of course quite clumsy, so is there a way to use the d-pad (think it uses POV?) or can there be an option for it in a future release?
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 13:20, 25 December 20
I was trying this on my media pc and only 62% performance, the cpu is not stressed at all.  Any idea why?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:01, 27 December 20
You would probably need to provide much more details, like operating system version, exact cpcec version you used, how you got it, etc.

You would probably need to provide much more details, like operating system version, exact cpcec version you used, how you got it, etc.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:32, 01 January 21
2020 is almost over and I'd like to wish everyone a happy new year 2021. A new release of CPCEC is in development: writeable Dandanator cartridges will be its main novelty, together with several fixes and tweaks as usual.

(http://cngsoft.no-ip.org/IMAGE_2020-11-20_12-02-41.PNG) (http://cngsoft.no-ip.org/IMAGE_2020-11-24_21-28-15.PNG)
By the way, I released a fourth public version of "Fire Tyre" back in Xmas, but I forgot to mention it here: mobile camera by default instead of static, four rival cars instead of three, maximum speed is now 225 mph instead of 180 ("Continental Circus" was a big inspiration), practice mode where you can play each track separately, etc.

Carnivius, CPCEC and ZXSEC do nothing special with the joystick, they simply request the first available joystick to Win32 or SDL2 (depending on the compiled version); the joystick configuration is up to the operating system.

tjohnson, I don't know, I'd have to know more about your system. Did CPCEC run faster in past versions? Is the "Video: software render" option on or off? Did you try different scanline and interlace modes? (some consume less CPU and video power than others)
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 03:05, 01 January 21
Happy new year-and thanks for the update!! 😊
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 12:50, 01 January 21

Carnivius, CPCEC and ZXSEC do nothing special with the joystick, they simply request the first available joystick to Win32 or SDL2 (depending on the compiled version); the joystick configuration is up to the operating system.
Damn. I can't really play games well on this then as it forces me to use analog stick. There's no way to force movement to the d-pad in Windows. Other emulators and programs tend to have even a basic config menu to sort that stuff out. This is a really great emulator but not one I can use as my main for now.  Never mind. Happy new year. :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 13:31, 01 January 21
Looks like it's mostly a misunderstanding of how the joystick APIs work - CPCEC asks for the analog position, and that's what it gets. The D-pad is actually simply mapped as extra buttons (or possibly the POV hat), so it's pretty trivial to read those as well (although it requires using JoyGetPosEx under win32).
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 15:53, 01 January 21
So I couldn't sleep until I fixed the dpad issue, patch is attached. This is working under linux with my controller. I've not tested the equivalent changes I made on the win32 side but they *might* work...

Looks like SDL has a mechanism for loading a standard mapping file in for game controllers; adding the call to do this I leave as an exercise to the reader.  :laugh:
Edit: fixed a minor bug with the win32 changes.
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 16:48, 01 January 21
Yep, this can be useful:

https://github.com/gabomdq/SDL_GameControllerDB

Perhaps?
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 01:04, 02 January 21

tjohnson, I don't know, I'd have to know more about your system. Did CPCEC run faster in past versions? Is the "Video: software render" option on or off? Did you try different scanline and interlace modes? (some consume less CPU and video power than others)


Well it turns out that using the amd automated driver installation installed a driver that was rubbish. It's a fairly old apu.  I uninstalled the drivers and used Microsofts update service,  that seems to have installed a driver that works.  I still skips a few frames but doesn't stick at 62% anymore.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 12:28, 02 January 21
So I couldn't sleep until I fixed the dpad issue, patch is attached. This is working under linux with my controller. I've not tested the equivalent changes I made on the win32 side but they *might* work...

Looks like SDL has a mechanism for loading a standard mapping file in for game controllers; adding the call to do this I leave as an exercise to the reader.  :laugh:
that's cool. how do i apply that?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Spirax on 14:12, 02 January 21
A new release of CPCEC is in development: writeable Dandanator cartridges will be its main novelty
1st Happy new year to all :)
As tester of the writeable option for Dandanator, I can say it works as espected with the writing asm code routines I used on Sword Of Ianna and also on a new cartridge CPC ported game that is in development....I also can say title for the new game will be anounced tomorrow ....
thanks
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 16:30, 02 January 21
that's cool. how do i apply that?
Under unix it's usually as simple as "patch < file.patch", as long as the files have the same line-ending type. And then compile.
Title: Re: CPCEC a new emulator from cngsoft
Post by: reidrac on 16:59, 02 January 21
Under unix it's usually as simple as "patch < file.patch", as long as the files have the same line-ending type. And then compile.

I think Scott may need someone to build the Windows version for him, with the patch (I'm on Linux and I don't think I have cross-compilation setup).

Or wait to see if César likes the patch and includes it in the next release!
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 17:17, 02 January 21
Hence why I didn't go into too much detail - either you're in a position to build it and don't need much handholding, or you can't and there's no point trying.
At the moment getting César to accept the changes into an official release is the best route for people who can't build it themselves. Which means I should probably test the win32 side.
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 18:01, 02 January 21
I fixed a minor bug in the win32 code but it looks like the basic win32 joystick api might not be sufficient and I'd need to rewrite it to use DirectInput. Yaaay microsoft.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 18:49, 04 January 21
I made a provisional version based on the code supplied by Pelrun: http://cngsoft.no-ip.org/cpcec-20210103-2555.zip (http://cngsoft.no-ip.org/cpcec-20210103-2555.zip)
I don't have any joysticks at home and right now I must head out, so please test it and tell me whether the new joystick code behaves as intended.
If everything goes well, I'll properly update the docs and make this version fully public. If not, I'll continue editing the code until both angular and axial joysticks work.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 19:16, 04 January 21
I made a provisional version based on the code supplied by Pelrun: http://cngsoft.no-ip.org/cpcec-20210103-2555.zip (http://cngsoft.no-ip.org/cpcec-20210103-2555.zip)
I don't have any joysticks at home and right now I must head out, so please test it and tell me whether the new joystick code behaves as intended.
If everything goes well, I'll properly update the docs and make this version fully public. If not, I'll continue editing the code until both angular and axial joysticks work.
heya, i tested it and it's not detecting any input from my controller.  I checked again on the previous version to make sure that one still does and yeah the previous one still detects buttons and has the movement attached to analog but this new one I'm getting nothing from. Sorry. :/
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:17, 05 January 21
heya, i tested it and it's not detecting any input from my controller.  I checked again on the previous version to make sure that one still does and yeah the previous one still detects buttons and has the movement attached to analog but this new one I'm getting nothing from. Sorry. :/
Second try: http://cngsoft.no-ip.org/CPCEC-20210104-2335.ZIP (http://cngsoft.no-ip.org/CPCEC-20210104-2335.ZIP)
Made after noticing three points: 1.- Win32 joyGetPosEx requires the dwSize and dwFlags fields of JOYINFOEX to be properly filled in advance, 2.- Win32 JOYINFOEX.dwPOV field is not -1 when the controller is a joystick, but 65535; 3.- the SDL2 SDL_GameController operation set must coexist with the SDL_Joystick set; the former does NOT include the later, the function SDL_IsGameController tells which operation set must be used.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 11:39, 05 January 21
Second try: http://cngsoft.no-ip.org/CPCEC-20210104-2335.ZIP (http://cngsoft.no-ip.org/CPCEC-20210104-2335.ZIP)
Made after noticing three points: 1.- Win32 joyGetPosEx requires the dwSize and dwFlags fields of JOYINFOEX to be properly filled in advance, 2.- Win32 JOYINFOEX.dwPOV field is not -1 when the controller is a joystick, but 65535; 3.- the SDL2 SDL_GameController operation set must coexist with the SDL_Joystick set; the former does NOT include the later, the function SDL_IsGameController tells which operation set must be used.
D-pad working fine now. Thanks! :)
My only other request would be to choose which buttons on the controller is Fire 1 and Fire 2 (and allow for some keys to be mapped to controller for games that require it like those that use Space or Return for smart bombs or menus or P/H keys for pausing) but don't worry about that.  Just having the more precise control of controlling CPC games correctly with the d-pad instead of the analog stick is a huge improvement and I can properly play games on it. :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 20:09, 05 January 21
D-pad working fine now. Thanks! :)
My only other request would be to choose which buttons on the controller is Fire 1 and Fire 2 (and allow for some keys to be mapped to controller for games that require it like those that use Space or Return for smart bombs or menus or P/H keys for pausing) but don't worry about that.  Just having the more precise control of controlling CPC games correctly with the d-pad instead of the analog stick is a huge improvement and I can properly play games on it. :)
Excellent, it works at last! I just made a couple more edits (accepting more joystick buttons as virtual mirrors) and published the resulting package:

20210105 -- minor patch fixing a bug in video recording (it turned 44KHz stereo into 88KHz mono) and tape playback (16 and 24 bit WAVE files were improperly supported), extending the joystick support to handle directional controls (thanks to Pelrun for the Win32 and SDL2 code) and letting the Dandanator emulation modify the cartridge (configuration, savestates...) if the user requests it.

I'll have to think of a way to give the user the ability to redefine the keyboard and joystick mappings altogether, although I cannot easily imagine it working on Win32 and SDL2 at the same time. Perhaps in the next major release...
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 02:38, 06 January 21
This latest version has broken my gamepad, now seems to be show up arrow constantly pressed on the pad.  Checked with previous version and that works fine.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 23:35, 07 January 21
This latest version has broken my gamepad, now seems to be show up arrow constantly pressed on the pad.  Checked with previous version and that works fine.
After buying a game controller for 10 EUR I edited the code until it behaved as intended. Interestingly, the order of buttons in SDL2 is different from Win32, despite the controller being the same. Arthur also spotted a couple of things that needed fixing and helped me get them right.

- 20210107 -- minor patch fixing a bug in the ASIC's screen split trigger (SSSL must be checked when HSYNC rises, rather than when HDISP rises) and a glitch in the Win32 joystick support, and making the Playcity CTC more responsive.

That being said, configuring the joystick within the OS stays important; my own new controller can work in digital and analog modes, and things fared differently on each mode; changing modes while CPCEC was on led to undesired effects (i.e. going crazy)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 16:39, 15 January 21
New update, made possible by a bug report from Xenomorph, and featuring several tweaks:
- 20210114 -- minor patch improving Playcity stereo autodetection ("Alcon 2020" uses the left chip only), adding ROM simulation to Dandanator cartridges ("CPC Soccer") and fixing a bug in Z80 instruction CPI introduced in version 20210105 (RAXOFT tests) and another one in the CRTC1 VSYNC length ("Pheelone").
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 17:19, 15 January 21
New update, made possible by a bug report from Xenomorph, and featuring several tweaks:
- 20210114 -- minor patch improving Playcity stereo autodetection ("Alcon 2020" uses the left chip only), adding ROM simulation to Dandanator cartridges ("CPC Soccer") and fixing a bug in Z80 instruction CPI introduced in version 20210105 (RAXOFT tests) and another one in the CRTC1 VSYNC length ("Pheelone").

As usual, all those update are propagated on https://github.com/cpcitor/cpcec . (I have written a script, it's just a matter of running it.)

Congratulations cngsoft!

Strangely enough, about a month ago I had a bug where the CPC screen would refresh only about once a second (version was up to date at the time, SDL2 on Xubuntu 20.04). Tested several versions recently, not reproduced anyway. ¯\_(ツ)_/¯
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:40, 16 January 21
Extremely quick fix: "20210115 -- minor patch fixing a bug in the CPC PIO: "Inertie" sends a value to port A, then reads the same value back instead of receiving a PSG register or keyboard bits." Thanks to Dlfrsilver for spotting the glitch.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 10:21, 28 January 21
Two updates:

(http://cngsoft.no-ip.org/IMAGE_2021-01-28_09-16-14.png) (http://cngsoft.no-ip.org/IMAGE_2021-01-28_09-19-03.png)
 
CPCEC 20210127 -- minor patch fixing bugs in the Spectrum timing ("LD (IX+n1),n2" and Z80_PRAE_SEND: thanks to Azesmbog for the FPGA test report) and the CPC tape analysis (conflict between Mikrogen and Hi-Tec).
CHIPNSFX 20210127 -- 32nd public release. Major rewrite: CHIPNSFX can be compiled with SDL2 ("gcc -O2 -DSDL2 -xc chipnsfx.c -lSDL2 -ochipnsfx") in other platforms than Windows. Added HEROBOTX.CHP, HISTEEL3.CHP, IKPLUS.CHP and TWINTUV8.CHP.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 23:23, 31 March 21
Thanks @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) for several updates again, published in :
cpcec-20210219.zip
cpcec-20210129.zip
cpcec-20210127.zip
cpcec-20210115.zip

Latest changelog from @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) says:

    minor patch adding a new option, "Video: Blend scanlines" that handles
    Gigascreen effects (Spectrum demos "Mescaline Synesthesia" and
    "Tiratok", CPC demos "Batman Forever" and "Mad Leprechaun") and
    changing the sound synchronisation in SDL2. The AY chip noise generator
    is now a LFSR. SNA files saved from Spectrum Plus3 set bit 4 of byte
    0x0C01E to state that the snapshot requires a Plus3 (Easter egg "Hello
    There I'm a +3"). The CPC debugger adds an information panel (key 'X')
    for Dandanator status, and its graphics viewer can show MODE 2 images.


https://github.com/cpcitor/cpcec is updated again with comprehensive history.

Congrats @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) for the impressive work!
Title: Re: CPCEC a new emulator from cngsoft
Post by: SerErris on 03:07, 18 April 21
Anyone has an idea what happend to the cpcec website? Looks like it is down - not answering.
Title: Re: CPCEC a new emulator from cngsoft
Post by: robcfg on 12:35, 18 April 21
I've told @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) about it, it will be up again soon, I'm pretty sure.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:47, 18 April 21
Good evening. The server needs some rest every once in a while, so it was off during the past night.

Just in time for an update, after several busy and difficult months: - 20210418 -- twentieth public release. Pixel and scanline filters are now saturation-based (colour aberration, desaturation) rather than luminosity-based (horizontal blur, shading). Fixed bug in XRF-to-AVI recording: VFW32 operations always assumed 16-bit stereo. The film recording options "High resolution" and "High framerate" now stick between sessions, and the first one also applies to BMP screenshots. Aded support for block types $19 and $4B in CDT/TZX tape files, as well as the new disc option "Read-only as default" so the user can choose whether discs are by default read-only or read-write, and this option stacks together with the already extant "Strict disc writes". Added new option "Flip joystick buttons" to CPCEC so users can swap the value of the two CPC joystick buttons, as suggested by SB1903. PSG emulation now catches overflows, regardless of whether they're programming errors (music distortion in "Thing on a Spring") or done on purpose (pipe sound effect in "Thing Bounces Back"). Fixed bug in ZXSEC's Plus3 memory contention ("Firefly" disc release) and improved the beeper (oversampling: Utz's "Quattropic"). ZXSEC snapshot handling is now more strict or flexible (changing models as often or as seldom as possible) depending on the option "Strict SNA files".

(http://cngsoft.no-ip.org/IMAGE_2021-04-04_10-32-26.png) (http://cngsoft.no-ip.org/IMAGE_2021-04-05_16-20-42.png)
(http://cngsoft.no-ip.org/IMAGE_2021-03-29_12-49-40.png) (http://cngsoft.no-ip.org/IMAGE_2021-04-18_22-52-43.png)
 
CHIPNSFX also got an update, although a small one: - 20210418 -- minor patch fixing a bug in the WaveOut timer and a glitch when testing instruments: sound must play even if channels are disabled. Pressing Control-U on the instrument panel removes unused instruments. Added M_U_L_F-G_.CHP, OUTWORLD.CHP, PULSOIDS.CHP and PULSOIDZ.CHP.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 23:14, 18 April 21
Just in time for an update, after several busy and difficult months: - 20210418 -- twentieth public release. Pixel and scanline filters are now saturation-based (colour aberration, desaturation) rather than luminosity-based (horizontal blur, shading). Fixed bug in XRF-to-AVI recording: VFW32 operations always assumed 16-bit stereo. The film recording options "High resolution" and "High framerate" now stick between sessions, and the first one also applies to BMP screenshots. Aded support for block types $19 and $4B in CDT/TZX tape files, as well as the new disc option "Read-only as default" so the user can choose whether discs are by default read-only or read-write, and this option stacks together with the already extant "Strict disc writes". Added new option "Flip joystick buttons" to CPCEC so users can swap the value of the two CPC joystick buttons, as suggested by SB1903. PSG emulation now catches overflows, regardless of whether they're programming errors (music distortion in "Thing on a Spring") or done on purpose (pipe sound effect in "Thing Bounces Back"). Fixed bug in ZXSEC's Plus3 memory contention ("Firefly" disc release) and improved the beeper (oversampling: Utz's "Quattropic"). ZXSEC snapshot handling is now more strict or flexible (changing models as often or as seldom as possible) depending on the option "Strict SNA files".

I'm always impressed by the level of precision cpcec appears to reach.

Anyway, latest release is now reflected on https://github.com/cpcitor/cpcec .
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 12:54, 08 May 21
I'm always impressed by the level of precision cpcec appears to reach.

Anyway, latest release is now reflected on https://github.com/cpcitor/cpcec .

Propagated this update from http://cngsoft.no-ip.org/cpcec.htm

Quote
20210428 -- minor patch fixing bugs in the firmware INI handler (spaces must be trimmed on both sides of each string) and in several tape fastloaders, and adding inverse video 8-bit characters to the debugger's memory dump.

Updated repo is as always on https://github.com/cpcitor/cpcec .
Title: Re: CPCEC a new emulator from cngsoft
Post by: genesis8 on 21:42, 17 May 21
Happy birthday César (god bless FB for remembering it) !
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 13:50, 21 May 21
Video recording feature: it works somehow

Hi! I just discovered how to use the video recording feature. I had seen it existed but all capture options seemed to do nothing. Looks like they actually write files in the directory containing cpcec executable and config and ROM file, without visual feedback.

Generating a very specific but well adapted file format, with a companion program that can pipe a dumb-but-not-written-to-disk AVI file to stdout for consumption by e.g. ffmpeg is actually a good design (weak coupling, no dependency hell, just works).

Video captured is 25fps not 50fps.

Something surprised me a lot: the generated XRF files have 25fps.

What? CPCEC is able to emulate for most demanding demos with 50fps solid effects, and it could record, but not at 50fps?

So I digged in source code. Source code seems to have provisions to change flags session_filmscale and session_filmtimer but no obvious key shortcut. I noticed that in .cpcecrc film reflects the values of these flags as bits.

Values where (film&2)==0 produce 50fps video files.
Values where (film&2)==1 produce 25fps video files.

Buggy flag in video capture: scale image or... ?

Values where (film&1)==1 produce working video files.
Values where (film&1)==0 make xrf crash.

Code: [Select]
for a in film_*xrf ; do echo ; echo $a ; ./xrf $a - > /dev/null ; done

film_1.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 210 frames, 0 unused.

film_2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
Erreur de segmentation (core dumped)

film_3.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 127 frames, 0 unused.

film_O.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
Erreur de segmentation (core dumped)

Looking at the source code more, there seem to be a mixture between (film&1) meaning "scale the images 2x" and "generate an AVI with 16bit sound"?

Generated AVI causes inconsistent conversion

Anyway, last but not least, conversion as documented:

xrf source.xrf - | ffmpeg -i - target.avi

Produces a working AVI, but AVI, while based on the nice-for-its-time IFF format https://en.wikipedia.org/wiki/Interchange_File_Format (https://en.wikipedia.org/wiki/Interchange_File_Format), is a relic of the past.

Strangely, total file duration is reported (in mpv and vlc and mediainfo) as twice the actual duration of the video.
mediainfo provides more details: it is the audio track that is announced twice as long as the real duration, so something is clearly invalid.

Curiously, the directly generated stream:
./xrf film_3.xrf - > direct.avi
does not play correctly in mplayer or VLC, although mediainfo reports consistent time for video and audio,

mpv reports a warning on playing:

Quote
Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).


Trying to convert directly to mp4 or mkv:

xrf source.xrf - | ffmpeg -i - target.mp4
xrf source.xrf - | ffmpeg -i - target.mkv

produce movies that play with the same problem as the direct AVI, with the same warning.

It looks like direct AVI file plays all video frames first then all audio?

Hope this helps to improve cpcec even further.

Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:14, 21 May 21
Workaround and bonus!

Workaround to get a clean video+audio file.

Experimenting with ffmpeg options -vn and -an seem to indicate that indeed problems are on the audio side: most extraction operations provide an audio file that starts with a silence for as long as the whole recording time, and only then starts audio normally.

I managed to find a sequence of conversions that allows to "clean up" the thing.
It looks like exporting to a format that does not understand timestamps, like AVI or WAV, produces a working audio file without the delay. Then one can combine that audio with the video (which has no such problem).

Code: [Select]
# Extract only the audio part in a container that does not understand timestamps
./xrf source.xrf - | ffmpeg -y -vn -i -  -c copy audio_unbroken.wav
# Extract again, with audio from "dumb" container, ignoring audio from xrf.
./xrf source.xrf - | ffmpeg -y -i audio_unbroken.wav -an -i - audioandvideo.mkv

One can use the regular ffmpeg options for audio and video codec in the second command.

The resulting mkv (or mp4) file plays without warning, without problem.

Bonus: high speed recording of CPC emulation

Bonus: compared to screen capture (with VLC, ffmpeg, OBS or others), this method of recording has two benefits:

* it is robust, it won't frop a frame, independent of system activity, won't mix with other programs playing sounds or other windows obscuring the cpcec window, you can even minimize the cpcec window
* it does not require to play the whole thing real time. While recording, you can press shift-F6 to speed up the whole thing, the recording will be exactly the same!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 19:49, 23 May 21
Workaround and bonus!

Workaround to get a clean video+audio file.

Experimenting with ffmpeg options -vn and -an seem to indicate that indeed problems are on the audio side: most extraction operations provide an audio file that starts with a silence for as long as the whole recording time, and only then starts audio normally.

I managed to find a sequence of conversions that allows to "clean up" the thing.
It looks like exporting to a format that does not understand timestamps, like AVI or WAV, produces a working audio file without the delay. Then one can combine that audio with the video (which has no such problem).

Code: [Select]
# Extract only the audio part in a container that does not understand timestamps
./xrf source.xrf - | ffmpeg -y -vn -i -  -c copy audio_unbroken.wav
# Extract again, with audio from "dumb" container, ignoring audio from xrf.
./xrf source.xrf - | ffmpeg -y -i audio_unbroken.wav -an -i - audioandvideo.mkv

One can use the regular ffmpeg options for audio and video codec in the second command.

The resulting mkv (or mp4) file plays without warning, without problem.

Bonus: high speed recording of CPC emulation

Bonus: compared to screen capture (with VLC, ffmpeg, OBS or others), this method of recording has two benefits:

* it is robust, it won't frop a frame, independent of system activity, won't mix with other programs playing sounds or other windows obscuring the cpcec window, you can even minimize the cpcec window
* it does not require to play the whole thing real time. While recording, you can press shift-F6 to speed up the whole thing, the recording will be exactly the same!

I posted a new version today, the bugs you're talking about are several versions old. However, just in case, I tested the current versions of CPCEC and XRF with all the four possible configurations (neither option, hi-resolution only, hi-framerate only, both options) and everything works fine either with the Windows codecs (i.e. including the third parameter) or with the built-in video output (either fed to FFMPEG, or straight to a gigantic file); all four configurations generated valid files. (if anything, not specifying any codecs in FFMPEG led to bad audio because the default lossy audio codec is completely unsuited for loud chiptunes)

Here are the test XRF files: the first four pages of the intro of "La Abadía del Crimen", http://cngsoft.no-ip.org/XRF-TEST-ABADIA.zip (http://cngsoft.no-ip.org/XRF-TEST-ABADIA.zip)

(also, why Shift+F6 rather than just F6? in other function keys Shift is relevant, but in this one it's not)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 20:57, 23 May 21
Summary: interesting test files, XRF still crashes, problem not solved, more hints below.

cpcec version: was latest one, double checked

Thanks you cngsoft for your reply.

I posted a new version today, but the bugs you're talking about are several versions old.

I think I was using cpcec version 20210418, not 100% sure. Below I'll be using latest today's cpcec-20210522.zip .

Just in case, I tested the current versions of CPCEC and XRF with all the four possible configurations (neither option, hi-resolution only, hi-framerate only, both options) and everything works fine either with the Windows codecs (i.e. including the third parameter) or with the built-in video output (either fed to FFMPEG, or straight to a gigantic file); all four configurations generated valid files. (if anything, not specifying any codecs in FFMPEG led to bad audio because the default lossy audio codec is completely unsuited for loud chiptunes)

Thanks for performing those tests.

Here are the test XRF files: the first four pages of the intro of "La Abadía del Crimen", http://cngsoft.no-ip.org/XRF-TEST-ABADIA.zip

Special thanks for providing sample XRF files.

With the XRF files you provide and the latest cpcec/xrf I can reproduce similar bugs as with the XRF files I generate.
I see xrf.c was last mofidied in cpcec-20210418.zip .

Reproduced with latest version and sample XRF files: xrf crash

Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done

abadia-1.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 1510 frames, 0 unused.

abadia-2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
Erreur de segmentation (core dumped)

abadia-3.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 3148 frames, 0 unused.

abadia-4.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
Erreur de segmentation (core dumped)

We'll ignore case 2 and 4 then.

Reproduced with latest version and sample XRF files: wrong duration reported in VLC, mpv, mediainfo

Here's my ffmpeg version. On latest Xubuntu stable, 20.04 with latest updated applied.

Code: [Select]
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Hyper fast Audio and Video encoder

The code below generates direct-from-xrf AVI files and through ffmpeg as documented in cpcec*.txt.

Code: [Select]
for XRF in *xrf ; do
STEM=${XRF%%.xrf} ;
xrf $XRF - >| ${STEM}.direct.avi 2>|${STEM}.xrf.log ;
xrf $XRF - | ffmpeg -y -i - ${STEM}.avi 2>|${STEM}.ffmpeg.log ;
done

Code below reports duration of generated AVI files, and reports 2 durations when audio and video are inconsistent with each other.

Code: [Select]
for a in abadia-{1,3}*.mediainfo.txt ; do egrep '^(Duration)' $a | sort | uniq | xargs echo $a ; done | sed 's/Duration *//g' | column  -t -s ":"

abadia-1.avi.mediainfo.txt           1 min 0 s    2 min 0 s
abadia-1.direct.avi.mediainfo.txt    1 min 0 s
abadia-3.avi.mediainfo.txt           1 min 3 s    2 min 5 s
abadia-3.direct.avi.mediainfo.txt    1 min 2 s

So, both converted files report inconsistent durations, like before.

Something changes: audio starts synced with video, not after, always. This is better.

Still, problems remain.

Playing the converted videos abadia-?.avi stops after around 1 minute, with progress bar showing 50% in VLC, also in mpv.

Playing the direct videos abadia-?.direct.avi (the huge ones) has another funny behavior:

* in VLC: sound is hashed, about 0.1s audio 0.1s silence, etc. Total duration 02:00 .
* in mpv: plays normally, progress bar goes from 0% to 100% regularly within 1 minute, then progress bar jumps back to 50%, image stays still and audio continues playing till 02:00
* mpv shows again warning: "Audio/Video desynchronisation detected! Possible reasons include too slow hardware, temporary CPU spikes, broken drivers, and broken files. Audio position will not match to the video (see A-V status field)."

Workaround: somehow fails now

This code applies workaround to files that can be converted:

Code: [Select]
for a in abadia-{1,3}*.xrf ; do
xrf $a - | ffmpeg -i - -an ${a}.videoonly.mkv  ;
xrf $a - | ffmpeg -i - -vn ${a}.audioonly.mkv ;
ffmpeg -i ${a}.audioonly.mkv -i ${a}.videoonly.mkv -c copy ${a}.audioandvideo.mkv ;
done

Files appear to play properly at the start. Total duration is 02:00. No progress bar jump. But video is frozen after 50%. Perhaps it was playing at double speed? I don't know the normal speed in that CPC prod.

(also, why Shift+F6 rather than just F6? in other function keys Shift is relevant, but in this one it's not)

Thanks for pointing out. I'm always lost with Ctrl and Shift variants in cpcec and always have to look it up by pressing F1 first.

Now what?

* There is something wrong in xrf since it crashes with abadia-2.xrf and abadia-4.xrf.
* Direct files play with funny behavior in VLC and mpv, so there is most certainly something wrong here.
* Straight conversion using documented ffmpeg yields other funny behavior.
* Workaround no longer works properly, but hey I just selected a combination that happened to work before.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 21:26, 23 May 21
You will find attached valgrind's report in the crashing case.

There are several invalid reads and writes in xrf, also access after valid buffer, invalid writes.

(If you don't know valgrind, it verifies read, write, memory access for things that a compiler cannot always do, and reports them at run time.)

Hope this helps.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:02, 23 May 21
You will find attached valgrind's report in the crashing case.

There are several invalid reads and writes in xrf, also access after valid buffer, invalid writes.

(If you don't know valgrind, it verifies read, write, memory access for things that a compiler cannot always do, and reports them at run time.)

Hope this helps.

It really helps -- it shows 8-byte operations where a 4-byte DWORD should be used! The line `#define DWORD unsigned long` for non-Windows systems is fine here at home (32-bit OS) but not on a 64-bit OS! Please replace that definition in (line 50 in xrf.c) with `#define DWORD unsigned __int32` or `#define DWORD u_int32_t` (some OSes use the former, others use the later) and tell me what happens.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 01:39, 24 May 21
Summary: Tested your change. + XRF no longer crashes. = AVI problems remain.

It really helps -- it shows 8-byte operations where a 4-byte DWORD should be used! The line `#define DWORD unsigned long` for non-Windows systems is fine here at home (32-bit OS) but not on a 64-bit OS! Please replace that definition in (line 50 in xrf.c) with `#define DWORD unsigned __int32` or `#define DWORD u_int32_t` (some OSes use the former, others use the later) and tell me what happens.

Why choose non-standard option accepted by some OS when there is a standard?

Here's a patch I just tested:

Code: [Select]
git diff xrf.c

diff --git a/xrf.c b/xrf.c
index 5cd8e28..9817c30 100644
--- a/xrf.c
+++ b/xrf.c
@@ -36,6 +36,7 @@ Contact information: <mailto:cngsoft@gmail.com> */
 #include <stdio.h> // printf...
 #include <string.h> // strcmp...
 #include <stdlib.h> // malloc...
+#include <stdint.h> // uint32_t...
 
 #ifdef _WIN32
 
@@ -47,7 +48,7 @@ Contact information: <mailto:cngsoft@gmail.com> */
 
 #define BYTE unsigned char
 #define WORD unsigned short
-#define DWORD unsigned long
+#define DWORD uint32_t
 
 #endif


No more crash of xrf!

Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done

abadia-1.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 1510 frames, 0 unused.

abadia-2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
ok: 1425 frames, 0 unused.

abadia-3.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 3148 frames, 0 unused.

abadia-4.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
ok: 3141 frames, 0 unused.

Still inconsistent parameters in generated avi:

Code: [Select]
for a in abadia-*.avi ; do mediainfo $a | egrep '^Duration' | sort | uniq | xargs echo $a ; done | sed 's/Duration *//g' | column  -t -s ":"

abadia-1.avi    1 min 0 s     2 min 0 s
abadia-2.avi    57 s 40 ms    57 s 51 ms
abadia-3.avi    1 min 3 s     2 min 5 s
abadia-4.avi    1 min 2 s


Playing yields this in mpv and in VLC (same behavior)

* abadia-1.avi plays and exits after 1:00 (one minute), having played the last video frame (scroll completely written), but the progress bar only attains 50%, while end is at 2:00
* abadia-2.avi seems normal: it plays and exits after 56 s, having played the last video frame (scroll completely written), with normal progress bar to 100% at 0:56 (0:57 in VLC).
* abadia-3.avi plays and exits after 1:02 (1:03 in VLC), having played the last video frame (scroll completely written), but the progress bar only attains 50%, at 1:02 while end is at 2:05
* abadia-4.avi seems normal: it plays and exits after 1:02, having played the last video frame (scroll completely written), with normal progress bar to 100% at 1:02

1 and 3 have problem and have both small size
2 and 4 have no problem and have both big size

So, problem is correlated to image size.

So, looks like the issue depending on fps is solved, while the issue depending on image size is not solved.

At the moment, the workaround would be to only use big size until small size is fixed.

Hope this helps again.


Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 01:44, 24 May 21
1 and 3 have problem and have both small size
2 and 4 have no problem and have both big size

So, problem is correlated to image size.

So, looks like the issue depending on fps is solved, while the issue depending on image size is not solved.

At the moment, the workaround would be to only use big size until small size is fixed.

Looking again, there is a strange thins also correlated to image size:

Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done

abadia-1.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 1510 frames, 0 unused.

abadia-2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
ok: 1425 frames, 0 unused.

abadia-3.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 3148 frames, 0 unused.

abadia-4.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
ok: 3141 frames, 0 unused.

Problem comes when XRF generates 2ch08b, no problem when XRF generated 2ch16b.

Why would sound channel format depend on image size? Does cpcec generate different audio format in XRF depending on film option? Does XRF format even support that? 
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:48, 24 May 21
Looking again, there is a strange thins also correlated to image size:
Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done abadia-1.xrf VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz ok: 1510 frames, 0 unused. abadia-2.xrf VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz ok: 1425 frames, 0 unused. abadia-3.xrf VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz ok: 3148 frames, 0 unused. abadia-4.xrf VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz ok: 3141 frames, 0 unused. Problem comes when XRF generates 2ch08b, no problem when XRF generated 2ch16b. Why would sound channel format depend on image size? Does cpcec generate different audio format in XRF depending on film option? Does XRF format even support that?

I think I found the bug in the raw AVI output: I forgot to propagate the sample size value. Line 365 of XRF.C stores it just once: `avi_header[0x0134]=flags_audio[flags_z&3];` but it should also fill the other fields requiring it: `avi_header[0x00FC]=avi_header[0x0114]=avi_header[0x0134]=flags_audio[flags_z&3];` (another bug, although invisible unless mute videos are recorded is line 399, `avi_mputcccc(&avi_h_mute[0x0108],count_z*audio_z); // avi_audios` -- it must be erased both because the index is out of bounds and the field is useless)

EDIT: there's also a bug in CPCEC-RT.H that leads to "dirty" videos because of bad cleanup between new videos: the last line of session_createfilm() uses MEMZERO with a pointer rather than an array, failing to fulfill its purpose. Replace it with `return memset(session_filmvideo,0,sizeof(VIDEO_UNIT)*SESSION_FILMVIDEO_LENGTH),session_filmcount=0;`
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:38, 24 May 21
I have written your changes in the source files and will test the result.


Here's a prod that seems to be not faithfully emulated in current cpcec: Galaxie. See screenshots on cpc-power: https://www.cpc-power.com/index.php?page=detail&num=7446

Here's the result on my screen:
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:48, 24 May 21
I think I found the bug in the raw AVI output:

I wrote the changes you asked.

Here are the result:

This seems correct again:

Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done

abadia-1.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 1510 frames, 0 unused.

abadia-2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
ok: 1425 frames, 0 unused.

abadia-3.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 3148 frames, 0 unused.

abadia-4.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
ok: 3141 frames, 0 unused.

Generate AVI again

Code: [Select]
for XRF in *xrf ; do STEM=${XRF%%.xrf} ;  xrf $XRF - | ffmpeg -y -i - ${STEM}.avi 2>|${STEM}.ffmpeg.log ; done

This shows minor discrepancy in abadia-2.avi, perhaps an effet of closing the emulator during xrf capture maybe?

Code: [Select]
for a in abadia-*.avi ; do mediainfo $a | egrep '^Duration' | sort | uniq | xargs echo $a ; done | sed 's/Duration *//g' | column  -t -s ":"

abadia-1.avi    1 min 0 s
abadia-2.avi    57 s 40 ms    57 s 51 ms
abadia-3.avi    1 min 3 s
abadia-4.avi    1 min 2 s

Playing the avi in mpv and VLC appears to play correctly.

One thing remains mysterious: all files now last around 1 minute.  How comes the same XRF data could appear to produce 2 minutes of music before?

What is the true duration of these captures?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:18, 24 May 21
I wrote the changes you asked.

Here are the result:

This seems correct again:

Code: [Select]
for a in abadia-*xrf ; do echo ; echo $a ; xrf $a - > /dev/null ; done

abadia-1.xrf
VIDEO 384x268px 25Hz - AUDIO 2ch08b 44100Hz
ok: 1510 frames, 0 unused.

abadia-2.xrf
VIDEO 768x536px 25Hz - AUDIO 2ch16b 44100Hz
ok: 1425 frames, 0 unused.

abadia-3.xrf
VIDEO 384x268px 50Hz - AUDIO 2ch08b 44100Hz
ok: 3148 frames, 0 unused.

abadia-4.xrf
VIDEO 768x536px 50Hz - AUDIO 2ch16b 44100Hz
ok: 3141 frames, 0 unused.

Generate AVI again

Code: [Select]
for XRF in *xrf ; do STEM=${XRF%%.xrf} ;  xrf $XRF - | ffmpeg -y -i - ${STEM}.avi 2>|${STEM}.ffmpeg.log ; done

This shows minor discrepancy in abadia-2.avi, perhaps an effet of closing the emulator during xrf capture maybe?

Code: [Select]
for a in abadia-*.avi ; do mediainfo $a | egrep '^Duration' | sort | uniq | xargs echo $a ; done | sed 's/Duration *//g' | column  -t -s ":"

abadia-1.avi    1 min 0 s
abadia-2.avi    57 s 40 ms    57 s 51 ms
abadia-3.avi    1 min 3 s
abadia-4.avi    1 min 2 s

Playing the avi in mpv and VLC appears to play correctly.

One thing remains mysterious: all files now last around 1 minute.  How comes the same XRF data could appear to produce 2 minutes of music before?

What is the true duration of these captures?

Re: "Galaxie", that intro is for CRTC0, what you show is one of the quirks of CRTC1: R12 and R13 are checked while VCC=0, rather than only when VCC becomes 0.

Re: video duration, the header of AVI files includes several measurements, including the expected duration of the video and audio streams. Both values must match time-wise (they can differ sample-wise because of the impact of lossy data compression) but the old XRF, by storing the audio sample size improperly (always 4 bytes, rather than 4 bytes for 16-bit stereo and 2 bytes for 8-bit stereo) made the AVI header look like the audio stream was twice as long (4:2) as the video stream. (also, abadia-2 is shorter because I simply stopped recording when the writer paused before turning pages, rather than actually keeping a timer)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:08, 25 May 21
Alright, I upgraded the upgrade with the XRF and AVI fixes:

20210522 -- minor patch fixing bugs in the ASIC (modifying the SSCR has an immediate impact; SSSL is checked when HCC==R1 rather than when HCC==R0; reported by NoRecess), the PSG (register 15 is valid, even if the hardware doesn't use it: the Plus demo "Phat" plays its music properly now), the Z80 (EI always delays the next IRQ, no matter the previous state of the interrupt enable flag, and OUTI sends the OUT signal during its last microsecond rather than during the second-to-last; "KKB First" demo needed both fixes to run correctly; reported by Hicks) and the FDC (errors imply delays that must be emulated: the original protected disc of "Bad Cat" accidentally relies on this; reported by Dlfrsilver). The debugger accepts very simple expressions (additions and substractions) when entering 16-bit values (address of "Go To", length of "Output"...) and the integer zoom allows 50% steps rather than 100% because the default size is technically 200% rather than 100%.
20210524 -- minor patch fixing bugs in film recording: field size errors on 64-bit machines, improper AVI header sound sample size on 8-bit output (both reported by Cpcitor), and accumulated dirt between multiple recordings within the same session. XRF also shows the length of the output file..
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 12:50, 25 May 21
https://github.com/cpcitor/cpcec updated with latest patch!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 08:25, 10 June 21
https://github.com/cpcitor/cpcec updated with latest patch!

https://github.com/cpcitor/cpcec updated again from http://cngsoft.no-ip.org/cpcec.htm .

Quote from: cngsoft
minor patch aligning the X-Masking video effect to the right instead of
    the left. The debugger expressions accept three new operators: & (AND),
    | (OR) and ^ (XOR). XRF shows the output file's accurate byte length
    rather than just the megabytes, and running it without a target
    parameter prints the source video parameters and the expected size.

    This commit corresponds to archive: cpcec-20210526.zip
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 15:52, 10 June 21
Let's update the update with further updates: (pictured here, "Trigger" for CPC, "Enforcer" for CPC Plus, "Mike Gunner" for Spectrum 48k and "Solo" for Spectrum 128K)

(http://cngsoft.no-ip.org/image_2021-06-04_11-33-16.png) (http://cngsoft.no-ip.org/image_2021-06-04_17-34-19.png)
(http://cngsoft.no-ip.org/image_2021-06-06_10-18-58.png) (http://cngsoft.no-ip.org/image_2021-06-07_21-58-45.png)

20210609 -- minor patch adding lightgun emulation for CPC (Trojan, Gunstick and Westphaser on joystick port) and Spectrum (Gunstick on Sinclair 1 and Kempston ports), recreating a CRTC0 quirk (when R6==0 a single scanline is shown, rather than none as in other CRTC types) and improving the choice of the filler colour when half scanlines are on. The SDL2 version now handles mouse clicks when the button is up to improve consistency with other user interfaces. Tape acceleration options stick between sessions.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 17:01, 10 June 21
Let's update the update with further updates: (pictured here, "Trigger" for CPC, "Enforcer" for CPC Plus, "Mike Gunner" for Spectrum 48k and "Solo" for Spectrum 128K)

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:57, 29 June 21
Here we have two small updates in a row:
* 20210624 -- minor patch adding Spectrum Dandanator support, and making both emulators able to load Dandanator cartridges from the command line and the key F3. Several heuristics ensure that the cartridges match the current system.
* 20210626 -- minor patch fixing several format errors ("%i" in place of "%d" or "%u" and so on), a bug in the CRTC (3D cylinders part of "PhX" on CRTC3) and another one in the Spectrum Dandanator ("LD (DE),A" trap). Slightly safer snapshot block loading on both CPCEC and ZXSEC.
(http://cngsoft.no-ip.org/IMAGE_2021-06-28_23-56-49.PNG) (http://cngsoft.no-ip.org/IMAGE_2021-06-18_18-53-14.PNG)
The CHIPNSFX tracker got an update, too:
* 20210626 -- minor patch making vibratos fully stable even in fringe cases reported by Adrián, and reworking the +512 experimental flag into a read-only mode where the player exclusively relies on the chipnsfx_bss buffer, instead of using self-modifying operations, also following an idea from Adrián.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 19:11, 29 June 21
Here we have two small updates in a row:
* 20210624 -- minor patch adding Spectrum Dandanator support, and making both emulators able to load Dandanator cartridges from the command line and the key F3. Several heuristics ensure that the cartridges match the current system.
* 20210626 -- minor patch fixing several format errors ("%i" in place of "%d" or "%u" and so on), a bug in the CRTC (3D cylinders part of "PhX" on CRTC3) and another one in the Spectrum Dandanator ("LD (DE),A" trap). Slightly safer snapshot block loading on both CPCEC and ZXSEC.

The CHIPNSFX tracker got an update, too:
* 20210626 -- minor patch making vibratos fully stable even in fringe cases reported by Adrián, and reworking the +512 experimental flag into a read-only mode where the player exclusively relies on the chipnsfx_bss buffer, instead of using self-modifying operations, also following an idea from Adrián.

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work.
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 02:22, 11 August 21
I'm having some trouble saving data from some games/program to disk. One example is Le Voyage du Nephi: it does not save game to disk (it does in other emus).
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 04:36, 11 August 21
The emulator defaults to opening disc images read only, have you checked that?
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 10:44, 11 August 21
got the same problem with my Raspberry Pi compiled version ... is there a way to set READ/WRITE permanent at boot ? Perhaps in INI ? Found nothing about it in the readme or help file ...
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 13:31, 11 August 21
Oh, thanks! I hadn't realized that option.
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 00:50, 12 August 21
Oh, I'm afraid the option is not saved from one session to another even when the tick keeps on being off. :( I wasted some time this morning playing Le Voyage du Nephi  :picard:
In fact, a BASIC test program is not saved to disc (although the firmware doesn't complain).
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 00:57, 12 August 21
That's what my question was about ... I must enable read/write every time I attach a disk image and that's not very comfortable ....
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 05:37, 12 August 21
There is a persistent setting for it in the code, but it looks like it's only available if you're using the windows UI...
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 10:14, 12 August 21
There is a persistent setting for it in the code, but it looks like it's only available if you're using the windows UI...
Thanks for the info, don't have a Windows machine anymore so I couldn't test myself ....
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:48, 12 August 21
How old are the versions you're using? Either way, here are the three ways to set the read-write disc flag:
1.- the configuration file: "fdcw 1" sets the read-only default mode, while "fdcw 0" sets the read-write mode.
2.- the SDL2 interface's menu: right-click on the emulator window or press F10 to see it. The option's name is "Read-only as default" and it's together with the disc and tape options.
3.- the disc file picker: the read/write mode checkbox is visible on Windows versions before Windows 7; later versions hide it into a context menu on the "open" button. The SDL2 version shows the read/write menu if you press TAB.
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 12:01, 12 August 21
Using CPCEC 20201215 here, was the only one I got compiled on my Pi400 64Bit


Setting the read/write in the "insert disk" menu works but it's fiddly when you swap disks often. Also tried to alter the CPCEC.INI with "fdcw 0" but it doesn't do anything.
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 12:37, 12 August 21
Using 20210626. I try to keep it updated all time. As I said in my former message, form W10 with the option unticked any saving to disc are not done, but there is no error message from AMSDOS.


EDITO: Testing a bit more, in the conf file I see fdcw set to 2, both setting it to 1 or 0 now launch dis is write protected when trying to save, If I toggle the Strict write to disc option to off (I think it already was of before, it must have changed when editing cfg file), the behaviour is the same I described upper.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:31, 01 September 21
Two months, two updates:
- 20210730 -- minor patch adding mouse support to the debugger and fixing bugs in the ASIC (modifying register 9 tests whether the new value is equal or lower than its counter, horizontal splitting doesn't draw garbage or retrigger IRQs: final scroller of "PhX") and the CRTC: reading the wrong port no longer returns the right value (secret part of "École Buissonière") and HSYNC events are filtered more carefully ("Chany Dream Demo 5", "Madness Demo", "Sub Hunter"...) unless the user prefers the old behavior ("Hard H-Hold" option). Several menu items have been relocated to set hardware traits and emulation options apart. CPCEC saves compressed memory blocks within snapshots unless "Strict SNA files" is enabled.
- 20210831 -- minor patch adding performance improvements to TZX/CDT playback and emulation of the Turbo Sound musical extension for ZXSEC, and removing the "Hard H-Hold" option from CPCEC, now useless thanks to further CRTC tweaks and the incipient emulation of the LA-7800 chip. The Windows version fixes a bug in joystick allocation, the SDL2 version understands UTF-8 filesystems and its user interface is a little more agile, and both versions can open GZIP archives and fix bugs in temporary file handling and YM file logging. CPCEC got a new icon.

(http://cngsoft.no-ip.org/IMAGE_2021-08-01_22-37-16.png) (http://cngsoft.no-ip.org/IMAGE_2021-08-24_20-20-23.png)

One more thing on the disc-write protection, by the way. The protection is handled when the disc image is opened (i.e., the fopen() option "rb" versus "wb"); changing the disc-write settings while a disc is inside the virtual drive doesn't change its write-enabled status.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 22:48, 01 September 21
Two months, two updates:
- 20210730 -- minor patch adding mouse support to the debugger and fixing bugs in the ASIC (modifying register 9 tests whether the new value is equal or lower than its counter, horizontal splitting doesn't draw garbage or retrigger IRQs: final scroller of "PhX") and the CRTC: reading the wrong port no longer returns the right value (secret part of "École Buissonière") and HSYNC events are filtered more carefully ("Chany Dream Demo 5", "Madness Demo", "Sub Hunter"...) unless the user prefers the old behavior ("Hard H-Hold" option). Several menu items have been relocated to set hardware traits and emulation options apart. CPCEC saves compressed memory blocks within snapshots unless "Strict SNA files" is enabled.
- 20210831 -- minor patch adding performance improvements to TZX/CDT playback and emulation of the Turbo Sound musical extension for ZXSEC, and removing the "Hard H-Hold" option from CPCEC, now useless thanks to further CRTC tweaks and the incipient emulation of the LA-7800 chip. The Windows version fixes a bug in joystick allocation, the SDL2 version understands UTF-8 filesystems and its user interface is a little more agile, and both versions can open GZIP archives and fix bugs in temporary file handling and YM file logging. CPCEC got a new icon.

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work. ;-)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:23, 12 September 21
Another small update, focusing more on ZXSEC than on CPCEC:
(http://cngsoft.no-ip.org/IMAGE_2021-09-03_21-15-13.png) (http://cngsoft.no-ip.org/IMAGE_2021-09-03_21-15-34.png)
(http://cngsoft.no-ip.org/IMAGE_2021-09-04_18-22-44.png) (http://cngsoft.no-ip.org/IMAGE_2021-09-10_21-29-08.png)
20210909 -- minor patch fixing bugs in the video render logic of ZXSEC, effectively ensuring that the multicolour effects seen in the tests ULA48, ULA128, FPGA48 and FPGA128 and the games made with the Nirvana engine ("Dreamwalker", "Multidude", "Stormfinch", "Sunbucket"...) show properly, and adding new audio extensions for CPCEC (Digiblaster audio) and ZXSEC (Covox $FB DAC) plus preliminary emulation of Pentagon 128 timings and (if the TRDOS.ROM file is available) the Beta128 disc drive and its TRD and SCL files.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 10:11, 12 September 21
20210909 -- minor patch fixing bugs in the video render logic of ZXSEC, effectively ensuring that the multicolour effects seen in the tests ULA48, ULA128, FPGA48 and FPGA128 and the games made with the Nirvana engine ("Dreamwalker", "Multidude", "Stormfinch", "Sunbucket"...) show properly, and adding new audio extensions for CPCEC (Digiblaster audio) and ZXSEC (Covox $FB DAC) plus preliminary emulation of Pentagon 128 timings and (if the TRDOS.ROM file is available) the Beta128 disc drive and its TRD and SCL files.

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work. ;-)
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 02:06, 13 September 21
Just compiled and tested on Raspberry Pi400 64Bit, no problems, keep up the good work  8)
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 13:38, 13 September 21
Using 20210626. I try to keep it updated all time. As I said in my former message, form W10 with the option unticked any saving to disc are not done, but there is no error message from AMSDOS.


EDITO: Testing a bit more, in the conf file I see fdcw set to 2, both setting it to 1 or 0 now launch dis is write protected when trying to save, If I toggle the Strict write to disc option to off (I think it already was of before, it must have changed when editing cfg file), the behaviour is the same I described upper.
Ok, I found out what happens: I linked the .dsk files to CPCEC. If I open a dsk by double clicking on it, the dsk is opened and auto executed but it doesn't admit any changes to disk. This doent's occurs when I open a dsk within the emulator through menu, in this case it works fine.