joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.75k stars 381 forks source link

Emulate empty floppy drive and CD-ROM drive #4853

Open frank-deng opened 7 months ago

frank-deng commented 7 months ago

Is your feature request related to a problem? Please describe.

No response

What you want

Is it possible to emulate a scenario where Floppy/CD-ROM is present but without floppy disk/CD-ROM disc inserted, like VirtualBox does.

Describe alternatives you've considered

No response

Additional information

No response

Have you checked that no similar feature request(s) exist?

Code of Conduct & Contributing Guidelines

rderooy commented 7 months ago

Yes, there should be an option for imgmount to "mount" an empty drive. Especially for running Win9x this would be helpful. The work-around for now is to always have some media in the drive, which for a floppy drive can be an empty disk.

For floppy, this will also require setting the floppy drive type.

joncampbell123 commented 7 months ago

Yes! Not everybody 1990s kid booted their computers with a floppy and a CD inserted in the drives. :)

joncampbell123 commented 7 months ago

I got an initial implementation for mounting an empty floppy and empty CD-ROM drive finished.

Latest commit:

IMGMOUNT 0 -fs none -t floppy -empty IMGMOUNT e: -t iso -empty

rderooy commented 7 months ago

@joncampbell123 nice!

But you should probably add a flag to set the floppy BIOS type, otherwise some software will get confused. I'm thinking of Win9x thinking you have a 5.25" drive (type 2), while you are wanting to use 3.5" 1.44MB (type 4).

joncampbell123 commented 7 months ago

@joncampbell123 nice!

But you should probably add a flag to set the floppy BIOS type, otherwise some software will get confused. I'm thinking of Win9x thinking you have a 5.25" drive (type 2), while you are wanting to use 3.5" 1.44MB (type 4).

It's going to have to be a 1.44MB drive for now, but I'll address that after release March 1st.

joncampbell123 commented 7 months ago

Actually, I added support for the -size numbers for the empty drive, and it will try to match BIOS floppy type code too. That should complete this request.

rderooy commented 7 months ago

I'm not sure what the issue is here, but compiled the latest code and cannot seem to mount an empty floppy or CD-ROM disk drive. some things I tried:

image

joncampbell123 commented 7 months ago

Syntax changed.

It is now:

IMGMOUNT 0 empty -t floppy -fs none

and

IMGMOUNT e: empty -t cdrom

The file name "empty" is now handled as a special name that means "empty drive".

This was done to clean up the code and to make it possible to mount "empty" along with other disk images to a drive so you can use "Swap Floppy" and "Swap CD" mapper shortcuts to rotate between empty and other disk images.

rderooy commented 7 months ago

Thanks,

That works for a 3.5" and CD-ROM drive, it does not seem to work for a 5.25". Or at least, after booting Win98SE it only saw the first floppy drive.

IMGMOUNT 0 empty -fs none -t floppy
IMGMOUNT 1 empty -fs none -t floppy -size 512,80,2,15
IMGMOUNT C hdd.img -ide 1m
IMGMOUNT D empty -t iso -ide 2m

Also, when I tried to mount a CD from the drop-down menus (DOS -> Change current CD image) while running Win98SE, DOSBox-X segfaulted.

Doing the same with a 3.5" diskette image did work.

joncampbell123 commented 7 months ago

Thanks,

That works for a 3.5" and CD-ROM drive, it does not seem to work for a 5.25". Or at least, after booting Win98SE it only saw the first floppy drive.

IMGMOUNT 0 empty -fs none -t floppy
IMGMOUNT 1 empty -fs none -t floppy -size 512,80,2,15
IMGMOUNT C hdd.img -ide 1m
IMGMOUNT D empty -t iso -ide 2m

Also, when I tried to mount a CD from the drop-down menus (DOS -> Change current CD image) while running Win98SE, DOSBox-X segfaulted.

Doing the same with a 3.5" diskette image did work.

Remember that -size is sz,S,H,C not sz,C,H,S.

IMGMOUNT 1 empty -fs none -t floppy -size 512,15,2,80

That's how the original DOSBox project defined it and DOSBox-X follows that for compatibility.

rderooy commented 7 months ago

Thanks for the correction. But it makes no difference, Win98SE still does not show the drive B icon. Here is what the logs print for the mount commands.

LOG: FAT: Partition type is MBR (IBM PC)
LOG: Mounted FAT volume is FAT32 with 514573 clusters
LOG: Mapping BIOS DISK C/H/S 1023/64/63 as IDE 4092/16/63
LOG: IMGMOUNT: HDD image mounted to drive no. 2 (IDE Primary Master)
LOG: Mounted empty C/H/S/sz 80/2/18/512 1440KB
LOG: Updating floppy type to 8 BIOS type 0x02
LOG: Mounted empty C/H/S/sz 80/2/15/512 1200KB
LOG: Empty ISO
LOG: IMGMOUNT: CD-ROM image mounted to drive D (IDE Secondary Master)
rderooy commented 7 months ago

Some further testing show that the issue seems to be that Win98SE only sees the first floppy drive, regardless of configuration. If I swap the two around such that A: becomes 5.25" and B: becomes 3.5", Win98SE will only show the 5.25" A: drive.

joncampbell123 commented 7 months ago

For whatever reason I can't get Windows 95 to see more than one floppy drive.

I also cannot get Windows 95 to talk to the floppy controller emulation. I don't mean like it pokes that the I/O ports and rejects it, I mean it absolutely won't even try to probe the FDC to talk to it. It doesn't try anything and then complains that the FDC is not present or working.

frank-deng commented 6 months ago

When I boot into real DOS with an empty CD-ROM drive, then load CD-ROM disc from menu "DOS->Change current CD image...", the whole emulator will CRASH!

Changing floppy disk from menu "DOS->Change current floppy image..." works well without crashing when booting into real DOS with empty floppy drives.

empty_drive

Also is it possible to add an action "Leave Empty" apart from Yes and No for this dialog? So as to emulate removing media from Floppy/CDROM drive.