Commit Graph

58 Commits

Author SHA1 Message Date
Ian Flanigan
910238bf63
Convert cards/disk2.js to Typescript (#54)
* 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.
2021-02-07 20:50:50 -08:00
Will Scullin
1aaa94a8ed
enforce indent case like vscode prefers 2020-11-25 17:28:37 -08:00
Ian Flanigan
b80436d99c
More typescript conversion (#46)
* 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.
2020-11-24 08:48:14 -08:00
Ian Flanigan
1e4e8381ec
Fix calls to cpu.cycles() and cpu.sync() (#43)
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.
2020-11-15 17:54:13 -08:00
Will Scullin
f600f7c6b4
typescript linting 2020-11-07 16:46:27 -08:00
Will Scullin
b3cb64357f
Use class fields instead of binding (#40)
* Use class fields instead of binding
* classy tests
* Fix typing
2020-11-07 08:54:49 -08:00
Ian Flanigan
f5ad2cca16
Track raw parallel port output and allow it to be downloaded (#36)
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.
2020-10-17 16:53:13 -07:00
Ian Flanigan
ccad317f63
Fix bug where the alert dialog would not close (#32)
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.
2020-10-11 08:53:33 -07:00
Ian Flanigan
f991833d68
Add a "Clear" button to clear the printer paper (#35)
Before, the printer "paper" would just keep accumulating changes. Now
the `printer-modal` dialog has a "clear" button that will the paper.
2020-10-11 08:48:16 -07:00
Will Scullin
ab05e99d81
Simple Smartport (#31)
* Simple Smartport

* Block device support

* turn off verbose debugging

* rom cleanup

* Turn off debugging, again

* Turn off debugging, again, again
2020-09-12 19:42:18 -07:00
Will Scullin
ffe8a76c86
Basic copy and paste. 2020-09-03 22:39:16 -07:00
Will Scullin
05fcc60c2e
Show audio error when loading tape. 2020-08-23 06:36:59 -07:00
Will Scullin
b2afdf7a36
New machine, new lint 2020-07-20 17:12:50 -07:00
Will Scullin
eb6b5620a5
Audio cleanup. 2020-07-20 17:04:55 -07:00
Will Scullin
4046a9dbce
Restore old //e key handling behavior. 2020-06-21 15:52:39 -07:00
Will Scullin
fe2b85f6e3
e e e 2020-06-18 02:34:31 -07:00
Will Scullin
9f34078f30
Fix lint. 2020-04-23 19:50:19 -07:00
Will Scullin
87e8cde031
Style cleanup 2020-04-23 19:48:52 -07:00
Will Scullin
bb6e36f964
Various fixes (#23)
* 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>
2020-04-23 19:47:44 -07:00
Will Scullin
8af8cdbbca
Clean up lint. 2020-03-26 20:01:24 -07:00
Will Scullin
91d1d753ad
Eat context menu events. Fixes #21 2020-01-12 11:43:16 -08:00
Will Scullin
ce0a1b59ce
Move most gfx into css. 2020-01-02 21:12:34 -08:00
Will Scullin
b647b3c2bb
CFFA (#20)
* 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.
2020-01-02 11:11:04 -08:00
Will Scullin
eaef394eb1
Rework full page mode. 2019-12-30 11:40:28 -08:00
Will Scullin
d15979d67e
Better stats. 2019-12-30 11:13:35 -08:00
Will Scullin
f75a2fa962
Fix acceleration, normalize heavily used signatures. (#18) 2019-12-29 19:13:59 -08:00
Will Scullin
deec11a2a3
Fix play/pause 2019-12-27 18:14:33 -08:00
Will Scullin
bcbe36db0c
Refactor main (#17)
* Refactor UI elements.

* Cleanup.

* Refactor core.

* Fix printer.

* Small fixes

* Fix frame counts
2019-12-27 15:04:07 -08:00
Will Scullin
c5ca5ee132
Less ES6 2019-06-15 15:59:02 -07:00
Will Scullin
81adfff2e4
Missed file. 2019-04-06 12:30:50 -07:00
Will Scullin
542786e87c
Export instead of attach to window, and make webpack like it. 2019-03-31 20:52:45 -07:00
Will Scullin
ccc3a329f7
Fix capslock. 2019-03-13 20:00:37 -07:00
Will Scullin
127cee2dc0
Tweak a bunch of sizes. 2019-03-13 19:27:55 -07:00
Will Scullin
be715f3f63
Remove jQuery and jQuery UI dependencies. 2019-03-12 21:11:00 -07:00
Will Scullin
0f5c83d6ad
jQuery-less keyboard. Small fixes. 2019-03-08 11:17:18 -08:00
Will Scullin
4f092ed4f5
Fix special keys. 2019-03-07 15:03:13 -08:00
Will Scullin
13446c0afa
Deal with some stray globals. 2019-03-01 06:48:50 -08:00
Will Scullin
573f36510d
Convert to webpack first pass. 2019-02-28 21:21:18 -08:00
Will Scullin
b8261252e3
True up with website.
* Drag and drop support.
* Re-enable audio in newer Chrome, Safari
* Minimal Printer
* Video dirty regions
2019-02-18 20:42:50 -08:00
Will Scullin
77372d388b
Ditch makefiles, switch to eslint, fix linting. 2019-01-09 00:51:25 -08:00
Will Scullin
131db0340a
Refactor tape drive. 2019-01-09 00:27:31 -08:00
Will Scullin
de4f1fc2d8 State save/restore work, updated audio class. 2017-12-02 20:45:02 -08:00
Will Scullin
fa4f85d014 Reduce browser deprecation warnings. 2017-10-01 11:18:20 -07:00
Will Scullin
7fdaeb844b Improved keyboard behavior, including iOS fixes. 2017-10-01 11:17:30 -07:00
Will Scullin
37a3fb9bcd Refactoring. 2017-09-22 21:42:57 -07:00
Will Scullin
0e80761a4d Cleanup and refactor I/O behavior. 2016-12-06 09:49:00 -08:00
Will Scullin
0906b7173c More cleanup. 2016-11-27 17:28:49 -08:00
Will Scullin
f9f0239d86 Cleanup and refactoring. 2016-11-21 21:26:40 -08:00
Will Scullin
1dfbc0b61b Audio cleanup. 2015-07-10 22:55:36 -07:00
Will Scullin
8a761be9a9 Minor fixes 2014-07-30 12:07:21 -07:00