1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00

moved types to baseplatform.ts

This commit is contained in:
Steven Hugg 2018-07-07 23:58:11 -05:00
parent 1c9817d155
commit 1e7e7feae5
4 changed files with 53 additions and 40 deletions

48
src/baseplatform.ts Normal file
View File

@ -0,0 +1,48 @@
export interface OpcodeMetadata {
minCycles: number;
// TODO
}
export interface Platform {
start() : void;
reset() : void;
isRunning() : boolean;
getToolForFilename(s:string) : string;
getDefaultExtension() : string;
getPresets() : Preset[];
pause() : void;
resume() : void;
loadROM(title:string, rom:Uint8Array);
inspect?(ident:string) : void;
disassemble?(addr:number, readfn:(addr:number)=>number) : any; // TODO
readAddress?(addr:number) : number;
setFrameRate?(fps:number) : void;
getFrameRate?() : number;
cpuStateToLongString?(state) : string;
ramStateToLongString?(state) : string;
getRasterPosition() : {x:number, y:number};
setupDebug?(debugfn : (state)=>void) : void;
clearDebug?() : void;
step?() : void;
runToVsync?() : void;
runToPC?(pc:number) : void;
runUntilReturn?() : void;
stepBack?() : void;
//TODO runEval?(evalfn : (cpustate) => boolean) : void;
runEval?(evalfn : Function) : void;
getOpcodeMetadata?(opcode:number, offset:number) : OpcodeMetadata; //TODO
saveState?() : any; // TODO
getDebugCallback?() : any; // TODO
getSP?() : number;
}
export interface Preset {
id : string;
name : string;
chapter? : number;
title? : string;
}

View File

@ -94,9 +94,9 @@ export class CodeProject {
tools_preloaded = {};
callbackBuildResult : BuildResultCallback;
callbackBuildStatus : BuildStatusCallback;
worker: any;
worker : Worker;
platform_id : string;
platform: any;
platform: any; // TODO: use type
store: any;
callbackGetRemote : GetRemoteCallback;
mainPath: string;

View File

@ -6,6 +6,7 @@ import $ = require("jquery");
import * as bootstrap from "bootstrap";
import { SourceFile, CodeProject } from "./project";
import { ProjectWindows } from "./windows";
import { Platform, Preset } from "./baseplatform";
import * as Views from "./views";
// external libs (TODO)
@ -18,43 +19,6 @@ declare var PLATFORMS;
// make sure VCS doesn't start
if (window['Javatari']) window['Javatari'].AUTO_START = false;
interface Preset {
id : string;
name : string;
chapter? : number;
title? : string;
}
interface Platform {
start() : void;
reset() : void;
isRunning() : boolean;
getToolForFilename(s:string) : string;
getDefaultExtension() : string;
getPresets() : Preset[];
pause() : void;
resume() : void;
loadROM(title:string, rom:Uint8Array);
inspect?(ident:string) : void;
disassemble?(addr:number, readfn:(addr:number)=>number) : any; // TODO
readAddress?(addr:number) : number;
setFrameRate?(fps:number) : void;
getFrameRate?() : number;
cpuStateToLongString?(state) : string;
ramStateToLongString?(state) : string;
getRasterPosition() : {x:number, y:number};
setupDebug?(debugfn : (state)=>void) : void;
clearDebug?() : void;
step?() : void;
runToVsync?() : void;
runToPC?(pc:number) : void;
runUntilReturn?() : void;
stepBack?() : void;
//TODO runEval?(evalfn : (cpustate) => boolean) : void;
runEval?(evalfn : Function) : void;
}
var PRESETS : Preset[]; // presets array
var platform_id : string; // platform ID string
var platform : Platform; // platform object

View File

@ -2,6 +2,7 @@
import $ = require("jquery");
import { SourceFile, WorkerError, CodeProject } from "./project";
import { Platform } from "./baseplatform";
export interface ProjectView {
createDiv(parent:HTMLElement, text:string) : HTMLElement;
@ -18,7 +19,7 @@ export interface ProjectView {
// TODO: move to different namespace
declare var CodeMirror;
declare var platform;
declare var platform : Platform;
declare var platform_id : string;
declare var compparams;
declare var addr2symbol : {[addr:number]:string};