1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-10-30 00:29:53 +00:00
8bitworkshop/gen/basic-TCPQRNE5.js.map

8 lines
81 KiB
Plaintext
Raw Normal View History

{
"version": 3,
"sources": ["../src/common/basic/runtime.ts", "../src/platform/basic.ts"],
"sourcesContent": ["\nimport * as basic from \"./compiler\";\nimport { EmuHalt } from \"../emu\";\nimport { SourceLocation } from \"../workertypes\";\nimport { isArray } from \"../util\";\n\nfunction isLiteral(arg: basic.Expr): arg is basic.Literal {\n return (arg as any).value != null;\n}\nfunction isLookup(arg: basic.Expr): arg is basic.IndOp {\n return (arg as any).name != null;\n}\nfunction isBinOp(arg: basic.Expr): arg is basic.BinOp {\n return (arg as any).op != null && (arg as any).left != null && (arg as any).right != null;\n}\nfunction isUnOp(arg: basic.Expr): arg is basic.UnOp {\n return (arg as any).op != null && (arg as any).expr != null;\n}\n\nexport interface InputResponse {\n line: string;\n vals: string[];\n elapsed?: number;\n}\n\n// expr2js() options\nclass ExprOptions {\n isconst?: boolean; // only allow constant operations\n novalid?: boolean; // check for valid values when fetching\n locals?: string[]; // pass local variable names when defining functions\n}\n\ninterface CompiledStatement {\n $run?: () => void;\n}\n\nclass RNG {\n next : () => number;\n seed : (aa,bb,cc,dd) => void;\n seedfloat : (n) => void;\n randomize() {\n this.seed(Math.random()*0x7fffffff, Math.random()*0x7fffffff, Math.random()*0x7fffffff, Math.random()*0x7fffffff);\n }\n constructor() {\n let f = () => {\n var a, b, c, d : number;\n this.seed = function(aa,bb,cc,dd) {\n a = aa; b = bb; c = cc; d = dd;\n }\n this.seedfloat = function(n) {\n this.seed(n, n*4294, n*429496, n*4294967296);\n this.next(); this.next(); this.next();\n }\n this.next = function() {\n // sfc32\n a >>>= 0; b >>>= 0; c >>>= 0; d >>>= 0; \n var t = (a + b) | 0;\n a = b ^ b >>> 9;\n b = c + (c << 3) | 0;\n c = (c << 21 | c >>> 11);\n d = d + 1 | 0;\n t = t + d | 0;\n c = c + t | 0;\n return (t >>> 0) / 4294967296;\n }\n };\n f();\n this.seedfloat(-1);\n }\n};\n\nconst DEFAULT_MAX_ARRAY_ELEMENTS = 1024*1024;\n\nexport class BASICRuntime {\n\n program : basic.BASICProgram;\n allstmts : basic.Statement[];\n pc2label : Map<number,string>;\n label2pc : {[label : string] : number};\n label2dataptr : {[label : string] : number};\n datums : basic.Literal[];\n builtins : {};\n opts : basic.BASICOptions;\n margin : number = 80; // number of columns\n\n curpc : number;\n dataptr : number;\n vars : {[name:string] : any}; // actually Value, but += doesn't work\n globals : {[name:string] : any};\n arrays : {};\n defs : {};\n subroutines : {};\n forLoops : { [varname:string] : { $next:(name:string) => void } };\n forLoopStack: string[];\n whileLoops : number[];\n returnStack : number[];\n column : number;\n rng : RNG;\n\n running : boolean = false;\n exited : boolean = true;\n trace : boolean = false;\n\n load(program: basic.BASICProgram) : boolean {\n // get previous label and offset for hot reload\n let prevlabel = null;\n let prevpcofs = 0;\n if (this.pc2label != null) {\n let pc = this.curpc;\n while (pc > 0 && (prevlabel = this.pc2label.get(pc)) == null) {\n pc--;\n }\n prevpcofs = this.curpc - pc;\n console.log('oldpc=', this.curpc, 'restart @ label', prevlabel, '+', prevpcofs);\n }\n // initialize program\n this.program = program;\n this.opts = program.opts;\n if (!this.opts.maxArrayElements) this.opts.maxArrayElements = DEFAULT_MAX_ARRAY_ELEMENTS;\n this.allstmts = program.stmts;\n this.label2pc = program.labels;\n this.label2dataptr = {};\n this.pc2label = new Map();\n this.datums = [];\n this.subroutines = {};\n this.builtins = this.get
"mappings": "mUAMA,WAAmB,EAAuC,CACtD,MAAQ,GAAY,OAAS,KAEjC,WAAkB,EAAqC,CACnD,MAAQ,GAAY,MAAQ,KAEhC,WAAiB,EAAqC,CAClD,MAAQ,GAAY,IAAM,MAAS,EAAY,MAAQ,MAAS,EAAY,OAAS,KAEzF,WAAgB,EAAoC,CAChD,MAAQ,GAAY,IAAM,MAAS,EAAY,MAAQ,KAoB3D,WAAU,CAIN,WAAY,CACR,K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