mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
b80436d99c
* 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.
44 lines
996 B
TypeScript
44 lines
996 B
TypeScript
|
|
/** A byte (0..255). This is not enforced by the compiler. */
|
|
export type byte = number;
|
|
|
|
/** A word (0..65535). This is not enforced by the compiler. */
|
|
export type word = number;
|
|
|
|
/** A raw region of memory. */
|
|
export type memory = number[] | Uint8Array;
|
|
|
|
/** A mapped region of memory. */
|
|
export interface Memory {
|
|
/** Start page. */
|
|
start(): byte;
|
|
/** End page, inclusive. */
|
|
end(): byte;
|
|
/** Read a byte. */
|
|
read(page: byte, offset: byte): byte;
|
|
/** Write a byte. */
|
|
write(page: byte, offset: byte, value: byte): void;
|
|
}
|
|
|
|
export type DiskFormat = '2mg' | 'd13' | 'do' | 'dsk' | 'hdv' | 'po' | 'nib' | 'woz';
|
|
|
|
export interface Drive {
|
|
format: DiskFormat,
|
|
volume: number,
|
|
tracks: Array<byte[] | Uint8Array>,
|
|
trackMap: unknown,
|
|
}
|
|
|
|
export interface DiskIIDrive extends Drive {
|
|
rawTracks: unknown,
|
|
track: number,
|
|
head: number,
|
|
phase: number,
|
|
readOnly: boolean,
|
|
dirty: boolean,
|
|
}
|
|
|
|
export interface Restorable<T> {
|
|
getState(): T;
|
|
setState(state: T): void;
|
|
} |