Commit Graph

8 Commits

Author SHA1 Message Date
Will Scullin 70ec626dd0
Clean up copyright notices (#93) 2021-12-21 12:35:26 -08:00
Will Scullin ce3631f3a2
Refactor disk parsing into webworker (#83)
* Refactor disk handling to allow disk processing to happen in a worker
* Type cleanup
* Convert format handlers to TypeScript
* Convert CFFA to TypeScript
2021-07-06 17:04:02 -07:00
Will Scullin 09c6d6fbb1
Options modal (#75)
Refactor Options modal, webgl scanline, restore `Apple2.apple2`, other minor fixes.
2021-04-20 17:42:32 -07:00
Will Scullin 63e49696b8
Goose slot detection code 2021-03-08 19:28:52 -08:00
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 c3befc896a
fix typo 2020-11-08 12:26:12 -08:00
Will Scullin f600f7c6b4
typescript linting 2020-11-07 16:46:27 -08:00
Ian Flanigan c4df78cf06
Typescript conversion of several files, including js/cpu6502 (#38)
* Convert `js/util.js` to Typescript and add tests

Besides converting `js/util.js` to Typescript, this change also adds
`js/types.ts` that defines common types used in apple2js. Some of
these types, like `byte` and `word` are for information only.

* Convert `js/base64.js` to Typescript

This also adds a new type, `memory`, that is either an array of
numbers, or a Uint8Array.

* Convert `js/ram.js` to Typescript

This change does not convert `RAM` to a class; it just introduces types.

* Basic typing of cpu6502

This is a really rough first pass. There are some problems that can't
be fixed until this is turned into a real class, but at least all of
the function arguments are now typed. This caught a few cases where
extra arguments were being passed in.

* Convert `js/cpu6502` to a class

In theory, idiomatic classes should be better than the previous
closure-based classes. However, this conversion shows that the
instruction table does not fit well with idiomatic classes as method
referenced in the table need to be called with the correct `this`
everywhere.

This should, at best, be considered a first attempt.
2020-11-01 08:43:48 -08:00