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

Add FDOS disk format for the SWTPC 6800 #10273

Merged
merged 2 commits into from Aug 27, 2022
Merged

Conversation

n6il
Copy link
Contributor

@n6il n6il commented Aug 26, 2022

The FDOS Operating System was released by SWTPC in 1977 along with the
MF-68 Mini Disk System and was superceeded by FLEX a few months later.
This change adds support to boot FDOS on the SWTPC 6800 machine in MAME
using a specific disk image (FDOSMPS.DSK) from deramp.com (Mike Douglas)
and can also read/write the other available disk images.

The FDOS Operating System was released by SWTPC in 1977 along with the
MF-68 Mini Disk System and was superceeded by FLEX a few months later.
This change adds support to boot FDOS on the SWTPC 6800 machine in MAME
using a specific disk image (FDOSMPS.DSK) from deramp.com (Mike Douglas)
and can also read/write the other available disk images.
Comment on lines 52 to 62
char filename[8]{};
char password[8]{};
uint8_t start_track = 0;
uint8_t start_sector = 0;
uint8_t num_sectors[2] = {};
uint8_t file_type = 0;
uint8_t start_addr[2] = {};
uint8_t end_addr[2] = {};
uint8_t exec_addr[2] = {};
uint8_t basic_high_line[2] = {};
uint8_t spares[3] = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you mixing T foo[N]{}; and T foo[N] = {}; style for array initialisation (with and without the equals sign) here? Please pick a single style to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch here, your fix was what I actually intended.

Comment on lines 124 to 128
LOG_FORMATS("FDOS floppy dsk: size %d bytes, %d total sectors, %d remaining bytes, expected form factor %x\n",
(uint32_t)size,
(uint32_t)size / f.sector_base_size,
(uint32_t)size % f.sector_base_size,
form_factor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn’t need to to cast the integers down to print them – osd_printf_info and friends are type-safe and handle 64-bit integers fine.

@cuavas cuavas merged commit 46ecd84 into mamedev:master Aug 27, 2022
@galibert
Copy link
Member

Since dumbass github doesn't allow me to reply by mail, let's do it again here:

Why so complex? It seems to be a fixed-size, pure sector format you handle nicely by deriving wd177x_format, but then you do a ton of checking of the actual sector contents. Why is it needed, isn't the size sufficient?

@n6il
Copy link
Contributor Author

n6il commented Aug 28, 2022

Why so complex? It seems to be a fixed-size, pure sector format you handle nicely by deriving wd177x_format, but then you do a ton of checking of the actual sector contents. Why is it needed, isn't the size sufficient?

Size by itself is not sufficient to distinguish this format from FLEX 2.0 (flex_dsk.cpp) format of the same size but different sector order. If you really do not like the complexity of this format then one option would be to add a generic catch all that would need to be last in the list of format detection as an attempt to guard against false positives. There are pros and cons for both the more specific and generic approaches. Please let me know if you want me to prepare a draft to explore this option.

@galibert
Copy link
Member

Ok, we had a similar issue with the apple2 with the do (dos) and po (prodos) formats which are also pure sector (hence same size) with a different sector order. To handle that we have two things:

  • recognition by extension, the dos format declares "do" and "dsk", the prodos "po" and "dsk", so the user can force the resolution in a specific way through a file extension
  • recognition by heuristic, both formats use a common heuristic looking at the contents to find which is more probable, and sets FIFID_HINT in the identify return for the more probable one

You may be able to do something similar? Apple 2 code is in ap2_dsk.cpp for reference, a2_16sect_format::identify essentially. The heuristic would be what you already implemented in identify, and the approach would leave the freedom to the user to force one way or the other when needed.

@galibert
Copy link
Member

galibert commented Oct 11, 2022 via email

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

Successfully merging this pull request may close these issues.

None yet

3 participants