1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-08 10:07:25 +00:00
Commit Graph

577 Commits

Author SHA1 Message Date
Thomas Harte
a09fb01d71 Makes an attempt at write support for Apple DSK files. 2018-05-19 22:30:52 -04:00
Thomas Harte
7cee3b7449 Resolves potential overflow / sign corruption. 2018-05-19 22:28:29 -04:00
Thomas Harte
8263c48a1d Added a guarantee that the TrackSerialiser won't modify tracks it receives. 2018-05-18 23:03:28 -04:00
Thomas Harte
ed06533e60 Implements write support out of the Disk II. 2018-05-18 22:07:58 -04:00
Thomas Harte
7b7beb13a3 Eliminates the fiction of setting and getting registers.
The Disk II seems lower level than that; it will read the data bus whenever it likes, it is the programmer's responsibility to keep up with that. It also reserves the right not to load the bus regardless of whether it receives a read or write access.
2018-05-17 21:39:11 -04:00
Thomas Harte
85c4e009f3 Undoes reformatting error. 2018-05-14 20:03:32 -04:00
Thomas Harte
76802b5e38 Eliminates arc4random.
It seems not to be as portable as I'd hoped.
2018-05-14 20:01:20 -04:00
Thomas Harte
9f2f388e5a Ensures generation of random noise if too many zeroes exist on a disk surface. 2018-05-14 19:17:34 -04:00
Thomas Harte
7996040f35 Rejigs segment conjugation to avoid potential accidental empty byte. 2018-05-13 22:30:44 -04:00
Thomas Harte
0055efb720 Corrects failure of expression in track size expansion. 2018-05-13 22:29:36 -04:00
Thomas Harte
5d6b5d9f10 Eliminates all emdashes in cross-platform code. 2018-05-13 15:34:31 -04:00
Thomas Harte
0b771ce61a Removes all instances of the copyright symbol. 2018-05-13 15:19:52 -04:00
Thomas Harte
3fdefb94e4 Removes requirement for correct sector epilogues.
It's now a length test that at present accepts 6-and-2 sectors only.
2018-05-12 23:03:08 -04:00
Thomas Harte
49592ebaf3 Ensures initialisation of scanner and that sectors overlapping the end of track are captured. 2018-05-12 18:42:07 -04:00
Thomas Harte
f410dcb3f3 Ensures proper test: not having a number of sectors that is a multiple of the track count. 2018-05-12 18:05:33 -04:00
Thomas Harte
0cb5362c6f Disambiguates whether Step will occur in addition to below zero/beyond maximum. 2018-05-11 21:44:08 -04:00
Thomas Harte
9089bf6535 Adds step events. 2018-05-10 21:58:14 -04:00
Thomas Harte
ef19a03efc Drives can now deliver activity events. 2018-05-10 21:54:10 -04:00
Thomas Harte
8ee34fafa6 Switches default DSK volume to 254. That seems to resolve Pravetz booting issues. 2018-05-09 20:28:58 -04:00
Thomas Harte
f65c65569a Makes disk head position explicitly something with sub-integral precision.
Also as a drive-by fix, corrects accidental assumption of 10 sectors for all MFMSectorDump descendants.
2018-05-06 23:17:36 -04:00
Thomas Harte
36f8b165cf Makes the epilogue test a bit more thorough. 2018-05-05 20:52:42 -04:00
Thomas Harte
ba7fbc4032 Reroutes all Disk II types through the Disk II analyser and returns actual sector from the Apple GCR parser results. 2018-05-05 16:37:33 -04:00
Thomas Harte
c36d7b4972 Makes first attempt at 6 and 2 decoder. 2018-05-04 23:11:12 -04:00
Thomas Harte
0dece80b5d Improves documentation. 2018-05-04 18:02:55 -04:00
Thomas Harte
e3b4aebf1a Introduces the Disk II as a unique media target platform.
As it makes a little more sense to analyse Apple GCR images to determine target platform than it does to have the potential platforms vote over them.

Also starts on the parser that'll be necessary for making a decision.
2018-05-04 18:02:36 -04:00
Thomas Harte
2e20191c01 Relocates and cleans up what is currently written of Apple GCR handling as the encoder.
A decoder will be forthcoming.
2018-05-03 22:40:45 -04:00
Thomas Harte
fcc750784a Switches interleaving logic around: having inspected some NIBs sectors are numbered in order, but scatter read from the image. 2018-05-02 21:28:18 -04:00
Thomas Harte
3787d094ec Deals with potential precision pitfall. 2018-05-02 21:26:39 -04:00
Thomas Harte
4b4ea4a103 Corrects final two bytes of Apple GCR low nibble encoding. 2018-05-02 21:06:18 -04:00
Thomas Harte
5e34c1b6b8 Switches to producing a single segment for NIBs and DSKs.
I've now seemingly verified that the values read back by the CPU are those I'm intending to produce, so I'm at a loss.
2018-05-01 20:31:42 -04:00
Thomas Harte
f4097290c2 Made various corrections following a quick for-loop constness audit. 2018-04-30 22:23:57 -04:00
Thomas Harte
9da481b060 Slightly simplifies syntax. 2018-04-30 22:08:51 -04:00
Thomas Harte
79002d6962 Adds an additional assert. 2018-04-30 22:07:54 -04:00
Thomas Harte
10c0e687f5 Attempts to introduce sleeping for the Disk II. 2018-04-29 17:51:10 -04:00
Thomas Harte
a9d4fe0b41 Introduces filetype wiring for DO and PO files.
Also corrects sector numbering logic to ensure there is a sector 15.
2018-04-29 16:34:10 -04:00
Thomas Harte
5cd15147eb Introduces interleaving of sector numbers. 2018-04-29 16:18:14 -04:00
Thomas Harte
c62db6665a Corrects storage of lower two bit pairs.
It turns out the non-integral result of 256/3 is handled differently than my guess.
2018-04-29 11:20:23 -04:00
Thomas Harte
fabcb261dc Corrects data prologue usage and off-by-one error in checksum placement. 2018-04-28 23:17:06 -04:00
Thomas Harte
45cf28e0eb Corrects sync lengths. 2018-04-28 15:48:49 -04:00
Thomas Harte
5b35c88be2 Corrections: data segments now correctly announce their number of bits, and tracks aren't oversized. 2018-04-28 15:47:50 -04:00
Thomas Harte
7f03f5d02f Makes a first attempt at six-and-two encoding for DSKs. 2018-04-28 15:18:48 -04:00
Thomas Harte
b98d5b790a Finally unifies disk image file exceptions, and adds a placeholder for Apple DSK. 2018-04-27 23:18:45 -04:00
Thomas Harte
5c74044e62 Unifies constants. 2018-04-27 21:38:08 -04:00
Thomas Harte
992a99d792 Improves validation of suspected sync regions. 2018-04-27 19:53:35 -04:00
Thomas Harte
41075356e2 Makes a first attempt at NIB support. 2018-04-26 22:49:07 -04:00
Thomas Harte
d59db504a3 Adjusted stepper logic; some disks load now. 2018-04-25 21:59:18 -04:00
Thomas Harte
4c6dc597f4 Converts Time::get into a template, introduces a via-a-double fallback for the timed event loop. 2018-04-25 19:54:39 -04:00
Thomas Harte
376b26c1e4 Simplifies the rotational multiplier upon construction, to mitigate against scale issues later. 2018-04-24 20:16:14 -07:00
Thomas Harte
7061537ff5 Makes joined-up attempt to run data through the Disk II. 2018-04-24 19:44:45 -07:00
Thomas Harte
4cbe5068a9 Works further towards NIB, but still isn't close. 2018-04-23 20:01:12 -07:00
Thomas Harte
38b2302b59 Corrects minor documentation errors. 2018-04-23 19:59:19 -07:00
Thomas Harte
bce0702745 Makes some faulty steps further towards providing Apple GCR assistance. 2018-04-23 19:59:03 -07:00
Thomas Harte
d447e81abd Adds provisional support for WOZ files. 2018-04-23 19:57:45 -07:00
Thomas Harte
6592745e53 Adds the bare minimum to respond to attempts to open NIB files with an Apple II. 2018-04-21 21:21:57 -07:00
Thomas Harte
72bc5f8d7b Adds a class to contain the Disk II and begins Apple GCR conversion routines. 2018-04-21 14:33:42 -07:00
Thomas Harte
e1c4035812 Switches away from C strings and allows Vic-20 region inference from filenames. 2018-04-06 17:42:24 -04:00
Thomas Harte
3bb496f9ae Enforces a maximum sector size to avoid impossible sizes.
Such as 128 * 2^255.
2018-03-22 22:00:26 -04:00
Thomas Harte
aafdff49be Implements the ugly stuff of converting a DMK back to flux. 2018-01-09 22:13:04 -05:00
Thomas Harte
4ef583813a Minor tidying of PCMSegment and Oric MFM DSK. 2018-01-09 22:12:34 -05:00
Thomas Harte
9f97fb738e Merge branch 'master' into DMK 2018-01-09 19:42:27 -05:00
Thomas Harte
4e124047c6 Introduces enough DMK support to progress to failure to parse a track. 2018-01-08 21:57:11 -05:00
Thomas Harte
6eb56a1564 Corrects various comment typos. 2018-01-08 20:55:40 -05:00
Thomas Harte
35fc0a5c16
Corrects assumption of double sidedness. 2018-01-08 09:35:29 -05:00
Thomas Harte
0ccc104027 Corrects start sector and track interleaving for MSX DSK.
MSX DSKs start with sector 1; Acorn disks still begin with sector 0. Also it turns out that MSX DSKs are indeed interleaved.
2018-01-07 21:59:18 -05:00
Thomas Harte
2f59226300 Fixes: DiskROM drive motor control, track_for_sectors' sides. 2018-01-07 20:02:40 -05:00
Thomas Harte
999a0c22d4 Adds superficial support for MSX .DSK.
In the sense that the file format itself is properly parsed, but the MSX doesn't actually yet have disk hardware.
2018-01-07 16:35:57 -05:00
Thomas Harte
0eaac99d74 Avoids implicit signed/unsigned comparison in the G64 reader. 2017-11-12 17:48:11 -05:00
Thomas Harte
792061a82b Corrects warnings in the CSW, CPC DSK, ZX8081 data encoding, and PRG and binary cartridges. 2017-11-12 17:46:06 -05:00
Thomas Harte
5aef81cf24 Commutes cross-platform #pragma marks to //MARK:s. 2017-11-12 15:59:11 -05:00
Thomas Harte
bce58683fa Corrects insert explicitly to supply a shared_ptr rather than a raw one. 2017-11-11 18:22:41 -05:00
Thomas Harte
2e15fab651 Doubles down on <cX> over <X.h> for C includes, and usage of the namespace for those types and functions. 2017-11-11 15:28:40 -05:00
Thomas Harte
cb0f58ab7a Corrects order-of-initialisation errors in the CPC (again), TextureBuilder, TextureTarget, Z80, MFM parser and binary tape player. 2017-11-10 22:57:03 -05:00
Thomas Harte
d9e56711ce Corrects order-of-initialisation errors in the Amstrad CPC, Vic-20, Oric, Commodore File, MFM disk controller, UEF and Commodore tape parser. 2017-11-10 22:47:10 -05:00
Thomas Harte
fabaf4e607 Adds missing include files, corrects bad include paths and eliminates the Clang-specific __undefined. 2017-11-10 21:56:53 -05:00
Thomas Harte
c0055a5a5f Further builds up SConstruct, correcting many missed imports and a couple of improper uses of C99 in C++ code. 2017-11-09 22:04:49 -05:00
Thomas Harte
f95515ae81 Eliminates a large number of instance of end-of-line tabs. 2017-11-07 22:51:06 -05:00
Thomas Harte
23d5849cda Attempts to map recognised [M]FM errors back to FDC status codes. 2017-11-03 21:29:42 -04:00
Thomas Harte
5a3ca0e447 Adds output for modified CPC DSKs. 2017-11-03 21:10:22 -04:00
Thomas Harte
e384c50580 Switches FileHolder to have a usage much closer to FILE *.
Thereby opens a route for file format implementations such as that appearing for CPC DSK that create an in-memory copy and perform a full rewrite.
2017-11-02 22:32:00 -04:00
Thomas Harte
f807a6b608 Generalises the concept of multiple samplings of an FM/MFM sector, simplifying CPC DSK support and paving the way for generic weak/fuzzy bit support. 2017-10-31 21:32:28 -04:00
Thomas Harte
833f8c02a4 Switches the CPC DSK implementation to building an in-memory version of the structure up front.
Preparatory to making these things writeable.
2017-10-31 19:41:16 -04:00
Thomas Harte
ad9df4bb90 Commutes uint8_t *, uint16_t *, uint32_t *, size_t, off_t and long to functional-style casts. 2017-10-21 22:30:15 -04:00
Thomas Harte
e983854e71 Converts all uint8_t and uint16_t casts to the functional style. 2017-10-21 21:50:53 -04:00
Thomas Harte
ec999446e8 Commutes int and unsigned casts to the functional style. 2017-10-21 21:00:40 -04:00
Thomas Harte
5e3e91373a Switches all unsigned int and double casts to functional style. 2017-10-21 19:49:04 -04:00
Thomas Harte
7f2febeec9 Ensures complete DPLL initial state assignment. 2017-10-17 22:13:37 -04:00
Thomas Harte
2d7a4fe5f0 Switches the MFM shifter to unsigned accumulation.
Since left shifting signed numbers is undefined behaviour.
2017-10-17 22:12:04 -04:00
Thomas Harte
b4583e976e Corrects buffer overwrites resulting from failure to treat a number of records of 0x80 as a special case. 2017-10-17 20:52:16 -04:00
Thomas Harte
44cdc124af Switches to providing a full record of changes to disk images, rather than feeding them a track at a time.
Gets explicit about `override`s while doing so, to ensure full adaptation.
2017-10-07 19:37:36 -04:00
Thomas Harte
b37787a414 Ensures lifetime-linked track flushing without relying on virtual calls within a destructor. 2017-10-07 19:14:18 -04:00
Thomas Harte
53b99ea248 Uses Disk::flush_tracks to elide replacement of dirty tracks. 2017-10-06 22:07:42 -04:00
Thomas Harte
97a2be71e3 Introduces flush_tracks to Drive, while switching its interface to using Track::Address and adjusting associated integer types. 2017-10-06 21:45:12 -04:00
Thomas Harte
edb9fd301c Begins this project's conversion to functional-style casts. 2017-10-03 22:04:15 -04:00
Thomas Harte
0fb363ea0e Adds writing support for HFEs. 2017-10-03 21:24:20 -04:00
Thomas Harte
1cc85615d5 Factors HFE track seeking out from the track fetching method. 2017-10-03 20:33:55 -04:00
Thomas Harte
7b01c1bee6 Revokes direct visibility of is_read_only_ to subclasses of FileHolder. 2017-10-03 19:36:06 -04:00
Thomas Harte
35705c5345 Factors out bit reversing from the HFE class. 2017-10-03 19:12:45 -04:00
Thomas Harte
ef605eda51 Factors out commonalities in SSD/DSD and ADF implementations. 2017-09-30 20:30:15 -04:00
Thomas Harte
326857a84d Corrects FM/MFM selection when looking for sectors. 2017-09-29 22:48:00 -04:00
Thomas Harte
5dd3945695 Factors out the more egregious similarities between ADF and SSD. 2017-09-29 22:07:23 -04:00
Thomas Harte
19eb975c73 Adds an intermediate step in CP/M directory parsing.
To reduce amount of time spent allocating and reallocating buffers.
2017-09-29 21:38:16 -04:00
Thomas Harte
698ffca51b Recasts the [M]FM parser in terms of the new factoring.
Temporarily breaks SSD writing support.
2017-09-29 20:08:36 -04:00
Thomas Harte
fe3cc5c57c Removes dead pragma. 2017-09-28 20:47:25 -04:00
Thomas Harte
f488854720 Switches Oric MFM DSK serialisation to feeding a track serialisation to a shifter.
Thereby eliminates the parser's need to offer get_track.
2017-09-27 22:14:50 -04:00
Thomas Harte
51c0c45e04 Turns MFM bit length into a globally-available constant. 2017-09-27 21:30:09 -04:00
Thomas Harte
c3e1489a8e Introduces Track::Address, a parallel to Sector::Address to enable more uniform storage. 2017-09-27 21:29:06 -04:00
Thomas Harte
e3420f62c6 Switches the Acorn ADF implementation to using the new track_serialisation/sectors_from_segment route for decomposition of a track into sectors. 2017-09-26 22:05:33 -04:00
Thomas Harte
9f4a407f94 Switches the track serialiser to a more standard header + implementation separation.
Also introduces a full priming of the PLL before deserialisation begins.
2017-09-26 22:01:32 -04:00
Thomas Harte
5dda897334 Changes function name to sector_size — into line with idioms. 2017-09-26 22:00:19 -04:00
Thomas Harte
3982e375e3 Introduces a route from a PCMSegment to a list of [M]FM sectors. 2017-09-25 19:57:11 -04:00
Thomas Harte
a8524daecb Marks the move constructor as noexcept, to improve usage with vector. 2017-09-25 19:53:22 -04:00
Thomas Harte
d1ce764201 Provides SectorsFromSegment, a bitstream to sector converter. 2017-09-24 22:41:16 -04:00
Thomas Harte
8875982e1f Ensures Sectors are move constructible (and still default constructible), and adds proper const qualifiers to Sector::Address. 2017-09-24 22:40:38 -04:00
Thomas Harte
3319a4f589 Isolates those Sector fields that describe its address and makes them usable as a set key. 2017-09-24 21:57:21 -04:00
Thomas Harte
c7f27b2db4 Renames MFM.[c/h]pp as per its new remit: encoding only. 2017-09-24 21:40:43 -04:00
Thomas Harte
631f630549 Severs the MFM parser from the overweight single MFM.hpp. 2017-09-24 20:31:19 -04:00
Thomas Harte
2a08bd9ecc Factors shifting plus stateful [M]FM token recognition out of the MFMDiskController.
Given the proliferation of MFM-related classes, establishes a subdirectory for them.
2017-09-24 20:07:56 -04:00
Thomas Harte
f789ee4ff0 Introduces a track to segment decoder.
This will be needed to make formats like G64 and HFE writeable, but probably also will be usable to speed up static analysis.
2017-09-23 22:39:19 -04:00
Thomas Harte
d72dad2d1a Severs the DiskImage implementation from its public header file. 2017-09-22 22:46:31 -04:00
Thomas Harte
698e4fe550 Tidies the Disk file hierarchy. 2017-09-22 22:39:23 -04:00
Thomas Harte
b5406b90cd Introduces a new class hierarchy for disk images.
Increasing independence of format-specific stuff and generic caching without mangling them into a common namespace, and allowing in some cases for a decrease in read/write blocking.
2017-09-22 20:28:11 -04:00
Thomas Harte
44a56724cb Speeds up byte decoding within sectors for the ahead-of-time MFM parser. 2017-09-16 20:28:24 -04:00
Thomas Harte
a85909198f Adds defences against double calls to end writing. 2017-09-16 17:07:36 -04:00
Thomas Harte
da082673d7 Drives now have a finite number of heads.
The Amstrad volunteers itself to be single sided. Everything else stays as it was.
2017-09-15 21:18:36 -04:00
Thomas Harte
662d031e3c Adds exposition on the meaning of a disk controller being in write mode. 2017-09-15 19:14:36 -04:00
Thomas Harte
bf20c717fb The Drive now no longer produces input when in writing mode — other than announcing the index hole. 2017-09-14 22:32:13 -04:00
Thomas Harte
4d4a0cf1d2 Puts the disk controller back into the loop with knowledge about reading mode, and uses that knowledge to cut off the PLL. 2017-09-14 22:30:40 -04:00
Thomas Harte
82b13e98f2 Implements the real hardware ready test for Drives — motor on plus two index holes. 2017-09-11 22:27:50 -04:00
Thomas Harte
96bf133924 Withdraws requirement for DiskController users to specify a PLL multiplier or to provide rotation speed.
In the latter case because it's no longer of any interest to the controller, and in the former because I'd rather it be picked automatically.
2017-09-10 22:56:05 -04:00
Thomas Harte
6d6cac429d Fixes extra time accumulation during track running.
Introduces a bunch of further asserts, which aided me in determining the fix, i.e. that Drives being responsible for their own setup_track could double-pump the event loop.
2017-09-10 22:44:14 -04:00
Thomas Harte
8882aa496f Corrected wiring to get advance signals through to Drive event delegates. 2017-09-10 20:51:05 -04:00
Thomas Harte
0622187ddf Strips Controller of all capabilities now housed on the Drive. 2017-09-10 19:23:23 -04:00
Thomas Harte
523e1288fa Updates the MFM parser to use SingleTrackDisk rather than the equivalent withdrawn Drive functionality. 2017-09-10 17:34:52 -04:00
Thomas Harte
1a96cce26f Implements SingleTrackDisk, a Disk that contains only a single, specified, track. 2017-09-10 17:34:14 -04:00
Thomas Harte
a4e275e1fc Provides an implementation of Drive's new interface.
Mostly lifted from DiskController. `set_disk_with_track` has been withdrawn in favour of providing a suitable wrapper `Disk` subclass, as being an unnecessary complexity and intermingling of concerns.
2017-09-10 17:33:01 -04:00
Thomas Harte
ff6e65cca9 Introduces necessary storage and interface for writing. 2017-09-10 16:23:31 -04:00
Thomas Harte
90c7056d12 Started devolving timed event loop logic down to the drives, moving them closer to modelling real life. 2017-09-10 14:43:20 -04:00
Thomas Harte
c6e6c3fcfb Resolves all current analyser warnings. 2017-08-24 22:18:44 -04:00
Thomas Harte
49285e9caa Attempted to implement Sleeper in Drive and therefore in DiskController. Also corrected a couple of nonconformant file names. 2017-08-20 11:54:54 -04:00
Thomas Harte
5344e3098b Minor: made has_disk something that is decided on insertion/deletion. 2017-08-20 10:55:08 -04:00
Thomas Harte
ef07c33741 Merge branch 'Plus10' into MFMParserDensity 2017-08-18 15:48:20 -04:00
Thomas Harte
e559a65ede Ideally I would be able to kill this multiplier, as it could easily be derived at runtime. But, for now, just turned it up so that the analysis-oriented parser is better at parsing different bit rates. 2017-08-18 15:47:46 -04:00
Thomas Harte
af61a7fa28 Two quick fixes: correctly set segment size, and flip bytes to match HFE's bit ordering to PCMTrack's. 2017-08-17 22:28:00 -04:00
Thomas Harte
c8c1792c3f Made a first attempt at HFE support. 2017-08-17 22:20:02 -04:00
Thomas Harte
e6683e7f2d Added the base skeletal stuff of HFE support. 2017-08-17 21:48:48 -04:00
Thomas Harte
0c1714b695 Relaxed a little to allow +10% in track length. 2017-08-17 21:36:14 -04:00
Thomas Harte
2c2dd8073c Modified to return nullptr if asked for an extended disk image track that doesn't exist. 2017-08-17 15:32:24 -04:00
Thomas Harte
4f8b89772e Improved logic for detecting when all sense has been derived from a track to spot any repeated track, not necessarily the first one. That avoids sectors that run over the index hold and obscure the first throwing things. 2017-08-17 15:31:53 -04:00
Thomas Harte
733ee5a5c3 Ensured no attempt to put a null track into the cache 2017-08-17 15:30:02 -04:00
Thomas Harte
fedf5a44a6 Imposes a maximum track length. 2017-08-17 15:20:49 -04:00
Thomas Harte
da3e8655e9 Withdrew some caveman debugging nonsense. 2017-08-17 13:25:19 -04:00
Thomas Harte
42ad670ec8 Fixed: catalogue bitmap is in blocks, not sectors. 2017-08-17 12:47:47 -04:00
Thomas Harte
468770b382 Removed debugging nonsense. 2017-08-15 22:06:58 -04:00
Thomas Harte
6cfc3daacb Introduced a test within the disk controller so as not to request illegal tracks from disks, instead automatically substituting an 'unformatted' track. Which is just empty. 2017-08-15 21:52:12 -04:00
Thomas Harte
7b92b235e1 Further upped asserts, thereby discovering the mistake I'd recently introduced: seeking properly within the event source as per its potential left-clipping, but then not allowing for that in the calculated current time. 2017-08-15 16:25:46 -04:00
Thomas Harte
c196f0018f Upped the assert quotient. 2017-08-15 16:15:09 -04:00
Thomas Harte
73080d6c36 Added an easy way for disk controllers to clamp termination of written data exactly to the index hole.
This commit also temporarily provides a whole load of extra logging and minor logic improvements from the 8272. I'm mid-flow on finding a particularly vicious error in its handling of writing; wait for the pull request. But, at least: now waits for the first part of a post-ID gap before writing data, and attempts partially to handle appearance of the index hole during writing a track. More work to do on that though.
2017-08-15 16:05:10 -04:00
Thomas Harte
9541a2a5f0 Corrections: seek_to now takes the segment_start_time into account, correcting a windowing error where segments overlay other segments. Also added some asserts while bug hunting, and corrected the steps taken when inserting a longer-than-a-track segment so that each is correctly windowed. 2017-08-15 15:54:09 -04:00
Thomas Harte
944222eba4 Added: write_id_data_joiner can now be instructed not to write the first portion of gap. Which makes more sense as an option, to avoiding splicing errors. 2017-08-15 15:29:23 -04:00
Thomas Harte
a366298022 Factored out the standard [M]FM gap and mark groups, to increase 8272 readability and because it's pretty-much certain I'll need them again if ever I try to tackle e.g. the 8271. 2017-08-14 16:03:35 -04:00
Thomas Harte
4df9307d25 Factored out the dull and repetitious stuff of writing n bytes of the same value. 2017-08-14 15:50:36 -04:00
Thomas Harte
cefec7a19f Sought more robustly (i.e. less repetitively) to handle dispatch, including cancelling seeks where appropriate. 2017-08-14 10:37:39 -04:00
Thomas Harte
1011143dbe Sought to correct my interpretation of 'gap 3'. 2017-08-13 21:52:48 -04:00
Thomas Harte
750f2cb883 Flagged as not read-only, at least for now, to allow 8272 writing tests definitively to function. 2017-08-13 18:54:39 -04:00
Thomas Harte
1576b4500b Added documentation. 2017-08-13 18:27:00 -04:00
Thomas Harte
e1e9a06712 Made an attempt at format a track. 2017-08-13 18:05:19 -04:00
Thomas Harte
6e36f8ffa4 Removed index-hole announcement. 2017-08-13 12:50:24 -04:00
Thomas Harte
b0a7208cc7 Strung together a very basic version of 8272 write [/deleted] data. Lots of cases as-yet unhandled. 2017-08-13 12:50:07 -04:00
Thomas Harte
eec42aa7ae Entrusted further status to drives; also adjusted them to report read only if diskless, which I now believe to be correct. 2017-08-13 11:50:49 -04:00
Thomas Harte
186048a88e Made an attempt to fix the condition for setting a broken header CRC. 2017-08-12 16:39:32 -04:00
Thomas Harte
0c8769e335 Just to be safe. 2017-08-11 18:41:08 -04:00
Thomas Harte
83c7d34df2 Switched to populating the sector cache with everything in a track the first time anything on that track is requested. That avoids the problem whereby each request of a non-existent sector costs two spins. 2017-08-11 18:40:16 -04:00
Thomas Harte
a12671010a Sector size is now reported, and CRC failures are merely indicated, not cause for a sector to be thrown away. 2017-08-11 16:23:33 -04:00
Thomas Harte
edb088526f Simplified slightly, and updated TODO as to still-missing functionality. 2017-08-11 14:33:34 -04:00
Thomas Harte
80ebc63101 Updated the SSD file format container to specify sector sizes, now that it's no longer implicit. 2017-08-11 14:30:35 -04:00
Thomas Harte
cf1403bc79 Increased documentation. 2017-08-11 14:27:07 -04:00
Thomas Harte
fcf63a7547 Expands the [M]FM encoder to respect some new Sector flags: it will now wilfully make CRC errors, omit data, include data that is different than the ID's declared length, write deleted data, and can be commanded as to header/data gaps and what should be within them. All based around expanding towards the needs for reproduction of the CPC's .DSK file format. 2017-08-11 14:24:50 -04:00
Thomas Harte
0411b51582 Added an attempt to deal with 16-bit allocation units, and to ensure middle-of-file holes are respected. 2017-08-11 10:59:37 -04:00
Thomas Harte
026101a268 Killed logic_extents_per_physical, since I don't know how to handle it, and instituted tracks, to allow a decision about short versus long allocation units. 2017-08-11 10:46:50 -04:00
Thomas Harte
734099a956 Threw a sector cache into my MFM parser, in an attempt to cut down analysis costs. Also made it aware of multiple heads. 2017-08-11 10:29:13 -04:00
Thomas Harte
6be5851484 Cleaned up. 2017-08-10 22:34:29 -04:00
Thomas Harte
994179f188 Taking a whole bunch of guesses, this might be correct. 2017-08-10 22:33:08 -04:00
Thomas Harte
6a65c7a52a Started working on a CPC-oriented analyser; for now I just want to be able to make a good guess at the appropriate file to load from a disk. As it turns out, the CPC simply adopts the CP/M format, so a generic parser is appropriate. This is its beginning. 2017-08-10 17:10:21 -04:00
Thomas Harte
7d1023ea98 Added a 'ready' getter to Drive, formally to let the drive take ownership of that test. 2017-08-08 21:15:56 -04:00
Thomas Harte
2b0dcf8573 Transcribed the status bits that I think actually need to be obeyed. 2017-08-07 12:37:45 -04:00
Thomas Harte
47732ffb98 Prevented the 8272 from overreading ID fields (and, by doing so, overrunning its internal buffer). Exposed the MFMController's CRC generator for inspection. 2017-08-07 12:37:22 -04:00
Thomas Harte
56d65ba6f3 Adapted slightly, to retain the ability to advertise an incorrect size, to adjust the confusion I've created by having two different types of thing both called new_sector, and to print a warning when ignoring error flags. 2017-08-07 12:12:04 -04:00
Thomas Harte
895a3cbf24 Corrected reading of the track size table for extended disks. My first extended disk has now loaded. 2017-08-07 11:38:19 -04:00
Thomas Harte
d951c8c1c2 Fixed search for track start position with extended disks: it's no longer an infinite loop. So that's a pretty good performance improvement. 2017-08-07 11:36:29 -04:00
Thomas Harte
a294963e98 Made an absolutely basic attempt to accommodate some extended disk images. 2017-08-07 11:26:15 -04:00
Thomas Harte
c839556a27 Fixed: rewind the file to check for 'EXTENDED' if 'MV - CPC' failed. 2017-08-06 19:47:10 -04:00
Thomas Harte
77da582e88 Switched the container in which events are passed to int, with the intention of subclasses extending the receivable range. 2017-08-06 12:35:20 -04:00
Thomas Harte
ffadb04761 Documented, and removed a couple of Event types that are WD-specific but had accidentally flown into here. Will need to figure out how best to expose the CRC result too, but I'm willing to let that one drop out naturally as I implement the 8272. 2017-08-06 11:36:36 -04:00
Thomas Harte
29288b690e Switched disk controllers to be instantiated explicitly in terms of cycles, created an Amstrad-specific subclass of the 8272 to record the direct programmatic availability of all disk motors bundled together, and otherwise adjusted to ensure the thing is clocked and that the motor is enabled and disabled appropriately. The 8272 is also now formally a subclass of the incoming MDM controller. 2017-08-06 09:45:16 -04:00
Thomas Harte
4d60b8801c Started trying to factor out just the PLL stream -> FM/MFM events part that is presently in the WD1770. 2017-08-05 22:26:15 -04:00
Thomas Harte
192f232d3f Silenced warnings. 2017-08-05 11:53:29 -04:00
Thomas Harte
6e4d3b8a77 Added enough logic to produce some sort of version of a completely unprotected DSK. So enough to start bootstrapping an FDC emulation, at least. 2017-08-05 11:44:53 -04:00
Thomas Harte
8eda24261c Removed unnecessary header — it's implied by being a child of FileHolder. 2017-08-05 11:44:06 -04:00
Thomas Harte
75c59fefab Added an empty husk to begin support for Amstrad CPC disk image formats. 2017-08-05 10:02:10 -04:00
Thomas Harte
9d953421d8 After a quick check, added a couple of other _delegate initialisations. I should probably find a way to template this. 2017-08-01 07:07:43 -04:00
Thomas Harte
4abd62e62b Standardises on const [Half]Cycles as the thing called and returned, rather than const [Half]Cycles & as it's explicitly defined to be only one int in size, so using a reference is overly weighty. 2017-07-27 22:05:29 -04:00
Thomas Harte
8361756dc4 Switched definitively to the works-for-now approach of requiring an explicit opt-in where somebody wants to clock a whole-cycle receiver from a half-cycle clock. 2017-07-27 07:40:02 -04:00
Thomas Harte
75d67ee770 Relocated ClockReceiver.hpp as it's a dependency for parts of the static analyser, and therefore needs to be distinct from the actual emulation parts. 2017-07-25 20:20:55 -04:00
Thomas Harte
a1e9a54765 Eliminated redundant uses of ClockReceiver and sought to ensure that proper run_fors are inherited all the way down. 2017-07-25 20:09:13 -04:00
Thomas Harte
8a2bdb8d22 Converted the TimedEventLoop and the things that sit atop it into ClockReceivers. 2017-07-24 21:19:05 -04:00
Thomas Harte
b3ae920746 Converted the DPLL and disk controller classes to be ClockReceivers. 2017-07-24 21:04:47 -04:00
Thomas Harte
45ec5f8eab Eliminated implicit sign conversion. 2017-07-21 21:53:27 -04:00
Thomas Harte
1d01acce06 Fixed differing types of loop variables and targets. 2017-07-21 21:53:05 -04:00
Thomas Harte
163c0f1b44 Ensured offset means exactly one thing. 2017-07-21 20:58:17 -04:00
Thomas Harte
e5188a60dc Settled on the new average-of-length approach to a PLL window sizing, eliminating the old errors-of-phase approach. Since it anchors automatically to the original target clocks per bit, killed the explicit mention of a tolerance. 2017-07-16 19:03:50 -04:00
Thomas Harte
e71d13c090 With the new PLL implementation, switching to a deeper window size returns the Acorn tape parser to: working. 2017-07-16 17:12:12 -04:00
Thomas Harte
51177e4e1f Attempted a different implementation of the PLL, that responds to changes only once. 2017-07-16 16:49:04 -04:00
Thomas Harte
4489f120f9 Eliminated foolish double indirection on phase history. 2017-07-15 22:40:38 -04:00
Thomas Harte
e01f3f06c8 Completed curly bracket movement. 2017-03-26 14:34:47 -04:00
Thomas Harte
f94f34f053 Made an attempt at read track. Which means process_input_bit can't just swallow syncs any more; it now reports them as tokens of type ::Sync. 2017-01-01 20:39:19 -05:00
Thomas Harte
b3c33d993a Made an attempt to explain the requirements placed upon Disk subclasses that wish to support writing. 2016-12-31 15:30:48 -05:00
Thomas Harte
8eb21c6702 The "MFM...Byte"s aren't MFM-specific, they're relevant to both FM and MFM encoding. So renamed them. Also slimmed syntax within MFM.cpp mostly where emigration from the Acorn disk analyser had left a residue of lengthy namespace specification. 2016-12-31 15:25:11 -05:00
Thomas Harte
52b850a3f5 Quick extra: make sure parsed tracks don't overflow the 6400 byte space available in an MFM disk. Which might be better expressed as 6250? 2016-12-31 12:51:52 -05:00
Thomas Harte
cfbab1448c Switched to a track parsing that disallows synchronisation values within sector contents. 2016-12-31 12:23:08 -05:00
Thomas Harte
12549ff412 Might as well get the file offset before entering the critical section; also moved the lock guard down more explicitly to group with the second set of actions. 2016-12-31 11:48:46 -05:00
Thomas Harte
6f0b5427e4 Made an attempt to avoid repetition of sync bytes. 2016-12-31 00:20:00 -05:00
Thomas Harte
0123b37213 Made an attempt to include sync values in the stream and properly to align. 2016-12-31 00:11:31 -05:00
Thomas Harte
ea4d85e1cd The virtual disk constructed is the same across all tracks. So why not just request zero? 2016-12-31 00:10:35 -05:00
Thomas Harte
f217d508b8 Completed first attempt at write support for Oric disk images. 2016-12-30 23:12:46 -05:00
Thomas Harte
1f625fad66 Decided that if this is an [M]FM parsing function then it should be something more intelligent than a mere PLL record. Which I guess conveniently implies Oric DSK-esque behaviour. But properly defined, rather than very vaguely. 2016-12-30 23:10:52 -05:00
Thomas Harte
632b3c63b1 Added the infrastructure necessary for Oric disks to appear writeable to the machine and to receive changed tracks. 2016-12-30 22:51:48 -05:00
Thomas Harte
d581294479 Added get_track to get the PLL output for a complete track. 2016-12-30 19:59:23 -05:00
Thomas Harte
3b29e6a473 Ensured SSD and ADFs are grown if required. 2016-12-30 18:08:12 -05:00
Thomas Harte
07dacff42d Added writing for Acorn ADF disks, plus appropriate TODOs in both similar bits of boilerplate. 2016-12-30 18:03:30 -05:00
Thomas Harte
c85450648f Fix: make sure copies have proper event lengths. Also made it much clearer what's going on with the initial copy to the heap. 2016-12-30 17:55:46 -05:00
Thomas Harte
c740d9655a Fixed: index_count_ may have been left high by a previous call; reset it just in case. 2016-12-30 17:55:06 -05:00
Thomas Harte
d09e7ac1e8 Made an attempt at reacting appropriately if the very first thing that looks like a sector doesn't pan out. 2016-12-30 17:44:35 -05:00
Thomas Harte
5d63556870 Periods need a custom copy constructor too, if they're going to avoid sharing an event_source. 2016-12-30 17:39:52 -05:00
Thomas Harte
81a3cbac45 Ensured a copy is passed for writing back rather than the original. 2016-12-30 17:26:44 -05:00
Thomas Harte
63ff5165a4 After a quick bit of reading, discovered the virtual copy constructor pattern really is only a convention in C++, and conformed to it. Which hopefully gives copyable tracks. 2016-12-30 17:25:39 -05:00
Thomas Harte
71dbd78cf2 If asynchronous background processing is to occur on tracks then, given that they inherently have state, they'll need to be copyable, and ideally 'cheaply' (though it's not too great a priority). So started implementing appropriate copy constructors. Also introduced an extra level of indirection to PCMSegmentEventSource so that it can copy itself without copying the underlying PCMSegment, which is 95% of the heft of a track in all currently-implemented cases. 2016-12-30 14:23:26 -05:00
Thomas Harte
f88f3c65e9 Removed duplicated newline. 2016-12-30 14:21:36 -05:00
Thomas Harte
82bb78fb2d Ensured that get_sector copes even if any invalid sectors are encountered. 2016-12-30 14:21:14 -05:00
Thomas Harte
6fc692cd34 Attempted to switch to an asynchronous means for continuous file updates. Testing with SSD, as usual. 2016-12-29 22:15:58 -05:00
Thomas Harte
b9fad184d7 Added just enough for a complete manual test of writing to a .ADF with the 1770 then getting the correct result parsing it back on the host side in order potentially to update a file.
... which means that now it's time to worry about when and how mounted files should actually update themselves. Which will make for some fun with threading, I dare say.
2016-12-28 23:00:47 -05:00
Thomas Harte
af1b396c9e Found an ugly issue with Storage::Time as implemented (i) to be unsigned; and (ii) automatically to simplify. Will need to fix. Here's a quick workaround for this one segment of code. 2016-12-28 22:57:11 -05:00
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