mamedev / mame

MAME
https://www.mamedev.org/
Other
7.75k stars 1.95k forks source link

20 sectors/track disk images for coco12 & coco3 not working #2385

Open drencorxeen opened 7 years ago

drencorxeen commented 7 years ago

Dear Devs,

Just thought I would write this issue ticket to let you know that the JVC header information for .dsk images for coco12 & coco3 are not being used correctly.

If you have a disk image that was copied over from a real CoCo that has 20 sectors per track and you add the two byte header to the front of: $1402 Which should allow MAME to understand that it should expect to be dealing with a disk image that has 20 sectors per track rather than 18.

When I try to mount the disk image I get a error message and then MAME crashes out. Message as follows:

Fatal error: Incorrect layout on track 0 head 0, expected_size=10000, current_size=102912

tlindner commented 7 years ago

The JVC format implementation (./src/lib/formats/jvc_dsk.cpp) uses the function build_wd_track_mfm() to build the entire track for use by the floppy system when the disk image is read into the system. That function is hard coded to use

Using those gaps, the code creates a track too long to fit on a disk track.

What gaps do you suggest when putting together a 20 sector per track disk?

drencorxeen commented 7 years ago

Hmmmm it actually builds the MFM track data????

Well here is a example of the information used to build the OS-9 track with native format command and the fudged information to actually make a 20 sector floppy.

Format data looks like this on original format NitrOS-9 format command: $204E,$0C00,$03F5,$01FE,$0400,$01F7,$164E,$0C00,$03F5,$01FB $80E5,$80E5,$01F7,$184E The $0400 is where the track #, sector #, head# stuff goes.

The format 20 command uses the following data in place of the previous data: $084E,$0800,$03F5,$01FE,$0400,$01F7,$0100,$1B00,$03F5,$01FB $80E5,$80E5,$01F7,$0100

This is all I have from the format_20 command. Personally I don't understand how these values work correctly as it doesn't match the WD177x or WD179x spec documents I found, but it does work. It worked back in the late 80's.

startaq commented 6 years ago

What's the command to format a disk with 20 sectors in OS-9?

drencorxeen commented 6 years ago

The command is format_20 this utility was downloaded off of compuserve many many years ago. It must be used in OS-9 L1, OS-9 L2, NitrOS-9 L1, or NitrOS-9 L2.

This command has been tested to work with the mfm based disk image that MAME has called: HxCFloppyEmulator.

This command also works on the CoCoSDC with its SDF mfm disk image format. This command was obviously used back in the original time period of the CoCo's on real floppy drives. I have recently tested this with both a 5.25" DD/DS floppy drive & 3.5" DD/DS floppy drive without any issues. Also tried it with a Radio Shack FD501 Disk Controller, Radio Shack FD502 Disk Controller, Disto Disk Controller, and a J&M Disk Controller all without issues.

The issue I have run into is that the jvc format seems to only support up to 18 sectors, but using the pure WD177x FDC datasheet specs for the controller based on their required GAP data was 18 sectors, but alternative information has shown that you can with a alternate header/GAP layout can get the # of sectors up to 20 and worked reliably for me and others back in the day.

startaq commented 6 years ago

Can you provide a disk image with the command included? Another way would be to enable the logging option TRACE_DESC in the wd_fdc core (need to compile MAME for this) and format a disk, then post the log somewhere.

drencorxeen commented 6 years ago

@startaq , I will try to post a image as soon as I can. Been behind on some other stuff I been trying to get done. I wanted to make sure I replied so you knew I was watching just need the time to dig through all my disk images to find the right one to send.

drencorxeen commented 6 years ago

os9fd80t20sds.zip 68nos9l2coco3_80ds.zip

The 68nos9l2coco3_80ds.dsk image needs to be mounted in drive 0. This disk image is setup for the 6809 CPU, but will also work in the coco3h profile that has the 6309. This disk image also has the jvc header on it.

I have also provided a pre-formatted disk image with 20 sectors with the jvc header on it.

Now MAME directly does not write the JVC header to the disk image when creating a new disk image. So that is one of the features that is currently lacking with the JVC disk image when you create a new disk image it doesn't ask you if it is double sided or single sided. Nor does it ask how many sectors you will be using. Standard sector count is 18, but with the format_20 command you can go all the way to 20 sectors per track.

If you want to create a new disk image to try out the format_20 command you will need to create a mfm based disk image format like HxCFloppyEmulator.

Also if you try mounting that os9fd80t20sds.dsk image MAME will probably error out since your default format routines seem to go out of bounds.

If you would like me to record a video to post on YouTube proving I can format a 3.5" DS/DD floppy disk to 20 sectors per track on real hardware I can do so at your request.

Just let me know what other information you need @startaq