English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   request.UAE Wishlist (http://eab.abime.net/forumdisplay.php?f=56)
-   -   Gotek/Cortex/HxC floppy emulator (http://eab.abime.net/showthread.php?t=88940)

mark_k 08 October 2017 17:43

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.]

mark_k 09 October 2017 18:04

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!

Jeff_HxC2001 09 October 2017 23:27

Quote:

Originally Posted by mark_k (Post 1190913)
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...

mark_k 10 October 2017 16:22

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?

Jeff_HxC2001 12 October 2017 08:55

Quote:

Originally Posted by mark_k (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 (Post 1191149)
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 ?

mark_k 12 October 2017 18:00

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)?

Toni Wilen 12 October 2017 18:42

Document does not really explain what "provide this track layout" mean. (Sector ID? Wrong platform probably..)

mark_k 12 October 2017 19:07

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.

Jeff_HxC2001 13 October 2017 07:58

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.


All times are GMT +2. The time now is 21:33.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.05303 seconds with 11 queries