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
Quote from: GUNHED on 20:30, 17 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
Quote from: XeNoMoRPH on 08:27, 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
Quote from: XeNoMoRPH on 08:27, 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
Quote from: GUNHED on 20:30, 17 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
Quote from: GUNHED on 21:35, 18 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
Quote from: 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 (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
Quote from: Gryzor on 15:08, 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:

Quote from: 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 ?

* 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
Quote from: 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.
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
Quote from: The_Mole_UK on 12:10, 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
Quote from: 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.

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)

Quote from: Ast on 23:38, 02 December 19Hi @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
Quote from: remax on 17:48, 27 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
Quote from: 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).


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
Quote from: cngsoft on 01:03, 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
Quote from: 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 :)
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)

Quote from: GUNHED on 18:00, 02 April 20Cool 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
Quote from: cngsoft on 12:52, 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
Quote from: roudoudou on 13:51, 05 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
Quote from: 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)


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
Quote from: GUNHED on 13:09, 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
Quote from: roudoudou on 14:19, 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:

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)

Quote from: Aeliss on 19:51, 24 April 20Hello, 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.

Quote from: 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
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

QuoteCPCEC requires a Microsoft Windows 2000 operating system or later.

Into something like this?

QuoteCPCEC 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

#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
Quote20200603 -- 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!

QuoteI 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
Quote from: 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.

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
Quote from: 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.

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
Quote from: pelrun on 11:15, 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
Quote from: cngsoft on 16:06, 11 October 20new 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    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:
    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
Quote from: 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    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:
    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
Quote from: cngsoft on 00:50, 21 October 20Excellent 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:

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

To update:

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
Quote from: 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
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:

10 PRINT"Hello world"

Then save it to disc:

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:

CAT

In my case, even though there were no error messages, the file has not been saved to the disc image!

[ This attachment cannot be displayed inline in 'Print Page' view ]

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
Quote from: 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?

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
Quote from: cngsoft on 20:37, 21 October 20On 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:



; ---------------------------------------------------------------------------------------- 
; 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:



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:


// 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
Quote from: Nich on 22:14, 21 October 20Is 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:
10 PRINT"Hello world"
Then save it to disc:
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:
CAT
In 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
Quote from: 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).
(...)
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:

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

To update:

git fetch ; git rebase
Title: Re: CPCEC a new emulator from cngsoft
Post by: tjohnson on 13:10, 08 November 20
Quote from: cngsoft on 02:08, 23 October 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
Quote from: tjohnson on 13:20, 25 December 20You 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
Quote from: cngsoft on 00:32, 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
Quote from: cngsoft on 00:32, 01 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
Quote from: 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:
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
Quote from: cngsoft on 00:32, 01 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
Quote from: Carnivius on 12:28, 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
Quote from: pelrun on 16:30, 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
Quote from: 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.
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
Quote from: Carnivius on 19:16, 04 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
Quote from: cngsoft on 01:17, 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
Quote from: Carnivius on 11:39, 05 January 21D-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
Quote from: tjohnson on 02:38, 06 January 21This 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
Quote from: 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").

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
Quote from: cngsoft on 22:47, 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
Quote from: cpcitor on 23:14, 18 April 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

Quote20210428 -- 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.


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:

QuoteAudio/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).


# 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
Quote from: 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).


# 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.

Quote from: cngsoft on 19:49, 23 May 21I 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 .

Quote from: cngsoft on 19:49, 23 May 21Just 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.

Quote from: cngsoft on 19:49, 23 May 21Here 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

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.

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.

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.


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:

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.

Quote from: cngsoft on 19:49, 23 May 21(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
Quote from: 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.

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.

Quote from: cngsoft on 22:02, 23 May 21
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:

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!

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:

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
Quote from: cpcitor on 01:39, 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:

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
Quote from: cpcitor on 01:44, 24 May 21Looking again, there is a strange thins also correlated to image size: 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
Quote from: cngsoft on 12: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:

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

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?

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
Quote from: cpcitor on 15:48, 24 May 21
I wrote the changes you asked.

Here are the result:

This seems correct again:

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

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?

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
Quote from: cpcitor on 12:50, 25 May 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: cngsoftminor 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
Quote from: 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)

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
Quote from: 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.

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
Quote from: 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...
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
Quote from: cngsoft on 22:31, 01 September 21Two 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
Quote from: cngsoft on 01:23, 12 September 2120210909 -- 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
Quote from: 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.
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.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:15, 03 October 21
Another month, another update:
(http://cngsoft.no-ip.org/IMAGE_2021-10-03_13-06-14.png) (http://cngsoft.no-ip.org/IMAGE_2021-09-26_21-12-26.png)
(http://cngsoft.no-ip.org/891393546312118352.png) (http://cngsoft.no-ip.org/891431409984626758.png)
20210930 -- minor patch fixing several bugs in the Z80 (ZXSEC now passes new Spectrum tests such as 48KNEC, EIHALT, IRCONT, BBG48 and BBG128, thanks to Azesmbog, Dunny, Woody and ZJoyKiLer), a glitch in the CRTC (the HSYNC filter required by "Onescreen Colonies" and "Scroll Factory" was harming "Paradise Megademo part 2" and others) and another one in the AY chip ("Stormbringer" for CPC needs more leeway than "Terminus"), improving the autorun logic and tape speedup of both CPCEC and ZXSEC, and adding the 64-colour ULAplus extension for Spectrum, as well as the ability to read SP and SZX snapshots.

Btw, I also changed the behavior of the disc autorun so it uses the same default read/write mode as the disc insert. I'm not too fond of this behavior (what if one particular autorunnable disc writes on itself and we do NOT want it to happen?) but it's more intuitive than the original always-read-only disc autorun.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 22:38, 03 October 21
Quote from: cngsoft on 14:15, 03 October 21Another month, another update:

... and another propagation to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work. ;-)
Title: Re: CPCEC a new emulator from cngsoft
Post by: genesis8 on 23:28, 17 October 21
Is it possible to paste text inside CPCEC like with Winape ?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:41, 08 November 21
Monthly update, once again focusing more on the Spectrum than on the CPC:
(http://cngsoft.no-ip.org/896023264978161674.png) (http://cngsoft.no-ip.org/IMAGE_2021-10-08_21-11-01.png) (http://cngsoft.no-ip.org/IMAGE_2021-10-17_20-35-19.png)
20211105 -- minor patch adding PZX file support to ZXSEC and reorganising the tape handling code (the TZX1 blocks JUMP, CALL and RETURN from are properly handled: "Hollywood Poker"), improving the Pentagon video logic ("Across the Edge" and "Rage" show their pixel-precise border effects), making the CPCEC option "Strict SNA files" write V2 snapshots when enabled, and simplifying the $EDA0-$EDBB Z80 opcode block. Experimental compile-time options include saving SZX snapshots from ZXSEC and reading Kansas City blocks from CDT and TZX files.

I wish I could improve the CPC emulation, but I've been stuck for many months with "Overflow Preview 2", the CRTC 0 version of "Octopus Pocus" and the PLUS cartridge "SHMUP POC".

Genesis8: No text pasting yet, though. CPCEC is already equipped with a "ghost typer" but so far it's limited to the autorun operations.
Title: Re: CPCEC a new emulator from cngsoft
Post by: genesis8 on 14:00, 08 November 21
Ok, thanks for the answer.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:54, 13 November 21
Another small update, focusing on an irritating bug in the tape playback, but also dabbling into the mysteries of device contention.

(http://cngsoft.no-ip.org/image_2021-11-11_12-44-33.png) (http://cngsoft.no-ip.org/908443122281906206.png)

20211111 -- minor patch fixing a bug in TZX playback that made all tapes after the first one lose the first item in the first block, adding basic DMA-PIO contention to the CPC Plus ASIC and improving the Spectrum floating bus: the tests HALT2INT (48K) and FLOATSPY (48K and 128K) work properly now.
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 05:15, 14 November 21
Hello,

I just released publicly the first release of cpcec-gtk, a native Debian-based front-end for cpcec.

You can download it here and try it by yourself : https://gitlab.com/norecess464/cpcec-gtk/-/tags/v1.0-20211004 (https://gitlab.com/norecess464/cpcec-gtk/-/tags/v1.0-20211004)

Project details: https://gitlab.com/norecess464/cpcec-gtk (https://gitlab.com/norecess464/cpcec-gtk)


Title: Re: CPCEC a new emulator from cngsoft
Post by: robcfg on 15:14, 14 November 21
Works nice on my Linux VM (albeit unusably slow), so that's great!


I tried compiling it on MacOS, but the trick you use for mixing GTK and SDL windows, only works on Linux with X11, which is pity.


Cheers,
Rob
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 01:51, 15 November 21
Quote from: MiguelSky on 13:38, 13 September 21Ok, 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.
This behavior also occurs when dragging a dsk into the emu window. The only way to get dsk saving working properly is by opening dsk files from menu/F7.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 14:59, 15 November 21
Hi there! Just downloaded the new 2021.11.11 version. Looks great and emulates some exotic hardware which is cool to have this on a emulator.


But I can't find of of the very basic functions. How can I use expansion ROMs? (There is an option to change firmware, but no expansion ROMs). Any help is appreciated.
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 15:30, 15 November 21
AFAIK there is no ROM Board emulation in CPCEC ...
Title: Re: CPCEC a new emulator from cngsoft
Post by: MiguelSky on 18:45, 15 November 21
In according with the manual, there is:
Quote[size=78%]INI files can be used to define a "profile", a set of extra ROMs to load on top[/size]
of the current firmware. Internally they're simple text files where each line
defines an attribute or a ROM:


* type = 0..3 : sets the firmware type (for example 0 stands for CPC464) as seen
in the command line parameters -m0..3;
* bank = 0..4 : sets the RAM size (for example 0 stands for 64k) as seen in the
parameters -k0..4;
* crtc = 0..4 : sets the CRTC type, as seen in the parameters -g0..4;
* fddc = 0..1 : sets whether the floppy disc drive controller is enabled (1) or
disabled (0);
* lowest=filename : sets the LOW ROM content; the ROM file must be located in
the same directory where the profile is;
* highXX=filename : sets the content of HIGH ROM slot XX, where XX is a
two-digit hexadecimal number: "00" is 0, "0A" is 10, "10" is 16, etc. for
example HIGH07=PARADOS.ROM would place PARADOS.ROM in slot 7.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 00:36, 16 November 21
Would be great to have that in the interface like anything else already.  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 12:53, 20 November 21
Congratulations CNG again for your work.

Propagated last 3 updates of cpcec to git repository at https://github.com/cpcitor/cpcec/ .
Title: Re: CPCEC a new emulator from cngsoft
Post by: krusty_benediction on 10:19, 21 November 21
I open the sources to add support for simple breakpoint loading from sna and discovered this code deactivated ?
        #if 0 // unsupported
        else if (k==0x42524B53&&!(l%5)&&snap_extended) // breakpoint table "BRKS"
        {
            MEMZERO(z80_breakpoints);
            for (;l;l-=5)
            {
                k=fgetiiii(f); if (!fgetc(f)&&k>=0&&k<length(z80_breakpoints))
                    z80_breakpoints[k]=1; // stick to breakpoints without flags
            }
        }
        #endif

It seems to work properly; is there any reasons to not enable it ?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 21:51, 21 November 21
Cpcitor: a new update came right after you propagated the previous three:

(http://cngsoft.no-ip.org/909890691407155330.png) (http://cngsoft.no-ip.org/910466267671040010.png)

- 20211119 -- minor patch adding a new entry in the Audio menu ("Audio acceleration") to set whether the audio buffer length is short (lower latency) or long (more compatible). The Plus ASIC DMA-PIO contention is a little more precise. Tapes for Spectrum avoid several unwanted coincidences ("Advanced Soccer Simulator" and "Banger Racer", found by Raúl). The help screens are a little more explicit, the WAV file output is always lil-endian even if the system is big-endian, the pixel filter and the scanline blend are faster, and the SDL2 user interface becomes white-on-black with the parameter `-$`.

Skulleater, GUNHED: INI files were described in the emulator docs, as well as in past posts in this thread; loading the resulting INI file is a matter of putting it in the command line or using F3 or F5 to select it.

Krusty_benediction: that code is dummied out because I don't know the meaning of the three bytes that follow the word stating the breakpoint's location.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 22:00, 21 November 21
Thanks @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) for notifying. The latest change is propagated now! https://github.com/cpcitor/cpcec/

Quote from: cngsoft on 21:51, 21 November 21
Cpcitor: a new update came right after you propagated the previous three:

(http://cngsoft.no-ip.org/909890691407155330.png) (http://cngsoft.no-ip.org/910466267671040010.png)

- 20211119 -- minor patch adding a new entry in the Audio menu ("Audio acceleration") to set whether the audio buffer length is short (lower latency) or long (more compatible). The Plus ASIC DMA-PIO contention is a little more precise. Tapes for Spectrum avoid several unwanted coincidences ("Advanced Soccer Simulator" and "Banger Racer", found by Raúl). The help screens are a little more explicit, the WAV file output is always lil-endian even if the system is big-endian, the pixel filter and the scanline blend are faster, and the SDL2 user interface becomes white-on-black with the parameter `-$`.

Skulleater, GUNHED: INI files were described in the emulator docs, as well as in past posts in this thread; loading the resulting INI file is a matter of putting it in the command line or using F3 or F5 to select it.

Krusty_benediction: that code is dummied out because I don't know the meaning of the three bytes that follow the word stating the breakpoint's location.
Title: Re: CPCEC a new emulator from cngsoft
Post by: krusty_benediction on 09:34, 22 November 21
Quote from: cngsoft on 21:51, 21 November 21Krusty_benediction: that code is dummied out because I don't know the meaning of the three bytes that follow the word stating the breakpoint's location.

yep, I think no one ;) We assume it is 0 if there is no flag. No idea for the other values
Title: Re: CPCEC a new emulator from cngsoft
Post by: roudoudou on 10:23, 22 November 21
Quote from: krusty_benediction on 09:34, 22 November 21
yep, I think no one ;) We assume it is 0 if there is no flag. No idea for the other values
i guess the other bytes are dealing for RAM/ROM connections (and zeroed for first 64K without ROM connected)
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 17:11, 22 November 21
Quote from: cngsoft on 21:51, 21 November 21
Skulleater, GUNHED: INI files were described in the emulator docs, as well as in past posts in this thread; loading the resulting INI file is a matter of putting it in the command line or using F3 or F5 to select it.
Nice, but not usable. For the daily usage it's (imho) required to have a comfortable ROM selection menu in the interface. You got options for all needed and not-so-much-needed things in your user interface. Why not ROMs? They are essential. Any other emulator has that actually.
Missing ROM options are imo like missing "Change DSK" options. (Especially if s/o develops serious software for the CPC). But hey, it's your project, handle it as you like of course. Meanwhile I just can't use it. No problem, all the games will not care anyway.  :) :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:26, 01 December 21
Just in time for the big news from Logon System, a new update, albeit a small one:

(http://cngsoft.no-ip.org/913724315139211264.png) (http://cngsoft.no-ip.org/915212818788278342.png)
(http://cngsoft.no-ip.org/CPCEC-20211201-AMAZING21-CRTC2.png) (http://cngsoft.no-ip.org/CPCEC-20211201-RV-LOGON-CRTC1.png)

20211130 -- minor patch adding a global speed option (for example "Settings: 2x realtime speed" makes the emulation run at twice the base speed) and relocating the Z80 speed option ("CPU clock") to the "Machine" submenu; it also fixes bugs in tapes (the starting pause in CDT/TZX files no longer worked) and the user interface (drag-and-drop had stopped handling ZIP archives: reported by Raúl). New Spectrum 16K option, both in the command line (`-K`, no longer used to disable the AY chip) and the menu. Experimental support for BRKS blocks (breakpoint tables) when saving and loading CPC snapshot files; to ease deleting the breakpoints they they're no longer required, key Z can delete them all at once from any panel in the debugger, instead of only from the disassembly panel.

Roudoudou and Krusty_Benediction: let's hope the $EDFF *BRK opcode and the BRKS block are good enough for the time being. Right now the later are MMU-blind, like the remainder of the debugger.

Gunhed: I can live with INI profiles. Write once, edit seldom, use daily.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 23:33, 01 December 21
Quote from: cngsoft on 14:26, 01 December 21
Just in time for the big news from Logon System, a new update, albeit a small one:

20211130 -- minor patch adding a global speed option (for example "Settings: 2x realtime speed" makes the emulation run at twice the base speed) and relocating the Z80 speed option ("CPU clock") to the "Machine" submenu; it also fixes bugs in tapes (the starting pause in CDT/TZX files no longer worked) and the user interface (drag-and-drop had stopped handling ZIP archives: reported by Raúl). New Spectrum 16K option, both in the command line (`-K`, no longer used to disable the AY chip) and the menu. Experimental support for BRKS blocks (breakpoint tables) when saving and loading CPC snapshot files; to ease deleting the breakpoints they they're no longer required, key Z can delete them all at once from any panel in the debugger, instead of only from the disassembly panel.

Propagated to https://github.com/cpcitor/cpcec
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 18:55, 03 December 21
Quote from: cngsoft on 14:26, 01 December 21
Gunhed: I can live with INI profiles. Write once, edit seldom, use daily.
As developper I do change ROMs several times a day. (Sometimes several times an hour).
It would be a great advantage to have a ROM selection menu (like any other emulator).  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 10:30, 04 December 21
I just released a new version of the Linux GTK3 front-end for CPCEC
https://gitlab.com/norecess464/cpcec-gtk/-/releases/v1.1-20211130 (https://gitlab.com/norecess464/cpcec-gtk/-/releases/v1.1-20211130)

Changelog:
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 10:34, 04 December 21
QuoteSaved last opened folders into configuration file
Any program should start by doing that. 8)
Title: Re: CPCEC a new emulator from cngsoft
Post by: ralferoo on 17:12, 12 December 21
Quote from: dlfrsilver on 13:23, 22 March 19
the tapes are always started with turbo mode ;
I'm biased, but this is a negative point!  :P


But in all seriousness, once you save the config it's remembers the correct setting and tapes play at normal speed if that's what you'd selected... :)


Anyway, great emulator!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:17, 19 December 21
Sooner or later, even the slightest exposure to Longshot's dossier ACCC2-FR was going to have an impact on CPCEC.

(http://cngsoft.no-ip.org/CPCEC-20211201-AMAZING21-CRTC0.png) (http://cngsoft.no-ip.org/917899798584131624.png)
(http://cngsoft.no-ip.org/920407055322480701.png) (http://cngsoft.no-ip.org/920407209731559494.png)

CPCEC-ZXSEC 20211217 -- "twenty-first public release. Important changes in video emulation: all parts of the 2021 rerelease of "Amazing Megademo" work on all CRTCs in CPCEC, thanks to Longshot's new monumental handbook "Amstrad CPC CRTC Compendium", and titles that check the floating bus through ULA-contended ports such as "A Yankee in Iraq" run properly in ZXSEC, even on Plus3. The AY chip has been rewritten to ensure that Playcity (CPC) and Turbosound (Spectrum) share the exact clock with the main audio chips (6-channel music on Pentagon is no longer off-key), and stereo channels are more flexible now, switching between the default ABC stereo setup and the ACB setup of AY-Melodik; audio oversampling now relies on system clock ticks instead of output samples. Minor fixes in the FDC logic (protected rereleases of "Arkanoid 2" and "Renegade" expect the disc to keep moving while the SENSE INTERRUPT STATUS command takes place), the ZIP archive reader (hidden files must stay invisible) and the WAV and AVI file handling (proper 2-byte alignment must be performed in the extremely rare cases where the length of a block is odd). V-hold options in CPCEC have been merged into one (disabling "Standard V-hold" extends the vertical sync both up and down), and the paired options PlayCity/Digiblaster (CPCEC) and Turbosound/Covox $FD (ZXSEC) are mutually exclusive."

Trivia: although the obvious priority was to make the whole "Amazing Megademo 2021" work on CRTC0, the Mega-Raster part kept resisting until I noticed that the changes I was trying to do also had an impact on the easier-to-analyse "Xmas 2019" intro. It was something of a Christmas gift!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:06, 19 December 21
Quote from: cngsoft on 14:17, 19 December 21
Sooner or later, even the slightest exposure to Longshot's dossier ACCC2-FR was going to have an impact on CPCEC.

Impressive document, that compendium (https://en.wikipedia.org/wiki/Compendium) at http://www.logonsystem.fr/down/ACCC2-FR.pdf (http://www.logonsystem.fr/down/ACCC2-FR.pdf).



Quote from: cngsoft on 14:17, 19 December 21
CPCEC-ZXSEC 20211217 -- "twenty-first public release.

Quote from: cngsoft on 14:17, 19 December 21
The AY chip has been rewritten (...) audio oversampling now relies on system clock ticks instead of output samples.

Ah, nice! That is a nice step to have best results on https://www.cpcwiki.eu/forum/emulators/sound-emulation-survey/25/

Anyway, propagated to https://github.com/cpcitor/cpcec
Title: Re: CPCEC a new emulator from cngsoft
Post by: ralferoo on 12:04, 20 December 21
Quote from: cpcitor on 15:06, 19 December 21
Impressive document, that compendium (https://en.wikipedia.org/wiki/Compendium) at http://www.logonsystem.fr/down/ACCC2-FR.pdf (http://www.logonsystem.fr/down/ACCC2-FR.pdf).
This goes to a 404 page
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 15:06, 20 December 21
Quote from: ralferoo on 12:04, 20 December 21
This goes to a 404 page

Strange. When I click on the link it opens the PDF document correctly in the browser.

http://www.logonsystem.fr/down/ACCC2-FR.pdf
Title: Re: CPCEC a new emulator from cngsoft
Post by: ralferoo on 17:18, 20 December 21
Strange, yeah it works again now!


And looks interesting (and long!)
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 19:37, 20 December 21
I just released a new version of cpcec-gtk : https://gitlab.com/norecess464/cpcec-gtk/-/releases/v1.2-20211217 (https://gitlab.com/norecess464/cpcec-gtk/-/releases/v1.2-20211217)

The big update of the day is the addition of a new ROM Configuration window.

Complete changelog since previous version:@cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) Thanks again for creating such a great and hackable emulator :)
(https://gitlab.com/norecess464/cpcec-gtk/-/raw/master/DocImages/rom-configuration.png)
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 23:51, 20 December 21
Quote from: norecess on 19:37, 20 December 21

       
  • Added new ROM Configuration window allowing to manage ROMs of the emulated Amstrad machine (lower, upper 0 to 127). For more information, please read the documentation! [/l][/l]
Awesome!!! Now it can compete with the other established CPC emulators. I will have a closer look at it now. Thank you very much.  :) :) :) [/list]
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 01:22, 21 December 21
Quote from: GUNHED on 23:51, 20 December 21Now it can compete with the other established CPC emulators.

Well, there is no "competition". As a reminder, I'm doing cpcec-gtk for my own needs on Sonic GX's development, and I'm sharing here my UI work back to the Linux community, exactly like @cngsoft (https://www.cpcwiki.eu/forum/index.php?action=profile;u=191) did with his CPCEC emulator AND @roudoudou (https://www.cpcwiki.eu/forum/index.php?action=profile;u=1714) did with his RASM assembler.

As a developer, for the best emulation accuracy and overall ergonomy I would still recommend using WinAPE on Windows. In my opinion it remains the best emulator ever made for the Amstrad CPC. But it wasn't perfectly running through wine on Linux, hence cpcec-gtk...

Other emulators are progressively catching up (over WinAPE), so we are living interesting times.  ;D
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:19, 02 January 22
New year, new version:

(http://cngsoft.no-ip.org/926194006487085107.png) (http://cngsoft.no-ip.org/926821660391276564.png)

20211231 -- minor patch adding printer emulation: the user selects a file that will store the data sent to the CPC's 7-bit line printer and the Spectrum's ZX Printer (48K), the serial 8-bit line printer (128K and Plus2), and the parallel 8-bit line printer (Plus3). The printer port of the Plus3 happens to be the floating bus too, leading to changes in the video and floating bus logic. ZXSEC can save uncompressed SZX snapshots now, although SNA stays the default format. Following research by Hoglet67 and tests by Ped7g, the Z80 block operations LDIR, LDDR, CPIR, CPDR, INIR, INDR, OTIR and OTDR show special temporary flags if an interruption arises before the end of the block. New commandline options `-o`, `-t`, `-y` and `-z` that provide the opposite behaviors of `-O`, `-T`, `-Y` and `-Z`. Happy new year 2022!

The emulation of printers led to an interesting discovery: the Plus3 floating bus is the printer port, same addresses and everything. Ast A. Moore's research on the floating bus stated that BIT 0 was always set: this bit happens to be the !READY signal of the Plus3 printer port, so plugging a printer (or in this case, enabling its emulation) makes the FLOAT3 test show even values and "A Yankee in Iraq" hang until the printer gets unplugged.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 14:22, 02 January 22
Quote from: cngsoft on 13:19, 02 January 22
20211231 -- minor patch adding printer emulation: the user selects a file that will store the data sent to the CPC's 7-bit line printer and the Spectrum's ZX Printer (48K), the serial 8-bit line printer (128K and Plus2), and the parallel 8-bit line printer (Plus3). The printer port of the Plus3 happens to be the floating bus too, leading to changes in the video and floating bus logic. ZXSEC can save uncompressed SZX snapshots now, although SNA stays the default format. Following research by Hoglet67 and tests by Ped7g, the Z80 block operations LDIR, LDDR, CPIR, CPDR, INIR, INDR, OTIR and OTDR show special temporary flags if an interruption arises before the end of the block. New commandline options `-o`, `-t`, `-y` and `-z` that provide the opposite behaviors of `-O`, `-T`, `-Y` and `-Z`. Happy new year 2022!

The emulation of printers led to an interesting discovery: the Plus3 floating bus is the printer port, same addresses and everything. Ast A. Moore's research on the floating bus stated that BIT 0 was always set: this bit happens to be the !READY signal of the Plus3 printer port, so plugging a printer (or in this case, enabling its emulation) makes the FLOAT3 test show even values and "A Yankee in Iraq" hang until the printer gets unplugged.

New release, new github update. ;-) https://github.com/cpcitor/cpcec

You appear to have introduced some changes in PSG emulation, can you explain them?

Especially this?

psg_tone_state[c]=(psg_tone_count[c]=psg_tone_limit[c])<=PSG_ULTRASOUND?psg_ultra_beep:~psg_tone_state[c];

Is the change related to the recent release of the final version with digitized voice of https://cpcitor.itch.io/just-get-9 ?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:31, 03 January 22
Quote from: cpcitor on 14:22, 02 January 22New release, new github update. ;-) https://github.com/cpcitor/cpcec

You appear to have introduced some changes in PSG emulation, can you explain them?

Especially this?

psg_tone_state[c]=(psg_tone_count[c]=psg_tone_limit[c])<=PSG_ULTRASOUND?psg_ultra_beep:~psg_tone_state[c];

Is the change related to the recent release of the final version with digitized voice of https://cpcitor.itch.io/just-get-9 ?
The changes are just a cleanup. Instead of multiplying the counter limits of the noise and hardware envelope by two, I alternatively check each on every tick of the PSG chip. Similarly, the ultrasound filter performs fewer tests, as I can reduce it to detecting Spectrum-like beepers on the CPC clobbering the register 7, the mixer: "Terminus" and "Stormbringer" are the handiest cases. "Just Get 9" uses a different method that needs no filtering at all: clobbering the amplitude.
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 09:51, 03 January 22
A new version of cpcec-gtk is available:
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 10:39, 03 January 22
The memory visualizer function is oddly satisfying!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 23:52, 03 January 22
Quote from: norecess on 09:51, 03 January 22
A new version of cpcec-gtk is available:

       
  • Integrated CPCEC emulation core 20211231
  • Added new feature "Memory Visualizer". With it, the user can see which portions of RAM are actually used (in real-time). Video demo is available here: https://youtu.be/xFdf0mpi0ZI (https://youtu.be/xFdf0mpi0ZI)
  • Added new feature "Extended Monitor". With it, the user can see hidden portions of the monitor. This is useful for CRTC debugging/programming. Video demo is available here: https://youtu.be/N0AI4sIhfL0 (https://youtu.be/N0AI4sIhfL0)
  • Bugfix: when using the virtual joystick (cf. left control/left alt/arrow keys simulating a joystick), other keys of the keyboard are now also accessible.
  • Updated documentation to match all latest changes
    Download: https://gitlab.com/norecess464/cpcec-gtk/-/releases

Hi! Great progress! I noticed some bug fixed (since last time I tried).

It is nice for example to see how Just Get 9 unpacks to fill most of the available memory.

On the same topic of "memory visualizer", one thing I sometime wish I could do is similar (and perhaps much easier with code you have now).
The idea is to show a kind of "current instantaneous screen content", as if you could freeze the Z80, preserve memory content and the Z80-writable CRTC register contents, and just show a complete image.

In a number of cases (arguably not every case), this could show interesting things, like hints to understand how some effect is made.


BTW, I observed a quite annoying bug. Nearly every time the ROM firmware reinitialized (and that includes calls to MC START PROGRAM), the emulated CPC believes that the space bar (or sometimes the CPC z key) is pressed continuously, while in reality no key is pressed at all. Pressing and releasing the affected key fixes the problem once, but if you are running some intro that exits at any key pressed (like the intro of Just Get 9 with stars), it just stops the show. Tried more than 20 times, I could run that part only once.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 00:23, 04 January 22
Regular cpcec and text-based cpc-plus allow to fast-forward with F6, which I use a lot and cpcec-gtk misses.

I'm very surprised that the debug window does not offer a "continue" button. Pressing "esc" like in the text-based cpcec-plus indeed continues, but the debugger window disappears. This is very surprising. Every debugger I've used in any windowed environment offers a "continue" button, and remains visible when the program runs (whether is refreshes in real time or not, IIRC I've seen both).

Quote from: norecess on 09:51, 03 January 22Added new feature "Memory Visualizer". With it, the user can see which portions of RAM are actually used (in real-time).

Hey, the huge bouncing-towards-the-viewer scroll text in "still rising" is made with Z80-based memory copy, not outrageously convoluted CRTC effects?
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 06:18, 04 January 22
Thanks @cpcitor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=531) for your feedback!

QuoteI'm very surprised that the debug window does not offer a "continue" button.
When the debugger is displayed, press the space bar to go to the next instruction, and ESC to close debugger and continue emulation.
Please have a look at the official documentation (scroll down in https://gitlab.com/norecess464/cpcec-gtk (https://gitlab.com/norecess464/cpcec-gtk) ) or Help/Contents directly in the emulator, many details of the emulator (including the usage of the debugger) is exposed there!

Quotethe emulated CPC believes that the space bar (or sometimes the CPC z key) is pressed continuously, while in reality no key is pressed at all.
Yes, I will eventually investigate that. Low priority for now, as it's not blocking anything. Please do not hesitate to report the issue directly in gitlab if you can: https://gitlab.com/norecess464/cpcec-gtk/-/issues (https://gitlab.com/norecess464/cpcec-gtk/-/issues)

QuoteThe idea is to show a kind of "current instantaneous screen content", as if you could freeze the Z80, preserve memory content and the Z80-writable CRTC register contents, and just show a complete image. In a number of cases (arguably not every case), this could show interesting things, like hints to understand how some effect is made.
I'm not sure to understand your idea? Whatever happens, I don't plan to invest more time in debugging features for now, unless I really need them.
But, please take note you can pause the emulator at any monitor scanline. Then, you could debug step-by-step from there and see how CRTC registers evolve. That's how I would proceed to understand what is happening with CRTC.

QuoteHey, the huge bouncing-towards-the-viewer scroll text in "still rising" is made with Z80-based memory copy, not outrageously convoluted CRTC effects?
It's probably a mix of Z80 copy to update the scroll content, and use of the CRTC to stretch the lines vertically. The challenge is to sync them both ;-)
Title: Re: CPCEC a new emulator from cngsoft
Post by: norecess on 06:28, 04 January 22
cpcec-gtk: minor enhancements done around the extended monitor feature (download: https://gitlab.com/norecess464/cpcec-gtk/-/releases (https://gitlab.com/norecess464/cpcec-gtk/-/releases)). The most notable progress is that the boundaries of the visible monitor are now displayed (also in the debugger), as shown in this video.
https://youtu.be/GYyHaHZAiS4 (https://youtu.be/GYyHaHZAiS4)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 23:33, 05 January 22
Several bug reports and new tests later, here's a minor patch, this year's first:

(http://cngsoft.no-ip.org/928400518026502174.png) (http://cngsoft.no-ip.org/928061347328032768.png)

20220104 -- minor patch improving the interruption flags of INIR/INDR/OTIR/OTDR (following new tests from Ped7g) and the timings of LDI/LDD/LDIR/LDDR on CPC (the eighth and ninth tests of Roudoudou's SPLIT.CPR pass at last) and fixing a bug in the CRTC1 logic (nonzero R5 in Chany and Grees' NPS cracktros: reported by Norecess464) and another one in the Spectrum interrupt counters (accepting an IRQ stops its counter on Pentagon: reported by Azesmbog). Configurable CMOS/NMOS Z80 style in ZXSEC.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:16, 09 January 22
Several bug reports later, another minor patch:

(http://cngsoft.no-ip.org/image_2022-01-09_21-14-54.png) (http://cngsoft.no-ip.org/image_2022-01-09_21-04-14.png)

20220108 -- minor patch fixing bugs in the ZX Dandanator (the demo "Possible" accidentally triggers the RESET command even without cartridges) and the Pentagon IRQ (it's short yet continuous rather than long and stoppable, following new tests from Azesmbog). Video filters are more CRT-like (suggested by Md0) and lightgun logic is linked to their triggers to avoid false positives.

Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 00:05, 10 January 22
Quote from: cngsoft on 23:33, 05 January 22Several bug reports and new tests later, here's a minor patch, this year's first:

What is the prod in the screenshot? Is it interlaced video?

Anyway, repository updated: https://github.com/cpcitor/cpcec
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:44, 10 January 22
Quote from: cpcitor on 00:05, 10 January 22What is the prod in the screenshot? Is it interlaced video?

Anyway, repository updated: https://github.com/cpcitor/cpcec
Thanks for the update :-) The demo is "Possible", https://www.pouet.net/prod.php?which=90547 ; the screenshot combines almost all the video filters (pxiels, scanlines, interlace, blending) in ZXSEC.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 00:56, 10 January 22
Quote from: cngsoft on 00:44, 10 January 22
Thanks for the update :-) The demo is "Possible", https://www.pouet.net/prod.php?which=90547 ; the screenshot combines almost all the video filters (pxiels, scanlines, interlace, blending) in ZXSEC.

Thanks. And that one?

(http://cngsoft.no-ip.org/928400518026502174.png)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:27, 10 January 22
Quote from: cpcitor on 00:56, 10 January 22Thanks. And that one?

(http://cngsoft.no-ip.org/928400518026502174.png)
This one is interlaced. No pixel blur, no frame blending, no scanlines. In hindsight it was a bad choice, scrollers suffer the most with interlace.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 09:20, 10 January 22
Quote from: cngsoft on 01:27, 10 January 22
This one is interlaced. No pixel blur, no frame blending, no scanlines. In hindsight it was a bad choice, scrollers suffer the most with interlace.

What is the name of that prod? I'd like to run it on a real CPC one day.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:10, 10 January 22
Quote from: cpcitor on 09:20, 10 January 22What is the name of that prod? I'd like to run it on a real CPC one day.
It's Chany & Grees' cracktro of "Popeye 3", https://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=1666 ; the cracktro relies on a CRTC1 quirk (changing R5 then C4 is zero but R4 is nonzero) to move the "Nul Part System" logo on top of the screen.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 22:03, 10 January 22
Quote from: cngsoft on 13:10, 10 January 22
It's Chany & Grees' cracktro of "Popeye 3", https://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=1666 ; the cracktro relies on a CRTC1 quirk (changing R5 then C4 is zero but R4 is nonzero) to move the "Nul Part System" logo on top of the screen.

Thanks!

Running it with latest cpcec on Linux, it works but is not interlaced, see attached picture. Why not the same result as yours?

 [ This attachment cannot be displayed inline in 'Print Page' view ]  
 [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:21, 10 January 22
Quote from: cpcitor on 22:03, 10 January 22Thanks!

Running it with latest cpcec on Linux, it works but is not interlaced, see attached picture. Why not the same result as yours?
Interlacing is just a video option of CPCEC, not an actual trait of the CPC hardware; I often enable it on my laptop because it saves CPU time as the emulator doesn't have to perform any scanline duplication. However, some CPC demos rely on software interlacing, for example "Mad Leprechaun", https://www.cpc-power.com/index.php?page=detail&num=12533 : the screen "shakes" with all scanline options disabled, but can become stable with the right options.

(http://cngsoft.no-ip.org/image_2022-01-10_21-14-53.png) (http://cngsoft.no-ip.org/image_2022-01-10_21-14-58.png)
(http://cngsoft.no-ip.org/image_2022-01-10_21-15-02.png) (http://cngsoft.no-ip.org/image_2021-02-10_20-03-09.png)

CPCEC shows either the right or the wrong interlace (it depends on the timing; switch back to "all scanlines", then back to an interlaced mode if you get the wrong picture) with simple or double interlace enabled, and shows a compromise between both if you enable blending. Something similar happens to the Batman-Spawn screen in the demo "Batman Forever", as well as in many Spectrum demos where the rapid flipping of the two VRAM pages in 128K mode is called "Gigascreen", for example the title screen of "Mescaline Synesthesia".

(http://cngsoft.no-ip.org/IMAGE_2019-04-06_22-00-08.PNG) (http://cngsoft.no-ip.org/IMAGE_2021-02-10_14-03-27.PNG)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 17:18, 04 March 22
The forum got upgraded; so did my emulators meanwhile.

(http://cngsoft.no-ip.org/949322786717958174.png) (http://cngsoft.no-ip.org/949330528912408606.png)

20220303 -- twenty-second public release. Major internal changes in the debugger: most of it is now part of the general library, only the Z80-specific features stay in the Z80 module. Toggling the debugger's illegal opcode behavior is now done with the key "," (comma); its old key "Q" now runs until the next interruption. The debugger styles (keys "V" and "Shift+V") now include a translucent mode where the emulated screen is visible through the debugger text. Minor optimisations in the video renderer (merge vertical position and frameskip tests), the AY chip (fewer calculations) and the Z80 emulation (reduced banking in operations that read and write the same address). Small tweaks in CPCEC ("Octopus Pocus" for CRTC0 works well at last), ZXSEC (SZX snapshots are now the default choice, SNA format is now secondary), the FDC ("READ ID" must fail when using the wrong density: noticed by Roudoudou), the audio extensions (now Playcity and Digiblaster can be enabled at once, as well as Turbosound and Covox $FB) and the video filters (weakening image contrast rather than saturation).
Title: Re: CPCEC a new emulator from cngsoft
Post by: McArti0 on 01:31, 06 March 22
Excelent bind mode for CPC Plus. Thank You so much.  :-*

ps. Sorry where is COPY key?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 01:49, 06 March 22
Quote from: McArti0 on 01:31, 06 March 22Excelent bind mode for CPC Plus. Thank You so much.  :-*

ps. Sorry where is COPY key?
You're welcome. The CPC's COPY key is now INSERT. Similarly, CLEAR is the modern DELETE.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:05, 09 March 22
Small update, after noticing bad colours in the half scanlines and the unability to watch the graphics of Plus cartridges and Dandanator cards:
(http://cngsoft.no-ip.org/IMAGE_2022-03-08_16-16-02.PNG) (http://cngsoft.no-ip.org/IMAGE_2022-03-08_16-16-39.PNG)
20220307 -- minor patch fixing a bug in the "half scanlines" mode and several omissions in the debuggers.
Title: Re: CPCEC a new emulator from cngsoft
Post by: CraigsBar on 14:57, 22 March 22
Loving this emulator. It certainly has replaced WinAPE for me on my windows machines. However I'd Love GUI options to select the "Standard" 16 Rom slots. So that Protext/Maxam etc.. and ParaDOS 1.2 and 1.2+ can be used for the CPC and Plus machines accordingly and swapped out when not needed. 
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:49, 04 April 22
Fixing the OUT (n),A timing bug solved the glitch of the first half of "Onescreen Colonies #2" (https://www.pouet.net/prod.php?which=91214), but getting the LA-7800 chip to handle the demo's second half is going to take a while:

(http://cngsoft.no-ip.org/957264474908278845.png) (http://cngsoft.no-ip.org/957756629594546217.png)

And it's a pity because the next major release is in the works, with the ability to redefine the keys of the virtual joystick (no longer limited to the cursors, Z and X) and a new sibling to CPCEC and ZXSEC: CSFEC.


Craigsbar, I also wish I could extend CPCEC's extra ROM support, but the user interface is very limited at the moment: please remember that these emulators must compile both on Windows, where we have plenty of widgets, and on SDL2, where I have none and I must improvise with my own snippets of code. Writing INI files outside the emulator, as seen already in this thread and the docs, should do at the moment.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 10:53, 14 April 22
At last "Onescreen Colonies #2" runs as intended! The LA-7800 horizontal-vertical synchronisation chip is a subtle beast.

(http://cngsoft.no-ip.org/image_2022-04-10_23-55-13.png) (http://cngsoft.no-ip.org/image_2022-03-24_14-10-10.png)

20220412 -- twenty-third public release. CSFEC is a new Commodore 64 emulator: it passes several tests from the PC64 suite (CPUTIMING, CPUPORT and the entire MOS 6510 opcode set) but fails others (IRQ, NMI and all CIA tests); it supports up to two extra SID chips (either $D420 and $D440 or $DE00 and $DF00) but the VIC-II emulation is incomplete (no badline handling, no sprite contention); it can load PRG files and play T64 and TAP tape images, but it doesn't emulate the C1541 disc drive yet and thus cannot handle D64 disc images at all. New virtual joystick interface: the user can redefine the keys that simulate the virtual joystick instead of sticking to the keys Z and X and the cursors. Tape analysis can detect musical loaders: tape acceleration will be temporarily disabled to ensure that songs play normally. Fixed a bug in the Z80 (the internal timings of OUT (n),A were wrong) and the LA-7800's horizontal synchronisation (both reported by Hicks): the CPC demo "Onescreen Colonies #2" behaves properly.
Title: Re: CPCEC a new emulator from cngsoft
Post by: grouik1er on 00:07, 04 May 22
Hi? Playing SRAM under CPCEC, i'm in front of the Sorceress and the game as me to press [copy] to continue.
[copy] is on the left on the space bar on a real cpc but "alt" is not mapped on [copy] ?
Title: Re: CPCEC a new emulator from cngsoft
Post by: SkulleateR on 02:09, 04 May 22
Quote from: grouik1er on 00:07, 04 May 22Hi? Playing SRAM under CPCEC, i'm in front of the Sorceress and the game as me to press [copy] to continue.
[copy] is on the left on the space bar on a real cpc but "alt" is not mapped on [copy] ?
It's on the INS Button (insert) :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: grouik1er on 23:20, 04 May 22
Quote from: SkulleateR on 02:09, 04 May 22
Quote from: grouik1er on 00:07, 04 May 22Hi? Playing SRAM under CPCEC, i'm in front of the Sorceress and the game as me to press [copy] to continue.
[copy] is on the left on the space bar on a real cpc but "alt" is not mapped on [copy] ?
It's on the INS Button (insert) :)
thanks , where find the keyboard map for CPCEC, Barbarian impossible to play "Return" don't choose mode.
No problem with winape
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 20:25, 06 May 22
I still enjoy this emulator a lot - so, again, big thanks to @cngsoft .

I noticed that some games on the CPC unfortunately don't support the second fire button, and instead use the spacebar key as a replacement, forcing the player to have one hand on the joystick and the other on the keyboard. I therefore wrote a small patch that makes the second fire button giving out a spacebar instead of 'Z' if the option is activated. Maybe somebody finds it useful and maybe you @cngsoft want to consider to add this function.

--- cpcec.c.bak 2022-05-06 17:19:39.227255646 +0200
+++ cpcec.c 2022-05-06 19:16:13.969255060 +0200
@@ -3225,6 +3225,7 @@
 // auxiliary user interface operations ------------------------------ //
 
 BYTE key2joy_flag=0; // alternate joystick buttons
+BYTE firezspace_flag=0; // replace fire 'Z' with spacebar
 char txt_error_snap_save[]="Cannot save snapshot!";
 char file_pattern[]="*.sna;*.rom;*.crt;*.cpr;*.ini;*.mld;*.dsk;*.cdt;*.csw;*.wav";
 
@@ -3297,6 +3298,7 @@
  "0x0400 Virtual joystick\tCtrl+F4\n"
  "0x0401 Redefine virtual joystick\n"
  "0x4400 Flip joystick buttons\tCtrl+Shift+F4\n"
+    "0x4402 Flip Fire Z to spacebar\n"
  "0x8521 No lightgun\n"
  "0x8522 Trojan Light Phaser\n"
  "0x8523 Gunstick (MHT)\n"
@@ -3392,6 +3394,7 @@
  session_menucheck(0x4900,tape_fastload);
  session_menucheck(0x0400,session_key2joy);
  session_menucheck(0x4400,key2joy_flag);
+    session_menucheck(0x4402,firezspace_flag);
  session_menuradio(0x0601+multi_t-1,0x0601,0x0604);
  session_menuradio(0x8501+crtc_type,0x8501,0x8505);
  session_menucheck(0x8508,!crtc_hold);
@@ -3425,6 +3428,8 @@
  video_vsync_max=crtc_hold?VIDEO_VSYNC_HI*2-VIDEO_LENGTH_Y:VIDEO_VSYNC_HI;
  kbd_joy[4]=kbd_joy[6]=0x4C+key2joy_flag;
  kbd_joy[5]=kbd_joy[7]=0x4D-key2joy_flag;
+    if (firezspace_flag && kbd_joy[4]==0X4D) kbd_joy[4]=kbd_joy[6]=0X2F;
+    if (firezspace_flag && kbd_joy[5]==0X4D) kbd_joy[5]=kbd_joy[7]=0X2F;
  #if AUDIO_CHANNELS > 1
  session_menuradio(0xC401+audio_mixmode,0xC401,0xC404);
  for (int i=0;i<3;++i)
@@ -3593,6 +3598,9 @@
  if ((t[5]=session_scan("FIRE 2",s))>=0)
  for (int i=0;i<length(t);++i) kbd_k2j[i]=t[i];
  break;
+        case 0x0402:
+            firezspace_flag = ! firezspace_flag; // FLIP FIRE 'Z' TO SPACE OR 'Z'
+            break;
  case 0x8501: // CRTC0
  case 0x8502: // CRTC1
  case 0x8503: // CRTC2

As you can see, the change is very simplistic (just 8 added lines of code). The setting of this functionality is not stored, so this must be toggled on individually every time cpcec is restarted (however, this probably makes sense as the functionality is only useful for certain games). I have tested it only on Linux. There, I tested it with the games Spindizzy and Harrier Attack, and it did what it is supposed to do. Especially, Spindizzy becomes a lot more playable with the break on the joystick button rather than having to press the space key.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 15:13, 11 May 22
The latest posts here are interesting because of their common focus: keyboard definition. Grouik1er's question is easy to answer (the big and small ENTER keys from the CPC are mapped to the big and small ENTER of modern keyboards) but Sb1903 goes further; his idea of mapping a joystick button to SPACE is one instance of a more general case I've been considering lately: giving the user the ability to define the whole keyboard+joystick mappings. I don't know how to implement it in a way that could please everyone; WINAPE's "Input" dialog comes to mind:
(http://cngsoft.no-ip.org/winape-setup-input-return.png)

Other than that I have few CPC-themed news to share. The next release will include a small bugfix: the intro "Simply the bests" proves that 32K screens are compatible with the PLUS SSSL:
(http://cngsoft.no-ip.org/967028976113582100.png) (http://cngsoft.no-ip.org/967029033751679056.png)
Title: Re: CPCEC a new emulator from cngsoft
Post by: eto on 16:11, 11 May 22
Quote from: cngsoft on 15:13, 11 May 22WINAPE's "Input" dialog comes to mind
yes, that would be highly appreciated. Maybe some defaults for "normal" keyboards that can be adjusted if required. 
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 23:12, 15 May 22
Yes, I also think this is a great idea. Looking forward to it, thanks a lot :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 00:29, 05 June 22
New month, new version.
(http://cngsoft.no-ip.org/976611580471033936.PNG) (http://cngsoft.no-ip.org/IMAGE_2022-05-16_18-59-36.PNG)

20220531 -- minor patch adding a new power-up boost option (enabled by default) that tells the emulators to trap boot procedures and speed them up. Printing a disassembly now includes the source bytes, ensuring that the binary can be always rebuilt even if the disassembly is ambiguous. The Z80 operations RETN and RETI are now identical; telling them apart is up to the NMI-issuing hardware. The Plus ASIC SSSL function is now 32k-compatible, as required by the intro "Simply the Bests". Simpler ZX ULA memory contention model: the timing buffer is now 128k long instead of 256k. The VIC-II chip is more accurate: slowdowns caused by badlines and sprite fetching are emulated (Extend's "Fellas", "HVSC 10 Years" intro...), effectively enabling badline manipulation (Archmage's "Data Zombies", Focus' "Ms. Pac Man", Excess' "Funny Rasters"...), DMA-delay horizontal scrolling ("Creatures", Tempest's "Rewind"...) and sprite stretching (Oxyron's "20 Years"). The default palette is now Community-Colors instead of Colodore. The CIA chips are more accurate too (TRSI's "4Krawall") but they don't pass the PC64 test suite yet. The internal SID filter is now partially emulated; the user can manually disable it. Minor optimisations through "likely/unlikely" branching hints.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:19, 17 June 22
Minor changes and additions.
(http://cngsoft.no-ip.org/984950927251345498.png) (http://cngsoft.no-ip.org/984954719766208552.png)

20220615 -- minor patch fixing several glitches: the Win32 binaries use timeBeginPeriod and timeEndPeriod because of recent changes in Win10; the emulators ensure that 'frame_pos_y' and 'video_pos_y' match properly; the Z80 module handles dummy IX/IY opcodes without the unreliable macros Z80_BEWARE and Z80_REWIND; the VIC-II chip avoids retriggering sprites ("Gothik", Booze Design's "Sprite Invaders") and clips them properly if they sit on screen edges (Singular's "Smooth and Wonders"). The filter of the SID chip is now more detailed, and its third voice's oscillator returns more realistic values: "Mazemania" no longer hangs at the beginning of a level. CSFEC can load extra colour palettes from VPL files, either old style "RR GG BB D" or new "RR GG BB".
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:28, 09 July 22
A new month dawns, a minor patch drops.
(http://cngsoft.no-ip.org/993098789927780403.png) (http://cngsoft.no-ip.org/image_2022-06-29_23-23-13.png)
20220707 -- minor patch replacing the old option "Zoom by integer" with a new submenu "Window" with options that set the size of the window, ranging from 100% to 300%, that also stick between sessions (suggested by Xyphoe), and turning the options "Pixel filter" and "Blend scanlines" into "X-blending", "Y-blending" and "Frame blending", that respectively blur the image horizontally, vertically and dynamically. Several improvements in the VIC-II (sprite crunching: Carrion & Crest's "Heraklion", Arise's "Merswiny"; line crunching: Samar's "Ukiyo") and the SID (ports 27 and 28: second chip detection in "To Norah", sound effects of "Cloud Kingdoms"; wave shapes: song of "HVSC 10 Years"; filter based on the Chamberlin algorithm). The command line parameter `-c0..-c7` is now `-c0..c9` and includes the fifth mode, average scanlines.
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 11:46, 09 July 22
Nice work in progress.

You know my point of view about the useless fake filters. ;)
(they are not representative of the CRT display)

I'm realy more impressed by your efforts around the CRTC accuraty! 8)
Title: Re: CPCEC a new emulator from cngsoft
Post by: WiltshireWizard on 12:54, 16 July 22
z
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 13:10, 16 July 22
Quote from: WiltshireWizard on 12:54, 16 July 22The accuracy of your spellchecker isn't accurate, really.
I don't know if it is good, it wrote: "Touch your ass".
Title: Re: CPCEC a new emulator from cngsoft
Post by: WiltshireWizard on 13:18, 16 July 22
z
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 13:25, 16 July 22
Quote from: WiltshireWizard on 13:18, 16 July 22I genuinely have no idea whether you are making some clever linguistic pun or not.
Please, return to your social networks were attacking people on their problems is a sport. Your post is not CPC related, just free wickedness. Thank you.
Title: Re: CPCEC a new emulator from cngsoft
Post by: abalore on 16:15, 16 July 22
Quote from: WiltshireWizard on 12:54, 16 July 22The accuracy of your spellchecker isn't accurate, really.

We are using a non-native language, it's a lack of education and very bad taste to make fun about it.
Title: Re: CPCEC a new emulator from cngsoft
Post by: eto on 18:02, 16 July 22
Quote from: WiltshireWizard on 12:54, 16 July 22The accuracy of your spellchecker isn't accurate, really.
don't drink and post.
Title: Re: CPCEC a new emulator from cngsoft
Post by: WiltshireWizard on 18:05, 16 July 22
z
Title: Re: CPCEC a new emulator from cngsoft
Post by: Urusergi on 18:33, 16 July 22
I think it's only a little joke ???
As a spanish speaker I've no problem if someone corrects me.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Gryzor on 22:47, 16 July 22
Dudes, tell me you haven't started drinking that early? 

Let's get back on topic. 
Title: Re: CPCEC a new emulator from cngsoft
Post by: Mage on 22:03, 24 July 22
Great emulator !!! Congrats and thank you @cngsoft !
And also thank you to NoRecess for the Linux GTK port !
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:37, 27 July 22
Thanks, @Mage. This is the feedback that makes this work worth taking :-)

And indeed, now that you mention @norecess' ports, and getting back on topic, what happened to @cpcitor's CPCEC repository? It got its last update back in January, half a year ago. Is Cpcitor alright?
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 18:09, 27 July 22
Quote from: cngsoft on 13:37, 27 July 22what happened to @cpcitor's CPCEC repository? It got its last update back in January, half a year ago. Is Cpcitor alright?

Hi everyone! Thanks for citing me, the notification got my attention. As a result, I've just updated the repo, with updates from the 6 latest zip archives.

https://github.com/cpcitor/cpcec

If I'm alright? Thanks for asking. I've been busy "In Real Life"(tm).  Also, slowly started to work on my next production(s). Considering one or two "tech demonstrators" (in the initial sense of a minimal thing that showcases one possibility, each could be fleshed out into a small actual intro/demo). They are meant as cumulative steps towards a somewhat ambitious game I have in mind, and will make real if time permits.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 12:26, 08 August 22
A new month, a new release.

(http://cngsoft.no-ip.org/image_2022-08-08_11-23-51.png) (http://cngsoft.no-ip.org/1006132712274399333.png)

20220806 -- minor patch fixing glitches in the VIC-II (the ending of "Creatures II" requires precise sprite priority), the CIA (the protection of "Druid 2" modifies and freezes the day-of-time clock, but "Island of Dr.Destructo" expects said clock to stay active after modifying it), the SID 6581 (Maniacs of Noise's "Echofied" scans channel 3 to generate a sampled echo), the C64 idle bus (the protection of "Barry McGuigan's Boxing" checks the $DE00-$DFFF area: reported by Neville) and the Z80 and MOS 6510 disassemblers. ZXSEC can save Dandanator information in SZX snapshots thanks to a new block type, "DNTR". The YM file generation is now in a new file, `cpcec-ym.h`. The SDL2 audio buffer is now the library's choice (suggested by Kawe). The keyboard shortcuts Alt+Up and Alt+Down zoom the window up and down. Enabling both X-masking and Y-masking shows a new dot matrix. Minor optimisations in XRF film logic.

@cpcitor, real life is indeed consuming. We look forward to your new tech demonstrations! (I certainly hope that CPCEC will run them as intended)

P.D.: CHIPNSFX and UZ80 got minor updates too, the former with similar audio buffer changes to CPCEC, the later with two new error checks.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 13:41, 08 August 22
Quote from: cngsoft on 12:26, 08 August 22A new month, a new release.



20220806 -- minor patch fixing glitches in the VIC-II (the ending of "Creatures II" requires precise sprite priority), the CIA (the protection of "Druid 2" modifies and freezes the day-of-time clock, but "Island of Dr.Destructo" expects said clock to stay active after modifying it), the SID 6581 (Maniacs of Noise's "Echofied" scans channel 3 to generate a sampled echo), the C64 idle bus (the protection of "Barry McGuigan's Boxing" checks the $DE00-$DFFF area: reported by Neville) and the Z80 and MOS 6510 disassemblers. ZXSEC can save Dandanator information in SZX snapshots thanks to a new block type, "DNTR". The YM file generation is now in a new file, `cpcec-ym.h`. The SDL2 audio buffer is now the library's choice (suggested by Kawe). The keyboard shortcuts Alt+Up and Alt+Down zoom the window up and down. Enabling both X-masking and Y-masking shows a new dot matrix. Minor optimisations in XRF film logic.

@cpcitor, real life is indeed consuming. We look forward to your new tech demonstrations! (I certainly hope that CPCEC will run them as intended)

P.D.: CHIPNSFX and UZ80 got minor updates too, the former with similar audio buffer changes to CPCEC, the later with two new error checks.

Very cool but could I ask if you could sort the files into folders, please?  I downloaded the zip and it appears all three emulators and their files are all in the same folder and it's a bit messy and I ain't sure how to split them into separates. There also appears to be scripts for the CPC one?  Is that what .H files are?


:)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 23:58, 08 August 22
Quote from: cngsoft on 12:26, 08 August 22A new month, a new release.

Nearly everyone here knows the official URL for the emulator, yet it can be reminded: http://cngsoft.no-ip.org/cpcec.htm

I updated https://github.com/cpcitor/cpcec with the latest patch.

Quote from: cngsoft on 12:26, 08 August 22@cpcitor, real life is indeed consuming. We look forward to your new tech demonstrations! (I certainly hope that CPCEC will run them as intended)

I'm confident about the Z80 part (behavior appears to have been very well covered by emulators  -- timings, flags, hidden registers) and the video part, because I'm not too much into CRTC effects and stick to the fully-portable-between-all-real-machines subset of CRTC settings.

One of the thing I'm considering digging very deep in one of the anticipated project is the sound. Deep enough to probably break a number of current emulators. Why? The AY chip also appears to have been well analyzed yet I see two issues:
* I suspect many emulators don't have cycle-accurate emulation, which might be a problem when banging the registers at high frequency for specific effects or trying to break the limits of sampled audio
* because the output of the AY chip fundamentally operates at 125kHz which is not a multiple of 44100Hz or 48000Hz, it additionally requires some math and/or audio engineering knowledge for an emulator to produce clean audio (Arnoldemu and RetroVM fare better than other emulators as observed on https://www.cpcwiki.eu/forum/emulators/sound-emulation-survey/ ).

Don't hold your breath, things will take time. Cheers!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 11:17, 09 August 22
Quote from: Carnivius on 13:41, 08 August 22Very cool but could I ask if you could sort the files into folders, please?  I downloaded the zip and it appears all three emulators and their files are all in the same folder and it's a bit messy and I ain't sure how to split them into separates. There also appears to be scripts for the CPC one?  Is that what .H files are?
The source files end in .C (sources), .H (headers), .RC (Windows resources), .ICO (Windows icons) and .PNG (non-Windows icons); you can erase them all if you don't plan to compile anything. The essential files end in .EXE (Windows binaries) and .ROM (firmwares), while the .TXT files are the docs. You can always write a short BAT file, something like "DEL *.C *.H *.RC *.ICO *.PNG", to erase the source files on demand.

That being said, it's true that rearranging the package is a suggestion that I get every now; the most common request is to merge the ROM files within the compiled binaries. It would reduce the amount of visible files, but it would also make the project less OSS-friendly (embedding "blobs", sourceless binaries that cannot be replaced with sourced ones) and damage its customisation (compiling the emulators with the English blobs would hurt users relying on other blobs: French, Spanish, German...). There's nothing I can do as long as there isn't a consensus on the matter.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 11:19, 09 August 22
Quote from: cngsoft on 11:17, 09 August 22The source files end in .C (sources), .H (headers), .RC (Windows resources), .ICO (Windows icons) and .PNG (non-Windows icons); you can erase them all if you don't plan to compile anything. The essential files end in .EXE (Windows binaries) and .ROM (firmwares), while the .TXT files are the docs. You can always write a short BAT file, something like "DEL *.C *.H *.RC *.ICO *.PNG", to erase the source files on demand.

That being said, it's true that rearranging the package is a suggestion that I get every now; the most common request is to merge the ROM files within the compiled binaries. It would reduce the amount of visible files, but it would also make the project less OSS-friendly (embedding "blobs", sourceless binaries that cannot be replaced with sourced ones) and damage its customisation (compiling the emulators with the English blobs would hurt users relying on other blobs: French, Spanish, German...). There's nothing I can do as long as there isn't a consensus on the matter.

Ok cool but how do I separate them emulators into CPC, ZX and C64 folders neatly?  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:20, 09 August 22
Quote from: Carnivius on 11:19, 09 August 22Ok cool but how do I separate them emulators into CPC, ZX and C64 folders neatly?  :)
* CPC: CPCEC.EXE, CPC464.ROM, CPC664.ROM, CPC6128.ROM, CPCPLUS.ROM and CPCADOS.ROM;
* ZX: ZXSEC.EXE, SPECTRUM.ROM, SPEC128K.ROM, SPEC-P-2.ROM, SPEC-P-3.ROM and TRDOS.ROM;
* C64: CSFEC.EXE, C64EN.ROM and C1541.ROM.
The odd one out is XRF.EXE, the video conversion tool shared by the three emulators.
Title: Re: CPCEC a new emulator from cngsoft
Post by: Carnivius on 14:49, 09 August 22
Quote from: cngsoft on 14:20, 09 August 22* CPC: CPCEC.EXE, CPC464.ROM, CPC664.ROM, CPC6128.ROM, CPCPLUS.ROM and CPCADOS.ROM;
* ZX: ZXSEC.EXE, SPECTRUM.ROM, SPEC128K.ROM, SPEC-P-2.ROM, SPEC-P-3.ROM and TRDOS.ROM;
* C64: CSFEC.EXE, C64EN.ROM and C1541.ROM.
The odd one out is XRF.EXE, the video conversion tool shared by the three emulators.
Thanks.  :)
Hm, when you list it like that it seems so obvious and I'm an idiot.  ;)
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 15:16, 10 August 22
It was more complicated in the past, when firmwares were inherited from extant projects that divided them into many small files and gave them arbitrary names. Typical C64 emulators cut the firmware into two 8K files and one 4K (KERNAL, BASIC and CHARGEN) and the Spectrum firmwares get often spliced into 16K files, leading to the 64K Spectrum Plus 3 firmware becoming PLUS3-0.ROM, PLUS3-1.ROM, PLUS3-2.ROM and PLUS3-3.ROM.
Title: Re: CPCEC a new emulator from cngsoft
Post by: GUNHED on 17:57, 10 August 22
What this emulator really needs is a comfortable ROM selection option. like all modern emulators have.  :) :) :) Anything else... this one could be the killer app!  :) :) :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: AmatCoder on 01:02, 11 August 22
Quote from: cngsoft on 11:17, 09 August 22[...] the most common request is to merge the ROM files within the compiled binaries. It would reduce the amount of visible files, but it would also make the project less OSS-friendly (embedding "blobs", sourceless binaries that cannot be replaced with sourced ones) and damage its customisation (compiling the emulators with the English blobs would hurt users relying on other blobs: French, Spanish, German...)[...]
Hmm, I had not thought about this: Embedding Amstrad ROM files into executable could violate GPLv3 license.

And not just because they are "blobs" but also because, as far as I know,  Amstrad given permission for non-commercial purposes. This is not compatible with GPLv3.

Any thoughts? Am I wrong?


Ps.- I am asking this because I was writing a(nother) GTK port of the CPCEC emulator (https://github.com/AmatCoder/CPCEG) and I was embedding the Amstrad ROM files into executable :doh:

Ps2.- @cngsoft : Thanks you for your work, it's really great! :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: andycadley on 10:12, 11 August 22
Embedding the Amstrad ROM is probably not compatible with any version of the GPL and almost certainly not GPLv3. If you want to stay safely within the terms of the GPL you probably shouldn't be distributed the ROMs with it at all, since you don't have the rights to GPL them.
Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 10:59, 11 August 22
I believe this is an incorrect interpretation. An emulator isn't linked against the ROM code, and doesn't require the ROM to have specific contents or functionality. The ROM is simply an input file read in by the emulator and acted upon - just because you load an image into the GIMP or a custom/commercial level into Chocolate DOOM doesn't make those files subject to the GPL either.

Embedding is not linking; executables can have embedded graphics and other files and that is considered an "aggregation" only.
Title: Re: CPCEC a new emulator from cngsoft
Post by: andycadley on 11:33, 11 August 22
Embedding (or including) non-GPL'd assets, whether images or other things, is quite probably a violation of the GPL. It is, at the very least, something of a legal headache for either you or someone else down the line.

As with all things GPL though, it's ultimately just a license contract between you and your users. Unless you're actually planning on suing them, it doesn't actually matter at all.
Title: Re: CPCEC a new emulator from cngsoft
Post by: eto on 13:06, 11 August 22
Quote from: andycadley on 11:33, 11 August 22quite probably a violation of the GPL.
Of course you must not publish those components under the GPL, so those have to be excluded from the statement, that the emulator is under GPL. 


If I understand the GPL correctly, then it basically only makes sure, that work that is derived from work under GPL or uses GPL work, will also be under GPL. But if your GPL work is using non-GPL work or us bundled with it, that does not automagically make that work GPL too. That's, as far as I can see, not part of the GPL. But maybe I missed that part in the GPL.

Title: Re: CPCEC a new emulator from cngsoft
Post by: pelrun on 13:13, 11 August 22
GPL does not concern itself with embedded assets if they're not executable. Those files are covered by their own licenses, which of course you must follow just as you follow the GPL for the code itself.

BTW the GPL is explicitly not a contract, as contract law and copyright law are distinct in various jurisdictions.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 23:33, 11 August 22
The legality of third-party data of any kind is indeed a problem: the default CPCEC package is already an impure compromise that mixes GPL source files and documentation, precompiled binaries for Windows and third-party firmware files. Ideally, the package should include the sources and docs, nothing else; it would be the user's task to compile the binaries and to bring his own firmware files.

In comparison, the Debian version of the Spectrum family emulator FUSE does it right: the "fuse-emulator-common" package doesn't include any firmwares on its own, and its only firmware-based dependency is "opense-basic", an open-source software replacement. The suggested packages include "spectrum-roms", unavailable on purpose from the main Debian repositories: Sinclair, Amstrad et al. may allow the distribution of the unmodified firmware files, but that doesn't make these files OSS-compliant, and the main Debian repositories cannot accept anything but pure OSS. You must go to the non-free repositories instead to fetch this particular package.

An important negative consequence is that as long as there aren't any OSS replacements of the CPC firmwares (or C64, now that I emulate it) CPCEC and CSFEC (as well as all CPC and C64 emulators in general) will be unacceptable in 100% pure open-source software environments.
Title: Re: CPCEC a new emulator from cngsoft
Post by: AmatCoder on 19:54, 13 August 22
Thanks for answers.

So package (source tarball) could contain the ROM files but they cannot be embedded (firmware also is executable code after all...)
It's a pity because it would have been more comfortable for the end user :( .

By the way (and getting back on topic) I want report a possible bug:
The game "007 The Living Daylights" is flickering with last versions of CPCEC (with CRT type 1).
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 20:50, 13 August 22
Quote from: cngsoft on 23:33, 11 August 22Ideally, the package should include the sources and docs, nothing else; it would be the user's task to compile the binaries and to bring his own firmware files.
And nobody will use it.

The problem is to have mixed the CPC/ZX/C64 emulators into your CPC emulator.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 13:31, 14 August 22
Quote from: AmatCoder on 19:54, 13 August 22So package (source tarball) could contain the ROM files but they cannot be embedded (firmware also is executable code after all...)
It's a pity because it would have been more comfortable for the end user :(
Making the job easy for the end users debases pure OSS into tainted freeware with undesired consequences; keeping it pure means all end users either have to install C compilers and learn to use them, or give up altogether as TotO says. Damned if we do, damned if we don't.

QuoteBy the way (and getting back on topic) I want report a possible bug:
The game "007 The Living Daylights" is flickering with last versions of CPCEC (with CRT type 1).
That's expected, the game doesn't setup its split screen properly (the debugger shows a clue of possible CRTC trouble: the screen is 512x304 pixels instead of the normal 512x312): launch that game on Winape or CPCEPower with CRTC1 and see what happens. It even looks like this game should also fail on PLUS ASIC hardware!
Title: Re: CPCEC a new emulator from cngsoft
Post by: TotO on 15:03, 14 August 22
It is a problem for you to split them?

- CPCEC (binary + ROMs)
- SPCEC
- C64EC

It is not possible to have a common open source base "EC" used by each CPC, SPC, C64 projects?
Title: Re: CPCEC a new emulator from cngsoft
Post by: Longshot on 23:47, 17 August 22
QuoteThat's expected, the game doesn't setup its split screen properly (the debugger shows a clue of possible CRTC trouble: the screen is 512x304 pixels instead of the normal 512x312): launch that game on Winape or CPCEPower with CRTC1 and see what happens.

Launching the game on another emulator is not a guarantee.
Just that they all emulate badly.
Only the test on the real machine is important.

The game works fine without flicking on a real machine with CRTC 1.

The problem comes from a bad update of R52 when a request to reset the counter occurs exactly on the last microsecond of the HSYNC. In general, R52 is incremented on C0=R2+R3-1. But the reset request on this same position is taken into account after the incrementation.

So, on the C0 position of the OUT, R52 goes to 0 and is incremented to 1, instead of being incremented and zeroed. (this takes place at 130F during the game for information). This causes interrupts to be shifted one line earlier, and since the game handles all of its ruptures under interrupt, this has consequences. CRTC 0 and 2 are not impacted since the R4 update falls on the last line (this is only a problem for CRTC 1 whose counter C4 goes into overflow, and then encounters the value of R7 by triggering a VSYNC).

A priori, this game already used multiple ruptures in 1987. :o

It must have been developed on CRTC 0 or 2, because there is another bug in the game inherent in the operation of CRTC 1. The absence of text (or the repetition of the score during the game) in the lower part of the screen is linked to the characteristic of the CRTC 1 to take into account the update of R12/R13 as long as C4=0. In other words, this operation occurs too early and the author would have seen it if he had worked on a CRTC 1.

QuoteIt even looks like this game should also fail on PLUS ASIC hardware!
There's no reason it shouldn't work because it's not a CRTC issue. It works on CRTC 4.
Title: Re: CPCEC a new emulator from cngsoft
Post by: cpcitor on 01:13, 18 August 22
> The problem comes from a bad update of R52 when a request to reset the counter occurs exactly on the last microsecond of the HSYNC. (...)

Now that's a deep knowledge of all the CRTC and their quirks... to each and every microsecond!  :o  :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 20:32, 01 November 22
Hi,

One thing that I noticed over time when using cpcec (which is the emulator I use most often, while cpcemu is on my rank #2 currently :) ), is that the sound is always a bit delayed. It's easiest to notice when just pushing backspace at the beginning of a basic line, to hear that beep. There is a noticeable delay. E.g. in cpcemu there is no such delay. This is on Linux, and I have compiled cpcec myself using the command that is told in the file CPCEC-E.TXT ("gcc -DSDL2 -O2 -xc cpcec.c -lSDL2 -ocpcec").

Any idea how to fix that delay?


Cheers!
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 14:36, 15 November 22
Quote from: sb1903 on 20:32, 01 November 22One thing that I noticed over time when using cpcec (which is the emulator I use most often, while cpcemu is on my rank #2 currently :) ), is that the sound is always a bit delayed. It's easiest to notice when just pushing backspace at the beginning of a basic line, to hear that beep. There is a noticeable delay. E.g. in cpcemu there is no such delay. This is on Linux, and I have compiled cpcec myself using the command that is told in the file CPCEC-E.TXT ("gcc -DSDL2 -O2 -xc cpcec.c -lSDL2 -ocpcec").
Any idea how to fix that delay?
The non-Win32 versions rely on SDL2, who handles both sound and timing on its own. There's one option in the emulator's menu ("Audio: audio acceleration") that shortens the internal audio buffer if you enable it.

However, if doesn't the job, you'll have to look for SDL_OpenAudioDevice in cpcec-ox.h , uncomment the preceeding statement "//spec.samples=4096;", turn it into "spec.samples=AUDIO_LENGTH_Z*N;" where N is a value you'll have to find by trial and error, and recompile the emulator. By default that setting is zero and SDL2 assigns it a supposedly reliable value on its own.
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 00:24, 16 November 22
Thanks a lot for the pointer.

Quote from: cngsoft on 14:36, 15 November 22There's one option in the emulator's menu ("Audio: audio acceleration") that shortens the internal audio buffer if you enable it.
I tried that. Indeed, this option improves the situation, but the audio lag was still very obvious even with this switched on.

Quote from: cngsoft on 14:36, 15 November 22However, if doesn't the job, you'll have to look for SDL_OpenAudioDevice in cpcec-ox.h , uncomment the preceeding statement "//spec.samples=4096;", turn it into "spec.samples=AUDIO_LENGTH_Z*N;" where N is a value you'll have to find by trial and error, and recompile the emulator. By default that setting is zero and SDL2 assigns it a supposedly reliable value on its own.
I tried this next, but at first it seemed that whatever I set spec.samples to, it didn't really reduce the audio lag to any acceptable level. Even if I just put a very low plain number (like 5) in. Just when I went too low (like simply 1), cpcec crashed when playing audio.

So next, I looked a few lines down in cpcec-ox.h and found the following line:
int n=AUDIO_N_FRAMES>>session_hardplay;Well... that looked interesting. With simply adding a printf, I found out that without audio acceleration, n=16 (no wonder, quite at the beginning of cpcec-ox.h AUDIO_N_FRAMES is set to that value) and with video acceleration on, n=8. So my idea was, if I reduce the value of n, maybe the audio lag reduces. And well... it does. Unfortunately, if reduced beyond 4, sound started to get distorted while still some lag was there.
So my next idea was to look at your earlier hint again and play with the value of spec.samples and n together. Actually, what I found is that when I simply set spec.samples=AUDIO_LENGTH_Z (without any multiplier) and n=1, then there seems to be no distortion anymore and no audible lag (or at least it's now so low that it's easily acceptable). I did very limited testing and need to test this more, but first impression (quickly trying one simply basic game called "line runner" and MASK 2 as a commercial game) it seems to work well and I keep it like this now for further testing.
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 01:21, 16 November 22
I may now be completely wrong (then please excuse that, I am really not a champion of coding in C and still try to make a sense of things), but reviewing the following code further...
audio_session=SDL_GetQueuedAudioSize(session_audio)/sizeof(audio_buffer);
int n=AUDIO_N_FRAMES>>session_hardplay;
for (j=audio_session>0?audio_session>n?0:1:n;j>0;--j) // pump audio
    SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));

... I suspect that it may be simply buggy. What this code in my opinion does is at the beginning (when the emulator is started) to fill the audio queue 16 times with the audio_buffer (which at the start of the emulator will contain silence only, obviously). This is because at the very first execution, j will be initialized with the value of n, actually (so 16). At any further executions (except of the very first "run"), j always will be 1, so the audio_buffer will be normally appended. As a result, sound is playing normally, however with a delay of 16x(duration of audio buffer). This is what, in my opinion, causes the audio lag when the code is not changed as described in my earlier post.
Title: Re: CPCEC a new emulator from cngsoft
Post by: walterg74 on 08:23, 16 November 22
Hi.  Is the site for the emu dead?
Title: Re: CPCEC a new emulator from cngsoft
Post by: robcfg on 14:29, 16 November 22
http://cngsoft.no-ip.org/cpcec.htm works for me.
Title: Re: CPCEC a new emulator from cngsoft
Post by: walterg74 on 16:05, 16 November 22
Quote from: robcfg on 14:29, 16 November 22http://cngsoft.no-ip.org/cpcec.htm works for me.
Thanks, it is working now. Was not last night. 
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 22:10, 17 November 22
Quote from: sb1903 on 01:21, 16 November 22I may now be completely wrong (then please excuse that, I am really not a champion of coding in C and still try to make a sense of things), but reviewing the following code further...
audio_session=SDL_GetQueuedAudioSize(session_audio)/sizeof(audio_buffer);
int n=AUDIO_N_FRAMES>>session_hardplay;
for (j=audio_session>0?audio_session>n?0:1:n;j>0;--j) // pump audio
    SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));

... I suspect that it may be simply buggy. What this code in my opinion does is at the beginning (when the emulator is started) to fill the audio queue 16 times with the audio_buffer (which at the start of the emulator will contain silence only, obviously). This is because at the very first execution, j will be initialized with the value of n, actually (so 16). At any further executions (except of the very first "run"), j always will be 1, so the audio_buffer will be normally appended. As a result, sound is playing normally, however with a delay of 16x(duration of audio buffer). This is what, in my opinion, causes the audio lag when the code is not changed as described in my earlier post.
The original idea was to keep the buffer as full as possible: whenever slowdowns delayed the refilling ot the buffer, the emulator was meant to fill it back, and reversely, when it was too full, the emulator wouldn't send the current chunk of audio to the queue. However, the method is indeed fragile: right now, as it is, if it somehow stays stable for long, the buffer can stay filled at just 1 frame of 16 (or 8 with acceleration on) and no delays are perceived, but if something causes a temporary slowdown, the buffer gets suddenly filled to full capacity and the delay grows to 16 frames (or 8 if accelerated).

As a result I'm rewriting this code at the moment to try to keep the buffer at 50% capacity at all times, either by refilling the buffer to half capacity when it becomes empty, or by "starving" it by half when it overflows. I'm trying to work around the general problem of this type of sound playback: it isn't independent of the operation of the remainder of the program. Unlike a videogame (where music and sound effects are asked to start whenever events in the game take place, but the game itself doesn't generate the sound; sound is defined as pre-existing assets) an emulator ties both action and sound tightly together. SDL2 simplifies audio by hiding platform-specific traits and merging audio logic into a simple data queue, but the price we pay is the unability to track the audio buffer, because to ensure full synchronisation between action and audio we must effectively use the sound hardware as the timer. I can do it with sufficient precision with the Win32 API, while SDL2 gives me a much more coarse approximation to the current queue status (SDL_GetQueuedAudioSize). For the curious, compiling the emulator with the optional compile time parameter -DDEBUG and then running it with "Video: Onscreen status" on will show the current state of the audio buffer on the bottom left corner as a bar.
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 22:55, 17 November 22
Thanks for these explanations @cngsoft . I have a couple of questions/concerns here. Again, I am not a C coding expert at all, please excuse if some of these questions/concerns are stupid.

I understand the problem that you don't want the buffer to become empty, because if I read https://wiki.libsdl.org/SDL_QueueAudio correctly, SDL will then add silence and that probably will sound really bad/weird. Also understand if you don't want the buffer to become too filled, as this may add long lags that are not corrected then anymore.

However, I don't get how just adding the content of audio_buffer here several times will help. With that, you will play the current "tune" twice, thrice, etc (depending how often you add it). Wouldn't that sound equally bad/weird? But I understand that normally the buffer should hopefully not run empty, so hopefully this situation will not happen (very often).

Another question in mind is if the computation
audio_session=SDL_GetQueuedAudioSize(session_audio)/sizeof(audio_buffer);
audio_buffer is an array of type AUDIO_UNIT with AUDIO_LENGTH_Z*AUDIO_CHANNELS elements in it. SDL_GetQueuedAudioSize() gets you the number of bytes in the queue. But the size of AUDIO_UNIT itself is not necessarily one byte. In fact, on my system it seems to be two bytes. So, I believe (but I may be wrong) the computation would have to be

audio_session=SDL_GetQueuedAudioSize(session_audio)/(sizeof(audio_buffer)*sizeof(AUDIO_UNIT));

Regarding the "keep the buffer at 50%", my understanding is that your concept is that you always want to be 50% of certain multipliers of the size of audio_buffer units in the SDL queue. Is the 100% then 16  times for "non-accelerated" and 8 times for "accelerated"? So 8 and 4 respectively? My big doubt here is that with these numbers, the delay will always be very visible. Maybe the results on Windows are different (or maybe for Windows this all here doesn't play any role), but it's really irritating in a game when you, for example, shoot or move, and the corresponding sound for the first shot/move already comes when you already make the second shot/move. This is really what currently happens under Linux, I am not overstating :)

If you want to use this concept, you should think to make the "100%" configurable. I will probably set it for my system to 0 (or 1?)  then, so that simply in any run of session_render, the audio_buffer is appended to the SQL queue without any further checks (unless the queue becomes too long and the algorithm decides not to add the audio_buffer anymore).

Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 00:16, 18 November 22
The hint to compile with the parameter -DDEBUG was a good one.

While watching darts in parallel ( :) ), I did some testing.

My conclusion is that it's best to set the spec.samples to AUDIO_LENGTH_Z and keep the buffer very small. At least there could be an option to do this.

I can do tests of more scenarios if that helps.


Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 00:33, 18 November 22
Two more test scenarios. This time I have commented out the line "for (j=audio_session>0?audio_session>n?0:1:n;j>0;--j) // pump audio" so that the SDL_QueueAudio(...) command is simply every time executed exactly once. I believe with this change, setting sound acceleration doesn't make a change. I didn't change AUDIO_N_FRAMES (so it's set to 16).


I believe the setting in the 2nd bullet point is the best result so far, although I also see the danger that on other systems, buffer may either run dry (which then likely results in distorted sound due to added silence) or runs full (due to no correction). Nevertheless, I would probably prefer to have at least an optional setting for such a risky sound setup (maybe there can be at least a correct for too long buffers still). Actually this probably is what "sound acceleration" actually should do :)
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 01:22, 19 November 22
I thought a bit further about this. As said in my previous approach, I believe this approach

Quote from: cngsoft on 22:10, 17 November 22try to keep the buffer at 50% capacity at all times

is not optimal, because it will just keep a constant delay of the sound which is then played with a delay of AUDIO_N_FRAMES / 2 *  AUDIO_LENGTH_Z.

I believe it's better to define a minimum buffer fill (which maybe could even be switched off if sound acceleration is switched on) and add the audio_buffer twice to the queue if the buffer fill is below minimum (then automatically the buffer will fill up). Additionally, it is already the case, there should be a maximum buffer fill (AUDIO_N_FRAMES times the sizeof(audio_buffer)), and if the fill exceeds the maximum, audio_buffer won't be added until we are below the maximum again. (*see remark at the end)

The corresponding code would look like this:
if (session_audio)
{
    static BYTE s=1; if (s!=audio_disabled)
        if (s=audio_disabled) // silent mode needs cleanup
            memset(audio_buffer,AUDIO_ZERO,sizeof(audio_buffer));
    audio_bytes_queued=SDL_GetQueuedAudioSize(session_audio);       
    audio_session=audio_bytes_queued/sizeof(audio_buffer);

    // check if audio queue fill is below minimum and needs to be filled
    if (session_hardplay == 0 && audio_bytes_queued < AUDIO_MIN_BYTES)
        SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));
   
    // check if audio queue is too full. if it's not, add audio_buffer
    if (audio_session < AUDIO_N_FRAMES)
        SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));

}


In order for this to work, we also need to add at the beginning of the file

#define AUDIO_MIN_BYTES AUDIO_LENGTH_Z * AUDIO_CHANNELS * sizeof(AUDIO_UNIT) / 2 // minimum buffer fill
int audio_bytes_queued=0;

Also, I would suggest to set
spec.samples=AUDIO_LENGTH_Z;as this seems not to harm to make latency even a bit better.

* Now the remark: If the buffer gets too full, current solution is not to add audio_buffer to the audio queue anymore. With this, we will make sure that the buffer fill will end up below the maximum size again, but probably it will stay just below the maximum size, causing a constantly high latency. Potentially if such an event (buffer overrun) happens, it would be better not to add the audio_buffer anymore several times in a row. However, the above implementation does not consider this thought yet. This is a problem because it seems the audio buffer runs quite full when doing UI actions (I didn't see it running full during my tests as long as I didn't use the UI) , so we need a mechanism to the buffer empty again.
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 11:34, 19 November 22
Sorry for writing so much here :)

One additional thought (and again, please correct me if I am wrong... I am currently teaching myself how these things work, and I may make mistakes).
If I get it right, then one audio_buffer of cpcec represents 20 ms of sound (since AUDIO_LENGTH_Z = 41000 Hz / 50 Hz). That means if there is one full such audio_session (as you call the variable in the code) in SDL's audio queue, then you have already a latency of 20 ms. In the default, you are keeping (with "audio acceleration" enabled) 8 such audio_sessions in the queue, which gives a latency of 160 ms (it will be 320 ms without audio acceleration). Actually, this is really a high latency, no wonder that this is easily noticeable and irritating. Was it the intention to program things this way (i.e. is there a "technical" need for this?) or is this simply a bug? Or do I do a mistake in my thinking?

If my write-up is correct, we should probably change the code to keep this target for queued bytes much(!) lower. I need to do a bit more research what latency between audio and video usually is considered acceptable. I understand we don't want buffer to underrun, as then SDL will fill the gaps with silence and that creates the sound distortion that I heard in some of my earlier tests. First thought would be to keep the latency between 0 and 40 ms maybe?

Btw, to show the current latency, add following debug line to the "if (session_audio) { ... }" part:

printf("Current sound delay: %d ms\n",audio_bytes_queued/171); 
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 16:43, 19 November 22
New attempt of a diff to improve audio_latency.

Idea: target the audio queue (SDL queued audio) to be always filled with between 1/2 (with audio acceleration: 1/4) and 8 (with audio acceleration: 4) frames. Theoretically, that should keep the audio latency between 10 ms and 160 ms (with acceleration on: between 5 ms and 80 ms). If the queued audio is above these boundaries, do not add audio to the queue anymore until queue is either empty or below the minimum targeted fill.

Additionally, I have set "spec.samples=AUDIO_LENGTH_Z;" (as this seems to improve the latency also and seems to be smooth) and am also cleaning the audio_queue whenever the menu is used or the session is considered dirty.

Please see the diff for the file cpcec-ox.h. It's the only file I changed. Theoretically, one could make min and max for the buffer size (AUDIO_MIN_FRAMES_TH, AUDIO_N_FRAMES) configurable, but after limited(!) testing (on just my Linux system), it seems cpcec runs fine with these changes/settings.

--- cpcec-ox.h.backup    2022-11-15 22:21:51.977347379 +0100
+++ cpcec-ox.h    2022-11-19 15:26:26.932514709 +0100
@@ -60,8 +60,8 @@
     #define AUDIO_ZERO 0
 #endif // bitsize
 #define AUDIO_CHANNELS 2 // 1 for mono, 2 for stereo
-#define AUDIO_N_FRAMES 16 // safe on all machines, but slow; must be even!
-
+#define AUDIO_N_FRAMES 8 // original: 16, which is safe on all machines, but slow; must be even!
+#define AUDIO_MIN_FRAMES_TH 2 // keep audio queue over at least 1/2th of buffer length (>=10 ms latency)
 VIDEO_UNIT *video_frame,*menus_frame,*video_blend; // video and UI frames, allocated on runtime
 AUDIO_UNIT *audio_frame,audio_buffer[AUDIO_LENGTH_Z*AUDIO_CHANNELS]; // audio frame
 VIDEO_UNIT *video_target; // pointer to current video pixel
@@ -70,6 +70,8 @@
 BYTE video_interlaced=0,video_interlaces=0; // video scanline status
 char video_framelimit=0,video_framecount=0; // video frameskip counters; must be signed!
 BYTE audio_disabled=0,audio_session=0; // audio status and counter
+int audio_bytes_queued=0, audio_min_bytes_queued=0, audio_bytes_min=0, audio_bytes_max=0;
+BYTE audio_bytes_reset=0;
 unsigned char session_path[STRMAX],session_parmtr[STRMAX],session_tmpstr[STRMAX],session_substr[STRMAX],session_info[STRMAX]="";
 
 int session_timer,session_event=0; // timing synchronisation and user command
@@ -707,7 +709,8 @@
         session_shift=session_event=0; // quit!
     else
         session_shift=!!(session_event&0x4000),session_event&=0xBFFF;
-    return;
+    audio_bytes_reset = 1;
+    return;
 }
 
 void session_ui_textinit(char *s,char *t,char q) // used by session_ui_text and session_ui_scan
@@ -1353,6 +1356,8 @@
         spec.format=AUDIO_BITDEPTH>8?AUDIO_S16SYS:AUDIO_U8;
         spec.channels=AUDIO_CHANNELS;
         //spec.samples=4096; // safe value?
+        spec.samples=AUDIO_LENGTH_Z;
+//        printf("samples=%d\n",spec.samples);
         if (session_audio=SDL_OpenAudioDevice(NULL,0,&spec,NULL,0))
             audio_frame=audio_buffer;
     }
@@ -1613,7 +1618,7 @@
         }
     }
     if (session_dirty)
-        session_dirty=0,session_clean();
+        session_dirty=0,audio_bytes_reset=1,session_clean();
     return 0;
 }
 
@@ -1665,10 +1670,33 @@
         static BYTE s=1; if (s!=audio_disabled)
             if (s=audio_disabled) // silent mode needs cleanup
                 memset(audio_buffer,AUDIO_ZERO,sizeof(audio_buffer));
-        audio_session=SDL_GetQueuedAudioSize(session_audio)/sizeof(audio_buffer);
-        int n=AUDIO_N_FRAMES>>session_hardplay;
-        for (j=audio_session>0?audio_session>n?0:1:n;j>0;--j) // pump audio
-            SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));
+        audio_bytes_queued=SDL_GetQueuedAudioSize(session_audio);       
+        audio_session=audio_bytes_queued/sizeof(audio_buffer);
+        if (audio_bytes_queued<audio_bytes_min) audio_bytes_min = audio_bytes_queued;
+        if (audio_bytes_queued>audio_bytes_max) audio_bytes_max = audio_bytes_queued;
+
+        audio_min_bytes_queued = sizeof(audio_buffer) / (AUDIO_MIN_FRAMES_TH<<session_hardplay);
+//        printf("session_hardplay=%d, queued bytes=%d, min fill=%d, max fill times=%d, audio_buffer_size=%d, audio_session=%d\n",session_hardplay, audio_bytes_queued, audio_min_bytes_queued, AUDIO_N_FRAMES>>session_hardplay, sizeof(audio_buffer), audio_session);
+//        printf("Sound delay - current: %d ms  -  min: %d ms  -  max: %d ms  - reset: %d\n",audio_bytes_queued/171, audio_bytes_min/171, audio_bytes_max/171,audio_bytes_reset);
+       
+        // if queued bytes below the minimum (or 0), stop the resetting of the queue
+        if (audio_bytes_queued == 0 || audio_bytes_queued < audio_min_bytes_queued)
+            audio_bytes_reset = 0;
+
+        // check if audio queue fill is below minimum and needs to be filled
+        if (audio_bytes_queued < audio_min_bytes_queued) {
+            //printf("buffer needs to be filled!\n");
+            SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));
+        }
+
+        // check if audio queue is too full. if it's not, add audio_buffer. otherwise, reset the buffer
+        if (audio_session >= (AUDIO_N_FRAMES>>session_hardplay))
+            audio_bytes_reset = 1;
+        if (audio_bytes_reset == 0) {
+            // printf("adding audio buffer to queue\n");
+            SDL_QueueAudio(session_audio,audio_buffer,sizeof(audio_buffer));
+        }
+
     }
 
     if (session_wait) // resume activity after a pause
Title: Re: CPCEC a new emulator from cngsoft
Post by: cngsoft on 02:10, 25 November 22
Quote from: sb1903 on 16:43, 19 November 22New attempt of a diff to improve audio_latency.
Interesting developments. I wonder how well they behave when disabling realtime for a while, then enabling it back (pressing F6, waiting some seconds, then hitting F6 again), or when loading sped-up tapes (that temporarily remove speed control)
Title: Re: CPCEC a new emulator from cngsoft
Post by: sb1903 on 15:01, 27 November 22
Hmm, I don't have any sped-up tapes here, but I tried F6 and also switched on/off different multipliers for the CPU clock. So far, I was not able to trigger any bad behavior with this on my setup.
Powered by SMFPacks Menu Editor Mod