1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-18 17:06:15 +00:00
Commit Graph

686 Commits

Author SHA1 Message Date
Thomas Harte
9cb902cc4f Experimentally marked ADF as writable too, immediately discovering a mistake in the analysing MFM decoder. 2016-12-28 22:34:22 -05:00
Thomas Harte
bfe6c0a0c1 Ensured that FileHolder gets a writeable file reference if one is possible, and records whether the file in hand is read-only. So now the SSD class can answer honestly. 2016-12-28 20:09:14 -05:00
Thomas Harte
46a93d2e12 Fixed errors to ensure that FM disks, at least, follow the same CRC generation rules when being built from sectors and when being parsed. 2016-12-28 19:48:46 -05:00
Thomas Harte
720b1e5802 Attempted to ensure proper CRC generation for FM-format input. 2016-12-28 18:56:53 -05:00
Thomas Harte
3a9ad3fb08 Fixed Oric .DSK handling, per my latest understanding. Which creates a desire to write shorts directly to the disk surface, so exposed that in the encoder. 2016-12-28 18:50:28 -05:00
Thomas Harte
a568172758 Made steps towards proper CRC generation. Am currently comparing against Oric disk images, as — amongst other things — they include precomputed CRCs. 2016-12-28 18:29:37 -05:00
Thomas Harte
0490a47058 Worked on the all-around framework for decoding sectors back from tracks when closing down a file. Hit the wall that the parser is more observant of CRCs than the WD. No, really. So I guess I have to stop avoiding that whole issue. 2016-12-26 14:24:33 -05:00
Thomas Harte
742c5df367 With lots of logging arising temporarily, fixed bug whereby conversion to a patched track would lead to holding a track with a distinct measure of time, leading to improperly-placed patches. 2016-12-25 22:00:39 -05:00
Thomas Harte
b538ee5bd8 Fixed discovery of correct active period and setting of track time, when seeking. 2016-12-25 21:32:50 -05:00
Thomas Harte
a6d038cad9 Eliminated special case that doesn't seek properly and isn't needed. Added TODO. 2016-12-25 21:32:14 -05:00
Thomas Harte
4fca30b81f Made the Plus 3 less chatty, documented invalidate_track. 2016-12-25 21:06:58 -05:00
Thomas Harte
26710c988d Modified SSD to ensure a fully-formatted surface is represented even if no track data is in the source file. This corrects the controller's sense of write success. 2016-12-25 20:40:06 -05:00
Thomas Harte
acc35885cd Attempted to reduce track invalidations. 2016-12-25 20:38:25 -05:00
Thomas Harte
beaa868079 Factored the MFM parser out into encodings. 2016-12-25 20:00:57 -05:00
Thomas Harte
1349e85d83 [Mostly] fixed track write-back. 2016-12-25 19:19:22 -05:00
Thomas Harte
007c13ec16 Fixed: cycles_per_bit_ isn't a function of the rotational multiplier, it's absolute. Also made sure that exactly hitting the end of a bit counts. 2016-12-25 16:35:39 -05:00
Thomas Harte
98be6ede45 Shuffled a little to reduce risk of overflow, ensured writing is a loop, still seem to be writing too quickly for some reason. 2016-12-25 16:13:05 -05:00
Thomas Harte
d2ad2c756e Added enough shovelling to write rubbish for an entire sector. 2016-12-25 15:46:49 -05:00
Thomas Harte
ec55a25620 It makes sense to simplify these ahead of time. 2016-12-25 12:32:25 -05:00
Thomas Harte
aceb7e3b6b Started implementing write sector on the 1770, immediately deciding it would be useful to have a callback for end-of-queued-data-written from disk controller. So had a go at implementing that, naively. More investigation required. 2016-12-25 12:31:38 -05:00
Thomas Harte
901f19f89c Added enough stuff that SSDs attached to a 1770 will now reach the entry point for writing. 2016-12-25 09:46:12 -05:00
Thomas Harte
9d555c4a02 Let's try just declining to pump the PLL while in write mode. Added documentation to explain. 2016-12-25 09:19:18 -05:00
Thomas Harte
b57038edc5 Actually, at least index holes will still be receivable while writing, so this wasn't entirely correct. Probably best to leave it in. 2016-12-25 09:16:09 -05:00
Thomas Harte
af69b21033 This is almost complete, except that it doesn't act appropriately if some bits are written but not enough to cover the entire writing period. 2016-12-24 22:51:26 -05:00
Thomas Harte
f601d796f5 Added documentation. 2016-12-24 22:37:20 -05:00
Thomas Harte
6e94d0c19f Extended Storage::Disk::Disk to permit write-back of modified tracks, exposed some interface via Storage::Disk::Drive. 2016-12-24 22:11:31 -05:00
Thomas Harte
7f303cfceb Continued the baby steps. 2016-12-24 21:54:43 -05:00
Thomas Harte
afc6f4129c Withdrew unused tally. 2016-12-24 21:47:57 -05:00
Thomas Harte
1e416d4af0 Withdrew now-unused and never-implemented API from TimedEventLoop, and the redundant track time count from DiskController. 2016-12-24 21:02:10 -05:00
Thomas Harte
bedea48d03 This is a much better way of dealing with being partway into an incoming event. Subject to eliminating overruns, of course. 2016-12-24 20:54:27 -05:00
Thomas Harte
4cb17143ef Messing around trying to lock down timing precisely. Which includes formal initial conditions. 2016-12-24 15:18:46 -05:00
Thomas Harte
1e970a9772 Started stepping slowly towards allowing writing on the disk controller, taking the opportunity to introduce self-simplifying behaviour to Storage::Time. 2016-12-24 13:07:23 -05:00
Thomas Harte
e4e0347638 Attempted to consolidate some of the repetition. 2016-12-21 22:17:00 -05:00
Thomas Harte
03579f33f1 Fixed multi-coverage insertion, via an appropriate test. 2016-12-20 21:38:32 -05:00
Thomas Harte
7eca910cc5 Fixed insertion location finding logic, working on the relevant test. 2016-12-20 21:14:05 -05:00
Thomas Harte
823ab9bc34 Completed initial non-trivial test, fixing revealed errors. 2016-12-20 19:15:36 -05:00
Thomas Harte
5a508ea0df Attempted properly to cover the exactly-equal starts and ends cases, and to improve meaning. 2016-12-20 18:32:49 -05:00
Thomas Harte
63d861a2f3 Switched from C-in-the-brain manual offset counting to using iterators like an ordinary C++ person. 2016-12-20 18:17:54 -05:00
Thomas Harte
6f17076003 Switched to much more logical shared_ptr ownership of PCMSegmentEventSources by Periods. 2016-12-20 18:13:10 -05:00
Thomas Harte
497b2ae4dd Still by manual inspection: the time for the next event should be provisional until proven acceptable, allowing a proper measurement of time until exiting the period to be taken; also fixed the accumulated period error when seeking back onto the underlying track. 2016-12-20 08:14:16 -05:00
Thomas Harte
6bdde542c5 Edging towards functioning automatic tests, fixed right-period adjustment and slightly decreased searching cost while in the process of adding a test. 2016-12-20 07:52:14 -05:00
Thomas Harte
ec624eaab1 Made an attempt fully to implement PCMPatchedTrack. Which now requires tests. 2016-12-20 07:30:57 -05:00
Thomas Harte
1ef1f6ec69 Attempted to implemnt seek_to and to finish add_segment. Started doing a little of get_next_event but ran out of time for the day. 2016-12-19 21:46:02 -05:00
Thomas Harte
8f937ceac8 Made an attempt to come up with a data structure that actually makes sense (though perhaps this is textbook list rather than vector stuff? I guess it depends on the frequency I expect inserts to occur versus reads) and to implement inserts. Though the Periods aren't yet honoured. 2016-12-19 07:42:43 -05:00
Thomas Harte
e081f224b6 Implemented a very basic PCMTrack test, nevertheless revealing an oversight in PCMSegmentEventSource related to improperly counting to the index hole if the final bit is set. Took that as a message that I should comment and document the event source. 2016-12-18 22:53:24 -05:00
Thomas Harte
a6354ebb01 Reimplemented PCMTrack to use PCMSegmentEventSource, eliminating code duplication. 2016-12-18 21:37:05 -05:00
Thomas Harte
f9a5595dad Added seeking tests, correcting such errors as uncovered. 2016-12-18 10:19:24 -05:00
Thomas Harte
3297f6d545 Made an attempt to implement seek_to on PCMSegmentEventSource, taking account of off-by-half counting. 2016-12-17 22:44:33 -05:00
Thomas Harte
3116a2cf4c Realised I was actually testing PCMSegmentEventSource, not PCMSegment; implemented a spread of tests; hence fixed PCMSegmentEventSource. 2016-12-17 21:47:13 -05:00
Thomas Harte
254cc41fd6 Made an attempt to separate and isolate the stuff of creating flux events from a PCMSegment, eventually to factor that out of PCMTrack and make it available also to PCMPatchedTrack. 2016-12-17 21:13:57 -05:00
Thomas Harte
313db75303 Ensured the patchable track owns its underlying track. 2016-12-17 18:17:22 -05:00
Thomas Harte
f1a08b7ab5 Opted to pass times by reference and added enough to PCMPatchedTrack that it could start being used by the disk controller, albeit that it doesn't work. 2016-12-17 16:26:45 -05:00
Thomas Harte
dc08a23ceb This is going to be a slow walk, I think. This class attempts to be the scratchpad which will hold in-memory track modifications. 2016-12-16 19:20:38 -05:00
Thomas Harte
c4041b06a8 This'll do as a write interface, won't it? 2016-12-07 22:19:20 -05:00
Thomas Harte
0dc2aa6454 Commuted all of 'Storage' other than 'Tape' to postfix underscores. 2016-12-03 11:59:28 -05:00
Thomas Harte
81ee834530 As well as a bunch of logging, reinstated rotation position preservation across tracks. 2016-12-02 18:36:47 -05:00
Thomas Harte
93c573bfa9 Implemented missing status bits (other than the index hole), and a head loading delay for the Microdisc. 2016-12-01 21:13:16 -05:00
Thomas Harte
2222cb65d6 Split the status up into flags, assembled into a register upon demand. Attempted to implement some of the differences between the 1770/1772 and 1773/1793. Albeit with a motor fix still in place. 2016-11-30 22:26:02 -05:00
Thomas Harte
f44542c18c Improved naming: this now explains what, not the mechanics of how. 2016-11-26 23:35:11 +08:00
Thomas Harte
5c8ecd3051 It probably needs a better name, but hastily implemented track caching at the Disk level. 2016-11-26 14:27:06 +08:00
Thomas Harte
2f86b07cfa Added a parser for Oric-format MFM disks. Causing my first disk to load! 2016-11-26 13:40:10 +08:00
Thomas Harte
dcfdd73077 Switched to more conventional runtime polymorphism, also now allowing encoders (shifters as were) to be obtained, as a slightly lower-level interface than vector-of-sectors. 2016-11-26 13:39:20 +08:00
Thomas Harte
b180f04c87 Okay, so this file format wasn't what I hoped it was. It's another hack. Lots of work to do. 2016-11-26 10:19:10 +08:00
Thomas Harte
7613755f94 Fixed addressing: types are 1 and 2, not 0 and 1. 2016-11-26 10:13:12 +08:00
Thomas Harte
8499783b14 Dragged multibyte primitives and signature checks up to the base class. Implemented support for Oric MFM-style .DSK, at the file format level. 2016-11-21 20:47:16 +08:00
Thomas Harte
31c2548804 Created a base class for the boilerplate fopen stuff, switched as many classes as possible to its use, switched to postfix underscores and non-camelCase names. 2016-11-21 20:14:09 +08:00
Thomas Harte
ca53fac732 Switched to assuming a single-sided disk, moved out magic constants. 2016-09-26 21:20:30 -04:00
Thomas Harte
572d5587d9 Made a first stab at enabling multi-disk machines and thereby obeying (some of) the Plus 3's status register. 2016-09-25 21:24:16 -04:00
Thomas Harte
9bbcbd1001 Renamed class, intending to turn a Disk::Drive into literally just that, and have a thing with a PLL that consumes events be a Controller. 2016-09-25 20:05:56 -04:00
Thomas Harte
523dbb9678 This'll do for getting the ADF into the machine. 2016-09-25 18:32:26 -04:00
Thomas Harte
de863719d0 Made a first attempt at Acorn ADFS support plus the start of a suitable analyser. 2016-09-25 17:46:11 -04:00
Thomas Harte
a9e65e9b7a Tweaked disk side density, added call-outs to a WD1770 if the Electron had one (albeit without run_for_cycles yet as I need to figure out the clock rate), added a shell of the basic functions of the WD1770. No implementation yet. 2016-09-19 22:06:56 -04:00
Thomas Harte
64f2538b1f Added CRC checking to DFS comprehension; fixed a bunch of places where I'd used Objective-C's #import rather than #include. 2016-09-19 08:16:06 -04:00
Thomas Harte
8a1b805d11 Fixed file offset calculation for single-sided images. 2016-09-19 07:34:10 -04:00
Thomas Harte
b1e7f2dfd0 There's no cache and no CRC checking yet, but this is probably a rough outline of an FM parser. 2016-09-18 22:03:06 -04:00
Thomas Harte
d1c861d3a5 That should be that, I hope. 2016-09-18 21:09:32 -04:00
Thomas Harte
02c9a82cb5 Edging towards SSD/DSD support. Hold on! 2016-09-18 19:32:08 -04:00
Thomas Harte
91cd7e143b Started on the SSD/DSD support. Realised I had ommitted multiple head support from my disk class. Fixed that. 2016-09-18 19:21:02 -04:00
Thomas Harte
5409c8ec54 Switched PCMSegments to std::vector; ensured generated [M]FM tracks are correctly sized, thereby making sure the individual flux windows will be correctly sized. 2016-09-18 18:56:35 -04:00
Thomas Harte
d9aaf456f0 Adapted pervasively to MSB-first output. Which seems to be correct. 2016-09-18 18:46:58 -04:00
Thomas Harte
180c3df2d4 Calling it 'number theory' probably isn't accurate but extracted the CRC stuff and started using it for [M]FM encoding. 2016-09-18 18:33:26 -04:00
Thomas Harte
55a7418cbf Parameterised to perform FM and MFM encodings, at least subject to CRCs still being missing. 2016-09-18 17:16:20 -04:00
Thomas Harte
22eed60d2b Started sketching out basic MFM track encoding. Which possibly even means that the shifters don't need to be public? 2016-09-18 16:53:21 -04:00
Thomas Harte
0089c830c6 This possibly correctly encapsultes the lowest level of FM and MFM rules. 2016-09-18 14:17:06 -04:00
Thomas Harte
bcf91de7e9 Declared support for the Acorn disk files, started hammering out an encoder. 2016-09-18 13:35:54 -04:00
Thomas Harte
79ef38b123 Attempted to use the new get_cycles_until_next_event method to take some repetition outside of the PLL and drive event loops. 2016-09-17 22:02:38 -04:00
Thomas Harte
9d6dcb80a7 Started work on a GCR parser and the helper functions that lie behind that. 2016-09-13 21:53:36 -04:00
Thomas Harte
82c8459055 Minor tidying of namespace usage declarations. 2016-08-27 17:18:12 -04:00
Thomas Harte
56c0d70c1f Gave disks their own namespace. 2016-08-27 17:15:09 -04:00
Thomas Harte
9d76cd9b60 Removed dead instance storage. 2016-08-04 21:41:12 -04:00
Thomas Harte
3e90b85ff8 Made an attempt to insert proper conversions to/from rotational speed. The Time class is now really turning into a full-on quotient. Might need refactoring. 2016-08-04 21:36:39 -04:00
Thomas Harte
e57ab1025d Fixed location calculation, up to a point. 2016-08-03 22:33:00 -04:00
Thomas Harte
9af9b28baf Made very first attempt at closing the loop on this. But it's time for work. 2016-08-03 08:16:23 -04:00
Thomas Harte
e15241dc3c Added ability to query how long since the new interval was set to the timed event loop. Discovered that LCM will returning the net effect of the common factors only. Otherwise continued iterating towards time preservation. 2016-08-03 07:49:00 -04:00
Thomas Harte
a3a3486f54 Okay, it's becoming more apparent where the (very mild) complexity will be here. But started moving towards retaining rotation between tracks. 2016-08-03 07:33:26 -04:00
Thomas Harte
21f1fa37a4 Fixed Time addition, added accumulation of distance into track into the disk drive, added a short circuit for LCM. 2016-08-03 07:26:05 -04:00
Thomas Harte
30f8b6baa4 Made an attempt to add the necessary extension to Track, with a concrete implementation in PCMTrack, to support time-based seeking, the intended mechanism for not magically spinning the disk back to the index hole upon every head step. 2016-08-03 06:59:45 -04:00
Thomas Harte
d832e5e10d Reduced 1540 PLL to running at 4Mhz. Which is possibly correct (?) Made minor change to avoid divide if possible. 2016-08-02 21:28:50 -04:00
Thomas Harte
bc10b3ee9a It appears the problem is as simple as sectors being counted from zero. 2016-08-01 10:08:38 -04:00
Thomas Harte
f5e4ea3351 Some minor tidying, lots more of the caveman stuff as I try to determine what I'm doing wrong. 2016-08-01 09:43:08 -04:00
Thomas Harte
a00f9adba3 Made a first attempt at D64 support. Made an error somewhere but this should be 90% of it. 2016-08-01 08:41:16 -04:00
Thomas Harte
58297f1baf Performed the basic metadata and routing for opening D64 files. Realised that I wasn't actually necessarily catching exceptions properly for all file opens, and fixed. 2016-08-01 07:09:15 -04:00
Thomas Harte
2799a87218 Reduced possibility of overflow on LCM, improved commenting widely, removed one stale piece of G64 bootstrapping caveman stuff. 2016-08-01 06:04:55 -04:00
Thomas Harte
198fbbedc7 Reeled back all appropriate pieces of caveman debugging. 2016-07-31 13:42:34 -04:00
Thomas Harte
2332f72875 Formalised clock-rate multiplication within disk drives, discovered that the stepper didn't have ideal behaviour for my timed event loop and hence nailed down the semantics a ilttle more.
(obiter: the 1540 now appears to discern the correct sequence of bits. Framing is off in my test printfs but that's neither here nor there).
2016-07-31 13:32:30 -04:00
Thomas Harte
6ee784a893 Increased logging; discovered I was packing events together too closely. Now getting some zeros. 2016-07-30 04:30:55 -04:00
Thomas Harte
fead524eb5 Attempted to give the PLL a litte extra leeway, and fixed PCMTrack length test. 2016-07-29 18:52:50 -04:00
Thomas Harte
8f62211f5e Wired up the 1540 as a PLL delegate. Which prima facie means it should start receiving a bit stream. Except that I clearly have something in the timing way off — either my flux transitions are far too short or I need to significantly increase the clock rate on the PLL. 2016-07-29 12:08:18 -04:00
Thomas Harte
89a1881fef Started turning the 1540 into an actual disk drive. 2016-07-29 11:03:09 -04:00
Thomas Harte
6532b3a8c8 Filled in a calculation of clocks per bit that'll do. 2016-07-29 07:51:07 -04:00
Thomas Harte
f984de42a3 Took some small steps towards having a disk drive that at least can select a track and pump relevant events into a PLL. 2016-07-29 07:31:02 -04:00
Thomas Harte
e55db0cfe8 Made an attempt to eliminate creeping tape processing accuracy misses, which implied factoring out the GCM and LCD functions, which I then felt didn't really amount to signal processing. 2016-07-29 05:19:01 -04:00
Thomas Harte
5c1614ce7b Attempted to simplify, very slightly. 2016-07-28 14:35:39 -04:00
Thomas Harte
015cea494d Switched to a much-more straightforward PLL. I think I'm just fiddling now rather than moving forwards. Probably time to move on? 2016-07-28 11:32:14 -04:00
Thomas Harte
e061e849d4 Had a second bash at the PLL. Probably I should read some of the literature. 2016-07-27 16:24:24 -04:00
Thomas Harte
63f39608a6 Added just enough to get back to a working build. 2016-07-15 20:35:19 -04:00
Thomas Harte
165dbd9651 Started fleshing this out a bit. Hopefully. 2016-07-15 08:28:34 -04:00
Thomas Harte
0aa90b943b Switched to specifying bit length as a quotient for the purposes of a PCMSegment and verified that I had the logic for picking a Commodore time zone backwards: bigger numbers are faster, not slower.
Started sketching out a DiskDrive class.
2016-07-15 06:51:11 -04:00
Thomas Harte
6afd619791 Eliminated floating point arithmetic. 2016-07-14 19:47:00 -04:00
Thomas Harte
6b4fec37ff Moved down to a single divide. 2016-07-14 19:45:08 -04:00
Thomas Harte
481475a0f4 Switched to a full-on linear regression. Which causes the current tests to pass. 2016-07-14 19:42:01 -04:00
Thomas Harte
6d6b26b99f Actually made things worse. 2016-07-14 07:32:27 -04:00
Thomas Harte
d8d3464c56 Made a quick-hack attempt at PLL synchronisation. Which doesn't work. 2016-07-14 07:31:23 -04:00
Thomas Harte
d1fe07f14d Added test of perfect DPLL input timing. 2016-07-12 21:42:23 -04:00
Thomas Harte
94db45456e Started sketching out the basic form here, albeit that it doesn't yet do _the only thing it advertises itself as useful for_. 2016-07-12 20:23:56 -04:00
Thomas Harte
75d95c0bc0 Sketched out an interface for a digial PLL. Not persuaded yet. Baby steps. 2016-07-11 22:12:58 -04:00
Thomas Harte
1e9eedc314 Factored out the PCM track since it's going to be a useful construct for almost every file format. Documented it a little better. 2016-07-10 18:36:52 -04:00
Thomas Harte
66895d3ac7 Actually, I think this is the correct conversion from received speed to clock rate. It'll become obvious if it's not when I get back to working on the 1541 itself. 2016-07-10 18:24:12 -04:00
Thomas Harte
19ee430d4a Made an effort to support zoned tracks, at least. 2016-07-10 18:07:53 -04:00
Thomas Harte
6593caca93 Switched to a probably more helpful way around of expecting bits in bytes. 2016-07-10 16:21:52 -04:00
Thomas Harte
845a00ccef Attempted via linear search to implement PCMTrack::get_next_event. 2016-07-10 16:17:25 -04:00
Thomas Harte
f9510c1b67 Put sufficiently much of PCMTrack into place to get to a stored list of segments, having determined a common clock rate between them and therefore a complete track length. 2016-07-10 16:10:05 -04:00
Thomas Harte
4ae9f5ad5d Added preliminaries of reading the speed zone information. 2016-07-10 13:42:45 -04:00
Thomas Harte
8ae78ba4e0 Fixed signature check and fseek parameter order. 2016-07-10 13:32:59 -04:00
Thomas Harte
ff49857f5c Started sketching out support for the G64 file format. 2016-07-10 10:17:53 -04:00
Thomas Harte
9e3d6b762b Sketched out the generic interface for a disk, documenting it and the tape interface while I'm here. 2016-07-10 08:54:39 -04:00