apple2js/js/videomodes.ts

95 lines
2.0 KiB
TypeScript
Raw Normal View History

import { MemoryPages, Restorable, memory } from './types';
export type bank = 0 | 1;
export type pageNo = 1 | 2;
export interface Region {
2022-05-10 15:04:20 +00:00
top: number;
bottom: number;
left: number;
right: number;
}
export interface GraphicsState {
buffer: memory[];
}
export interface VideoModesState {
2022-05-10 15:04:20 +00:00
grs: [gr1: GraphicsState, gr2: GraphicsState];
hgrs: [hgr1: GraphicsState, hgr2: GraphicsState];
textMode: boolean;
mixedMode: boolean;
hiresMode: boolean;
pageMode: pageNo;
_80colMode: boolean;
altCharMode: boolean;
an3State: boolean;
flag: number;
}
2021-03-06 23:04:13 +00:00
export interface VideoPage extends MemoryPages, Restorable<GraphicsState> {
2022-05-10 15:04:20 +00:00
imageData: ImageData;
dirty: Region;
2022-05-10 15:04:20 +00:00
bank0(): MemoryPages;
bank1(): MemoryPages;
2022-05-10 15:04:20 +00:00
refresh: () => void;
}
export interface LoresPage extends VideoPage {
2022-05-10 15:04:20 +00:00
getText: () => string;
}
export interface HiresPage extends VideoPage {
}
export interface VideoModes extends Restorable<VideoModesState> {
2022-05-10 15:04:20 +00:00
textMode: boolean;
mixedMode: boolean;
hiresMode: boolean;
pageMode: pageNo;
_80colMode: boolean;
altCharMode: boolean;
an3State: boolean;
doubleHiresMode: boolean;
flag: number;
monoMode: boolean;
context: CanvasRenderingContext2D;
2022-05-10 15:04:20 +00:00
page(pageNo: number): void;
2022-05-10 15:04:20 +00:00
blit(altData?: ImageData): boolean;
2022-05-10 15:04:20 +00:00
reset(): void;
2022-05-10 15:04:20 +00:00
setLoresPage(page: pageNo, lores: LoresPage): void;
setHiresPage(page: pageNo, lores: HiresPage): void;
2022-05-10 15:04:20 +00:00
_80col(on: boolean): void;
altChar(on: boolean): void;
an3(on: boolean): void;
doubleHires(on: boolean): void;
hires(on: boolean): void;
mixed(on: boolean): void;
text(on: boolean): void;
2022-05-10 15:04:20 +00:00
is80Col(): boolean;
isAltChar(): boolean;
isDoubleHires(): boolean;
isHires(): boolean;
isMixed(): boolean;
isPage2(): boolean;
isText(): boolean;
2022-05-10 15:04:20 +00:00
mono(on: boolean): void;
scanlines(on: boolean): void;
2022-05-10 15:04:20 +00:00
getText(): string;
2022-05-10 15:04:20 +00:00
ready: Promise<void>;
}