Gotek 800k disc images!

Tatung Hardware talk TC01 & 256.
retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: Gotek 800k disc images!

Post by retrogamer » Sun Jun 20, 2021 2:21 pm

Great stuff, Lardo :D

Worth posting a reminder that the disc in Drive 0 determines how the format of each drive is recognised by the system. So this disc image will be fine in a Gotek designated as Drive 0.

Anyone wishing to use this image in a Gotek designated as Drive 1 will need to update their DOS80 boot disc in Drive 0 to take advantage of 800k in Drive 1. Remember to save the updated DOS to Drive 0 when using CONFIG.

The system looks to the DOS tracks in Drive 0 for the format configuration of all four drives, not the discs themselves!

For those interested in how the configuration is stored, it's all cleverly encapsulated in one byte (stored at 0xE106) where each bit flags 40/80 tracks or single/double sided for each of the four drives. It's this byte that is changed on the boot disc by CONFIG as DOS is often reloaded.

Richard

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: Gotek 800k disc images!

Post by retrogamer » Tue Jun 22, 2021 10:26 pm

When I started this thread, I had presumed (wrongly) that 800k was the maximum disc format that could be configured on the Einstein.

In the light of recent discussion, I wondered if an extra track or two could add a little more space to an image. I remembered that Amstrad CPC discs could be formatted with an extra couple of tracks to push forty tracks (0-39) to forty-two tracks (adding 40 and 41). So can extra tracks be implemented on the Einstein?

Turns out that disc access is implemented so that DOS is compatible with CP/M 2.2. Consequently, a Disc Parameter Block (DPB) of 15 bytes is used to configure each drive format. This includes the number of 128 byte records per track, the data block allocation shift factor (determined by the data block allocation size), the size of the disc, and information about reserved tracks for both the directory and the system.

So I wondered how easy it would be to increase the size of the disc format. Particularly as Gotek emulation is not physically constrained like a real disc drive.

More tracks? Well, an extra couple of tracks on an 800k disc would give 820k. This is not really much of a gain, is it? And I'm not sure how compatible this would be with software expecting an 80 track maximum.

More sectors? There's no doubt that 16 rather than 10 sectors per track would yield a much better increase in size to 1280k. Again, I'm not sure how compatible this would be with software as Einstein Sector IDs range from 0x00 to 0x09 (not to 0x0F). Previous failed experimentation with an 800k DSK with incorrect sector IDs makes me suspect this wouldn't function as expected, if at all.

Larger block size? I could see that all formats (both 40 and 80 tracks) have a 2k block size. So moving to a 4K block size would double the disc size to 1600k at a stroke!

Albert Revealed has a disassembly of the HDM (the Hardware Dependent Module) that includes the disc definitions for XtalDOS 2.05 (System 5 Plus - 1987). So I patched the DPB in the HDM to configure a format of 1600k and was pleased to find that DOS appeared to be fine. I could save to the HFE image and then DIR, ERA, LOAD, and VERIFY without issue.

So I then tried an 8k block size. And I got 3200k working under DOS 2.05.

And yes, you've guessed it! I tried a 16k block size to yield 6400k (6320k Total with 6288k Free)!! Again, it seemed to function correctly with saving, copying and running programs.

Now, the caveat. To date, I've been working with an 800k formatted disc image to investigate whether DOS can be reconfigured for even larger formats. And it does look like it can :)

But I've had to cheat a little for the moment with the number of records per track being aligned with the actual disc image I'm using, rather than a 6400k disc image. Clearly, this is work still in progress and there are a number of aspects still being developed in taking this forward (e.g. more directory entries than 128).

In the meantime, any suggestions for configuring and formatting an 80-track double-sided 6400k HFE or DSK image would be more than welcome!!
Last edited by retrogamer on Wed Jun 23, 2021 10:55 am, edited 1 time in total.

Lardo Boffin
Posts: 296
Joined: Thu Oct 24, 2019 11:47 am

Re: Gotek 800k disc images!

Post by Lardo Boffin » Wed Jun 23, 2021 8:59 am

Blimey! 6000k is practically HD size!

Is there a scanned copy of Albert Revealed anywhere do you know? I’m a bit concerned what results I might get googling that…

Edit - found a copy.
TC-01 + einSDein + TM-01 + TK-02 + gotek

gunrock
Posts: 45
Joined: Sun Apr 11, 2021 10:27 pm

Re: Gotek 800k disc images!

Post by gunrock » Wed Jun 23, 2021 12:45 pm

Lardo Boffin wrote:
Wed Jun 23, 2021 8:59 am
Is there a scanned copy of Albert Revealed anywhere do you know? I’m a bit concerned what results I might get googling that…
Prince Albert Revealed - Body Modifications and Sub-Atomic Physics

Lol!

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: Gotek 800k disc images!

Post by retrogamer » Wed Jun 23, 2021 2:44 pm

Yes, Albert Revealed is on the Tatung Einstein Reborn website under Manuals. A great read, but not for the faint-hearted :)
http://www.tatungeinstein.co.uk/front/mans.htm

Well, I couldn't find documented the numbers needed for a 32k block size in CP/M 2.2. But I did find the formula used to calculate the values, patched two bytes in the DPB with my new figures, and you'll never guess! DOS was happy to report:

12320k Free, 12640k Total

And it all worked too! Copied some files and DIR, COPY, and VERIFY were all fine, and I ran some programs from the disc image in the Gotek to make sure there were no issues.

Amazing :o

This would appear to be the absolute limit as this sets the block mask byte to the maximum value of 0xFF.

Anyone know how to configure and format an 80-track 12800k HFE or DSK?

Richard

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: Gotek 800k disc images!

Post by retrogamer » Sun Jul 04, 2021 10:57 pm

The easiest way to generate blank formatted FlashFloppy compatible DOS80 DSK images is to use HxCFloppyEmulator software on your PC.

You can create custom formatted images for each of the DOS80 format options and then export/save them as required (most usefully as DSK, HFE or even raw IMG).

The double sided 80 track DOS80 format has 20 sectors per track with 512 byte sectors numbered from 0 to 9 on head 0 and numbered from 10 to 19 on head 1. That's a total of 800k [819200 bytes].

So click on the 'Create custom floppy' menu option and enter the following options:
80 tracks
2 sides
10 sectors per track
512 byte sectors
0 Sector ID start
'inter side sector numbering' option needs to be ticked
229 Format value

If you've done this correctly the total size should show as 819200. Click on the 'Create Empty Floppy' button to configure the disk. Then click on the 'Export disk' menu option, select your required output format from the dropdown (use the 'CPC DSK file' option rather than the 'Oric DSK file' option!) and save your image. Remember to run CONFIG on your DOS80 boot disc to set the format for your Gotek drive. Then you're good to go with the formatted image :)

Change tracks from 80 to 40 and sides from 2 to 1 as needed to create the other DOS80 formats.

Some potential issues to note:
* 1 sided disks won't require 'inter side sector numbering' ticked, but this option must be ticked for 2 sided formats to ensure the correct sector numbers for each head or your image won't work properly.
* The format value must be set at 229 (=0xE5) or the Einstein will report a directory error when trying to save files as DOS presumes there's no blank space on the disc.
* As expected, using the raw IMG image will report a 'No Sector 1' error on the Einstein as FlashFloppy requires an IMG.CFG text file as listed below to be saved to the root of your USB drive. I've commented out (#) the alternate duplicate 400k format below as only one format for each size can be initialised without some additional file naming configuration. If you wish to use the alternative format instead, simply readjust the commented section (#).

###########################################
# Save this as IMG.CFG in the root folder of your USB drive to use raw image files

# Tatung Einstein DOS80 single sided 40 tracks 200k
[::204800]
cyls = 40
heads = 1
secs = 10
bps = 512
id = 0

# Tatung Einstein DOS80 double sided 40 tracks 400k
[::409600]
cyls = 40
heads = 2
secs = 10
bps = 512
tracks = 0-39.0
  id = 0
tracks = 0-39.1
  id = 10

# Tatung Einstein DOS80 single sided 80 tracks 400k
#[::409600]
#cyls = 80
#heads = 1
#secs = 10
#bps = 512
#id = 0

# Tatung Einstein DOS80 double sided 80 tracks 800k
[::819200]
cyls = 80
heads = 2
secs = 10
bps = 512
tracks = 0-79.0
  id = 0
tracks = 0-79.1
  id = 10
###########################################

Appreciate the initial setup can be somewhat convoluted, particularly if you wish to use IMG files, but it does all work beautifully. Enjoy :D
Last edited by retrogamer on Mon Jul 05, 2021 10:34 pm, edited 2 times in total.

User avatar
arcadesy
Posts: 75
Joined: Sun Feb 07, 2021 5:41 pm

Re: Gotek 800k disc images!

Post by arcadesy » Mon Jul 05, 2021 10:20 pm

This is a great hack :D thanks for sharing i'll have to try this
--------------------------------
https://twitter.com/arcadesy

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: Gotek 800k disc images!

Post by retrogamer » Sat Jul 10, 2021 10:10 pm

Having been using DOS80 for a while now, the extra capacity is very useful but the big disadvantage is that the four different available formats (200k, 400k single sided, 400k double sided, and 800k) are not compatible with each other. For instance, once my Drive 1 has been configured to work with a Gotek 800k image, a reboot with a different DOS disc is required to read a standard 200k DSK image on the Gotek. That's a bit of a pain!

An even bigger pain is that it not possible to copy files from one format to another on the same drive. For example, if the Gotek is set to 800k, copying a file from a 200k Gotek image on the same drive would require rebooting the Gotek with a 200k boot disc, then copying the file to a second drive before rebooting to 800k again. Quite an inconvenience, particularly if your boot drive is the original 3 inch drive!

So I tweaked my DOS80 boot disc to change between different capacity images on the Gotek without needing to reboot DOS :)

This is so much more user friendly and useful!

All four formats have the same 2k block size and have 10k reserved for system track/s. The only real difference causing the incompatibility is the space reserved for the directory entries. All the larger sizes (400k and 800k) have 4k reserved for 128 directory entries. The standard 200k format is different in that it has 2k reserved for 64 directory entries.

So I modified a DOS80 boot disc so that the larger formats have the same allocated directory space as the standard 200k format. This ensures compatibility and enables file copying across different capacity formats on the same drive!

The downside is that it's possible to run out of directory space before the disc is full, but the worst that can happen is that DOS reports a directory error. How quickly this happens depends on the number and size of the files saved. The maximum capacity is 64 files of 16k or less which is generally more than enough files on one disc! Even with an larger size of 32k there's directory space for around 32 files. So the restriction of a smaller directory is actually not too problematic in practice.

In order to benefit from a larger disc size and reduce any potential directory capacity issues, I've chosen to use the DOS80 Option C 400k format (390k Total) for my Gotek in Drive 1, modded so as to be compatible with both 200k and 400k formats. Two bytes need changing to modify a DOS80 boot disc so the single-sided 80 track 400k format (Option C) has 64 directory entries rather than 128. Fixing the drive at 400k means that DOS displays all images in the Gotek as having '390k Total'. This affects 200k images in that the displayed number of total free bytes appears wrong, but this inconsistency doesn't affect the accessibility of the files. So I know when I see 390k this means the modified DOS is operational with capacity 'up to 390k' (if the working image in the Gotek is big enough). Obviously, if you try to write more files to a full 200k disc image it'll fail and complain!

With the boot disc in drive 0, the modification is done from MOS:
Type R 100 1B00 [ENTER] (this loads DOS into memory)
Type M 18E5 [ENTER]
Type 3F (to overwrite 7F) [ENTER]
Press [ENTER] (to leave 18E6 as 00)
Type 80 (to overwrite C0) [ENTER]
Type . [ENTER] (a full stop exits the editor)
Type W 100 1B00 [ENTER] (this saves the modified DOS back to disc)

Run CONFIG to select your Gotek as single sided 80 track (option C) and that's it!

You don't even need to bother about generating a separate custom 400k HFE or DSK image to use this format. You can use an 800k double sided HFE or DSK for this format too. But my advice is to format this with BACK80 so you can check it verifies as it should. As far as FlashFloppy is concerned the size of the disc image in the Gotek is determined by the stored values in the HFE or DSK, and the Einstein DOS relies on its own parameters. So DOS is quite happy to access only one side of the disc and ignore the other side.

I've left the 800k format (Option D) unaltered with 128 directory entries and this is still selectable by running CONFIG to change the boot format. And yes, I've an alternative boot disc that has tweaked this option to a whopping 1600k!

Post Reply