acemielektron / fddEMU

AVR (atmega328p) based floppy drive emulator for PC
https://acemielektronikci.blogspot.com/2021/10/fddemu-disket-surucu-emulatoru.html
GNU General Public License v3.0
144 stars 22 forks source link

Modification for 256 bytes sectors #8

Open ikonko opened 2 years ago

ikonko commented 2 years ago

Hi,

Would it be possible to modify the code (primarily avrFlux I assume) to accommodate DD disk format with 40 or 80 tracks 2 sides and 16 sectors 256 bytes in length? More about the format here: https://sinclair.wiki.zxnet.co.uk/wiki/TRD_format

TR-DOS uses 256 BPS and 16 SPT for disks, so a

Due to current code length (~23 out of 32k) this may require a separate branch?

acemielektron commented 2 years ago

Would it be possible to modify the code (primarily avrFlux I assume) to accommodate DD disk format with 40 or 80 tracks 2 sides and 16 sectors 256 bytes in length? More about the format here: https://sinclair.wiki.zxnet.co.uk/wiki/TRD_format

It seems Sinclair ZX use FD1793 as FDC which is capable of both FM and MFM.

avrFlux is mostly compatible to arbitrary sector sizes, just void genSectorID(uint8_t track, uint8_t side, uint8_t sector) function needs some modification. While rest of the code need major changes: fddEMU is built upon 512 byte sectors not because floppy sectors are usually 512 bytes, it is actually due to sd-card sectors being 512 bytes and this is compatible with most floppy sectors. It is certainly possible to adapt fddEMU for 256 byte sectors but I can't test it, as I don't have any compatible hardware.

acemielektron commented 2 years ago

Please check commit 546b867. I didn't test anything so it might work or might not work.

Edit: Sinclair wiki says TRD images might be smaller if they contain less data this might interfere with raw floppy image detection as it is based on image size

ikonko commented 2 years ago

I gave it a try. New firmware does recognize the image file in Betadisk format and can load it as a boot.img too. When trying to get the content of the disk, the host system reports Sector not found though. I think this will require an oscilloscope or logic analyzer view of the signals to understand what differs from the real floppy. Encoding used by TR-DOS and WD1793 is MFM definitively. FM encoding had been used for 8" floppies only, which aren't supported by Betadisk.

TRD images have fixed sizes, but there is another "compressed" format called SCL which is stripping down unused sectors on the disk. There is a conversion utility SCL2TRD which allows you to restore the image to disk file to a 80 track, double sided (640 KB) .trd disk file[cite from man page].

ikonko commented 2 years ago

If I enable DEBUG and try to use FORMAT command I get following output: `R0/0/1 R0/0/2 R0/0/3 R0/0/4 R0/0/5 R0/0/6 R0/0/7 R0/0/8 R0/0/9 R0/0/10 R0/0/11 R0/0/12 R0/0/13 R0/0/14 R0/0/15 R0/0/16

R0/1/1

R0/1/2

R0/1/3

R0/1/4

R0/1/5

R0/1/6

R0/1/7

R0/1/8

R0/1/9

R0/1/10

R0/1/11

R0/1/12

R0/1/13

R0/1/14

R0/1/15

R0/1/16

R0/1/1

`

After this, fddEMU hangs with LED flashing, but not responding to the host system.

acemielektron commented 2 years ago

If I enable DEBUG and try to use FORMAT command I get following output: R0/0/1 R0/0/2 R0/0/3 R0/0/4 R0/0/5 R0/0/6 R0/0/7 R0/0/8 R0/0/9 R0/0/10 R0/0/11 R0/0/12 R0/0/13 R0/0/14 R0/0/15 R0/0/16 #R0/1/1 #R0/1/2 #R0/1/3 #R0/1/4 #R0/1/5 #R0/1/6 #R0/1/7 #R0/1/8 #R0/1/9 #R0/1/10 #R0/1/11 #R0/1/12 #R0/1/13 #R0/1/14 #R0/1/15 #R0/1/16 #R0/1/1

After this, fddEMU hangs with LED flashing, but not responding to the host system.

Interesting debug: just after cyl=0 head=0 sector=16 it changes to cyl=0 head=1 sector=0 at the end after cyl=0 head=1 sector=16 it wraps to sector=1. I would say it doesn't recognize the sector header (your previous message points to it), but if so how can it change to head 1 exactly at the end of the head 0 sectors. If fddEMU is responding to serial commands it is not frozen (if so watchdog timer should kick in and restart at 8 seconds) so FDC is releasing motor or select pins or both.

When trying to get the content of the disk, the host system reports Sector not found though.

This error message might mean floppy controller couldn't find the sector header it is looking for, but as I said above if it couldn't read the sector header how does it know to change side to 1 at just after the last sector of side 0.

Is there a working baseline where we can do step by step modifications from ? Does the host system recognize 512 byte/sector floppy images ?

FD1793 datasheet states For MFM formats, DDEN should be placed to a logical "0" It is pin 37 according to the datasheet.

Edit: Writing to floppy image is disabled for half sector floppy disk images so it is normal for format to fail. What does it do while trying to read ?

ikonko commented 2 years ago

Based on Beta controller schematic, it seems that /DDEN can be programmatically changed. From my experience I never had a chance to use Single Density disks, so I don't know how TR-DOS detects this. The formats requested in this enhancement are Double Density disk sizes and tested images were 80 tracks/DS/DD (640 kB).

acemielektron commented 2 years ago

I don't have anything to test TR-DOS images, so I tried making ArduinoFDC compatible to TR-DOS floppies here is my fork of ArduinoFDC. This fork now has the capability to read my 256b_sectors branch. As I don't have any TR-DOS images, I created an image using fallocate -l 327680 testtrd.img and used this image. On ArduinoFDC I selected newly added disk type 3.5" 40 by typing t 5 on serial console (DD 40 track TR-DOS image). My imaginary TR-DOS format works but obviously this is not the true TR-DOS format. So if possible try using my fork of ArduinoFDC with a real TR-DOS floppy and see what works. If we can build something that can read true TR-DOS floppies than I think, we can use it as testing/debugging tool to make fddEMU TR-DOS image compatible.

ikonko commented 2 years ago

Thanks for forking the ArduinoFDC and testing 256b sector branch of fddEMU. I didn't have a chance yet to build ArduinoFDC, but that was my plan alongside building the ZX Floppy Emulator which might help to understand the differences between processing the TR-DOS image by fddEMU and other floppy emulators. By using Fuse emulator I've created a simple TR-DOS image which can be downloaded here. Of course plenty of others with more meaningful content can be also downloaded here.

acemielektron commented 2 years ago

Thanks for reminding me the ZX Floppy Emulator. I can use the test image you built with the ZX Floppy Emulator. Connecting it to the modified ArduinoFDC might give some results. Building it might take some time tough, I might need to wait for some parts to arrive.

ikonko commented 2 years ago

I was really thinking to use exactly the same modules as for fddEMU - Nano, SD reader and OLED. But this will require the LCD output routines to be modified for OLED. On top of it only requires 3 push buttons Schematic

acemielektron commented 2 years ago

Here is the debug output from my fork of ArduinoFDC when used with ZX_FDD_Emulator (used image test.trd built by @ikonko ). I checked and this is same as what test.trd's first 256 bytes looks like in hexedit. So 256b_branch of fddEMU should also have worked. ???

Reading track 0 sector 1 side 0 ---cut short--- 0000: 62 6F 6F 74 20 20 20 20 42 82 00 82 00 01 00 01 boot B....... 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0100: ---cut short---

ikonko commented 2 years ago

Could you please also check sector 8 on track 0 side 0? This is the 1st one TR-DOS is trying to read and in my case fails. There is a data about disk format, free sectors and the label.

acemielektron commented 2 years ago

Full ArduinoFDC debug outputs of sector 0, sector 8, sector 9, and sector 17 read from ZX_FDD_Emulator (image: test.trd). Sector 8 was empty so I also added debug output sectors 9 and 17 (r0,1,1) where there is some data

Drive A: 3.5" HD Drive B: 3.5" HD

Command: s0 Selecting drive A

Command: t5 Setting disk type for drive A to 3.5" 40

Command: r0,1,0 Reading track 0 sector 1 side 0 Drive not ready! HFE00000801+ HFB00000000- HFE00000901+ HFB00000000- HFE00000A01+ HFB00000000- HFE00000B01+ HFE00000C01+ HFE00000D01+ HFE00000E01+ HFE00000F01+ HFE00001001+ 0000: 62 6F 6F 74 20 20 20 20 42 82 00 82 00 01 00 01 boot B....... 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

Command: r0,8,0 Reading track 0 sector 8 side 0 Drive not ready! 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

Command: r0,9,0 Reading track 0 sector 9 side 0 Drive not ready! HFE00000801+ HFB00000000- 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 01 01 17 01 EF 04 10 00 00 20 20 20 20 20 20 ........ ..
00F0: 20 20 20 00 00 54 65 73 74 20 20 20 20 00 00 00 ..Tes t ...

Command: r0,1,1 Reading track 0 sector 1 side 1 Drive not ready! HFE00010801+ HFB00000000- HFE00010901+ HFB00000000- HFE00010A01+ HFB00000000- HFE00010B01+ HFE00010C01+ HFE00010D01+ HFE00010E01+ HFE00010F01+ HFE00011001+ 0000: 00 01 09 00 E7 31 0E 00 00 01 00 00 0D 00 02 09 .....1.. ........ 0010: 00 E7 32 0E 00 00 02 00 00 0D 00 03 09 00 E7 33 ..2..... .......3 0020: 0E 00 00 03 00 00 0D 00 04 09 00 E7 34 0E 00 00 ........ ....4... 0030: 04 00 00 0D 00 05 09 00 E7 35 0E 00 00 05 00 00 ........ .5...... 0040: 0D 00 06 09 00 E7 36 0E 00 00 06 00 00 0D 00 07 ......6. ........ 0050: 09 00 E7 37 0E 00 00 07 00 00 0D 00 08 09 00 E7 ...7.... ........ 0060: 30 0E 00 00 00 00 00 0D 00 09 09 00 F2 31 0E 00 0....... .....1.. 0070: 00 01 00 00 0D 00 0A 09 00 EC 31 0E 00 00 01 00 ........ ..1..... 0080: 00 0D 80 AA 01 00 6F 6F 74 22 CA 31 0D 80 31 35 ......oo t".1..15 0090: 36 31 36 0E 00 00 00 3D 00 0D 80 CA C1 5E 04 00 616....= .....^.. 00A0: 00 00 C1 5E 04 00 00 00 01 00 00 00 00 00 00 00 ...^.... .......00 00 00 00 00 00 00 00 00 00 0 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

ikonko commented 2 years ago

Today I've done testing of ZX FDD Emulator as I was able to obtain I2C LCD and rotary encoder just yesterday. The result is exactly the same - unable to read Sector 8 on Track 0. I've tested two Betadisk controllers with WD2793 and there was no difference, both failed.

I'm about to finalize another Betadisk with MB8877A controller and test both solutions again. Will post the update once ready.

acemielektron commented 2 years ago

Today I've done testing of ZX FDD Emulator as I was able to obtain I2C LCD and rotary encoder just yesterday. The result is exactly the same - unable to read Sector 8 on Track 0. I've tested two Betadisk controllers with WD2793 and there was no difference, both failed.

I'm about to finalize another Betadisk with MB8877A controller and test both solutions again. Will post the update once ready.

Interesting, it (WD2793) only fails at sector 8. So it is able to read other sectors ? Again I thought ZX_FDD_Emulator would have worked. After all it is written for the ZX spectrum. I don't know if you can directly access WD2793 on ZX but If you are not directly accessing the WD2793 it would be very hard to debug. The bios and even the floppy controller itself abstracts a lot of things. I am not sure if it would be helpful but how about connecting a ZX floppy drive with a TR-DOS floppy inside to ArduinoFDC, debug messages might be useful.

ikonko commented 2 years ago

I performed the Pentagon 48k (a clone of ZX Spectrum with built-in Betadisk based on MB8877A controller or its local equivalent) testing today. The results bring a good news and a bad news. The good one is that this machine works with ZX FDD Emulator, and the bad one that it doesn't work with 256b_sectors branch of fddEMU. I only tried to read the directory and load a program with standard TR-DOS routines. The next step is to prepare assemly routines to understand what's failing and why.

acemielektron commented 2 years ago

I performed the Pentagon 48k (a clone of ZX Spectrum with built-in Betadisk based on MB8877A controller or its local equivalent) testing today. The results bring a good news and a bad news. The good one is that this machine works with ZX FDD Emulator, and the bad one that it doesn't work with 256b_sectors branch of fddEMU. I only tried to read the directory and load a program with standard TR-DOS routines. The next step is to prepare assemly routines to understand what's failing and why.

Sorry for the late answer, I didn't have time until now. I tested fddEMU 256b branch (floppy image: TEST.TRD) with ArduinoFDC and indeed, it was returning wrong sector content. I fixed this in 1217e4d

Unmodified output of ArduinoFDC after this commit: Drive A: 3.5" HD Drive B: 3.5" HD

Command: s0 Selecting drive A

Command: t5 Setting disk type for drive A to 3.5" 40

Command: r0,1,0 Reading track 0 sector 1 side 0 0000: 62 6F 6F 74 20 20 20 20 42 82 00 82 00 01 00 01 boot B....... 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

Command: r0,8,0 Reading track 0 sector 8 side 0 HFE00000101+ HFB626F6F74- HFE00000201+ HFB00000000- HFE00000301+ HFB00000000- HFE00000401+ HFB00000000- HFE00000501+ HFB00000000- HFE00000601+ HFB00000000- HFE00000701+ HFB00000000- 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

Command: r0,9,0 Reading track 0 sector 9 side 0 HFE00000101+ HFB626F6F74- HFE00000201+ HFB00000000- HFE00000301+ HFB00000000- HFE00000401+ HFB00000000- HFE00000501+ HFB00000000- HFE00000601+ HFB00000000- HFE00000701+ HFB00000000- HFE00000801+ HFB00000000- 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 01 01 17 01 EF 04 10 00 00 20 20 20 20 20 20 ........ ..
00F0: 20 20 20 00 00 54 65 73 74 20 20 20 20 00 00 00 ..Tes t ...

Command: r0,1,1 Reading track 0 sector 1 side 1 0000: 00 01 09 00 E7 31 0E 00 00 01 00 00 0D 00 02 09 .....1.. ........ 0010: 00 E7 32 0E 00 00 02 00 00 0D 00 03 09 00 E7 33 ..2..... .......3 0020: 0E 00 00 03 00 00 0D 00 04 09 00 E7 34 0E 00 00 ........ ....4... 0030: 04 00 00 0D 00 05 09 00 E7 35 0E 00 00 05 00 00 ........ .5...... 0040: 0D 00 06 09 00 E7 36 0E 00 00 06 00 00 0D 00 07 ......6. ........ 0050: 09 00 E7 37 0E 00 00 07 00 00 0D 00 08 09 00 E7 ...7.... ........ 0060: 30 0E 00 00 00 00 00 0D 00 09 09 00 F2 31 0E 00 0....... .....1.. 0070: 00 01 00 00 0D 00 0A 09 00 EC 31 0E 00 00 01 00 ........ ..1..... 0080: 00 0D 80 AA 01 00 6F 6F 74 22 CA 31 0D 80 31 35 ......oo t".1..15 0090: 36 31 36 0E 00 00 00 3D 00 0D 80 CA C1 5E 04 00 616....= .....^.. 00A0: 00 00 C1 5E 04 00 00 00 01 00 00 00 00 00 00 00 ...^.... ........ 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........

Note: I realize this is not the same as ZX_FDD_Emulator; There is no Drive not ready ! error. Still I hope this works.

acemielektron commented 2 years ago

Hi @ikonko , it seems over two weeks have passed since my last modification 1217e4d for 256b_sectors and I haven't heard from you since. I guess 1217e4d also didn't work. Since I don't have the relevant hardware -the ZX- and I can't do anything to resolve this issue without your input, I am considering closing this issue as is (unresolved), if that is okay with you ?

ikonko commented 2 years ago

Hi @acemielektron, I'm very sorry I didn't have the opportunity to check the latest modification with multiple controllers. I've only checked with one, and it didn't work straight away. But then I realized that controller didn't work with regular floppy either. I'm waiting for spare 2793 to come so I can test more. In addition to that I'm awaiting version 1.1 PCBs to come to confirm there is no interference or other electrical issue with board 1.0. If you could please leave the issue open for at least two more weeks, so I can run more tests once goods will arrive. Thank you!

acemielektron commented 2 years ago

Hi @acemielektron, I'm very sorry I didn't have the opportunity to check the latest modification with multiple controllers. I've only checked with one, and it didn't work straight away. But then I realized that controller didn't work with regular floppy either. I'm waiting for spare 2793 to come so I can test more. In addition to that I'm awaiting version 1.1 PCBs to come to confirm there is no interference or other electrical issue with board 1.0. If you could please leave the issue open for at least two more weeks, so I can run more tests once goods will arrive. Thank you!

Thank you for the prompt response. I hoped 1217e4d would work, but not hearing from you for so long, I guessed it didn't work after all. I had fun writing fddEMU and if nothing works on ZX, another approach could be writing an emulator that replaces the FDC (2793). Though I don't have much free time nowadays, I guess it could also be a fun project.

ikonko commented 2 years ago

Hi @acemielektron, it took a while for me to get back to testing due to various delays, but finally I can confirm your fork for 256 bytes probably works. I tested the ArduinoFDC together with fddEMU and real floppy on the cable at the same time.Your 256b fork of ArduinoFDC could read both fddEMU emulated and real Betadisk formatted floppy well and without issues. What I've found in additional testing was incompatibility between fddEMU and FDC WD2793 or TMS2793NL respectivelly. I managed to get PC formatted floppies to be read by Betadisk with external program not using standard TR-DOS routines. And these disks are, of course, formatted to 720kB (using 512b sectors). The real drive on the same cable with fddEMU connected to Betadisk FDC and the results was the same - real floppies could be read without any issue while fddEMU still struggling to be read by FDC.

Another test had been taken with MSX computers (another 8-bit platform) - Philips VG-8235 and NMS-8245. Both using TMS2793NL. Original main repo HEX file used for programming the Nano in fddEMU, MSXDOS format using same physical layout as MS-DOS DD diskettes, and again - on the same cable real drive and fddEMU together. Still the same result - floppies are readable, while the same image on SD card served by fddEMU reporting reading error. I tried to tweak pull-ups too, but without success.

There are few more test scheduled for Didaktik Kompakt where fddEMU will be connected as external drive B (FDC: WD2797), ZX Spectrum +3 (FDC: Z0765) and Amstrad CPC6128 (FDC: NEC uPD765). All these systems support 512b sectors, and they should be able to read such floppies natively.

I will come back with results once tests completed.

Thank you for your continuous support for this great project.

acemielektron commented 2 years ago

Hi @ikonko, thank you for the extensive test using multiple computers and floppy controllers. After reading your post I looked at avrFlux, ArduinoFDC and ZX_FDD_Emulator code again and again. What I found is that I have shortened 12 bytes of pre-data-filler zeroes to 10 bytes to account for the time lost waiting. PC FDC tolerates this well, after all it is just filler. For ArduinoFDC 10 bytes of zeroes are enough. Another try after restoring default value might worth a shot. In the meanwhile I want to bring another 8 bit computer to your notice, Intel 8080 based Consul C2717 boots CP/M through fddEMU, have no problem reading emulated floppy images, unfortunately has trouble writing to floppy images. Edit: commit b3f8694

acemielektron commented 2 years ago

Hello I have implemented a few changes to fddEMU, here is fddEMU-4db7038.zip compiled from 4db7038. If ZX spectrum is compliant to IBM System 34 disk format it should/might/hopefully work.