mirror of
https://github.com/whscullin/apple1js.git
synced 2024-12-25 22:31:32 +00:00
Convert cpu6502 to Typescript
This commit is contained in:
parent
23a1cb83a8
commit
fc536fdb20
1626
js/cpu6502.js
1626
js/cpu6502.js
File diff suppressed because it is too large
Load Diff
3417
js/cpu6502.ts
Normal file
3417
js/cpu6502.ts
Normal file
File diff suppressed because it is too large
Load Diff
25
js/types.ts
25
js/types.ts
@ -16,3 +16,28 @@ export type word = number;
|
||||
export type address = word;
|
||||
|
||||
export type memory = Uint8Array | byte[];
|
||||
|
||||
export interface Memory {
|
||||
/** Read a byte. */
|
||||
read(page: byte, offset: byte): byte;
|
||||
/** Write a byte. */
|
||||
write(page: byte, offset: byte, value: byte): void;
|
||||
}
|
||||
|
||||
/** A mapped region of memory. */
|
||||
export interface MemoryPages extends Memory {
|
||||
/** Start page. */
|
||||
start(): byte;
|
||||
/** End page, inclusive. */
|
||||
end(): byte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the members of a constant array as a type. Used as:
|
||||
*
|
||||
* @example
|
||||
* const SOME_VALUES = ['a', 'b', 1, 2] as const;
|
||||
* type SomeValues = MemberOf<typeof SOME_VALUES>; // 'a' | 'b' | 1 | 2
|
||||
*/
|
||||
export type MemberOf<T extends ReadonlyArray<unknown>> =
|
||||
T extends ReadonlyArray<infer E> ? E : never;
|
||||
|
Loading…
Reference in New Issue
Block a user