Author Topic: CPCEC a new emulator from cngsoft  (Read 35384 times)

0 Members and 1 Guest are viewing this topic.

Offline cngsoft

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

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

EDIT: there's also a bug in CPCEC-RT.H that leads to "dirty" videos because of bad cleanup between new videos: the last line of session_createfilm() uses MEMZERO with a pointer rather than an array, failing to fulfill its purpose. Replace it with `return memset(session_filmvideo,0,sizeof(VIDEO_UNIT)*SESSION_FILMVIDEO_LENGTH),session_filmcount=0;`
« Last Edit: 13:37, 24 May 21 by cngsoft »
(if you can't see the banner right now my server is currently offline)

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #151 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:
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #152 on: 15:48, 24 May 21 »
I think I found the bug in the raw AVI output:

I wrote the changes you asked.

Here are the result:

This seems correct again:

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

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

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

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

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

Generate AVI again

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

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

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

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

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

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

What is the true duration of these captures?
« Last Edit: 15:50, 24 May 21 by cpcitor »
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

Offline cngsoft

  • CPC6128
  • ****
  • Posts: 180
  • Country: es
  • Liked: 763
  • Likes Given: 362
Re: CPCEC a new emulator from cngsoft
« Reply #153 on: 21:18, 24 May 21 »
I wrote the changes you asked.

Here are the result:

This seems correct again:

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

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

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

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

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

Generate AVI again

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

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

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

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

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

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

What is the true duration of these captures?

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

Re: video duration, the header of AVI files includes several measurements, including the expected duration of the video and audio streams. Both values must match time-wise (they can differ sample-wise because of the impact of lossy data compression) but the old XRF, by storing the audio sample size improperly (always 4 bytes, rather than 4 bytes for 16-bit stereo and 2 bytes for 8-bit stereo) made the AVI header look like the audio stream was twice as long (4:2) as the video stream. (also, abadia-2 is shorter because I simply stopped recording when the writer paused before turning pages, rather than actually keeping a timer)
(if you can't see the banner right now my server is currently offline)

Offline cngsoft

  • CPC6128
  • ****
  • Posts: 180
  • Country: es
  • Liked: 763
  • Likes Given: 362
Re: CPCEC a new emulator from cngsoft
« Reply #154 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..
« Last Edit: 14:23, 25 May 21 by cngsoft »
(if you can't see the banner right now my server is currently offline)

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #155 on: 12:50, 25 May 21 »
https://github.com/cpcitor/cpcec updated with latest patch!
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #156 on: 08:25, 10 June 21 »
https://github.com/cpcitor/cpcec updated with latest patch!

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

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

    This commit corresponds to archive: cpcec-20210526.zip
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

Offline cngsoft

  • CPC6128
  • ****
  • Posts: 180
  • Country: es
  • Liked: 763
  • Likes Given: 362
Re: CPCEC a new emulator from cngsoft
« Reply #157 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)




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.
« Last Edit: 15:54, 10 June 21 by cngsoft »
(if you can't see the banner right now my server is currently offline)

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #158 on: 17:01, 10 June 21 »
Let's update the update with further updates: (pictured here, "Trigger" for CPC, "Enforcer" for CPC Plus, "Mike Gunner" for Spectrum 48k and "Solo" for Spectrum 128K)

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

Offline cngsoft

  • CPC6128
  • ****
  • Posts: 180
  • Country: es
  • Liked: 763
  • Likes Given: 362
Re: CPCEC a new emulator from cngsoft
« Reply #159 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.
(if you can't see the banner right now my server is currently offline)

Offline cpcitor

  • The user previously known as FindYWay
  • 464 Plus
  • *****
  • Posts: 356
  • Country: fr
  • My heart still runs on traditional CPC.
    • My code for the CPC.
  • Liked: 197
  • Likes Given: 452
Re: CPCEC a new emulator from cngsoft
« Reply #160 on: 19:11, 29 June 21 »
Here we have two small updates in a row:
* 20210624 -- minor patch adding Spectrum Dandanator support, and making both emulators able to load Dandanator cartridges from the command line and the key F3. Several heuristics ensure that the cartridges match the current system.
* 20210626 -- minor patch fixing several format errors ("%i" in place of "%d" or "%u" and so on), a bug in the CRTC (3D cylinders part of "PhX" on CRTC3) and another one in the Spectrum Dandanator ("LD (DE),A" trap). Slightly safer snapshot block loading on both CPCEC and ZXSEC.

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

Propagated to https://github.com/cpcitor/cpcec . Congrats again cngsoft for your work.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.