110 Commits

Author SHA1 Message Date
Andre Zeps
266b32dddf Documentation and removal of unused code 2026-05-25 22:12:43 +02:00
Andre Zeps
2c0332e40e CDIC: Add support for Subchannel R..W
- Allows playback of CD+G
2026-05-25 22:12:43 +02:00
Andre Zeps
7f3be52193 FMV: Fixed regression of GOP Timecode
- Issue was introduced with 594bae844
- Fixes division by zero with Addams Family Disc 2 when
  opening playback controls
2026-05-02 19:07:03 +02:00
Andre Zeps
98eb8b7755 Added test ROM for TOC analysis 2026-05-02 19:07:03 +02:00
Andre Zeps
2b2c222d82 SERVO: Perform machine reset when a CD image is remounted with a closed tray
- Remount is allowed without reset, when the CD wasn't read yet during power cycle
- Allows changing a disc with multi disc titles after application induced eject
- Added debug option to allow replacing the image during operation
- Also fixed tray close on image mount
2026-02-28 21:53:11 +01:00
Andre Zeps
c0faa4906e FMV: Added support for MPEG frame synced register updates
- Required for games like Lost Ride
- Partially breaks https://github.com/Slamy/CDi_FMVTest/tree/main/fmv_moving_window again
- Mechanism not yet fully understood
2026-02-22 14:12:37 +01:00
Andre Zeps
ec0ff3b771 FMA: Fixed regression with timing of buffer underflow IRQ
Fixes regression by 7e3d995781
2026-02-22 14:12:37 +01:00
Andre Zeps
112d467b92 FMV: Altered timing of DTS register
- Slightly improves stability of MPEG pause and continue
  with "Lost Ride"
  Still not 100% there...
2026-02-22 14:12:37 +01:00
Andre Zeps
594bae844e FMV: Fixed timing of frame events and parameters
- Decoupled SEQ event from GOP event.
  Now behaves like real VMPEG hardware
- Fixes Lost Ride gameplay after vehicle charge intro
- Fixes timing accuracy of temp ref and time code
  Measurable with mv_status()
2026-02-22 14:12:37 +01:00
Andre Zeps
176e9b6403 FMV: Add support for mid stream sequence parameter change
- Fixes graphical issues after vehicle charge intro
  in "Lost Ride"
2026-02-22 14:12:37 +01:00
Andre Zeps
66cf1711ca FMV: Add 65ms playback delay after SYSCMD Play
- Fixes MPEG buffer underflow with certain titles
  like "Mad Dog McCree"
- Measured on real hardware with 30 and 25 FPS MPEG stream.
  Display rate seems irrelevant
2026-02-22 14:12:37 +01:00
Andre Zeps
6674435be8 Added manual for usage with homebrew software 2026-02-20 15:28:45 +01:00
Andre Zeps
c6c211cd76 MCD212: Increased ROM bus bandwidth
- Was slightly slower than real hardware. Now slightly faster than real hardware.
- Fixes black flicker during the intro of "The Ultimate Noah’s Ark", when
  running in 60 Hz mode

This title is on the edge when it comes to using DC_PWrLCT just a few lines
before it is too late. This resulted into wrong mixing weights for single frames
2026-01-25 11:37:40 +01:00
Andre Zeps
4a8d44aebd Moved test ROMs for simulation to a separate folder 2026-01-25 11:37:39 +01:00
Andre Zeps
84dd96fc43 MCD212: Fix latch timing of DYUV Abs. Start Value
- Ensure DCA completion before start value is utilized
- Fixes graphical corruption in "Lost Eden" during the character screen of "Dina"
2026-01-22 20:59:18 +01:00
Andre Zeps
c029785c57 FMV: Added averaging filter to MPEG video during VCD pixel clock mode
- Isn't visible on CRT but improves perceived HDMI quality
- Can be deactivated in debug options to show the improvement
2026-01-22 20:59:18 +01:00
Andre Zeps
b8e3baca21 FMV: Allow up to 17 frames in picture FIFO
- Fixes long videos with small frame size
- Fixes videos in "Les Guignols de l’Info"

A user has mentioned that "Les Guignols de l’Info" sometimes has problems with videos.

After analysis of "/cd/rtf/application.rtf" from said disc,
starting at byte position 0x11DEA000, it turns out that the
pictures in FIFO (0x0E040A4) can go up to 17 even on real hardware.
This has never happened before and I've assumed that 8 is the maximum.

This is an issue because DecodTS of fdrvs1 calculates the DTS of the next picture with
the formula GEN_DEC_TIM1 (0x0E040A0) - GEN_PINF (0x0E040A4) * GEN_PICT_RATE (0x0E040A8).
This means that GEN_DEC_TIM1 is constantly increasing but GEN_PINF was limited to 8
before. This resulted in having the next picture to show getting more and more out of reach
of V_SCR.

On real hardware, the FIFO reaches 14 until playback starts.
2026-01-04 11:23:43 +01:00
Andre Zeps
f855ffc493 FMV: Fixed some meta data returned by MV_Status
- Fixed temporal ref and both frame rate registers
- Effect on commerical titles unknown
2025-12-28 15:49:43 +01:00
Andre Zeps
92a47322d9 FMV: Fix occurrence of NIS event when playing another video
- Fixes soft lock of "Brain Dead 13" after company logo

Also decoupled frame display from FIFO consumption as the real hardware
will probably also do. I don't recall why I even made that change.
Partially reverts ca4216f95
2025-12-28 15:49:43 +01:00
Andre Zeps
948eb013f2 FMV: Added support for VCD pixelclock
- Fixes width of VCDs according to the White book
- Current implementation uses next neighbor approach
  as a first test. Linear filtering might be a better option.

This change is not 100% accurate to hardware. I can measure,
that at least my VMPEG DVC cuts off 1 pixel on the left
and 5 pixels on the right. I ignore this phenomenom for now
and show all 352 pixels, a VCD is delivering.
2025-12-28 15:49:43 +01:00
Andre Zeps
1bdb01cb74 FMV: Improved timing of latched offset settings
- VCUP and DCL IRQs should now behave like real hardware
- "FMV Moving Test" is now behaving as expected

DCL is not documented in any way. It's just that it seems
to occur at the same time as VCUP and a compare behaves differently
because of that
2025-12-28 15:49:43 +01:00
Andre Zeps
3fff0f0e41 FMV: Fix for pl_mpeg parsing single frame videos
This library is not suited for playback of short MPEG files and
pauses in stream delivery at the same time.
If the stream has not enough data, frame generation is aborted.
So one would assume to just always wait until enough data
is there to decode. But that is trap, because short MPEG files
are never decoded on time.

This fix does 2 things
- If enough data for one frame to decode is available, communicate
  at least 1 frame in the FIFO to the driver even so it is not yet
  fully commited by pl_mpeg.
- Don't wait for data as soon as the driver has
  instructed VMPEG to decode and play. I would guess that the buffer is
  filled enough at that point to not underflow.
- Since my guess was wrong as underflows can still occur,
  to abort the wait, the output buffer must be empty too.

There is also another fix here. The worker descriptor must now
be manually committed to increment the command counter.
Since waiting for data can now be aborted, it is possible
that a requested buffer for a worker descriptor needs to be thrown away,
which resulted into a wrong increment and an assertion failure ont the worker side.
2025-12-28 15:49:43 +01:00
Andre Zeps
da3bfd7467 FMV: Added 3rd MPEG macroblock worker core
- Increases computing power for pixel operations
- Fixes freeze at timecode 04:32 of
  "Star Trek VI - Terre Inconnue (France) (Disc 1)"
  during the shock wave scene
2025-12-21 22:02:28 +01:00
Andre Zeps
556c2c57f5 Simulation: Verilator update fixes
Required for Verilator 5.042 2025-11-02

Also made the copy to mister script slightly more useful
2025-12-18 13:30:33 +01:00
Andre Zeps
957662932e Simulation: Added fdrvs1 variable analysis
- Provides better insight into state of FMV driver
2025-12-18 13:30:33 +01:00
Andre Zeps
ca4216f956 FMV: Added support for window, screen, display offset and NIS events
- Fixes wrong offset with "Les Guignols de l’Info"
- Fixes graphical corruption with "Christmas Crisis"
- Fixes "skewed image corruption" with MPEG video
- Adds support for NIS video event due to update of sequence parameters
- Fixes "Philips Logo Intro" with "Brain Dead 13"

Dynamic behavior is probably not yet correct.
- "Christmas Crisis" is stuttering in the bonus rides.

It should be noted that "Brain Dead 13" is still not working
after the company logo.
2025-12-18 13:30:33 +01:00
Andre Zeps
dcb1cd7ef8 MCD212: Fixes OFF coding
- Fixes graphical corruption in "David and Goliath"
- Removed forgotten hack for "Kether"
2025-12-18 13:30:33 +01:00
Andre Zeps
249adbfaef Simulation: Added syscall analysis
- Provides better insight into program flow
2025-12-15 22:37:24 +01:00
Andre Zeps
db44bc7304 MCD212: Fixed switch from CLUT to DYUV without VSR reload
- Display file reader now avoids writing bitmap data into the pipeline
  during a blank phase
- Fixes graphical corruption during fade transition in "Lost Eden"
  (noticable in first area when going forward and then back)
2025-11-23 21:10:11 +01:00
Andre Zeps
842b3f1d74 FMA: Fixed decoding flag in status register
- Fixes ASY_Stat info of MPEG Audio handle
- Fixes perpetual start-stop of music in "Lost Eden"
- Fixes early stop of playback in "Les Guignols de l’Info"
- Fixes audio stop of "Mutant Rampage: Bodyslam" after music has played
- Fixes current stream id as returned by ma_status()
  This might not have an effect at all but it is more accurate
2025-11-23 21:10:11 +01:00
Andre Zeps
e1adbef8b9 Merge of DVC branch into mainline
# Conflicts:
#	.gitmodules
#	CDi.sv
#	README.md
#	files.qip
#	rtl/audiodecoder.sv
#	rtl/cdic.sv
#	rtl/cdic_clock_gen.sv
#	rtl/cditop.sv
#	rtl/hps_cd_sector_cache.sv
#	rtl/mcd212.sv
#	rtl/tg68k/TG68KdotC_Kernel.vhd
#	scripts/copy_to_mister.sh
2025-11-14 23:28:14 +01:00
Andre Zeps
09778e02a0 Removed git submodules
Copy of tg68k added to rtl subfolder

Last revision
https://github.com/Slamy/TG68K.C.git
a1c18a18a073b33f49aaf092509da06bc14f47ed

This should make merges with mainline easier
2025-11-13 20:12:20 +01:00
Andre Zeps
76ce55a0ae VMPEG: Fixed image size registers 00E04002 and 00E04004
Written values were stored but could not be read back

Concerning "Addams Family" - Disc 2, it crashed when entering the menu.
This was caused by a "Division by Zero" exception, resetting the machine.
This was caused by corrupted data, caused by double execution of the instructions
at 0x0275ed0 (program of the movie player) which causes a zero value at 0xD01D8A.
This problem already manifests even before the movie starts playback, but the crash itself is only occuring when the value is read.
This happens only when the movie player menu is opened.

All of this was caused by the values in mentioned registers being not the written ones but artificial ones when the VMPEG verilog implementation was first conceived.

So, this change does:

- Fixes "Division by Zero" when opening movie player menu with "Addams Family" - Disc 2
2025-11-13 20:12:20 +01:00
Andre Zeps
e70c8e7728 Prints of Exceptions
Will make analysis of Exceptions easier in the future.
Also fixed videosim compiling.
2025-11-13 20:12:20 +01:00
Andre Zeps
d5c17b7159 SCC68070: Removed privilege violation from SR read
The TG68k should now behave more like a 68000 here.
Not like a 68010, which doesn't allow SR reading in user mode.

- Fixes bootup of "Lost Eden"

Game is still not playable. It seems to hang periodically.
I assume an MPEG audio problem?
2025-11-13 20:11:55 +01:00
Andre Zeps
ad65b8a5f3 Altered linker and startup scripts
in an attempt to fix memory errors after resets.
The error is no longer occuring

- .bss segment erase no longer overwrites first word of .noinit
- .data segment no longer overwritten by itself

Also added an endurance test which scans through the video
and tries to encourage this issue
2025-11-13 19:45:25 +01:00
Andre Zeps
b724f4ab4f FMV: Increased stability of decoding process resume
- Frame buffer indexes kept between resets
  - Avoids display of not committed buffers
- Discard frames until first I frame
  - Avoids corrupted graphics during scanning
- Sequence header configuration protected from restart
  - Configuration validity stored outside of soft core

- Fixes continuing playback of "Coneheads" which
  only has one SEQ header at the start of whole stream

- Fixes scanning through Top Gun
2025-11-10 16:50:36 +01:00
Andre Zeps
49ffdbf434 Cleanup of source code and reset behaviour 2025-11-09 16:28:18 +01:00
Andre Zeps
413b8f78bb VMPEG: Interlocked MPEG system clock reference with CD sector time
Fixes desynchronisation in fmvdrv after 18 minutes of Top Gun

Thanks to cdifan for pointing this out
Source:
http://icdia.co.uk/notes/technote097.pdf
TN #097 - The Full Motion System for CD-I,
section 4. ARCHITECTURE OF FULL MOTION CD-I PLAYER
VMPEG can be disabled via OSD
WIP
FMV: Increased soft core clock rate to 92 MHz

Was 80 MHz before, which wasn't enough
Fixes Top Gun CPU overload at timecode ~15:48
2025-11-02 13:11:42 +01:00
Andre Zeps
e5a2b93918 Simulation traces different MPEG streams in separate files 2025-11-02 13:11:42 +01:00
Andre Zeps
f3437725e8 FMV: Increased decoder clock rate to 86 MHz
Also renamed a number of variables.
Early on 60 MHz was considered but was simply too slow.
2025-11-02 13:11:41 +01:00
Andre Zeps
142207fcca FMV: Increased accuracy of video IRQs
- Added EOI - ISO 11172 End Code detection in demuxer
- Added EOS - Sequence End Code detection in decoder firmware
- SEQ, GOP and PIC no longer generated by bitstream decoder
- PIC now aligned to vblank before a new picture is shown
- SEQ and GOP now aligned to PIC when its the first I frame of a GOP
- LPD now aligned to PIC when it was the last picture
- BUF - Buffer underflow now detected by firmware
- Added pictures in FIFO register (00E040A4)
- Added DTS register (00E040A0)
- Added VDI register for DTS updates (0E0408C)
- FMV Playback start no longer decided by demuxer but by VMPEG ROM
- Added pixel width calculation for later use

- Fixes hang at the end of the Space Ace Intro

Names of events to according
https://github.com/TwBurn/cdi-docs/blob/main/mv_cbnd.md#mv_trigger-define-mpeg-video-events-to-signal
2025-11-02 13:11:41 +01:00
Andre Zeps
0fc841c7ea CDIC: Added CD sector cache
Ensures a consistent stream of CD data from HPS,
even when MiSTer Main stumbles once.
Request of sector data is decoupled from sector ticks.

This will still not allow screenshots being performed,
as MiSTer Main will hang for a second.
2025-10-16 18:07:31 +02:00
Andre Zeps
0c1ac322ff CDIC: Added CD sector cache
Ensures a consistent stream of CD data from HPS,
even when MiSTer Main stumbles once.
Request of sector data is decoupled from sector ticks.

This will still not allow screenshots being performed,
as MiSTer Main will hang for a second.
2025-10-06 17:43:39 +02:00
Andre Zeps
5620998e4a Simulation with live trace control 2025-10-06 17:43:39 +02:00
Andre Zeps
ce5edf3b68 Speedup of simulation
MPEG clock rate is increased when the FIFO level raises
and more computing power is required.
2025-10-06 17:43:39 +02:00
Andre Zeps
58446c336c VMPEG: Added Stream filter
Fixes audio playback of
"Burger King - CD-i Training - November, 1997 (USA)"
2025-10-06 17:43:39 +02:00
Andre Zeps
6eca879175 FMV: Added validity state to frameplayer
Only show data that was committed by the decoder.
Avoids scrambled graphics before playback starts.

Also added experimental "Last Picture Displayed" flag
2025-10-06 17:43:39 +02:00
Andre Zeps
34f4371904 FMV: Added display offset registers
- Fixes the cut off picture with "The 7th Guest".
- Might not be accurate. More investigation needed.

Also removal of debugging code.
2025-09-29 12:46:40 +02:00
Andre Zeps
741ac6b9c3 Fixed clock domain crossing 2025-09-29 12:46:40 +02:00