Drive Emulation Type Cleanup

From vice-emu
Revision as of 13:34, 22 August 2021 by Gpz (talk | contribs) (→‎files)
Jump to navigation Jump to search

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

related options

First we need to collect all related options and how they relate to each other

emulation related options

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
    • 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")
what does "none" mean exactly?

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 DE ID VD                                       iecbus_device
 0  0  0  0  nothing enabled                       IECBUS_DEVICE_NONE
 0  0  0  1  trap device enabled                   IECBUS_DEVICE_NONE
 0  0  1  0  IEC device enabled                    IECBUS_DEVICE_IECDEVICE
 0  0  1  1  IEC device enabled+trap dev. enabled  IECBUS_DEVICE_IECDEVICE
 0  1  0  0  nothing enabled                       IECBUS_DEVICE_NONE
 0  1  0  1  trap device enabled                   IECBUS_DEVICE_NONE
 0  1  1  0  IEC device 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
 1  0  0  1  nothing enabled                       IECBUS_DEVICE_NONE
 1  0  1  0  IEC device enabled                    IECBUS_DEVICE_IECDEVICE
 1  0  1  1  IEC device enabled                    IECBUS_DEVICE_IECDEVICE
 1  1  0  0  TDE drive enabled                     IECBUS_DEVICE_TRUEDRIVE
 1  1  0  1  TDE drive enabled                     IECBUS_DEVICE_TRUEDRIVE
 1  1  1  0  IEC device enabled                    IECBUS_DEVICE_IECDEVICE
 1  1  1  1  IEC device enabled                    IECBUS_DEVICE_IECDEVICE

TDE = true drive emulation (device switch)
DE = device enable (device switch)
ID = IEC devices (device switch)
VD = virtual devices (global switch)


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

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:

  • 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