* Add a basic write test for WOZ images
The new test just tries to change some random nibbles at the beginning
of the image and then verifies that the change has been recorded.
This exposed a bug where `q7` was never set to `true` when write mode
was toggled on.
Also, the assumptions and limitations of `moveHead` are more clearly
documented.
* Address comments
* Improved `moveHead` documentation a bit more.
* Removed redundant variable in `readNibble`.
* Refactored `findSector` and commented out the chatty log line.
All tests pass. No lint warnings.
* Add a test for the dirty callback on writes
This new test just checks that a clean disk becomes dirty after a
write _and_ that the dirty callback is fired.
* Add tests for WOZ disks
The new tests verify the basic read behavior of the state sequencer on
well-behaved disks, including sync bytes and so on. Write tests are
still to come.
There's also a change to the Woz format to return the info chunk data
as well.
* Add tests for the DiskII card
This change adds basic read tests for nibble-based disks for the
DiskII card and fixes a few minor errors.
These tests are in preparation for refactoring.
* Add write tests
These are some basic tests of writing to nibble disks. In the process,
one minor bug was found, fixed and documented.
* Fix the write tests
I misinterpreted something from Sather and thought that the high bit
had to be set on the data for writing to happen at all. This is not
true. Instead, there is a flux transition every time the high bit is
set as the data is left-shifted out of the data register. The
erroneous test has been removed.
At the same time, I finally understand what `skip` does and documented
that.
* Add tests for saving and restoring Disk II state
These are not exhaustive tests, but they ensure that some basic state
is saved and restored.
This adds both the recommended TypeScript checks, plus the recommended
TypeScript checks that require type checking. This latter addition
means that eslint essentially has to compile all of the TypeScript in
the project, causing it to be slower. This isn't much of a problem in
VS Code because there's a lot of caching being done, but it's clearly
slower when run on the commandline.
All of the errors are either fixed or suppressed. Some errors are
suppressed because fixing them would be too laborious for the little
value gained.
The eslint config is also slightly refactored to separate the strictly
TypeScript checks from the JavaScript checks.
Disk side information was being dropped and thus not displayable in the UI. This plumbs the value through various formats and adds some light testing.
Also fixes an issue where URL encoded hashes were not properly interpreted.
* Refactor disk handling to allow disk processing to happen in a worker
* Type cleanup
* Convert format handlers to TypeScript
* Convert CFFA to TypeScript
This is mostly a mechanical change; there are still lots of things
about `ui/apple2` that could be improved. The change also converts a
few dependencies of `ui/apple2`, like `applesoft/compiler`.
Besides the straight conversions, some other packages have changes to
make all of the typing work out.
Lastly, `@types/micromodal` has been added as a development
dependency.
During the typescriptification of `disk2.js`
(9d0ec5489c), `drive`, a parameter
reference, was changed into `this.drive`, the current active disk, by
mistake. This change fixes that error.
* Convert `cards/disk2.js` to Typescript
This is mostly a straightforward conversion of `cards/disk2.js` to
Typescript, with the following exceptions:
* `setState()` did not restore the drive light state correctly
because the callback was called with the old `on` value.
* `setPhase()` did not work for WOZ images.
* `getBinary()` did not work for `nib` files.
* `getBase64()` did not work for `nib` files and maybe didn't work
right at all.
Even with these fixes, local storage still doesn't work correctly.
I have also added several TODOs where methods don't support WOZ disks.
* Convert most uses of `memory` to `Uint8Array`
There are many places in the existing code where we use `Uint8Array`
directly. This change merely makes the `memory` type equivalent to
`Uint8Array`.
This change also changes most ROM data to be read-only in Typescript
to ensure that it is not modified by mistake. This can't be done just
by applying `as const` to the declaration because `Uint8Array`s are
can not be expressed as literals. Instead, we create a new type,
`ReadonlyUint8Array` that drops the mutation methods and makes indexed
access read-only.
See
https://www.growingwiththeweb.com/2020/10/typescript-readonly-typed-arrays.html
for details.
* Tighten types and document `disk2.ts`
While trying to understand the Disk ][ emulation, I tighted the types
and documented the parts that I could, including references to other
sources, like _Understanding the Apple //e_ by Jim Sather.
The one functional change is the addition of the P6 ROM of DOS 3.2 and
earlier. This is automatically selected if the card is initialized for
13 sector disks.
Apparently, I broke everything when I removed the underscores from the
field names and added them to the method names. The fix is just to
rename the methods `getCycles` and `getSync` and call it a day.
* Sort disks in category order
* Fix saving disk
* Fix keyboard not working after modal
* Make caps lock key on keyboard work, while keeping caps lock on virtual keyboard working too
* Fix delete local storage
* Fix minus key on Mac
* Remove backtick
* Credit.
Co-authored-by: Matthew Hebley <Matthew.Hebley@navico.com>
* CFFA
* CFFA multi-disk and write functionaliity.
* Clean up multi-devices/partition behavior.
* ProDOS WIP
* Update against refactored codebase.
* WIP
* Wait until disks load, show progress.
* Don't wait so long to boot floppies.
* Forgot to save :|.
* Credit.