Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Fastloaders & serial transfer timing
2016-02-29 09:41
lft

Registered: Jul 2007
Posts: 369
Fastloaders & serial transfer timing

This is a continuation of an off-topic discussion in X2016 Competitions: Your Input Wanted!.

There was some concern about serial transfer routines that might fail due to small margins.

I tried adding one safety cycle per bit pair in the transfer routine of Spindle. This caused an average slowdown of 1.5% for my benchmark scenario.



Crosses are bitfire 0.3, just to get some perspective.
Hollow circles are the latest unreleased Spindle with the original (fast) transfer routine.
Green circles are the latest unreleased Spindle with the new (possibly more robust) transfer routine.

I'm thinking that perhaps the robust version should be default, and the fast version available as an option. But on the other hand, nobody has reported any actual issues with the fast code on real drives, so this decision would be based on fear, more or less. Spindle users, what do you say?
 
... 19 posts hidden. Click here to view all posts....
 
2016-03-01 07:07
Bitbreaker

Registered: Oct 2002
Posts: 500
Quoting soci
These three timings are from Bitfire:
Bitfire 0.5 is just as tight as Spindle. Does it fail on Chameleon in standalone mode too?


Thanks for the test and numbers! So far i have not noticed any drive having problems in the transfer, but due to too strict timing when reading a sector or sector header. This is finally fixed in the next version, even THCM's floppy that is known to be very very picky managed to do a 24h test without any error. I suspect, that this drive is changing clock speed when getting warm in a noticeable way, while rotation speed stays stable. With the three floppys i have at home i never experienced any problems, no matter what i did, so it is about finding those not so in spec drives.

As for chamaeleon i don't know, Groepaz did not rant so far, so guess it is fine :-D
2016-03-01 07:12
Bitbreaker

Registered: Oct 2002
Posts: 500
Quote: When we had this issue with n0sd0s it seemed to be limited to 1571 drives, just to note.

Means, a drive detection is enough and manipulating the code in case to slow things down, just as one does with NTSC.
2016-03-01 07:48
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quoting Bitbreaker
Means, a drive detection is enough and manipulating the code in case to slow things down, just as one does with NTSC.
Alternatively:
lda #%00100000
sta $1801
;IRQ transfer loop..
lda #%00000000
sta $1801
2016-03-01 09:06
Bitbreaker

Registered: Oct 2002
Posts: 500
In fact 2 MHz mode can be switched on all over, except for the sector reading. Seems to speed up things by ~4% then.
That said, who is going to try it out on his 1571? .d64 is available for testing :-)
2016-03-01 10:28
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quoting Bitbreaker
In fact 2 MHz mode can be switched on all over, except for the sector reading. Seems to speed up things by ~4% then.
As long as the track stepping is VIA timed I suppose. Of course in Lft's case sector reading and IEC transmission is basically _all_ there is.

Quoting Bitbreaker
That said, who is going to try it out on his 1571? .d64 is available for testing :-)
I'll give it a quick whirl for you on my C128D (non-CR) which has survived $1801 pokes in the past. It doesn't suffer from sensitive IEC timing though.
2016-03-01 12:25
Flavioweb

Registered: Nov 2011
Posts: 447
All this theory could mean that if a real hw drive is connected through another drive (eg running on drive 9 with 8 connected), we can have timing troubles?
2016-03-01 13:12
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quoting Flavioweb
All this theory could mean that if a real hw drive is connected through another drive (eg running on drive 9 with 8 connected), we can have timing troubles?
It will certainly _affect_ the timing. Whether it's a help or a hindrance is difficult to guess at without getting out the oscilloscope.
2016-03-01 16:06
chatGPZ

Registered: Dec 2001
Posts: 11107
yes, connecting more drives generates more trouble :) some guy reported the weirdest things for chameleon...and then it turned out he had 4 drives connected. doh!
2016-03-02 08:43
Bitbreaker

Registered: Oct 2002
Posts: 500
A lot of tests and pain was gained on tests on real hardware and it turned out that serial is not the biggest problem to cope with. A loader should also sustain some variation in rotation speed. Also in very rare cases it is not enough to rely on the checksum, neither of the header nor the payload. When spinning up and starting directly to load, it can happen that one still passes all tests and load chunk. Been there, seen that. Same goes if you ommit a check on right track during header sanity checks. It might happen that for a short while you are reading from a neighbour track after stepping, with valid checksums of course. All problems that do not occur on emulated hardware but might let you fail after a bunch of successful runs over a whole disk.
Another though: if you populate the gaps in specific gcr_decode tables with other variables/data to make optimum use of your floppy ram, there is another potential risk:
When reading chunk while spinning up/stepping one could also read invalid gcr codes and make looukups in the gaps. If we have zeroes there, it is an easier to get a false positive checksum. As we read an arbitrary amount of zeroes, we will match with a zero checksum as well, though we have just read nothing. But i have no yet checked, thought of what the floppy is reading if there's no change in polarization, maybe 00000 all over?
2016-03-02 09:34
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quoting Bitbreaker
A lot of tests and pain was gained on tests on real hardware and it turned out that serial is not the biggest problem to cope with. A loader should also sustain some variation in rotation speed. Also in very rare cases it is not enough to rely on the checksum, neither of the header nor the payload, ...
It seems to me that what is really called for is a stronger checksum. More carefully tuned drivecode is going to keep failing regardless, during disk swaps and mechanical problems if nothing else.

I don't know quite what though. A one's complement sum would be a start though, with the sector header and data block sums linked in.

I suppose anything fancier is tricky on a single-accumulator machine though but fletcher-16 is doable, and CRC-8 is only 6 extra cycles per byte if you can afford the 256-byte table. Probably an 8-bit sum in parallel with the standard parity byte would be quite sufficient though.

As has been noted a clearer error model to work with would certainly also help in evaluating the candidates.

Side-note: Things get rather interesting when combined with Kabuto's arithmetic coding, which sort-of makes errors cascade by default. Combined with a header swizzled into the middle of the payload I figure an 8-bit one's complement sum is farily decent. Of course having been to lazy to bothered doing the analysis and it is quite possible that the two arithmetic codes interact badly ;)
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Slaxx/Q/HF/MYD!
Jammer
Alakran_64
AMB/Level 64
Andy/AEG
katon/Lepsi De
iceout/Avatar/HF
Krill/Plush
Guests online: 75
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.053 sec.