Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

very high latency when reading from CDs (Win95) (slow CD reads) #5361

Open
2 tasks done
checktext00 opened this issue Jan 1, 2025 · 4 comments
Open
2 tasks done

very high latency when reading from CDs (Win95) (slow CD reads) #5361

checktext00 opened this issue Jan 1, 2025 · 4 comments
Labels

Comments

@checktext00
Copy link

checktext00 commented Jan 1, 2025

Describe the bug

There is very high latency when reading files from a CD in Windows 95. I'm using the almost default win95.conf from the guide

I tested this with a 5.5 MB .wav file, copied from the CD to the C: drive. I opened the file 10 times on the CD, then 10 times on the C: drive

on the CD it takes an average of 5 seconds to play the audio after opening the file
on the C: drive it take around 1.20 seconds

  • I tested this with both a Zstandard compressed CHD, and the same CD as an uncompressed BIN/CUE
  • I tested this with both
[ide, secondary]
cd-rom insertion delay=4000

enabled and commented out in win95.conf

On my game with audio tracks on the CD, the game sometimes freezes for a second or so when it loads another track. If I turn the in-game radio off it doesn't freeze anymore when loading audio tracks. This game has an optional installer that can save some files to the hard drive (which by default doesn't include the radio audio), but if I copy the .wav audio tracks into its Program Files folder on the HDD it will use them instead of the CD tracks (no more audio load freezing).

macOS 11, DOSBox-X 2024.12.04 SDL2

Steps to reproduce the behaviour

play an audio file from a CD and compare the same file read from the HDD (I tested this with an actual file, not a music CD audio track that plays on regular CD players)

Expected behavior

it should take the same amount of time to play the audio

What operating system(s) this bug have occurred on?

macOS 11

What version(s) of DOSBox-X have this bug?

DOSBox-X 2024.12.04 SDL2

Used configuration

No response

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

  • I have searched and didn't find any similar bug report.

Code of Conduct & Contributing Guidelines

  • I agree to follow the code of conduct and the contributing guidelines.
@checktext00 checktext00 added the bug label Jan 1, 2025
@joncampbell123
Copy link
Owner

What you're probably seeing is the intentional delay added by DOSBox-X whenever the virtual CD-ROM drive has "spun down" as real drives do when they're not in use.

When the guest issues a read to the drive, the drive has to spin back up before it can provide data to the OS. DOSBox-X emulates that as well.

If you run with the --debug option with the console window open, you should see messages that appear when the virtual CD-ROM drive spins down, and spins up again.

@checktext00
Copy link
Author

What you're probably seeing is the intentional delay added by DOSBox-X whenever the virtual CD-ROM drive has "spun down" as real drives do when they're not in use.

When the guest issues a read to the drive, the drive has to spin back up before it can provide data to the OS. DOSBox-X emulates that as well.

If you run with the --debug option with the console window open, you should see messages that appear when the virtual CD-ROM drive spins down, and spins up again.

oh ok, thanks

is there a way to disable this similar to

[dos]
hard drive data rate limit=0
floppy drive data rate limit=0

also, is this really emulating the original hardware? I can't imagine the game freezing when loading audio tracks was the original behavior on real hardware (all the official installation options for the game leave the audio tracks on the CD, and the game also has a no-install play-straight-from-CD option). The game is SimCopter btw so it's not some random low budget title

@joncampbell123
Copy link
Owner

Yes, there are dosbox.conf options to control spin down and spin up delay.

Under the ide sections of dosbox.conf, such as [ide, primary] or [ide, secondary] are options "cd-rom spinup time" and "cd-rom spindown timeout".

There is also one to control the delay in swapping CDs needed for Window 95 to detect a CD change (it doesn't detect a change if it's too fast).

See the reference conf file for details.

@checktext00
Copy link
Author

Hey thanks for the help, but I still have the same issue (it takes 5 seconds to play the audio from my test file on the CD vs less than 2 seconds from the emulated HDD)

I checked the reference conf file, and added the options to my win95.conf:

[ide, primary]
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=0
cd-rom spinup time=0
cd-rom spindown timeout=0

[ide, secondary]
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=0
cd-rom spinup time=0
cd-rom spindown timeout=0

[autoexec]
IMGMOUNT E SimCopter-Classics.cue -t iso -ide 2m

then I launched with
~/Applications/dosbox-x.app/Contents/MacOS/dosbox-x -defaultdir ~/DOSBox-X -conf win95.conf -debug

Now, when playing the .wav audio file in Windows 95, in the macOS Terminal that stays open I can see:

LOG: ATAPI CD-ROM: triggered to spin up from idle
LOG:  855178756 DEBUG BIOS:APM BIOS call AX=530b BX=0x0000 CX=0x0006
LOG: ATAPI CD-ROM: spinup complete
LOG:  909299244 DEBUG BIOS:APM BIOS call AX=530b BX=0x0000 CX=0x000b
LOG:  942548536 DEBUG BIOS:APM BIOS call AX=530b BX=0x0000 CX=0x0009
LOG:  973647374 DEBUG BIOS:APM BIOS call AX=530b BX=0x0000 CX=0x0009
LOG: 1001326250       SBLASTER:DMA Transfer:8-bits PCM Playback Mono Auto-Init freq 11025 rate 11025 size 688 gold 0
LOG: 1001326731       SBLASTER:DMA unmasked, starting output, auto 1 block 1375
LOG: 1001351222 DEBUG BIOS:APM BIOS call AX=530b BX=0x0000 CX=0x000a
LOG: 1002584069       SBLASTER:Raising IRQ
LOG: 1003114322 DEBUG BIOS:APM BIOS, 13 calls to AX=5305 BX=0x00e8 CX=0xe138
LOG: 1003133773       SBLASTER:Raising IRQ
LOG: 1003169870       SBLASTER:Raising IRQ

and eventually

LOG: ATAPI CD-ROM: spinning down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants