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.
* Typescriptify all of the UI peripherals
This converts the audio, gamepad, keyboard, printer, and tape
peripherals into Typescript. This is a pretty mechanical change.
It does fix issue #72, though.
* Add and that were missing
When using the old webpack-dev-server with webpack 5+, we get bitten
by webpack/webpack-dev-server#2692. This upgrades to 4.0.0-beta1 which
also (unhelpfully) changes the config options. The `watchContentBase`
and `watchOptions` don't seem to have analogs in the new versions, but
I left them commented out for future reference.
Also, this does not update `package-lock.json` because even just
updating locally gave different output since I'm on a different
version of node, I'm guessing.
* Add green screen support for the GL renderer
This adds a configuration that is equivalent to a Monitor II monitor
(at least according to the Open Emulator Project) to GL renderer.
This does not need a restart to take effect.
* Update `package.json` to latest `apple2shader` version
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.
Stop stringifying opcodes during runtime and only do so upon inspection. Moves all the debugging logic to a common place to allow building an interface.
This is a mechanical update to Typescript and Jest dependencies, but
since I also upgraded `npm` to 7.5.2, the `package-lock.json` file has
a lot of churn.
* 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.
Like the DOS 3.3 and ProDOS sector order issues, this change fixes the
physical order of the sectors on 13-sector disks when nibblized.
This change also adds tests for the 13-sector format to verify the
sector order.
One of the crazy things is that _Beneath Apple DOS_ failed me in this
instance because it doesn't discuss what happens to the last byte in
"5 and 3" encoding anywhere (AFAICT). I went back to the DOS 3.1
source released by the Computer History Museum here:
https://computerhistory.org/blog/apple-ii-dos-source-code/
The code is in `appdos31.lst` in the `POSTNIB` routine on line 4777.