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
* Switch modules to `esnext` to allow `webpack` to see import statements
* Pass rom names into Apple2 class
* Move ROMs into `system` and `character` directories to allow webpack bundle appropriate ROMs.
* Wait for ROMs to load before completing initialization.
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
* 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.
* Convert js/ram to a class
* Convert js/mmu to Typescript
* Convert js/apple2io to Typescript
* Convert js/canvas to Typescript
* Use new types in js/mmu
* Rename js/symbols.js to js/symbols.ts
* Remove the difference between readPages and writePages
As @whscullin said in PR #38, there's no need to have both readable
and writable pages since all implementations are currently both. This
change combines them into `Page`. Likewise, `PageHandler` now extends
`Page`.
`Apple2IO` now implements `PageHandler`. This caught a bug where `end`
had been renamed `endend` by mistake.
There are a few other formatting changes as well.
* Convert js/apple2 to Typescript
* Convert js/prefs to Typescript
* Convert all of the ROMs in js/roms to Typescript
Now all of the ROMs are classes that extend the ROM class. There is
some rudamentary checking to make sure that the length of the ROM
matches the declared start and end pages. (This caught what looks to
be an error in roms/apple2e, but it's hard for me to tell.)
The typing also caught an error where the character ROM was being
used for the main ROM for the apple2j version.
* Convert js/roms/cards/* to Typescript
* Convert js/formats/format_utils to Typescript
This change also seems to fix a bug with `.po` image files that
weren't being read correctly.
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.
This change adds a download link to the printer dialog. The contents
of the download will be the raw bytes written to the parallel
interface. Note that often these bytes will have the high-bit set
causing the contents to look like gibberish.
However, this is extremely handy because it allows one to turn the
printer output into a PDF:
1. In Appleworks (for example) configure an Apple ImageWriter in slot
1 and print a file.
2. Download the printer output.
3. Download the header file from https://github.com/AppleWin/AppleWin/files/1168047/ImageWriterEmulator-NoLF.ps.txt
4. In Linux, run:
```shell
$ cat ImageWriterEmulator-NoLF.ps.txt raw_printer_output.bin | ps2pdf - printer_output.pdf
```
Note that the parallel port emulation in apple2js does not yet support
Print Shop, so I haven't been able to test that out.
Micromodal maintains a reference to the current open dialog in
this.modal. If one dialog is open while opening another, Micromodal
can get confused and maintain a reference to the wrong one.
One of the problems is that the close action is not instantaneous, so
even closing one dialog and opening another immediately after can
cause the problem.
This change adds a small delay before opening the alert dialog to work
around the problem.
* 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>