apple2js/js/videomodes.ts
Ian Flanigan 207bed3d27
Typescriptify ui/apple2.js (#74)
This is mostly a mechanical change; there are still lots of things
about `ui/apple2` that could be improved.  The change also converts a
few dependencies of `ui/apple2`, like `applesoft/compiler`.

Besides the straight conversions, some other packages have changes to
make all of the typing work out.

Lastly, `@types/micromodal` has been added as a development
dependency.
2021-03-30 17:27:44 -07:00

79 lines
1.6 KiB
TypeScript

import { MemoryPages, Restorable, byte, memory } from './types';
export type bank = 0 | 1;
export type pageNo = 1 | 2;
export interface Region {
top: number,
bottom: number,
left: number,
right: number,
}
export interface GraphicsState {
page: byte;
mono: boolean;
buffer: memory[];
}
export interface VideoModesState {
grs: [gr1: GraphicsState, gr2: GraphicsState],
hgrs: [hgr1: GraphicsState, hgr2: GraphicsState],
textMode: boolean,
mixedMode: boolean,
hiresMode: boolean,
pageMode: pageNo,
_80colMode: boolean,
altCharMode: boolean,
an3: boolean,
}
export interface VideoPage extends MemoryPages, Restorable<GraphicsState> {
imageData: ImageData
dirty: Region;
bank0(): MemoryPages
bank1(): MemoryPages
mono: (on: boolean) => void
refresh: () => void
}
export interface LoresPage extends VideoPage {
getText: () => string
}
export interface HiresPage extends VideoPage {
}
export interface VideoModes extends Restorable<VideoModesState> {
page(pageNo: number): void
blit(altData?: ImageData): boolean
reset(): void
_80col(on: boolean): void
altchar(on: boolean): void
doubleHires(on: boolean): void
enhanced(on: boolean): void
hires(on: boolean): void
mixed(on: boolean): void
text(on: boolean): void
is80Col(): boolean
isAltChar(): boolean
isDoubleHires(): boolean
isHires(): boolean
isMixed(): boolean
isPage2(): boolean
isText(): boolean
mono(on: boolean): void
getText(): string
ready: Promise<void>
}