Drive Emulation Type Cleanup
related patch: https://sourceforge.net/p/vice-emu/patches/301/
goals:
get rid of all "global" options, ie it should all be "per device"- have a "emulation type" option rather than seperate options for various features
- prevent non working combinations
- fix the autostart logic to always work, regardless of options
files
src/attach.c src/traps.c src/machine-bus.c src/drive/drive-resources.c
First we need to collect all related options and how they relate to each other
Drives
- Virtual Device Traps ("VirtualDeviceX" = 0,1)
- Host Filesystem ("FileSystemDeviceX" = ATTACH_DEVICE_FS)
- Disk Images ("FileSystemDeviceX" = ATTACH_DEVICE_VIRT)
- Real Device (opencbm) ("FileSystemDeviceX" = ATTACH_DEVICE_REAL)
- IEC Device ("IECDeviceX" = 0,1)
- Host Filesystem ("FileSystemDeviceX" = ATTACH_DEVICE_FS)
- Disk Images ("FileSystemDeviceX" = ATTACH_DEVICE_VIRT)
- Real Device (opencbm) (opencbm) ("FileSystemDeviceX" = ATTACH_DEVICE_REAL)
- True Drive Emulation ("DriveXTrueEmulation" = 0,1)
- Disk Images
- Drive Type ("DriveXType")
- Disk Images
- what does "none" mean exactly?
found in attach.c: /* * FIXME: Note about ATTACH_DEVICE_FS and ATTACH_DEVICE_VIRT: * Attaching a disk image also uses _FS even though you would expect _VIRT. * The value _VIRT seems to be unused in practice. * One would expect _FS for the fsdevice, and _VIRT for vdrive images. */
"FileSystemDeviceX" = ATTACH_DEVICE_FS apparently means that we will either get "host system" or "virtual device with disk image" depending on wether an image is attached or not
when "FileSystemDeviceX" = ATTACH_DEVICE_NONE using a disk image still appears to work
Printer
- Virtual Device ("VirtualDeviceX" = 0,1)
- None ("PrinterX" = PRINTER_DEVICE_NONE)
- Host Filesystem ("PrinterX" = PRINTER_DEVICE_FS)
- Real Device (opencbm) ("PrinterX" = PRINTER_DEVICE_REAL)
- IEC Device ("IECDeviceX" = 0,1)
- None ("PrinterX" = PRINTER_DEVICE_NONE)
- Host Filesystem ("PrinterX" = PRINTER_DEVICE_FS)
- Real Device (opencbm) ("PrinterX" = PRINTER_DEVICE_REAL)
Printer #7 is kindof special, there appears no actual printer emulation attached to it, only the options exist that are required to redirect device #7 to opencbm
- Virtual Device ("VirtualDevice7" = 0,1)
- None ("Printer7" = PRINTER_DEVICE_NONE)
- Real Device (opencbm) ("Printer7" = PRINTER_DEVICE_REAL)
- IEC Device ("IECDevice7" = 0,1)
- None ("Printer7" = PRINTER_DEVICE_NONE)
- Real Device (opencbm) ("Printer7" = PRINTER_DEVICE_REAL)
Tape
Tape Emulation generally requires neither Traps nor IEC bus things. The exception is .t64 support, which is implemented via device traps, and requires "VirtualDevice1" = 1
other options
- handle TDE at autostart
- warpmode
- Host Filesystem
- use long filenames
- create P00 files
- only show P00 files
odd stuff
- for the PET and CBM2, the "VirtualDevices" resource is not related to ROM traps, but to "IEC devices"? wth? (see traps.c)
- on PET loading a prg file gives a syntax error with the current patch? wth
Precedence
iecbus.c contains this table:
iecbus_status_set() sets IEC bus devices according to the following table: TDE ID VD DE iecbus_device none 0 0 0 0 nothing enabled IECBUS_DEVICE_NONE 0 0 0 1 nothing enabled IECBUS_DEVICE_NONE VD 0 0 1 0 trap device enabled IECBUS_DEVICE_NONE VD 0 0 1 1 trap device enabled IECBUS_DEVICE_NONE IEC 0 1 0 0 IEC device enabled IECBUS_DEVICE_IECDEVICE IEC 0 1 0 1 IEC device enabled IECBUS_DEVICE_IECDEVICE 0 1 1 0 IEC device enabled+trap dev. enabled IECBUS_DEVICE_IECDEVICE 0 1 1 1 IEC device enabled+trap dev. enabled IECBUS_DEVICE_IECDEVICE -------------------------------------------------------------------------- 1 0 0 0 nothing enabled IECBUS_DEVICE_NONE TDE 1 0 0 1 TDE drive enabled IECBUS_DEVICE_TRUEDRIVE 1 0 1 0 nothing enabled IECBUS_DEVICE_NONE 1 0 1 1 TDE drive enabled IECBUS_DEVICE_TRUEDRIVE 1 1 0 0 IEC device enabled IECBUS_DEVICE_IECDEVICE 1 1 0 1 IEC device enabled IECBUS_DEVICE_IECDEVICE 1 1 1 0 IEC device enabled IECBUS_DEVICE_IECDEVICE 1 1 1 1 IEC device enabled IECBUS_DEVICE_IECDEVICE TDE = true drive emulation ID = IEC devices VD = virtual devices DE = device enable
conclusion
The following is a proposal on how the UI could look like to be less confusing.
THIS IS WORK IN PROGRESS - CURRENT UI CHANGES WILL USE THE EXISTING SWITCHES/OPTIONS PER DRIVE
Drives
For Drives, the UI should have a Dropdown box or Radio Button group to select the emulation mode:
- None ("VirtualDeviceX" = 0, "IECDeviceX" = 0, "DriveXTrueEmulation" = 0)
- Virtual Device Traps ("VirtualDeviceX" = 1, "IECDeviceX" = 0, "DriveXTrueEmulation" = 0)
- IEC Device ("IECDeviceX" = 1, "VirtualDeviceX" = 0, "DriveXTrueEmulation" = 0)
- True Drive Emulation ("DriveXTrueEmulation" = 1, "VirtualDeviceX" = 0, "IECDeviceX" = 0)
only when the above is not "none" it should enable another Dropdown box or Radio Button group to select the device type that is emulated:
- Host Filesystem ("FileSystemDeviceX" = ATTACH_DEVICE_FS, "DriveXType = DRIVE_TYPE_NONE")
- Disk Images ("FileSystemDeviceX" = ATTACH_DEVICE_VIRT, "DriveXType != DRIVE_TYPE_NONE")
- Real Device (opencbm) (opencbm) ("FileSystemDeviceX" = ATTACH_DEVICE_REAL)
FIXME: find out if we really need to set "DriveXType = DRIVE_TYPE_NONE", it would be more intuitive if we leave it alone.
when "True Drive Emulation" is enabled, the device type selection should be "greyed out"
when "True Drive Emulation" is NOT enabled, the drive type selection should be "greyed out"
Printers
For Printers, the UI should have a Dropdown box or Radio Button group to select the emulation mode:
- None ("PrinterX" = PRINTER_DEVICE_NONE, "VirtualDeviceX" = 0, "IECDeviceX" = 0)
- Virtual Device ("VirtualDeviceX" = 1, "IECDeviceX" = 0)
- IEC Device ("IECDeviceX" = 1, "VirtualDeviceX" = 0)
only when "PrinterX" is not PRINTER_DEVICE_NONE it should enable another Dropdown box or Radio Button group to select the device type that is emulated:
FIXME: find out if we really need to set "PrinterX = PRINTER_DEVICE_NONE", it would be more intuitive if we leave it alone.
- Host Filesystem ("PrinterX" = PRINTER_DEVICE_FS)
- Real Device (opencbm) ("PrinterX" = PRINTER_DEVICE_REAL)
for Device #7, the second selection should "grey out" the "Host Filesystem" item (Printer #7 only exists so you can redirect it to opencbm)
Tape
no UI changes required, the only option is "VirtualDevice1" = 0,1