High density .STX / pastis support

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.2.0

Moderators: simonsunnyboy, thothy, Moderator Team

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Tue Feb 12, 2019 12:44 pm

So all you good people can see I'm not making this up, some screenshots from MegaSTe and Falcon using the attached STX

MegaSTe incorrectly reading disk as DD:
Screenshot 2019-02-12 at 12.31.02.png


Falcon correctly reading disk as HD:
Screenshot 2019-02-12 at 12.33.39.png
You do not have the required permissions to view the files attached to this post.

darwinmac
Captain Atari
Captain Atari
Posts: 217
Joined: Sat Aug 06, 2011 2:49 pm
Location: San Jose, USA

Re: High density .STX / pastis support

Postby darwinmac » Tue Feb 12, 2019 11:35 pm

I did not think you were crazy.

However, I assumed the AkaiSex program created a standard Atari floppy disk. It does not appear to do so. When I downloaded the AkaiSex program, I was able to read your Pasti (STX) file when I set Hatari to be a Falcon. I could not figure out what to do with the sample after I loaded it. When I used the same program when setting Hatari as a Mega STE, I received an "Out of Memory" error.

I have not seen a program like this, but it appears that Hatari would need to be changed to have an option to broadcast to software that the Mega STE has a High Density drive.

I am not npomarede so I do not know how long it would take to add this support and whether it would have any unintended consequences. If you cannot create the HFE file as a Double Density, rather than a High Density, disk, you will probably need to use Hatari in Falcon mode until this is changed.

Bob C

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Wed Feb 13, 2019 7:59 am

Thanks Bob, it’s very good of you to check my findings.

I agree with your assessment. Indeed, my immediate problem is solved. Still, I think it’d be very handy to select an HD drive on the MegaSTe mode.

User avatar
npomarede
Atari God
Atari God
Posts: 1320
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: High density .STX / pastis support

Postby npomarede » Wed Feb 13, 2019 10:03 am

Hi
I also had a look at the STX file, and it looks rather "normal", no specific protection. It's just that each track has 10 sectors and each sector is 1024 bytes instead of 512 bytes.

I would need to have a look at the TOS 2.06 code to see how it checks that the drive is DD or HD (ie how can the DIP switch status be read in one of the HW registers at $FFxxxx).
Maybe someone has already looked at this in the TOS 2.06 ?
BTW, did you try to run the emulated megaSTE with emutos instead of tos 2.06 ? It's possible that emutos handles DD/HD better (as tos 3 and 4 for TT/Falcon do)

Nicolas

EDIT : found an old topic here viewtopic.php?f=27&t=13362 about this DD/HD matter and the way to toggle between DD/HD is to change main CPU freq from 8 to 16 MHz by writing to FF860E.
Tos then tries to read sector in DD for example, and if it doesn't work it switches to 16 MHz and try to read in HD. As it works with Hatari under tos 3 and 4, but not tos 2.06, it's possible the DD/HD test is not made in the same order (maybe tos 3 and 4 test for HD first then fallback to DD, whereas tos 2.06 tests DD first and HD after). As Hatari itself will always report a successful read in both case (since there's no concept of HD/DD drive at the moment in Hatari), this would explain why tos 2.06 incorrectly switches to DD mode.

So, only correct solution for Hatari would be to support DD/HD option on each drive and fails if an HD floppy is inserted in a DD drive (or the opposite). This will need some changes to Hatari.

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Wed Feb 13, 2019 10:32 am

I just tried EmuTOS (version 0.9.10 from last year, 256K ROM)

In fact yes..

Although the desktop does not provide me the option to format a high density disk, the AkaiSex program does correctly recognise the image as being HD, and works properly with the disk.
Last edited by gwEm on Wed Feb 13, 2019 10:36 am, edited 1 time in total.

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Wed Feb 13, 2019 10:34 am

Thanks again for looking at this Nicolas! I’m kind of excited with how this is working out.

Edit: in fact, I think it is the floppy controller that is clocked between 8 and 16MHz - I remember this from when I upgraded my MegaSTe years ago.

Finally, DD disks work fine in my HD equipped MegaSTe.

Actually, I recall this was quite a nice upgrade at the time because writes and reads were twice as fast on an HD disk.

ijor
Hardware Guru
Hardware Guru
Posts: 3907
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: High density .STX / pastis support

Postby ijor » Wed Feb 13, 2019 11:41 am

This is NOT a normal high density disk. High density disks have 18 (or more) sectors per track, each sector being still 512 bytes as it is in DD. This disk, as mentioned, have bigger sectors instead. This is the reason that HxC must create a Pasti image in the first place.
Fx Cast: Atari St cycle accurate fpga core

ijor
Hardware Guru
Hardware Guru
Posts: 3907
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: High density .STX / pastis support

Postby ijor » Fri Feb 15, 2019 12:33 am

I finally had a chance to look at this.

The reason that the disk is not detected as HD with standard TOS 2.06 is because the FDC cookie jar doesn't signal an HD drive. And this is in turn because the MSTe dip switch is not emulated. This has no direct relation with doubling the FDC clock, although the HD cookie jar is normally set when there is hardware capable of reading HD disks.

I'm not sure why EmuTOS does set the cookie jar even without the dip switch being emulated. I suspect it's a bug in EmuTOS or an emulation bug.

And once again, this is not a standard HD disk. That's probably the reason that the HxC software doesn't convert the image to an ST or MSA file.
Fx Cast: Atari St cycle accurate fpga core

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Fri Feb 15, 2019 3:06 pm

Not sure how to respond Ijor, not having the low level knowledge of disk formats and images.

The sampler -> HxE -> STX -> Atari chain is working well for me now, which is awesome.

Obviously I’d like to see things done properly and I’m ready to test anything anyone wants.

czietz
Hardware Guru
Hardware Guru
Posts: 1062
Joined: Tue May 24, 2016 6:47 pm

Re: High density .STX / pastis support

Postby czietz » Fri Feb 15, 2019 5:55 pm

ijor wrote:I'm not sure why EmuTOS does set the cookie jar even without the dip switch being emulated. I suspect it's a bug in EmuTOS or an emulation bug.


With current EmuTOS (from git repo) and Hatari 2.2.1, I see the following settings for the _FDC cookie:
ST: 0 = DD,
MegaST: 0 = DD,
STE: 0 = DD,
MegaSTE: 0 = DD,
TT: 1 = HD,
Falcon: 1 = HD.

I see nothing wrong there, it detects the same drive density as Atari TOS. So no bug in EmuTOS, no bug in Hatari. I have no idea what AkaiSex does to detect a HD floppy drive, but it cannot be solely based on the value of the _FDC cookie.

User avatar
npomarede
Atari God
Atari God
Posts: 1320
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: High density .STX / pastis support

Postby npomarede » Fri Feb 15, 2019 6:26 pm

Hi, I havent't checked the code, but maybe emutos tries to read in HD then in DD (if HD fails), whatever the value of the cookie is ? And in that case this would allow this STX floppy to work.
In all cases, I will add support for ff860e lowest 2 bits, so this should make emulated TOS works similar to real HW.
Nicolas

gwEm
Captain Atari
Captain Atari
Posts: 220
Joined: Tue Jun 08, 2004 4:43 pm
Location: London, UK
Contact:

Re: High density .STX / pastis support

Postby gwEm » Fri Feb 15, 2019 7:07 pm

I had a little dig into the format of Akai disks. What I read fits into Ijor’s comments before. It should have:

2 sides
80 tracks
10 sectors/track
1024 bytes/sector
=1600KB

PC, as a reminder:
2 sides
80 tracks
18 sectors/track
512 bytes/sector
= 1440KB

ijor
Hardware Guru
Hardware Guru
Posts: 3907
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: High density .STX / pastis support

Postby ijor » Fri Feb 15, 2019 8:25 pm

czietz wrote:With current EmuTOS (from git repo) and Hatari 2.2.1, I see the following settings for the _FDC cookie:
ST: 0 = DD,
MegaST: 0 = DD,
STE: 0 = DD,
MegaSTE: 0 = DD,
...
I see nothing wrong there, it detects the same drive density as Atari TOS.


But Atari TOS doesn't create the _FDC cookie at all unless the dip switch is set. You might say it is not a bug. But it is an incompatibility and that's what makes the difference here.
Fx Cast: Atari St cycle accurate fpga core

User avatar
npomarede
Atari God
Atari God
Posts: 1320
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: High density .STX / pastis support

Postby npomarede » Thu Mar 28, 2019 9:48 pm

Hi

I improved Hatari to better handle the DD/HD density for ST/MSA and STX floppy images.

- In MegaSTE mode, upper byte of register FF9200 (DIP switches on motherboard) is now emulated too (it was only emulated for TT and Falcon). This register will return amongst other things the model of drive in the machine (in bit 6).
MegaSTE was defaulting to a DD drive before, it's now defaulting to HD drive. As such, the _FDC cookie is now correctly created and TOS will recognize the drive as HD capable.

- For MegaSTE, TT and Falcon, register FF860E is now emulated and will allow to set the FDC to either DD mode or HD mode (before that Hatari did some kind of automatic mode selection). In DD mode FDC will only read DD floppies and in HD mode FDC will only read HD floppies.
The "fun" thing is that TOS doesn't have a way to detect if the inserted floppy is DD or HD (there's no line going from the drive to the FDC or other component).
So, to "detect" DD or HD floppy, TOS will in fact set FDC to DD and try to read from floppy. If it works, floppy is DD. If not, TOS set FDC to HD mode and try again. If it works, floppy is HD

- For STF/STE, the previous behaviour was kept, ie we consider that we can successfully read a DD or HD floppy image even if there's to HD drive (it's not the case of real HW, but it's for convenience in the emulation)

Akaisex is able to read the 10 sectors, 1024 bytes per sector used by the akai S1000 disk layout. As this disk layout is not TOS compatible (it's not a standard FAT disk), akaisex itself will toggle register FF860E to go from DD to HD mode and try to read the floppy. It will try to switch to HD mode only if the _FDC cookie is present (for TT, Falcon and MegaSTE with HD drive)

From my tests, this new version of Hatari will now work correctly in MegaSTE mode when using akaisex.

You can get a precompiled built of the devel version here http://antarctica.no/~hatari/latest/ if you want to test it

EDIT : the above binary is for Windows,as you seem to use MacOS from your screenshot, you can try the version Hatari.20190328_235118.dmg.zip built by Troed/Sync here https://troed.ddns.net/d/b90229b625/

Nicolas


Social Media

     

Return to “Hatari”

Who is online

Users browsing this forum: No registered users and 6 guests