apple2js/js/roms/apple2lc_char.ts

263 lines
11 KiB
TypeScript
Raw Normal View History

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-08 04:50:50 +00:00
import { ReadonlyUint8Array } from '../types';
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-08 04:50:50 +00:00
const apple2lc_charset = new Uint8Array([
2019-03-01 18:15:17 +00:00
0x1c,0x22,0x2a,0x2a,0x2c,0x20,0x1e,0x00,
0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00,
0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c,0x00,
0x1c,0x22,0x20,0x20,0x20,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x22,0x22,0x22,0x3c,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x20,0x00,
0x1e,0x20,0x20,0x26,0x22,0x22,0x1e,0x00,
0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00,
0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,
0x02,0x02,0x02,0x02,0x02,0x22,0x1c,0x00,
0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x3e,0x00,
0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00,
0x22,0x22,0x32,0x2a,0x26,0x22,0x22,0x00,
0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x3c,0x20,0x20,0x20,0x00,
0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a,0x00,
0x3c,0x22,0x22,0x3c,0x28,0x24,0x22,0x00,
0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c,0x00,
0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x22,0x22,0x22,0x22,0x22,0x14,0x08,0x00,
0x22,0x22,0x22,0x2a,0x2a,0x36,0x22,0x00,
0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00,
0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x00,
0x3e,0x02,0x04,0x08,0x10,0x20,0x3e,0x00,
0x3e,0x30,0x30,0x30,0x30,0x30,0x3e,0x00,
0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x3e,0x06,0x06,0x06,0x06,0x06,0x3e,0x00,
0x08,0x14,0x22,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00,
0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00,
0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00,
0x08,0x1e,0x28,0x1c,0x0a,0x3c,0x08,0x00,
0x32,0x32,0x04,0x08,0x10,0x26,0x26,0x00,
0x18,0x24,0x28,0x10,0x2a,0x24,0x1a,0x00,
0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,
0x08,0x10,0x20,0x20,0x20,0x10,0x08,0x00,
0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00,
0x08,0x2a,0x1c,0x08,0x1c,0x2a,0x08,0x00,
0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x08,0x10,
0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,
0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,
0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c,0x00,
0x08,0x18,0x08,0x08,0x08,0x08,0x1c,0x00,
0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e,0x00,
0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c,0x00,
0x04,0x0c,0x14,0x24,0x3e,0x04,0x04,0x00,
0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c,0x00,
0x0e,0x10,0x20,0x3c,0x22,0x22,0x1c,0x00,
0x3e,0x02,0x04,0x08,0x10,0x10,0x10,0x00,
0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00,
0x1c,0x22,0x22,0x1e,0x02,0x04,0x38,0x00,
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x00,
0x00,0x00,0x18,0x18,0x00,0x18,0x08,0x10,
0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,
0x00,0x00,0x3c,0x00,0x3c,0x00,0x00,0x00,
0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00,
0x1c,0x22,0x04,0x08,0x08,0x00,0x08,0x00,
0x9c,0xa2,0xaa,0xaa,0xac,0xa0,0x9e,0x80,
0x88,0x94,0xa2,0xa2,0xbe,0xa2,0xa2,0x80,
0xbc,0xa2,0xa2,0xbc,0xa2,0xa2,0xbc,0x80,
0x9c,0xa2,0xa0,0xa0,0xa0,0xa2,0x9c,0x80,
0xbc,0xa2,0xa2,0xa2,0xa2,0xa2,0xbc,0x80,
0xbe,0xa0,0xa0,0xbc,0xa0,0xa0,0xbe,0x80,
0xbe,0xa0,0xa0,0xbc,0xa0,0xa0,0xa0,0x80,
0x9e,0xa0,0xa0,0xa6,0xa2,0xa2,0x9e,0x80,
0xa2,0xa2,0xa2,0xbe,0xa2,0xa2,0xa2,0x80,
0x9c,0x88,0x88,0x88,0x88,0x88,0x9c,0x80,
0x82,0x82,0x82,0x82,0x82,0xa2,0x9c,0x80,
0xa2,0xa4,0xa8,0xb0,0xa8,0xa4,0xa2,0x80,
0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xbe,0x80,
0xa2,0xb6,0xaa,0xaa,0xa2,0xa2,0xa2,0x80,
0xa2,0xa2,0xb2,0xaa,0xa6,0xa2,0xa2,0x80,
0x9c,0xa2,0xa2,0xa2,0xa2,0xa2,0x9c,0x80,
0xbc,0xa2,0xa2,0xbc,0xa0,0xa0,0xa0,0x80,
0x9c,0xa2,0xa2,0xa2,0xaa,0xa4,0x9a,0x80,
0xbc,0xa2,0xa2,0xbc,0xa8,0xa4,0xa2,0x80,
0x9c,0xa2,0xa0,0x9c,0x82,0xa2,0x9c,0x80,
0xbe,0x88,0x88,0x88,0x88,0x88,0x88,0x80,
0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0x9c,0x80,
0xa2,0xa2,0xa2,0xa2,0xa2,0x94,0x88,0x80,
0xa2,0xa2,0xa2,0xaa,0xaa,0xb6,0xa2,0x80,
0xa2,0xa2,0x94,0x88,0x94,0xa2,0xa2,0x80,
0xa2,0xa2,0x94,0x88,0x88,0x88,0x88,0x80,
0xbe,0x82,0x84,0x88,0x90,0xa0,0xbe,0x80,
0xbe,0xb0,0xb0,0xb0,0xb0,0xb0,0xbe,0x80,
0x80,0xa0,0x90,0x88,0x84,0x82,0x80,0x80,
0xbe,0x86,0x86,0x86,0x86,0x86,0xbe,0x80,
0x88,0x94,0xa2,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0xbe,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x88,0x88,0x88,0x88,0x88,0x80,0x88,0x80,
0x94,0x94,0x94,0x80,0x80,0x80,0x80,0x80,
0x94,0x94,0xbe,0x94,0xbe,0x94,0x94,0x80,
0x88,0x9e,0xa8,0x9c,0x8a,0xbc,0x88,0x80,
0xb2,0xb2,0x84,0x88,0x90,0xa6,0xa6,0x80,
0x98,0xa4,0xa8,0x90,0xaa,0xa4,0x9a,0x80,
0x88,0x88,0x88,0x80,0x80,0x80,0x80,0x80,
0x88,0x90,0xa0,0xa0,0xa0,0x90,0x88,0x80,
0x88,0x84,0x82,0x82,0x82,0x84,0x88,0x80,
0x88,0xaa,0x9c,0x88,0x9c,0xaa,0x88,0x80,
0x80,0x88,0x88,0xbe,0x88,0x88,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x98,0x88,0x90,
0x80,0x80,0x80,0x9c,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x98,0x98,0x80,
0x80,0x82,0x84,0x88,0x90,0xa0,0x80,0x80,
0x9c,0xa2,0xa6,0xaa,0xb2,0xa2,0x9c,0x80,
0x88,0x98,0x88,0x88,0x88,0x88,0x9c,0x80,
0x9c,0xa2,0x82,0x8c,0x90,0xa0,0xbe,0x80,
0xbe,0x82,0x84,0x8c,0x82,0xa2,0x9c,0x80,
0x84,0x8c,0x94,0xa4,0xbe,0x84,0x84,0x80,
0xbe,0xa0,0xbc,0x82,0x82,0xa2,0x9c,0x80,
0x8e,0x90,0xa0,0xbc,0xa2,0xa2,0x9c,0x80,
0xbe,0x82,0x84,0x88,0x90,0x90,0x90,0x80,
0x9c,0xa2,0xa2,0x9c,0xa2,0xa2,0x9c,0x80,
0x9c,0xa2,0xa2,0x9e,0x82,0x84,0xb8,0x80,
0x80,0x80,0x98,0x98,0x80,0x98,0x98,0x80,
0x80,0x80,0x98,0x98,0x80,0x98,0x88,0x90,
0x84,0x88,0x90,0xa0,0x90,0x88,0x84,0x80,
0x80,0x80,0xbc,0x80,0xbc,0x80,0x80,0x80,
0x90,0x88,0x84,0x82,0x84,0x88,0x90,0x80,
0x9c,0xa2,0x84,0x88,0x88,0x80,0x88,0x80,
0x1c,0x22,0x2a,0x2a,0x2c,0x20,0x1e,0x00,
0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00,
0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c,0x00,
0x1c,0x22,0x20,0x20,0x20,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x22,0x22,0x22,0x3c,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x20,0x00,
0x1e,0x20,0x20,0x26,0x22,0x22,0x1e,0x00,
0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00,
0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,
0x02,0x02,0x02,0x02,0x02,0x22,0x1c,0x00,
0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x3e,0x00,
0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00,
0x22,0x22,0x32,0x2a,0x26,0x22,0x22,0x00,
0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x3c,0x20,0x20,0x20,0x00,
0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a,0x00,
0x3c,0x22,0x22,0x3c,0x28,0x24,0x22,0x00,
0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c,0x00,
0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x22,0x22,0x22,0x22,0x22,0x14,0x08,0x00,
0x22,0x22,0x22,0x2a,0x2a,0x36,0x22,0x00,
0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00,
0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x00,
0x3e,0x02,0x04,0x08,0x10,0x20,0x3e,0x00,
0x3e,0x30,0x30,0x30,0x30,0x30,0x3e,0x00,
0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x3e,0x06,0x06,0x06,0x06,0x06,0x3e,0x00,
0x08,0x14,0x22,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00,
0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00,
0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00,
0x08,0x1e,0x28,0x1c,0x0a,0x3c,0x08,0x00,
0x32,0x32,0x04,0x08,0x10,0x26,0x26,0x00,
0x18,0x24,0x28,0x10,0x2a,0x24,0x1a,0x00,
0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,
0x08,0x10,0x20,0x20,0x20,0x10,0x08,0x00,
0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00,
0x08,0x2a,0x1c,0x08,0x1c,0x2a,0x08,0x00,
0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x08,0x10,
0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,
0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,
0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c,0x00,
0x08,0x18,0x08,0x08,0x08,0x08,0x1c,0x00,
0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e,0x00,
0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c,0x00,
0x04,0x0c,0x14,0x24,0x3e,0x04,0x04,0x00,
0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c,0x00,
0x0e,0x10,0x20,0x3c,0x22,0x22,0x1c,0x00,
0x3e,0x02,0x04,0x08,0x10,0x10,0x10,0x00,
0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00,
0x1c,0x22,0x22,0x1e,0x02,0x04,0x38,0x00,
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x00,
0x00,0x00,0x18,0x18,0x00,0x18,0x08,0x10,
0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,
0x00,0x00,0x3c,0x00,0x3c,0x00,0x00,0x00,
0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00,
0x1c,0x22,0x04,0x08,0x08,0x00,0x08,0x00,
0x1c,0x22,0x2a,0x2a,0x2c,0x20,0x1e,0x00,
0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00,
0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c,0x00,
0x1c,0x22,0x20,0x20,0x20,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x22,0x22,0x22,0x3c,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e,0x00,
0x3e,0x20,0x20,0x3c,0x20,0x20,0x20,0x00,
0x1e,0x20,0x20,0x26,0x22,0x22,0x1e,0x00,
0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00,
0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,
0x02,0x02,0x02,0x02,0x02,0x22,0x1c,0x00,
0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x3e,0x00,
0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00,
0x22,0x22,0x32,0x2a,0x26,0x22,0x22,0x00,
0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x3c,0x22,0x22,0x3c,0x20,0x20,0x20,0x00,
0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a,0x00,
0x3c,0x22,0x22,0x3c,0x28,0x24,0x22,0x00,
0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c,0x00,
0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00,
0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00,
0x22,0x22,0x22,0x22,0x22,0x14,0x08,0x00,
0x22,0x22,0x22,0x2a,0x2a,0x36,0x22,0x00,
0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00,
0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x00,
0x3e,0x02,0x04,0x08,0x10,0x20,0x3e,0x00,
0x3e,0x30,0x30,0x30,0x30,0x30,0x3e,0x00,
0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x3e,0x06,0x06,0x06,0x06,0x06,0x3e,0x00,
0x08,0x14,0x22,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,
0x20,0x10,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x1c,0x02,0x1e,0x22,0x1e,0x00,
0x20,0x20,0x2c,0x32,0x22,0x32,0x2c,0x00,
0x00,0x00,0x1e,0x20,0x20,0x20,0x1e,0x00,
0x02,0x02,0x1a,0x26,0x22,0x26,0x1a,0x00,
0x00,0x00,0x1c,0x22,0x3e,0x20,0x1c,0x00,
0x0c,0x12,0x10,0x38,0x10,0x10,0x10,0x00,
0x00,0x02,0x1c,0x22,0x22,0x1e,0x02,0x1c,
0x20,0x20,0x2c,0x32,0x22,0x22,0x22,0x00,
0x08,0x00,0x18,0x08,0x08,0x08,0x1c,0x00,
0x04,0x00,0x0c,0x04,0x04,0x04,0x24,0x18,
0x20,0x20,0x22,0x24,0x38,0x24,0x22,0x00,
0x18,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,
0x00,0x00,0x34,0x2a,0x2a,0x2a,0x2a,0x00,
0x00,0x00,0x2c,0x32,0x22,0x22,0x22,0x00,
0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00,
0x00,0x00,0x2c,0x32,0x32,0x2c,0x20,0x20,
0x00,0x00,0x1a,0x26,0x26,0x1a,0x02,0x02,
0x00,0x00,0x2c,0x30,0x20,0x20,0x20,0x00,
0x00,0x00,0x1e,0x20,0x1c,0x02,0x3c,0x00,
0x10,0x10,0x38,0x10,0x10,0x12,0x0c,0x00,
0x00,0x00,0x22,0x22,0x22,0x26,0x1a,0x00,
0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00,
0x00,0x00,0x22,0x2a,0x2a,0x2a,0x14,0x00,
0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00,
0x00,0x00,0x22,0x22,0x26,0x1a,0x02,0x1c,
0x00,0x00,0x3e,0x04,0x08,0x10,0x3e,0x00,
0x06,0x08,0x08,0x30,0x08,0x08,0x06,0x00,
0x08,0x08,0x08,0x00,0x08,0x08,0x08,0x00,
0x30,0x08,0x08,0x06,0x08,0x08,0x30,0x00,
0x00,0x00,0x10,0x2a,0x04,0x00,0x00,0x00,
0x2a,0x14,0x2a,0x14,0x2a,0x14,0x2a,0x00
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-08 04:50:50 +00:00
]) as ReadonlyUint8Array;
2019-03-01 18:15:17 +00:00
export default apple2lc_charset;