English Amiga Board


Go Back   English Amiga Board > Requests > request.UAE Wishlist

 
 
Thread Tools
Old 08 October 2017, 17:43   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,333
Gotek/Cortex/HxC floppy emulator

Gotek/Cortex and HxC floppy emulators can use an Amiga program to communicate (to some extent) with the unit, to select disk image etc.

I don't have one of these, but I could disassemble the SELECTOR (Cortex) & HXCFEMNG (HxC) programs to figure out how they work, then WinUAE could support the selection method. Instead of choosing an ADF for DF0: you'd select a directory with ADF files in (e.g. your USB stick). And WinUAE would initially choose the selector ADF from that directory. Could maybe be useful for people with the actual hardware.

Do the Cortex and HxC programs use the same method of communication?
Does FlashFloppy support similar functionality?

[btw having WinUAE support .hfe images would be helpful.]

Last edited by mark_k; 08 October 2017 at 17:49.
mark_k is offline  
Old 09 October 2017, 18:04   #2
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,333
Answering my own post...

Source for the HxC file selector is at https://github.com/jfdelnero/HXCFE_file_selector

From briefly looking at that, it seems the Amiga can read/write any sector on the USB drive. That means, it would (in theory) be possible to write an Exec .device which in conjunction with fat95 would allow full access to files on the USB stick!

Last edited by mark_k; 09 October 2017 at 20:52.
mark_k is offline  
Old 09 October 2017, 23:27   #3
Jeff_HxC2001
Registered User
 
Join Date: Sep 2008
Location: Paris / France
Posts: 656
Quote:
Originally Posted by mark_k View Post
Answering my own post...

Source for the HxC file selector is at https://github.com/jfdelnero/HXCFE_file_selector

From briefly looking at that, it seems the Amiga can read/write any sector on the USB drive. That means, it would (in theory) be possible to write an Exec .device which in conjunction with fat95 would allow full access to files on the USB stick!
Sure ! And this was already done on Atari ST (have a look hxcmount).
All popular Amiga compatible floppy emulators (HxC,Cortex,FF...) are using the same HxC Direct Access protocol... :

http://hxc2001.com/download/floppy_d...ccess_mode.pdf

btw the hxc file selector is compatible with the cortex firmware since the last release...
Jeff_HxC2001 is offline  
Old 10 October 2017, 16:22   #4
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,333
Thanks for that link! Some questions...

In direct_access_status_sector:
What are the power-on defaults for lba_base and number_of_sector?
What happens if a read/write is attempted that would overrun the end of the USB drive?

In direct_access_cmd_sector struct, is cmd_checksum used? I couldn't see where the Amiga selector code sets that.

CMD_SET_LBA: Does parameter_4 do anything on Gotek hardware? What happens if parameter_5 value is not valid?

CMD_SET_TRACK_POS (command 0x02): What is that used for? I guess it's to set the track number at which the hardware responds to "special" commands/access. Does Gotek hardware support emulation of two drives simultaneously, or is that only for HxC hardware?

What is the name of command 0x03? I think there's a typo in the PDF, it has CMD_SET_TRACK_POS twice.


In the examples, to e.g. read sector 0x00100004, you change LBA to 0x00100000 first. Is it required for the base LBA to be a multiple of 8? Or could you instead change LBA to 0x00100004 and read sector#1?


What are the timing limits (min/max) for stepping heads? For support in WinUAE or other emulator it will be best to match what real hardware/firmware requires.

The Amiga selector uses 80us or 8us step delay when checking for presence of floppy emulator in test_drive(). Then jumptotrack() uses 1ms.

test_drive() steps to track 0 with 80us step delay (too small for a real floppy drive). Needs max 260 steps until track0 signal.

Then it steps inward 40 times (source comment says 30 though?) with 8us step delay. Wait 200us then step outward (towards track 0) 40 times (again comment says 30). Need to have track0 signal after the 40th step.


Edit to add: is there any way for the Amiga to determine the USB drive capacity?

Last edited by mark_k; 10 October 2017 at 21:13.
mark_k is offline  
Old 12 October 2017, 08:55   #5
Jeff_HxC2001
Registered User
 
Join Date: Sep 2008
Location: Paris / France
Posts: 656
Quote:
Originally Posted by mark_k View Post
Thanks for that link! Some questions...

In direct_access_status_sector:
What are the power-on defaults for lba_base and number_of_sector?
0x00000000

Quote:
Originally Posted by mark_k View Post
What happens if a read/write is attempted that would overrun the end of the USB drive?
Error reported (SD flag changed)

Quote:
Originally Posted by mark_k View Post
In direct_access_cmd_sector struct, is cmd_checksum used? I couldn't see where the Amiga selector code sets that.
No. Just rely on the sector CRC.

Quote:
Originally Posted by mark_k View Post
CMD_SET_LBA: Does parameter_4 do anything on Gotek hardware? What happens if parameter_5 value is not valid?
You can't clear the read only flag. nothing more.

Quote:
Originally Posted by mark_k View Post
CMD_SET_TRACK_POS (command 0x02): What is that used for? I guess it's to set the track number at which the hardware responds to "special" commands/access. Does Gotek hardware support emulation of two drives simultaneously, or is that only for HxC hardware?
Fast direct access mode exit. The file images are then ready to be used faster.
2 drives on the real HxC only.

Quote:
Originally Posted by mark_k View Post
What is the name of command 0x03? I think there's a typo in the PDF, it has CMD_SET_TRACK_POS twice.
something like CMD_FORCE_300RPM. Must check.

Quote:
Originally Posted by mark_k View Post
In the examples, to e.g. read sector 0x00100004, you change LBA to 0x00100000 first. Is it required for the base LBA to be a multiple of 8? Or could you instead change LBA to 0x00100004 and read sector#1?
No, no special alignment required, you can do what you want. Just think that a write to change the LBA cost time, so if you can avoid to change the LBA for each sector, this is better

Quote:
Originally Posted by mark_k View Post
What are the timing limits (min/max) for stepping heads? For support in WinUAE or other emulator it will be best to match what real hardware/firmware requires.

The Amiga selector uses 80us or 8us step delay when checking for presence of floppy emulator in test_drive(). Then jumptotrack() uses 1ms.

test_drive() steps to track 0 with 80us step delay (too small for a real floppy drive). Needs max 260 steps until track0 signal.

Then it steps inward 40 times (source comment says 30 though?) with 8us step delay. Wait 200us then step outward (towards track 0) 40 times (again comment says 30). Need to have track0 signal after the 40th step.
No special timing required. I just do this to check that the drive is the emulator before stepping to track 255... The emulator can accept faster step rate...

Quote:
Originally Posted by mark_k View Post
Edit to add: is there any way for the Amiga to determine the USB drive capacity?
The size detection is based on the FAT partition informations.

Why all these questions ? Just to ask or something is planned ?
Jeff_HxC2001 is offline  
Old 12 October 2017, 18:00   #6
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,333
Thanks for all those answers.

Most questions were relevant for emulator support. If(/when?) that exists, developing Amiga programs to talk to Gotek/HxC will be much easier than having to test each build on real hardware. The more edge cases/limits are correctly emulated, the fewer surprises with program working in emulation but not on real hardware.

Regarding head step timing, is there really "no" lower limit (e.g. glitch filter in the firmware)?

Some suggestions, could be useful for host software, to improve read throughput:

For successive reads (of USB drive sector data), auto-increment base LBA when drive head changes. Then programs could read and write contiguous chunks without needing to issue CMD_SET_LBA every 8 sectors. [Maybe you could use a currently-unused parameter of CMD_SET_LBA command to enable that?] Program would then read side 0, read side 1, read side 0 etc.

Make it possible to detect actual USB drive capacity (i.e. result of READ CAPACITY SCSI command). That would allow full access, e.g. host computer would be able to (re)partition the drive itself.

Add compatibility with 4KB-sector USB drives. Some USB hard drives and flash drives have 4096-byte sectors.

For PC or other computers that support HD floppies, maybe you could enable 16 sectors to be read each time (500kb/sec)?
mark_k is offline  
Old 12 October 2017, 18:42   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Document does not really explain what "provide this track layout" mean. (Sector ID? Wrong platform probably..)
Toni Wilen is online now  
Old 12 October 2017, 19:07   #8
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,333
I think the provided track data is supposed to be in (something like) PC/DOS 8-sector format. Having more sectors in the returned track data (e.g. the usual 9) wouldn't hurt.

amiga.c in the file selector source could help, see the writesector() and readsector() functions.
mark_k is offline  
Old 13 October 2017, 07:58   #9
Jeff_HxC2001
Registered User
 
Join Date: Sep 2008
Location: Paris / France
Posts: 656
The sector format is the commonly used ISO sector format.

You can change the number of sectors present on the track with the set_lba command (parameter 5). You can have a 64 sectors track for example...

The track step idea is a good one, but i am not sure if this is really faster since you have generally to make big jumps when reading the fat for example. May be useful to read/write big contiguous file but i think that you can have the same result by setting properly/dynamically the number of sector per track parameter.
The current file selector low level implementation don't use this feature, but i think that hxcmount does.
Jeff_HxC2001 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show us your drive emulator mods (Gotek/HxC/etc) ADz Hardware mods 109 31 January 2024 12:12
HxC Gotek Emulator Some games are not loading spannernick support.Hardware 5 11 July 2016 13:29
Gotek floppy emulator vs. HxC SD floppy emulator c0dehunter support.Hardware 50 05 July 2016 09:49
Amiga GOTEK FD Drive Emulator ADF ( Cortex 105a ) smashngrab support.Hardware 6 13 April 2016 16:28
USB HxC Floppy emulator and SD HxC Floppy Emulator by Lotharek on ext FDD dirkies Amiga scene 1 03 April 2012 00:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:18.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11887 seconds with 15 queries