News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_endangermice

Emulating the FDC

Started by endangermice, 16:35, 23 September 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fredouille

UPD765 Datasheet says when CPU do not read data fast enough, the FDC sets the OR (overrun) flag in ST1 to 1 and terminates the Read Data Command.
For you "terminates the Read Data Command" is quite an abort. I will check that. Thanks for the clue.


Later in LATIS protection, we have following commands:

CMD Command=SEEK : 0F 00 21
RESULT Command=INTSTAT : 08
RESULT Result=20 21
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 30 20 24 00 C1 02
CMD Command=SEEK : 0F 00 22
RESULT Command=INTSTAT : 08
RESULT Result=20 22
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 10 00 24 00 C1 02
CMD Command=SEEK : 0F 00 23
RESULT Command=INTSTAT : 08
RESULT Result=20 23
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 10 00 24 00 C1 02

Expected sector seems to be found even if cylinder is incorrect.
In my code, I only check R and N to remove "No Data".

Fredouille

@arnorldemu: Thanks a lot, I am aborting read track at overrun detection and it works.


Now, I have a silly question because I still have issue with Basun (Seek requested after motor off).

When motor is OFF, is stepping motor functional to move head ?

I am trying to follow "MOTOR ON" and "STEP" signals on CPC6128 service manual (page 29/31) but I still going lost on IC1.
I believe IC2 (HA13421) is performing stepping commands.

arnoldemu

Quote from: Fredouille on 14:49, 02 November 16
@arnorldemu: Thanks a lot, I am aborting read track at overrun detection and it works.


Now, I have a silly question because I still have issue with Basun (Seek requested after motor off).

When motor is OFF, is stepping motor functional to move head ?
It depends on when the drive reports "not ready".

If the drive is not ready then the seek will not be done, or will be stopped.

Two cases:
- if fdc is already at the track, then it's possible seek is completed even if not ready (this I would need to check)
- if fdc is seeking, and then not ready, seek is abandoned.

All steps come from fdc.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

Quote from: Fredouille on 16:16, 01 November 16
UPD765 Datasheet says when CPU do not read data fast enough, the FDC sets the OR (overrun) flag in ST1 to 1 and terminates the Read Data Command.
For you "terminates the Read Data Command" is quite an abort. I will check that. Thanks for the clue.


Later in LATIS protection, we have following commands:

CMD Command=SEEK : 0F 00 21
RESULT Command=INTSTAT : 08
RESULT Result=20 21
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 30 20 24 00 C1 02
CMD Command=SEEK : 0F 00 22
RESULT Command=INTSTAT : 08
RESULT Result=20 22
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 10 00 24 00 C1 02
CMD Command=SEEK : 0F 00 23
RESULT Command=INTSTAT : 08
RESULT Result=20 23
CMD Command=READTRK : 42 00 24 00 C1 02 C1 2A FF
RESULT Result=40 10 00 24 00 C1 02

Expected sector seems to be found even if cylinder is incorrect.
In my code, I only check R and N to remove "No Data".
Interesting. I will do more checks to see which is needed for "no data". Maybe just R.. but N will also make things interesting.
If you set N to 4, and sectors are formatted as 512 bytes, then I believe read track will read size 2048. It will miss any id fields if it thinks it is still reading the data block, so here it could report "No data". If you then try with N=2, it will see them because it will finish block, see gaps, see id and find it.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Fredouille

Quote from: arnoldemu on 15:00, 02 November 16
It depends on when the drive reports "not ready".

If the drive is not ready then the seek will not be done, or will be stopped.

Two cases:
- if fdc is already at the track, then it's possible seek is completed even if not ready (this I would need to check)
- if fdc is seeking, and then not ready, seek is abandoned.

All steps come from fdc.

This is why I have added states STARTING and STOPPING when motor is set ON or OFF. Using these states was working with Basun as seek was allowed to be performed during STOPPING phase.
But this is not working anymore with your tests...


Fredouille

Quote from: arnoldemu on 15:02, 02 November 16
Interesting. I will do more checks to see which is needed for "no data". Maybe just R.. but N will also make things interesting.
If you set N to 4, and sectors are formatted as 512 bytes, then I believe read track will read size 2048. It will miss any id fields if it thinks it is still reading the data block, so here it could report "No data". If you then try with N=2, it will see them because it will finish block, see gaps, see id and find it.

Yes. I believe this is the reason of the read of track 36. FDC requests size 2 sectors but first sector is size 0. Hence, ID of second sector is not detected. As the second sector is the one expected by FDC, "No data" is set.

Lone

Quote from: Fredouille on 15:22, 02 November 16
This is why I have added states STARTING and STOPPING when motor is set ON or OFF. Using these states was working with Basun as seek was allowed to be performed during STOPPING phase.
But this is not working anymore with your tests...


Hello,
With a bit of reflection, and with some testing, I manage to figure how is it possibly working:
In Sugarbox, I handle the speed of the rotating disk.


I assume that the signal is READY when the speed is in a working range (id : the timings are enough to read the datas), and not when the motor is just on.
With this, I manage to get values that make both Basun and the acid's test running (maybe because, in the tests, the motor is stopped in the previous test (seek_test7)- stopping motor in the seek_nr test is not doing anynthing)








arnoldemu

Quote from: Lone on 12:53, 11 November 16
With this, I manage to get values that make both Basun and the acid's test running (maybe because, in the tests, the motor is stopped in the previous test (seek_test7)- stopping motor in the seek_nr test is not doing anynthing)

wow! good find.

I will update the tests so that when the drive is stopped it will wait until the drive is not ready.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

freemac

#33
Quote from: arnoldemu on 14:17, 01 November 16
I will need to add more tests to verify but:

34 indicates overrun, read error and no-data.

The read track for Hercule II is asked to read C1 (193!) sectors. EOT is the *number* of sectors in read track and not the last. The error says the protection code is reading less (looking at the results it read only 1 sector). This causes the fdc to signal "overrun" and quit the read. Therefore EOT sectors is not read and EN will not be set.

To set EN, EOT number of sectors must be read completely.

There is one more thing, Hercule II has sector size 0 (128 bytes), read track is reading size 2 (512 bytes), this will read sector data AND gaps etc.

EDIT: The "No Data" for read track means that the C,H,R,N in the read track command were not found on the disc. But so far every test I have done shows it will ALWAYS say "no data" :(

I will need to add more tests to verify the operation. (I did not yet have tests to trigger overrun on last sector and this kind of thing).


Hi ! I'm also playing with fdctest.asm on my core :)

Following my tests EOT is sector ID for read_data command and EOT is sector count for read_track (=read_diagnostic)

What happen in case sectors are not in order (C3 C5 C4) ? read_data having N=C3 and EOT=C4, does it read two tracks or three tracks here ?

What about skip flag on each command case (read_data/read_track) ?

Powered by SMFPacks Menu Editor Mod