Commit Graph

192 Commits

Author SHA1 Message Date
Will Scullin
b687dd9ac3
tweak video7 behaviors 2021-03-06 18:35:55 -08:00
Will Scullin
87b60d4eb4
Type restructuring 2021-03-06 15:07:06 -08:00
Will Scullin
3c5ded7058
Clean up, restructure MMU switches 2021-03-04 06:31:56 -08:00
Will Scullin
774dcf8089
Fix bank 1 bleed-through 2021-03-01 20:47:15 -08:00
Will Scullin
afc5280ac2
Flesh out some state stuff (#59)
Get save and restore state limping along to nearly as well as before I refactored and broke everything.
2021-02-27 19:17:36 -08:00
Will Scullin
3004aa99f2
Fix some edge cases 2021-02-21 21:26:07 -08:00
Will Scullin
be35aa9315
NTSC shader (#58)
Incorporate a real NTSC shader.
2021-02-21 18:38:21 -08:00
Will Scullin
1923d7a71c
Fix gamepad support
Thanks @JasonWoof
2021-02-15 17:55:46 -08:00
Will Scullin
3f966ad608
Basic binary file support. (#56) 2021-02-07 21:58:19 -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
Ian Flanigan
dc13b6a59a
DOS 13-sector tests and fixes (#53)
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.
2021-01-03 15:01:30 -08:00
Ian Flanigan
ab748b3aa6
Add JS typing to remaining disk types (#52) 2021-01-03 15:00:40 -08:00
Ian Flanigan
715ea6ffaa
ProDOS image format tests and fixes (#51)
Like the DOS 3.3 sector order issues in #49, this change fixes the
order of the physical sectors on the ProDOS disk when nibblized.

This change also adds tests similar to the DOS 3.3 tests to verify the
sector order.

Because the DOS 3.3 and ProDOS tests are so similar, the utility
methods have been refactored into their own file.
2021-01-03 14:59:42 -08:00
Ian Flanigan
565da09575
Minor type improvements (#50)
* Improve typing for `base64_encode`

* Better typing for `BRA` and `is65C02`
2020-12-29 06:40:58 -08:00
Ian Flanigan
72ecce113a
DOS 3.3 image format tests and fixes (#49)
* Adds an initial test for DOS format (.do) files

* Fix physical sector order when nibblizing DOS 3.3 ordered images

Before, when `.dsk` or `.do` images were nibblized, the resulting
track had the sectors in the wrong physical layout.

Now the nibblized track has the correct physical layout (all sectors
in order) which results in the correct DOS 3.3 layout as well.

There is also a test that verifies the order.

* Add another test for a non-zero sector

The new test checks that the values in physical sector 1 are those for
DOS sector 7.

* Add test for all physical sectors on all tracks

This change also removes a few stray console.log calls in the test.
2020-12-29 06:40:40 -08:00
Will Scullin
1aaa94a8ed
enforce indent case like vscode prefers 2020-11-25 17:28:37 -08:00
Will Scullin
1e58e2c1b8
lint 2020-11-24 08:53:43 -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
Will Scullin
e1b807ba9e
minor cleanup 2020-11-15 18:51:05 -08:00
Will Scullin
231d7d8768
lint 2020-11-15 18:20:58 -08:00
Ian Flanigan
f1b6c51ce7
Fix a "wrong this" bug in cpu6502 (#44) 2020-11-15 17:54:27 -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
c3befc896a
fix typo 2020-11-08 12:26:12 -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
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
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
a200d6de83
Fix a problem where sometimes the emulator would run too fast (#34)
Before, when using `requestAnimationFrame`, the emulator did not save
the id returned by the browser. This broke the invariant of `run`,
namely that on exit either `runAnimationFrame` or `runTimer` would be
set. This meant that sometimes when the emulator restarted, there
would be two callbacks to `requetsAnimationFrame` run on every frame.

Now the id is saved correctly and the invariant of `run` is maintained.
2020-10-11 08:50:20 -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
8d74ccaa13
typo 2020-09-20 06:37:26 -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
1e56b0af63
No Slot Clock 2020-09-03 20:39:35 -07:00
Will Scullin
05fcc60c2e
Show audio error when loading tape. 2020-08-23 06:36:59 -07:00
Will Scullin
42b30141ad
Move //e specific out of apple2io.js (#28) 2020-08-06 06:31:27 -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
9824c51119
Add 13 sector ][+ option. 2020-07-19 14:53:01 -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
cf16b9cf55
Minor optimization. 2020-06-17 22:20:11 -07:00
Will Scullin
7394900020
Don't clear flag if re-entering hires. 2020-06-17 20:31:17 -07:00
Will Scullin
00bc5b3c04
Support undocumented AppleColor RGB 160x192 mode. 2020-06-16 09:49:11 -07:00
Will Scullin
3e6f1e586e
Clean up special RBG mode support. 2020-06-05 12:53:56 -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
ddcabc5683
Really brief delay for CFFA. 2020-01-12 13:06:40 -08: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
506dfc52de
Small cleanup and fixes. 2020-01-02 10:57:26 -08:00
Will Scullin
398ed17c79
Truer colors, fix dirty rect. 2020-01-01 12:33:24 -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
680de778ee
Reinstate vbl hack. 2019-12-29 13:35:00 -08:00
Will Scullin
deec11a2a3
Fix play/pause 2019-12-27 18:14:33 -08:00
Will Scullin
2c2a1832da
Fix alt char set. 2019-12-27 15:50:40 -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
409e627abc
Add quick and dirty Applesoft compiler. 2019-12-02 18:55:01 -08:00
Will Scullin
37e0c8a84c
Fix Thunderclock with more correct implementation. 2019-12-01 09:52:14 -08:00
Will Scullin
0059910122
Fix Disk II writing. 2019-12-01 06:43:42 -08:00
Will Scullin
5cbf6bd335
Fix parallel rom. 2019-11-24 20:47:10 -08:00
Will Scullin
69bdd3fde4
Move ROM data out of card sources. (#16) 2019-11-24 16:52:01 -08:00
Will Scullin
5e4aac70d2
Use bit math more places. (#15) 2019-11-23 19:05:52 -08:00
Will Scullin
37a6efc661
Better linting, tests, fix text buffer, ROR. 2019-10-16 20:20:38 -07:00
Will Scullin
e2c615f20b
Fix ROL. 2019-10-07 22:18:15 -07:00
Will Scullin
3b95726655
Crude native woz support. (#13)
Readonly for now.
2019-10-01 19:56:10 -07:00
Will Scullin
7d9090133b
No CPU cycle left behind. 2019-09-29 15:52:22 -07:00
Will Scullin
859bd1ff8f
Apply Sather to stack operations. 2019-09-22 20:04:47 -07:00
Will Scullin
6348d52cfe
Fix RDMIXED 2019-09-21 20:49:09 -07:00
Will Scullin
56e17f5b15
minor cleanup 2019-09-18 19:51:31 -07:00
Will Scullin
86602a4eb7
Try and emulate "false reads" 2019-09-18 19:46:15 -07:00
Will Scullin
8ee543619e
First pass it more accurate cycle counting. 2019-09-18 18:46:26 -07:00
Will Scullin
8e5a60b284
Fix high bit miscalculation, mouse offset calcuation. 2019-07-27 15:57:40 -07:00
Will Scullin
c5ca5ee132
Less ES6 2019-06-15 15:59:02 -07:00
Will Scullin
ea8766f370
Back out last change. 2019-06-15 09:38:38 -07:00
Will Scullin
dfe1b28476
Fix undefined toHex. 2019-06-15 09:36:17 -07:00
Will Scullin
024ca76800
Remove ES6 function declarations. 2019-06-15 09:16:11 -07:00
Will Scullin
81adfff2e4
Missed file. 2019-04-06 12:30:50 -07:00
Will Scullin
83d9fd8730
Fix tape loading. 2019-04-06 12:20:35 -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
2963f116ce
Fix build, clean up lint comments. 2019-03-26 21:12:05 -07:00
Will Scullin
6a5fd9cf0c
Add a real test harness. 2019-03-26 21:02:27 -07:00
Will Scullin
82815e5b85
Fix hamfisted jquery -> html5 translation. 2019-03-21 20:39:48 -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
ed63e0fe92
Fix 80 col. 2019-03-05 11:29:55 -08:00
Will Scullin
d5ab930935
Merge pull request #9 from whscullin/whscullin/webpack
Convert to webpack first pass.
2019-03-02 12:26:56 -08:00
Will Scullin
9bffd347cc
Wire up tests. 2019-03-01 20:38:04 -08:00
Will Scullin
58dbac1a78
Add missing roms. 2019-03-01 10:15:17 -08:00
Will Scullin
2b63a4b569
Fix reset. 2019-03-01 06:54:22 -08:00
Will Scullin
13446c0afa
Deal with some stray globals. 2019-03-01 06:48:50 -08:00
Will Scullin
9e706b5991
Merge pull request #8 from iflan/maximize-in-window
Allow Shift-F2 to maximize the Apple screen in the window
2019-02-28 21:24:09 -08:00