-
Notifications
You must be signed in to change notification settings - Fork 2.2k
esq5505.cpp: Add VFX-family ROM & EEPROM Cartridge support, and improve floppy support. #14444
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
Conversation
|
While I've tried to address the issues that were raised when the previous attempt at this was reverted, I would appreciate feedback on what I have missed, even in small things. |
…ve floppy support. Second attempt, simpler and hopefully better.
… indicate this on the LED on the panel layout.
f2ee5f5 to
0fb58f4
Compare
MooglyGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/mame/ensoniq/esq5505.cpp
Outdated
|
|
||
| void esq5505_state::floppy_load(floppy_image_device *floppy) | ||
| { | ||
| (void) floppy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, don't need to explicitly void out unused function parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The user can always rename a writable (.eeprom, .sc32) image to .rom or .cart to mark it as read-only.
… ones created with the filetypes that indicate a read-only image are effectively write-once. Also normalize the spelling of to "writeable".
|
Upon some further reflection, I've restored the "write-once" behaviour: it's useful, and it avoids the situation where the code has to back out of creating an image, leaving an empty file behind. More than that, it is also fairly analogous to some functionality relating to floppy disk images: those can be mounted such that the original floppy image is untouched and changes are written to a separate file, for example. Much like write-once cartridges, such copy-on-write floppy disks don't exist in real life. But in an emulation context, both protect the image files the user is working with from being accidentally written to when they shouldn't, and thus prevent data loss. |
|
I don't have a strong preference here either way, but it would be good to be able to emulate those aftermarket cartridges. This still points me towards believing a slot device is the way to go. I'll wait for RB, OG, or Vas to weigh in. Not the end of the world if this waits a bit, hopefully. |
|
For hardware keyboards, the aftermarket cartridge multi-cartridge offers two main advantages:
Neither of those is important in an emulation context:
So I don't really foresee much need to emulate those; YAGNI seems to apply. If someone wishes to emulate these multi-cartridges in the future, there are other issues to resolve as well: Any multi-cartridge would also require some UI/UX for how to switch between the different "banks" of 32kB each, since that is really not part of the UI of the keyboard itself, and that UI also needs to be connected to the multi-cartridge. In that context, separating the current class into separate slot & cartridge classes at that time would be comparatively trivial (since the slot device literally just passes through read and write requests). Indeed an alternative design choice could be to extend the capabilities of the current class, so that it can handle some multiple of 32kiB in file size, and not requiring a split into separate slot & cartridge classes at all. So on the balance I think that there is much more value in getting this functionality in place than debating a possible future extension for which there is little need in an emulation context, which may not even need the split into two separate classes, and if it does, then that split is easy to make at that time. |
|
@rb6502 @galibert @cuavas , @MooglyGuy requests "for RB, OG, or Vas to weigh in". |
|
I pinged them earlier in the thread, they'll still have an e-mail about it. They'll respond when they have the time. |
| required_device<esq_5505_5510_pump_device> m_pump; | ||
| optional_device<wd1772_device> m_fdc; | ||
| optional_device<floppy_connector> m_floppy_connector; | ||
| optional_device<ensoniq_vfx_cartridge> m_cart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thought for future work: having more than one optional_device often means it would be cleaner to have a base class with nothing optional and then various inherited child classes that extend that in various ways. Back when I wrote esq5505 originally I wasn't in that mindset and it does show.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth looking at this for a refactor more generally. The EPS Classic, for example, doesn't really belong here at all: it has no es5510 ESP, and the sound generator is the es5504 "DOC II", not the es5505 "OTIS".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for sure.
| void esq5505_state::floppy_formats(format_registration &fr) | ||
| { | ||
| fr.add_mfm_containers(); | ||
| fr.add(FLOPPY_ESQIMG_FORMAT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably not a bad idea to add the HFE format too - that's become kind of the standard way to distribute synth floppies with nonstandard physical formats, since a lot of people still using real hardware have Gotek or similar drive replacements that use that format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea, though the FlashFloppy firmware for Gotek drives explicitly supports the Ensoniq 800 kB format for Ensoniq hosts, so for these keyboards in particular, HFE may be less important. Either way I'd prefer to read up more on that before I make such a change, separately from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reading Ensoniq floppies, the GreaseWeazle software also explicitly supports Ensoniq's floppy formats, so they can be directly read to .img files for use with a FlashFloppy Gotek drive, or here in MAME.
src/mame/ensoniq/esq5505.cpp
Outdated
| floppy_image_device *floppy = m_floppy_connector->get_device(); | ||
| if (floppy) | ||
| { | ||
| floppy->mon_w(motor_on ? CLEAR_LINE : ASSERT_LINE); // active low |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!motor_on should work too, and is faster to read/interpret.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/mame/ensoniq/esq5505.cpp
Outdated
| void esq5505_state::update_floppy_inputs() | ||
| { | ||
| // update the "Disk Ready" input | ||
| int state = (m_floppy_is_active && m_floppy_is_loaded) ? ASSERT_LINE : CLEAR_LINE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just collapse this to m_duart->ip0_w(m_floppy_is_active && m_floppy_is_loaded);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| LOG("docirq (m68k_irq1) due to disk change = %d\n", floppy_dskchg_irq); | ||
| if (floppy_dskchg_irq && m_floppy_is_loaded) | ||
| { | ||
| // The drives that Ensoniq use only _pulse_ DSKCHG for a brief time, when a disk is in the drive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this 100% verified? Most drives will raise DSKCHG on eject and then lower it the next time a seek happens with a disk in the drive, and MAME emulates that by default with the dskchg_r() method on the floppy image device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so; please see this comment on the previous attempt at these changes:
Are you sure the dskchg is timer-based and not the usual "clear on first track change with a floppy in" that is implemented in floppy_image_device?
I an absolutely sure.
I first found it documented for the EPS in Keir Fraser's FlashFloppy firmware, when people tried to connect it to an Ensoniq EPS and it would not recognize disk changes.
But with this being so strange, I measured it with my cheap Saleae Logic clone logic analyzer on an SD-1/32. After a disk change - so, removed the previous disk, inserted a new disk, then went to try to read something from the disk: pressed the "Storage" button, then selected "Disk" by pressing the middle button below the screen, and then "Load" again with the middle button below the screen) - the keyboard signals (drives low) the DSEL and MO signals (enabling the drive and starting the motor), and the drive responds with a brief pulse: in my measurement with a cheap logic analyzer sampling at 4 MHz, all of two (2) samples were low, so a pulse of 500 nanoseconds and certainly no more than 1000 nanoseconds to 1 microsecond.
I'm including the sigrok trace recorded with PulseView:.
Load from floppy after new floppy inserted.zip
Look at the 335088 mycrosecond timestamp: the MO and DSEL signals both go low, and at the same time, DSKCHG goes low, but only for 2 samples, and with no other signal changing during that very short window.
The DSKCHG signal is actually routed, via a gate and a transistor, into the same IRQ line on the CPU itself that is also used by the ES5505 OTIS sound generator chip. It so happens that on the SD-1, if that interrupt is taken (and I presume after the keyboard has checked the ES5505 interrupt status), eventually the SD-1 will assert (drive low) the DSEL (and MO) lines to the floppy drive and issue a STEP command, which will inturn reset DSKCHG even on a standard drive; but that of course might take longer than it does when the drive itself only briefly pulses the signal.
And while this would technically work on the SD-1, it would not work on the EPS, as documented by FlashFloppy users - where they added a configuration setting precisely to reset DSKCHG after a short time. So including this code is useful, possibly even necessary, to get the EPS and EPS16+ to work in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. That's kind of wild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the floppy signal routing in general and the DSKCHG pulsing behaviour in particular were interesting to trace and track down. Being able to measure on real hardware and seeing the behaviour really helped confirm that was what was actually happening, even after reading about it in the FlashFloppy firmware discussion and documentation.
src/mame/ensoniq/esq5505.cpp
Outdated
| bits 0/1/2 = analog sel | ||
| bit 3 = SSEL (disk side) | ||
| bit 4 = DSEL (drive select?) | ||
| bit 4 = DSEL (Drive Delect and floppy Motor On) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delect? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Select" of course. Fixed.
src/mame/ensoniq/esq5505.cpp
Outdated
| else | ||
| { | ||
| floppy->ss_w(((data & 8)>>3)^1); | ||
| floppy->ss_w(((data & 8) >> 3) ^ 1); // bit 3, inverted -> floppy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
floppy->ss_w(!BIT(data, 3)); would do the same thing much cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/mame/ensoniq/esq5505.cpp
Outdated
| { | ||
| floppy->ss_w(((data & 8)>>3)^1); | ||
| floppy->ss_w(((data & 8) >> 3) ^ 1); // bit 3, inverted -> floppy | ||
| m_floppy_is_active = (data & 16) != 0; // bit 4 is used to activate the floppy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, m_floppy_is_active = BIT(data, 4);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
Thank you! |
Second attempt, simpler and hopefully better.
I've tried to address the issues identified in the Revert commit message. Specifically, the cartridge is now represented by a single image device class, and vfxcart.h includes only diimage.h, not emu.h. All indentation should also now be tabs, not spaces, and there should be no trailing spaces (running srcclean changes nothing further).