1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00
8bitworkshop/lib/stellerator/stellerator.min.js.map
2021-09-15 14:41:25 -05:00

1 line
1.3 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"stellerator.min.js","sources":["../../node_modules/microevent.ts/lib/Event.js","../../node_modules/microevent.ts/lib/index.js","../../node_modules/worker-rpc/lib/RpcProvider.js","../../node_modules/worker-rpc/lib/index.js","../../worker/src/rpc.ts","../../node_modules/tslib/tslib.es6.js","../../src/web/stella/service/EmulationServiceInterface.ts","../../src/machine/board/BoardInterface.ts","../../src/machine/cpu/CpuInterface.ts","../../src/tools/pool/PoolMember.ts","../../src/tools/pool/Pool.ts","../../src/video/surface/ArrayBufferSurface.ts","../../src/web/driver/VideoEndpoint.ts","../../src/tools/pool/InducedMember.ts","../../src/tools/pool/InducedPool.ts","../../src/tools/AudioOutputBuffer.ts","../../src/web/driver/PCMAudioEndpoint.ts","../../src/web/stella/service/vanilla/EmulationContext.ts","../../src/machine/stella/Bus.ts","../../src/machine/stella/Pia.ts","../../src/machine/cpu/statemachine/ResultImpl.ts","../../src/tools/decorators.ts","../../src/machine/cpu/statemachine/vector/boot.ts","../../src/machine/cpu/statemachine/vector/interrupt.ts","../../src/machine/cpu/Instruction.ts","../../src/machine/cpu/statemachine/addressing/absolute.ts","../../src/machine/cpu/statemachine/addressing/absoluteIndexed.ts","../../src/machine/cpu/statemachine/addressing/dereference.ts","../../src/machine/cpu/statemachine/addressing/immediate.ts","../../src/machine/cpu/statemachine/addressing/indexedIndirectX.ts","../../src/machine/cpu/statemachine/addressing/indirectIndexedY.ts","../../src/machine/cpu/statemachine/addressing/zeroPage.ts","../../src/machine/cpu/statemachine/addressing/zeroPageIndexed.ts","../../src/machine/cpu/statemachine/instruction/branch.ts","../../src/machine/cpu/statemachine/instruction/jsr.ts","../../src/machine/cpu/statemachine/instruction/readModifyWrite.ts","../../src/machine/cpu/statemachine/instruction/rts.ts","../../src/machine/cpu/statemachine/instruction/nullaryOneCycle.ts","../../src/machine/cpu/statemachine/instruction/pull.ts","../../src/machine/cpu/statemachine/instruction/push.ts","../../src/machine/cpu/statemachine/instruction/rti.ts","../../src/machine/cpu/statemachine/instruction/write.ts","../../src/machine/cpu/statemachine/ops.ts","../../src/machine/cpu/statemachine/addressing/indirect.ts","../../src/machine/cpu/statemachine/Compiler.ts","../../src/machine/cpu/StateMachineCpu.ts","../../src/machine/cpu/ops.ts","../../src/machine/cpu/BatchedAccessCpu.ts","../../src/machine/cpu/Factory.ts","../../src/machine/stella/Config.ts","../../src/tools/base64.ts","../../src/machine/stella/tia/ToneGenerator.ts","../../src/machine/stella/tia/WaveformAudio.ts","../../src/machine/stella/tia/PCMChannel.ts","../../src/machine/stella/tia/PCMAudio.ts","../../src/machine/stella/tia/drawCounterDecodes.ts","../../src/machine/stella/tia/Missile.ts","../../src/machine/stella/tia/Playfield.ts","../../src/machine/stella/tia/Player.ts","../../src/machine/stella/tia/Ball.ts","../../src/machine/stella/tia/LatchedInput.ts","../../src/machine/stella/tia/PaddleReader.ts","../../src/machine/stella/tia/FrameManager.ts","../../src/machine/stella/tia/DelayQueue.ts","../../src/machine/stella/tia/palette.ts","../../src/machine/stella/tia/Tia.ts","../../src/machine/io/Switch.ts","../../src/machine/stella/ControlPanel.ts","../../src/machine/io/DigitalJoystick.ts","../../src/machine/io/Paddle.ts","../../node_modules/seedrandom/lib/alea.js","../../node_modules/seedrandom/lib/xor128.js","../../node_modules/seedrandom/lib/xorwow.js","../../node_modules/seedrandom/lib/xorshift7.js","../../node_modules/seedrandom/lib/xor4096.js","../../node_modules/seedrandom/lib/tychei.js","../../node_modules/rollup-plugin-node-builtins/src/es6/empty.js","../../node_modules/seedrandom/seedrandom.js","../../node_modules/seedrandom/index.js","../../src/machine/stella/cartridge/CartridgeInterface.ts","../../src/machine/stella/cartridge/CartridgeInfo.ts","../../src/tools/rng/SeedrandomGenerator.ts","../../src/machine/stella/Board.ts","../../src/tools/rng/factory.ts","../../src/machine/stella/cartridge/AbstractCartridge.ts","../../src/machine/stella/cartridge/Cartridge2k.ts","../../src/machine/stella/cartridge/Cartridge4k.ts","../../src/machine/stella/cartridge/util.ts","../../src/machine/stella/cartridge/CartridgeCV.ts","../../src/machine/stella/cartridge/CartridgeF8.ts","../../src/machine/stella/cartridge/CartridgeF6.ts","../../src/machine/stella/cartridge/CartridgeE0.ts","../../src/machine/stella/cartridge/CartridgeFE.ts","../../src/machine/stella/cartridge/Cartridge3F.ts","../../src/machine/stella/cartridge/Cartridge3E.ts","../../src/machine/stella/cartridge/CartridgeUA.ts","../../src/machine/stella/cartridge/CartridgeFA.ts","../../src/machine/stella/cartridge/CartridgeE7.ts","../../src/machine/stella/cartridge/CartridgeF0.ts","../../src/machine/stella/cartridge/CartridgeEF.ts","../../src/machine/stella/cartridge/CartridgeF4.ts","../../src/machine/stella/cartridge/CartridgeFA2.ts","../../src/machine/stella/cartridge/supercharger/Header.ts","../../src/machine/stella/cartridge/supercharger/blob.ts","../../src/machine/stella/cartridge/CartridgeSupercharger.ts","../../src/machine/stella/cartridge/CartridgeDPC.ts","../../node_modules/thumbulator.ts/node_modules/tslib/tslib.es6.js","../../node_modules/rollup-plugin-node-globals/src/global.js","../../node_modules/process-es6/browser.js","../../bf18229f6f35122c72a9703496fa41","../../node_modules/buffer-es6/base64.js","../../node_modules/buffer-es6/ieee754.js","../../node_modules/buffer-es6/isArray.js","../../node_modules/buffer-es6/index.js","../../node_modules/rollup-plugin-node-builtins/src/es6/path.js","../../node_modules/thumbulator.ts/lib/native/thumbulator.js","../../node_modules/thumbulator.ts/lib/Thumbulator.js","../../src/tools/hex.ts","../../src/machine/stella/cartridge/harmony/Soc.ts","../../src/machine/stella/cartridge/CartridgeDPCPlus.ts","../../src/machine/stella/cartridge/CartridgeCDF.ts","../../src/machine/stella/cartridge/Cartridge0840.ts","../../src/machine/stella/cartridge/CartridgePP.ts","../../src/machine/stella/cartridge/CartridgeDetector.ts","../../src/machine/stella/cartridge/CartridgeFactory.ts","../../src/machine/stella/AsyncIO.ts","../../src/tools/scheduler/PeriodicScheduler.ts","../../node_modules/setimmediate2/dist/setImmediate.js","../../src/tools/scheduler/setImmediate.ts","../../src/tools/scheduler/ImmedateScheduler.ts","../../src/tools/scheduler/getTimestamp.ts","../../src/tools/scheduler/limiting/BusyWait.ts","../../src/tools/scheduler/limiting/ConstantCycles.ts","../../src/tools/scheduler/limiting/ConstantTimeslice.ts","../../src/tools/scheduler/Factory.ts","../../src/tools/ClockProbe.ts","../../node_modules/async-mutex/es6/Semaphore.js","../../node_modules/async-mutex/es6/Mutex.js","../../src/web/stella/service/vanilla/EmulationService.ts","../../src/web/stella/service/DriverManager.ts","../../src/web/stella/service/worker/messages.ts","../../src/web/stella/service/worker/VideoDriver.ts","../../src/web/stella/service/worker/ControlDriver.ts","../../src/web/stella/service/worker/WaveformAudioDriver.ts","../../src/web/stella/service/worker/PCMAudioDriver.ts","../../src/web/driver/AsyncIO.ts","../../src/web/stella/service/worker/EmulationBackend.ts","../../worker/src/main/stellerator.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar factories = [];\nfactories[0] = function () {\n return function dispatcher0() { };\n};\nfactories[1] = function (callback, context) {\n if (typeof (context) === 'undefined')\n return callback;\n return function dispatcher1(payload) {\n callback(payload, context);\n };\n};\nfunction getFactory(handlerCount) {\n if (!factories[handlerCount])\n factories[handlerCount] = compileFactory(handlerCount);\n return factories[handlerCount];\n}\nfunction compileFactory(handlerCount) {\n var src = 'return function dispatcher' + handlerCount + '(payload) {\\n';\n var argsHandlers = [], argsContexts = [];\n for (var i = 0; i < handlerCount; i++) {\n argsHandlers.push('cb' + i);\n argsContexts.push('ctx' + i);\n src += ' cb' + i + '(payload, ctx' + i + ');\\n';\n }\n src += '};';\n return new (Function.bind.apply(Function, [void 0].concat(argsHandlers.concat(argsContexts), [src])))();\n}\nvar Event = /** @class */ (function () {\n function Event() {\n this.hasHandlers = false;\n this._handlers = [];\n this._contexts = [];\n this._createDispatcher();\n }\n Event.prototype.addHandler = function (handler, context) {\n if (!this.isHandlerAttached(handler, context)) {\n this._handlers.push(handler);\n this._contexts.push(context);\n this._createDispatcher();\n this._updateHasHandlers();\n }\n return this;\n };\n Event.prototype.removeHandler = function (handler, context) {\n var idx = this._getHandlerIndex(handler, context);\n if (typeof (idx) !== 'undefined') {\n this._handlers.splice(idx, 1);\n this._contexts.splice(idx, 1);\n this._createDispatcher();\n this._updateHasHandlers();\n }\n return this;\n };\n Event.prototype.isHandlerAttached = function (handler, context) {\n return typeof (this._getHandlerIndex(handler, context)) !== 'undefined';\n };\n Event.prototype._updateHasHandlers = function () {\n this.hasHandlers = !!this._handlers.length;\n };\n Event.prototype._getHandlerIndex = function (handler, context) {\n var handlerCount = this._handlers.length;\n var idx;\n for (idx = 0; idx < handlerCount; idx++) {\n if (this._handlers[idx] === handler && this._contexts[idx] === context)\n break;\n }\n return idx < handlerCount ? idx : undefined;\n };\n Event.prototype._createDispatcher = function () {\n this.dispatch = getFactory(this._handlers.length).apply(this, this._handlers.concat(this._contexts));\n };\n return Event;\n}());\nexports.default = Event;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Event_1 = require(\"./Event\");\nexports.Event = Event_1.default;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar microevent_ts_1 = require(\"microevent.ts\");\nvar MSG_RESOLVE_TRANSACTION = \"resolve_transaction\", MSG_REJECT_TRANSACTION = \"reject_transaction\", MSG_ERROR = \"error\";\nvar RpcProvider = /** @class */ (function () {\n function RpcProvider(_dispatch, _rpcTimeout) {\n if (_rpcTimeout === void 0) { _rpcTimeout = 0; }\n this._dispatch = _dispatch;\n this._rpcTimeout = _rpcTimeout;\n this.error = new microevent_ts_1.Event();\n this._rpcHandlers = {};\n this._signalHandlers = {};\n this._pendingTransactions = {};\n this._nextTransactionId = 0;\n }\n RpcProvider.prototype.dispatch = function (payload) {\n var message = payload;\n switch (message.type) {\n case RpcProvider.MessageType.signal:\n return this._handleSignal(message);\n case RpcProvider.MessageType.rpc:\n return this._handeRpc(message);\n case RpcProvider.MessageType.internal:\n return this._handleInternal(message);\n default:\n this._raiseError(\"invalid message type \" + message.type);\n }\n };\n RpcProvider.prototype.rpc = function (id, payload, transfer) {\n var _this = this;\n var transactionId = this._nextTransactionId++;\n this._dispatch({\n type: RpcProvider.MessageType.rpc,\n transactionId: transactionId,\n id: id,\n payload: payload\n }, transfer ? transfer : undefined);\n return new Promise(function (resolve, reject) {\n var transaction = _this._pendingTransactions[transactionId] = {\n id: transactionId,\n resolve: resolve,\n reject: reject\n };\n if (_this._rpcTimeout > 0) {\n _this._pendingTransactions[transactionId].timeoutHandle =\n setTimeout(function () { return _this._transactionTimeout(transaction); }, _this._rpcTimeout);\n }\n });\n };\n ;\n RpcProvider.prototype.signal = function (id, payload, transfer) {\n this._dispatch({\n type: RpcProvider.MessageType.signal,\n id: id,\n payload: payload,\n }, transfer ? transfer : undefined);\n return this;\n };\n RpcProvider.prototype.registerRpcHandler = function (id, handler) {\n if (this._rpcHandlers[id]) {\n throw new Error(\"rpc handler for \" + id + \" already registered\");\n }\n this._rpcHandlers[id] = handler;\n return this;\n };\n ;\n RpcProvider.prototype.registerSignalHandler = function (id, handler) {\n if (!this._signalHandlers[id]) {\n this._signalHandlers[id] = [];\n }\n this._signalHandlers[id].push(handler);\n return this;\n };\n RpcProvider.prototype.deregisterRpcHandler = function (id, handler) {\n if (this._rpcHandlers[id]) {\n delete this._rpcHandlers[id];\n }\n return this;\n };\n ;\n RpcProvider.prototype.deregisterSignalHandler = function (id, handler) {\n if (this._signalHandlers[id]) {\n this._signalHandlers[id] = this._signalHandlers[id].filter(function (h) { return handler !== h; });\n }\n return this;\n };\n RpcProvider.prototype._raiseError = function (error) {\n this.error.dispatch(new Error(error));\n this._dispatch({\n type: RpcProvider.MessageType.internal,\n id: MSG_ERROR,\n payload: error\n });\n };\n RpcProvider.prototype._handleSignal = function (message) {\n if (!this._signalHandlers[message.id]) {\n return this._raiseError(\"invalid signal \" + message.id);\n }\n this._signalHandlers[message.id].forEach(function (handler) { return handler(message.payload); });\n };\n RpcProvider.prototype._handeRpc = function (message) {\n var _this = this;\n if (!this._rpcHandlers[message.id]) {\n return this._raiseError(\"invalid rpc \" + message.id);\n }\n Promise.resolve(this._rpcHandlers[message.id](message.payload))\n .then(function (result) { return _this._dispatch({\n type: RpcProvider.MessageType.internal,\n id: MSG_RESOLVE_TRANSACTION,\n transactionId: message.transactionId,\n payload: result\n }); }, function (reason) { return _this._dispatch({\n type: RpcProvider.MessageType.internal,\n id: MSG_REJECT_TRANSACTION,\n transactionId: message.transactionId,\n payload: reason\n }); });\n };\n RpcProvider.prototype._handleInternal = function (message) {\n var transaction = typeof (message.transactionId) !== 'undefined' ? this._pendingTransactions[message.transactionId] : undefined;\n switch (message.id) {\n case MSG_RESOLVE_TRANSACTION:\n if (!transaction || typeof (message.transactionId) === 'undefined') {\n return this._raiseError(\"no pending transaction with id \" + message.transactionId);\n }\n transaction.resolve(message.payload);\n this._clearTransaction(this._pendingTransactions[message.transactionId]);\n break;\n case MSG_REJECT_TRANSACTION:\n if (!transaction || typeof (message.transactionId) === 'undefined') {\n return this._raiseError(\"no pending transaction with id \" + message.transactionId);\n }\n this._pendingTransactions[message.transactionId].reject(message.payload);\n this._clearTransaction(this._pendingTransactions[message.transactionId]);\n break;\n case MSG_ERROR:\n this.error.dispatch(new Error(\"remote error: \" + message.payload));\n break;\n default:\n this._raiseError(\"unhandled internal message \" + message.id);\n break;\n }\n };\n RpcProvider.prototype._transactionTimeout = function (transaction) {\n transaction.reject('transaction timed out');\n this._raiseError(\"transaction \" + transaction.id + \" timed out\");\n delete this._pendingTransactions[transaction.id];\n return;\n };\n RpcProvider.prototype._clearTransaction = function (transaction) {\n if (typeof (transaction.timeoutHandle) !== 'undefined') {\n clearTimeout(transaction.timeoutHandle);\n }\n delete this._pendingTransactions[transaction.id];\n };\n return RpcProvider;\n}());\n(function (RpcProvider) {\n var MessageType;\n (function (MessageType) {\n MessageType[MessageType[\"signal\"] = 0] = \"signal\";\n MessageType[MessageType[\"rpc\"] = 1] = \"rpc\";\n MessageType[MessageType[\"internal\"] = 2] = \"internal\";\n })(MessageType = RpcProvider.MessageType || (RpcProvider.MessageType = {}));\n ;\n})(RpcProvider || (RpcProvider = {}));\nexports.default = RpcProvider;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar RpcProvider_1 = require(\"./RpcProvider\");\nexports.RpcProvider = RpcProvider_1.default;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\ndeclare function postMessage(message: any, transfer?: any): void;\n\nimport { RpcProviderInterface, RpcProvider } from 'worker-rpc';\n\nlet rpcProvider: RpcProvider = null,\n port: MessagePort = null,\n portPending: MessagePort = null;\n\nfunction send(message: any, transfer?: any): void {\n if (port) {\n port.postMessage(message, transfer);\n } else {\n postMessage(message, transfer);\n }\n\n if (portPending) {\n port = portPending;\n port.onmessage = (e: MessageEvent) => rpcProvider.dispatch(e.data);\n }\n\n portPending = null;\n}\n\nrpcProvider = new RpcProvider(send);\nrpcProvider.error.addHandler(e => {\n console.log(e ? e.message : 'unknown rpc error');\n});\nonmessage = (e: MessageEvent) => port || rpcProvider.dispatch(e.data);\n\nrpcProvider.registerRpcHandler('/use-port', (newPort: MessagePort) => {\n if (!(port || portPending)) {\n portPending = newPort;\n return Promise.resolve();\n } else {\n return Promise.reject('RPC already switched to message port');\n }\n});\n\nexport function getRpc(): RpcProviderInterface {\n return rpcProvider;\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { EventInterface } from 'microevent.ts';\n\nimport StellaConfig from '../../../machine/stella/Config';\nimport CartridgeInfo from '../../../machine/stella/cartridge/CartridgeInfo';\nimport EmulationContextInterface from './EmulationContextInterface';\n\ninterface EmulationServiceInterface {\n init(): Promise<void>;\n\n start(\n buffer: { [i: number]: number; length: number },\n config: EmulationServiceInterface.Config,\n cartridgeType?: CartridgeInfo.CartridgeType\n ): Promise<EmulationServiceInterface.State>;\n\n stop(): Promise<EmulationServiceInterface.State>;\n\n pause(): Promise<EmulationServiceInterface.State>;\n\n resume(): Promise<EmulationServiceInterface.State>;\n\n reset(): Promise<EmulationServiceInterface.State>;\n\n setRateLimit(enforce: boolean): Promise<void>;\n\n getRateLimit(): boolean;\n\n getState(): EmulationServiceInterface.State;\n\n getLastError(): Error;\n\n getEmulationContext(): EmulationContextInterface;\n\n getFrequency(): number;\n\n stateChanged: EventInterface<EmulationServiceInterface.State>;\n\n frequencyUpdate: EventInterface<number>;\n}\n\nnamespace EmulationServiceInterface {\n export enum State {\n stopped = 'stopped',\n running = 'running',\n paused = 'paused',\n error = 'error'\n }\n\n export interface Config extends StellaConfig {\n asyncIO?: boolean;\n }\n}\n\nexport { EmulationServiceInterface as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { EventInterface } from 'microevent.ts';\n\nimport BusInterface from '../bus/BusInterface';\nimport CpuInterface from '../cpu/CpuInterface';\nimport TimerInterface from './TimerInterface';\n\ninterface BoardInterface {\n getBus(): BusInterface;\n\n getCpu(): CpuInterface;\n\n getTimer(): TimerInterface;\n\n reset(hard: boolean): BoardInterface;\n\n boot(): BoardInterface;\n\n suspend(): void;\n\n resume(): void;\n\n getClockMode(): BoardInterface.ClockMode;\n\n setClockMode(clockMode: BoardInterface.ClockMode): BoardInterface;\n\n triggerTrap(reason: BoardInterface.TrapReason, message?: string): BoardInterface;\n\n getBoardStateDebug(): string;\n\n trap: EventInterface<BoardInterface.TrapPayload>;\n\n cpuClock: EventInterface<number>;\n\n clock: EventInterface<number>;\n\n systemReset: EventInterface<void>;\n}\n\nnamespace BoardInterface {\n export const enum TrapReason {\n cpu,\n bus,\n debug,\n board\n }\n\n export const enum ClockMode {\n instruction,\n lazy\n }\n\n export class TrapPayload {\n constructor(public reason: TrapReason, public board: BoardInterface, public message?: string) {}\n }\n}\n\nexport { BoardInterface as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\ninterface CpuInterface {\n setInterrupt(irq: boolean): CpuInterface;\n\n isInterrupt(): boolean;\n\n nmi(): CpuInterface;\n\n halt(): CpuInterface;\n\n resume(): CpuInterface;\n\n isHalt(): boolean;\n\n setInvalidInstructionCallback(callback: CpuInterface.InvalidInstructionCallbackInterface): CpuInterface;\n\n getInvalidInstructionCallback(): CpuInterface.InvalidInstructionCallbackInterface;\n\n getLastInstructionPointer(): number;\n\n reset(): CpuInterface;\n\n cycle(): CpuInterface;\n\n executionState: CpuInterface.ExecutionState;\n state: CpuInterface.State;\n}\n\nnamespace CpuInterface {\n export const enum ExecutionState {\n boot,\n fetch,\n execute\n }\n\n export class State {\n a: number = 0;\n x: number = 0;\n y: number = 0;\n s: number = 0;\n p: number = 0;\n flags: number = 0;\n\n irq = false;\n nmi = false;\n }\n\n export const enum Flags {\n c = 0x01, // carry\n z = 0x02, // zero\n i = 0x04, // interrupt\n d = 0x08, // decimal mode\n b = 0x10, // break\n e = 0x20, // reserved\n v = 0x40, // overflow\n n = 0x80 // sign\n }\n\n export interface InvalidInstructionCallbackInterface {\n (cpu?: CpuInterface): void;\n }\n}\n\nexport { CpuInterface as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport PoolMemberInterface from './PoolMemberInterface';\n\nclass PoolMember<T> implements PoolMemberInterface<T> {\n constructor(\n private _value: T,\n private _releaseCB: (victim: PoolMember<T>) => void,\n private _disposeCB: (victim: PoolMember<T>) => void\n ) {}\n\n adopt(target: T): void {\n this._value = target;\n }\n\n get(): T {\n return this._value;\n }\n\n release(): void {\n this._releaseCB(this);\n }\n\n dispose(): void {\n this._disposeCB(this);\n }\n\n public _isAvailable = false;\n public _isDisposed = false;\n public _poolPosition: number;\n}\n\nexport { PoolMember as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport PoolMember from './PoolMember';\nimport PoolInterface from './PoolInterface';\n\nclass Pool<T> implements PoolInterface<T> {\n constructor(private _factory: Pool.FactoryInterface<T>) {}\n\n get(): PoolMember<T> {\n let member: PoolMember<T>;\n\n if (this._poolSize === 0) {\n const newItem = this._factory();\n\n member = new PoolMember<T>(\n newItem,\n (victim: PoolMember<T>) => this._releaseMember(victim),\n (victim: PoolMember<T>) => this._disposeMember(victim)\n );\n } else {\n member = this._pool[--this._poolSize];\n member._isAvailable = false;\n }\n\n return member;\n }\n\n private _releaseMember(victim: PoolMember<T>) {\n if (victim._isAvailable) {\n throw new Error('Trying to release an already released pool member');\n }\n\n if (victim._isDisposed) {\n throw new Error('Trying to release an already disposed pool member');\n }\n\n const position = this._poolSize++;\n\n this._pool[position] = victim;\n\n victim._isAvailable = true;\n victim._poolPosition = position;\n\n this.event.release.dispatch(victim.get());\n }\n\n private _disposeMember(victim: PoolMember<T>) {\n if (victim._isDisposed) {\n throw new Error('Trying to dispose of an already disposed pool member');\n }\n\n if (victim._isAvailable) {\n if (this._poolSize > 1) {\n this._pool[victim._poolPosition] = this._pool[this._poolSize - 1];\n }\n\n this._poolSize--;\n }\n\n victim._isDisposed = true;\n\n this.event.dispose.dispatch(victim.get());\n }\n\n event = {\n release: new Event<T>(),\n dispose: new Event<T>(),\n };\n\n private _pool: Array<PoolMember<T>> = [];\n\n private _poolSize = 0;\n}\n\nnamespace Pool {\n export interface FactoryInterface<T> {\n (): T;\n }\n}\n\nexport { Pool as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport RGBASurfaceInterface from './RGBASurfaceInterface';\n\nclass ArrayBufferSurface implements RGBASurfaceInterface {\n static createFromArrayBuffer(width: number, height: number, buffer: ArrayBuffer): ArrayBufferSurface {\n return new ArrayBufferSurface().replaceUnderlyingBuffer(width, height, buffer);\n }\n\n replaceUnderlyingBuffer(width: number, height: number, buffer: ArrayBuffer): ArrayBufferSurface {\n if (width * height * 4 !== buffer.byteLength) {\n throw new Error('surface size mismatch');\n }\n\n this._width = width;\n this._height = height;\n this._underlyingBuffer = buffer;\n\n this._buffer = new Uint32Array(this._underlyingBuffer);\n\n return this;\n }\n\n getUnderlyingBuffer(): ArrayBuffer {\n return this._underlyingBuffer;\n }\n\n resetUnderlyingBuffer(): ArrayBufferSurface {\n this._width = this._height = 0;\n this._underlyingBuffer = this._buffer = null;\n\n return this;\n }\n\n getWidth(): number {\n return this._width;\n }\n\n getHeight(): number {\n return this._height;\n }\n\n getBuffer(): Uint32Array {\n return this._buffer;\n }\n\n getByteOrder(): RGBASurfaceInterface.ByteOrder {\n return RGBASurfaceInterface.ByteOrder.rgba;\n }\n\n fill(value: number): this {\n for (let i = 0; i < this._buffer.length; i++) {\n this._buffer[i] = value;\n }\n\n return this;\n }\n\n private _height = 0;\n private _width = 0;\n private _underlyingBuffer: ArrayBuffer;\n\n private _buffer: Uint32Array = null;\n}\n\nexport { ArrayBufferSurface as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport VideoOutputInterface from '../..//machine/io/VideoOutputInterface';\nimport ObjectPool from '../../tools/pool/Pool';\nimport PoolMemberInterface from '../../tools/pool/PoolMemberInterface';\nimport ArrayBufferSurface from '../../video/surface/ArrayBufferSurface';\nimport RGBASurfaceInterface from '../../video/surface/RGBASurfaceInterface';\nimport VideoEndpointInterface from '../driver/VideoEndpointInterface';\n\nclass VideoEndpoint implements VideoEndpointInterface {\n constructor(private _video: VideoOutputInterface) {\n this._pool = new ObjectPool<ImageData>(() => new ImageData(this._video.getWidth(), this._video.getHeight()));\n\n this._video.setSurfaceFactory(\n (): RGBASurfaceInterface => {\n const poolMember = this._pool.get(),\n imageData = poolMember.get();\n\n if (!this._surfaces.has(imageData)) {\n const newSurface = ArrayBufferSurface.createFromArrayBuffer(\n imageData.width,\n imageData.height,\n imageData.data.buffer\n );\n\n this._surfaces.set(imageData, newSurface.fill(0xff000000));\n }\n\n const surface = this._surfaces.get(imageData);\n\n this._poolMembers.set(surface, poolMember);\n\n return surface;\n }\n );\n\n this._video.newFrame.addHandler(imageData => this.newFrame.dispatch(this._poolMembers.get(imageData)));\n }\n\n getWidth(): number {\n return this._video.getWidth();\n }\n\n getHeight(): number {\n return this._video.getHeight();\n }\n\n newFrame = new Event<PoolMemberInterface<ImageData>>();\n\n private _pool: ObjectPool<ImageData>;\n private _poolMembers = new WeakMap<RGBASurfaceInterface, PoolMemberInterface<ImageData>>();\n private _surfaces = new WeakMap<ImageData, RGBASurfaceInterface>();\n}\n\nexport { VideoEndpoint as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport PoolMemberInterface from './PoolMemberInterface';\n\nclass InducedMember<T, U> implements PoolMemberInterface<U> {\n constructor(\n private _value: PoolMemberInterface<T>,\n private _mapper: (value: T) => U,\n private _adopter: (value: PoolMemberInterface<T>, target: U) => void\n ) {}\n\n adopt(target: U): void {\n this._adopter(this._value, target);\n }\n\n get(): U {\n return this._mapper(this._value.get());\n }\n\n release(): void {\n this._value.release();\n }\n\n dispose(): void {\n this._value.dispose();\n }\n}\n\nexport { InducedMember as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport InducedMember from './InducedMember';\nimport PoolMemberInterface from './PoolMemberInterface';\n\nclass InducedPool<T, U> {\n constructor(\n private _mapper: (value: T) => U,\n private _adopter: (value: PoolMemberInterface<T>, target: U) => void = () => {\n throw new Error('adopt is not supported');\n }\n ) {}\n\n get(original: PoolMemberInterface<T>): InducedMember<T, U> {\n if (!this._map.has(original)) {\n this._map.set(original, new InducedMember(original, this._mapper, this._adopter));\n }\n\n return this._map.get(original);\n }\n\n private _map = new WeakMap<PoolMemberInterface<T>, InducedMember<T, U>>();\n}\n\nexport { InducedPool as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass AudioOutputBuffer {\n constructor(private _content: Float32Array, private _sampleRate: number) {}\n\n getLength(): number {\n return this._content.length;\n }\n\n getContent(): Float32Array {\n return this._content;\n }\n\n getSampleRate(): number {\n return this._sampleRate;\n }\n\n replaceUnderlyingBuffer(buffer: Float32Array): void {\n this._content = buffer;\n }\n}\n\nexport { AudioOutputBuffer as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport Pool from '../../tools/pool/Pool';\nimport InducedPool from '../../tools/pool/InducedPool';\nimport PoolMemberInterface from '../../tools/pool/PoolMemberInterface';\nimport PCMAudioEndpointInterface from './PCMAudioEndpointInterface';\nimport PCMAudioOutputInterface from '../../machine/io/PCMAudioOutputInterface';\nimport AudioOutputBuffer from '../../tools/AudioOutputBuffer';\n\nclass PCMAudioEndpoint implements PCMAudioEndpointInterface {\n constructor(private _output: PCMAudioOutputInterface) {\n this._output.newFrame.addHandler((buffer: AudioOutputBuffer) =>\n this.newFrame.dispatch(this._pcmDataPool.get(this._audioBufferMap.get(buffer)))\n );\n\n this._output.togglePause.addHandler((paused: boolean) => this.togglePause.dispatch(paused));\n\n this._output.setFrameBufferFactory(() => {\n const wrappedBuffer = this._audioBufferPool.get();\n\n if (!this._audioBufferMap.has(wrappedBuffer.get())) {\n this._audioBufferMap.set(wrappedBuffer.get(), wrappedBuffer);\n }\n\n return wrappedBuffer.get();\n });\n }\n\n getSampleRate(): number {\n return this._output.getSampleRate();\n }\n\n getFrameSize(): number {\n return this._output.getFrameSize();\n }\n\n isPaused(): boolean {\n return this._output.isPaused();\n }\n\n newFrame = new Event<PoolMemberInterface<Float32Array>>();\n\n togglePause = new Event<boolean>();\n\n private _audioBufferPool = new Pool<AudioOutputBuffer>(\n () => new AudioOutputBuffer(new Float32Array(this.getFrameSize()), this.getSampleRate())\n );\n\n private _audioBufferMap = new WeakMap<AudioOutputBuffer, PoolMemberInterface<AudioOutputBuffer>>();\n\n private _pcmDataPool = new InducedPool(\n (buffer: AudioOutputBuffer) => buffer.getContent(),\n (value: PoolMemberInterface<AudioOutputBuffer>, target: Float32Array) =>\n value.get().replaceUnderlyingBuffer(target)\n );\n}\n\nexport { PCMAudioEndpoint as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport EmulationContextInterface from '../EmulationContextInterface';\nimport ControlPanelInterface from '../../../../machine/stella/ControlPanelInterface';\nimport JoystickInterface from '../../../../machine/io/DigitalJoystickInterface';\nimport PaddleInterface from '../../../../machine/io/PaddleInterface';\nimport Board from '../../../../machine/stella/Board';\nimport Config from '../../../../machine/stella/Config';\nimport VideoEndpoint from '../../../driver/VideoEndpoint';\nimport VideoEndpointInterface from '../../../driver/VideoEndpointInterface';\nimport VideoOutputInterface from '../../../../machine/io/VideoOutputInterface';\nimport WaveformAudioOutputInterface from '../../../../machine/io/WaveformAudioOutputInterface';\nimport PCMAudioEndpointInterface from '../../../driver/PCMAudioEndpointInterface';\nimport PCMAudioEndpoint from '../../../driver/PCMAudioEndpoint';\nimport AsyncIOInterface from '../../../../machine/io/AsyncIOInterface';\n\nexport default class EmulationContext implements EmulationContextInterface {\n constructor(private _board: Board, private _asyncIO?: AsyncIOInterface) {}\n\n getConfig(): Config {\n return this._board.getConfig();\n }\n\n getVideo(): VideoEndpointInterface {\n if (!this._videoEndpoint) {\n this._videoEndpoint = new VideoEndpoint(this._board.getVideoOutput());\n }\n\n return this._videoEndpoint;\n }\n\n getJoystick(i: number): JoystickInterface {\n switch (i) {\n case 0:\n return this._board.getJoystick0();\n\n case 1:\n return this._board.getJoystick1();\n\n default:\n throw new Error(`invalid joystick index ${i}`);\n }\n }\n\n getControlPanel(): ControlPanelInterface {\n return this._board.getControlPanel();\n }\n\n getPaddle(i: number): PaddleInterface {\n if (i >= 0 && i < 4) {\n return this._board.getPaddle(i);\n } else {\n throw new Error(`invalid paddle index ${i}`);\n }\n }\n\n getWaveformChannels(): Array<WaveformAudioOutputInterface> {\n return this._board.getWaveformChannels();\n }\n\n getPCMChannel(): PCMAudioEndpointInterface {\n if (!this._audioEndpoint) {\n this._audioEndpoint = new PCMAudioEndpoint(this._board.getPCMChannel());\n }\n\n return this._audioEndpoint;\n }\n\n getRawVideo(): VideoOutputInterface {\n if (this._videoEndpoint) {\n throw new Error(`video endpoint already initialized; raw video unavailable`);\n }\n\n return this._board.getVideoOutput();\n }\n\n getAsyncIO(): AsyncIOInterface {\n return this._asyncIO;\n }\n\n private _videoEndpoint: VideoEndpoint = null;\n private _audioEndpoint: PCMAudioEndpointInterface = null;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport BusInterface from '../bus/BusInterface';\nimport Tia from './tia/Tia';\nimport Pia from './Pia';\nimport CartridgeInterface from './cartridge/CartridgeInterface';\n\nclass Bus implements BusInterface {\n setTia(tia: Tia): Bus {\n tia.trap.addHandler((payload: Tia.TrapPayload) =>\n this.triggerTrap(Bus.TrapReason.tia, 'TIA: ' + (payload.message || ''))\n );\n\n this._tia = tia;\n\n return this;\n }\n\n setPia(pia: Pia): Bus {\n pia.trap.addHandler((payload: Pia.TrapPayload) =>\n this.triggerTrap(Bus.TrapReason.pia, 'PIA: ' + (payload.message || ''))\n );\n\n this._pia = pia;\n\n return this;\n }\n\n setCartridge(cartridge: CartridgeInterface): Bus {\n cartridge.trap.addHandler((payload: CartridgeInterface.TrapPayload) =>\n this.triggerTrap(Bus.TrapReason.cartridge, 'CARTRIDGE: ' + (payload.message || ''))\n );\n\n this._cartridge = cartridge;\n\n return this;\n }\n\n readWord(address: number): number {\n return this.read(address) | (this.read((address + 1) & 0xffff) << 8);\n }\n\n read(address: number): number {\n // Mask out bits 13-15\n this._lastAddressBusValue = address;\n address &= 0x1fff;\n\n // Chip select A12 -> cartridge\n if (address & 0x1000) {\n this._lastDataBusValue = this._cartridge.read(address);\n this.event.read.dispatch(Bus.AccessType.cartridge);\n } else if (address & 0x80) {\n // Chip select A7 -> PIA\n this._lastDataBusValue = this._pia.read(address);\n this.event.read.dispatch(Bus.AccessType.pia);\n } else {\n this._lastDataBusValue = this._tia.read(address);\n this.event.read.dispatch(Bus.AccessType.tia);\n }\n\n return this._lastDataBusValue;\n }\n\n write(address: number, value: number): void {\n this._lastDataBusValue = value;\n this._lastAddressBusValue = address;\n\n // Mask out bits 12-15\n address &= 0x1fff;\n\n // Chip select A12 -> cartridge\n if (address & 0x1000) {\n this._cartridge.write(address, value);\n this.event.write.dispatch(Bus.AccessType.cartridge);\n } else if (address & 0x80) {\n // Chip select A7 -> PIA\n this._pia.write(address, value);\n this.event.write.dispatch(Bus.AccessType.pia);\n } else {\n this._tia.write(address, value);\n this.event.write.dispatch(Bus.AccessType.tia);\n }\n }\n\n peek(address: number): number {\n address &= 0x1fff;\n\n // Chip select A12 -> cartridge\n if (address & 0x1000) {\n return this._cartridge.peek(address);\n } else if (address & 0x80) {\n // Chip select A7 -> PIA\n return this._pia.peek(address);\n } else {\n return this._tia.peek(address);\n }\n }\n\n // Stub\n poke(address: number, value: number) {}\n\n getLastDataBusValue(): number {\n return this._lastDataBusValue;\n }\n\n setDataBusValue(value: number): void {\n this._lastDataBusValue = value;\n }\n\n getLastAddresBusValue(): number {\n return this._lastAddressBusValue;\n }\n\n private triggerTrap(reason: Bus.TrapReason, message?: string): void {\n if (this.event.trap.hasHandlers) {\n this.event.trap.dispatch(new Bus.TrapPayload(reason, this, message));\n } else {\n throw new Error(message);\n }\n }\n\n event = {\n trap: new Event<Bus.TrapPayload>(),\n read: new Event<Bus.AccessType>(),\n write: new Event<Bus.AccessType>()\n };\n\n private _tia: Tia = null;\n private _pia: Pia = null;\n private _cartridge: CartridgeInterface = null;\n\n private _lastDataBusValue = 0;\n private _lastAddressBusValue = 0;\n}\n\nnamespace Bus {\n export const enum TrapReason {\n tia,\n pia,\n cartridge\n }\n\n export const enum AccessType {\n tia,\n pia,\n cartridge\n }\n\n export class TrapPayload {\n constructor(public reason: TrapReason, public bus: Bus, public message?: string) {}\n }\n}\n\nexport { Bus as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport ControlPanelInterface from './ControlPanelInterface';\nimport DigitalJoystickInterface from '../io/DigitalJoystickInterface';\nimport Bus from './Bus';\n\nimport RngInterface from '../../tools/rng/GeneratorInterface';\n\nclass Pia {\n constructor(\n private _controlPanel: ControlPanelInterface,\n private _joystick0: DigitalJoystickInterface,\n private _joystick1: DigitalJoystickInterface,\n private _rng?: RngInterface\n ) {\n this.reset();\n }\n\n reset(): void {\n for (let i = 0; i < 128; i++) {\n this.ram[i] = this._rng ? this._rng.int(0xff) : 0;\n }\n\n this._interruptFlag = 0;\n this._flagSetDuringThisCycle = false;\n\n this._timerDivide = 1024;\n this._subTimer = 0;\n this._rng.int(0xff);\n this._timerValue = 0;\n this._timerWrapped = false;\n }\n\n read(address: number): number {\n // RAM select = A9 low?\n if (address & 0x0200) {\n if (address & 0x0004) {\n return this._readTimer(address);\n } else {\n return this._readIo(address);\n }\n } else {\n // Mask out A7 - A15\n return this.ram[address & 0x7f];\n }\n }\n\n peek(address: number): number {\n // RAM select = A9 low?\n if (address & 0x0200) {\n if (address & 0x0004) {\n return this._peekTimer(address);\n } else {\n return this._readIo(address);\n }\n } else {\n // Mask out A7 - A15\n return this.ram[address & 0x7f];\n }\n }\n\n write(address: number, value: number) {\n // RAM select = A9 low?\n if (address & 0x0200) {\n if (address & 0x0004) {\n return this._writeTimer(address, value);\n } else {\n return this._writeIo(address, value);\n }\n } else {\n // Mask out A7 - A15\n this.ram[address & 0x7f] = value;\n }\n }\n\n cycle(): void {\n this._cycleTimer();\n }\n\n getDebugState(): string {\n return `divider: ${this._timerDivide} raw timer: INTIM: ${this._timerValue}`;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n private _writeIo(address: number, value: number): void {}\n\n private _writeTimer(address: number, value: number): void {\n this._interruptFlag = 0;\n\n // clear bit 3 <-> interrupt enable/disable\n switch (address & 0x0297) {\n case Pia.Registers.t1024t:\n return this._setTimer(1024, value);\n\n case Pia.Registers.tim64t:\n return this._setTimer(64, value);\n\n case Pia.Registers.tim8t:\n return this._setTimer(8, value);\n\n case Pia.Registers.tim1t:\n return this._setTimer(1, value);\n }\n }\n\n private _setTimer(divide: number, value: number): void {\n this._timerDivide = divide;\n this._timerValue = value;\n this._subTimer = 0;\n this._timerWrapped = false;\n }\n\n private _readIo(address: number): number {\n switch (address & 0x0283) {\n case Pia.Registers.swcha:\n return (\n (this._joystick1.getUp().read() ? 0 : 0x01) |\n (this._joystick1.getDown().read() ? 0 : 0x02) |\n (this._joystick1.getLeft().read() ? 0 : 0x04) |\n (this._joystick1.getRight().read() ? 0 : 0x08) |\n (this._joystick0.getUp().read() ? 0 : 0x10) |\n (this._joystick0.getDown().read() ? 0 : 0x20) |\n (this._joystick0.getLeft().read() ? 0 : 0x40) |\n (this._joystick0.getRight().read() ? 0 : 0x80)\n );\n\n case Pia.Registers.swchb:\n return (\n (this._controlPanel.getResetButton().read() ? 0 : 0x01) |\n (this._controlPanel.getSelectSwitch().read() ? 0 : 0x02) |\n (this._controlPanel.getColorSwitch().read() ? 0 : 0x08) |\n (this._controlPanel.getDifficultySwitchP0().read() ? 0 : 0x40) |\n (this._controlPanel.getDifficultySwitchP1().read() ? 0 : 0x80)\n );\n }\n\n return this._bus.getLastDataBusValue();\n }\n\n private _readTimer(address: number): number {\n if (address & 0x01) {\n const flag = this._interruptFlag;\n\n return flag & 0x80;\n } else {\n if (!this._flagSetDuringThisCycle) {\n this._interruptFlag = 0;\n this._timerWrapped = false;\n }\n\n return this._timerValue;\n }\n }\n\n private _peekTimer(address: number): number {\n return address & 0x01 ? this._interruptFlag & 0x80 : this._timerValue;\n }\n\n private _cycleTimer(): void {\n this._flagSetDuringThisCycle = false;\n\n if (this._timerWrapped) {\n this._timerValue = (this._timerValue + 0xff) & 0xff;\n } else if (this._subTimer === 0 && --this._timerValue < 0) {\n this._timerValue = 0xff;\n this._flagSetDuringThisCycle = true;\n this._interruptFlag = 0xff;\n this._timerWrapped = true;\n }\n\n if (++this._subTimer === this._timerDivide) {\n this._subTimer = 0;\n }\n }\n\n trap = new Event<Pia.TrapPayload>();\n\n ram = new Uint8Array(128);\n\n private _bus: Bus = null;\n\n private _timerValue = 255;\n private _subTimer = 0;\n private _timerDivide = 1024;\n private _interruptFlag = 0;\n private _timerWrapped = false;\n private _flagSetDuringThisCycle = false;\n}\n\nnamespace Pia {\n export const enum Registers {\n swcha = 0x280,\n swacnt = 0x281,\n swchb = 0x282,\n swncnt = 0x283,\n intim = 0x284,\n instat = 0x285,\n tim1t = 0x294,\n tim8t = 0x295,\n tim64t = 0x296,\n t1024t = 0x297\n }\n\n export const enum TrapReason {\n invalidRead,\n invalidWrite\n }\n\n export class TrapPayload {\n constructor(public reason: TrapReason, public pia: Pia, public message?: string) {}\n }\n}\n\nexport { Pia as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from './StateMachineInterface';\n\nclass ResultImpl implements StateMachineInterface.Result {\n constructor() {}\n\n read(nextStep: StateMachineInterface.Step, address: number): this {\n this.cycleType = StateMachineInterface.CycleType.read;\n this.address = address;\n this.nextStep = nextStep;\n\n return this;\n }\n\n write(nextStep: StateMachineInterface.Step, address: number, value: number): this {\n this.cycleType = StateMachineInterface.CycleType.write;\n this.address = address;\n this.value = value;\n this.nextStep = nextStep;\n\n return this;\n }\n\n poll(poll: boolean): this {\n this.pollInterrupts = poll;\n\n return this;\n }\n\n cycleType = StateMachineInterface.CycleType.read;\n address = 0;\n value = 0;\n pollInterrupts = false;\n nextStep: StateMachineInterface.Step = null;\n}\n\nexport default ResultImpl;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst immutables = Symbol('immutable properties');\n\nexport function freezeImmutables(target: any): void {\n const immutableProperties = target[immutables];\n if (!immutableProperties) {\n return;\n }\n\n for (const prop of immutableProperties) {\n Object.defineProperty(target, prop, { writable: false, configurable: false });\n }\n}\n\nexport function Immutable(target: any, prop: string): void {\n if (!target[immutables]) {\n Object.defineProperty(target, immutables, { value: [], writable: false, enumerable: false });\n }\n\n target[immutables].push(prop);\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Boot implements StateMachineInterface {\n constructor(state: CpuInterface.State) {\n this._state = state;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._pre1Step, 0xff);\n\n @Immutable private _pre1Step = (): StateMachineInterface.Result => this._result.read(this._pre2Step, 0x0ff);\n\n @Immutable private _pre2Step = (): StateMachineInterface.Result => this._result.read(this._stack1Step, 0x0100);\n\n @Immutable private _stack1Step = (): StateMachineInterface.Result => this._result.read(this._stack2Step, 0x01ff);\n\n @Immutable\n private _stack2Step = (): StateMachineInterface.Result => {\n this._state.s = 0xfd;\n return this._result.read(this._stack3Step, 0x01fe);\n };\n\n @Immutable\n private _stack3Step = (): StateMachineInterface.Result => this._result.read(this._readTargetLoStep, 0xfffc);\n\n @Immutable\n private _readTargetLoStep = (operand: number): StateMachineInterface.Result => {\n this._targetAddress = operand;\n return this._result.read(this._readTargetHiStep, 0xfffd);\n };\n\n @Immutable\n private _readTargetHiStep = (operand: number): null => {\n this._targetAddress |= operand << 8;\n this._state.p = this._targetAddress;\n\n return null;\n };\n\n private _targetAddress = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n}\n\nexport const boot = (state: CpuInterface.State) => new Boot(state);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Interrupt implements StateMachineInterface {\n constructor(state: CpuInterface.State, defaultVector: number, isBrk: boolean) {\n this._state = state;\n this._defaultVector = defaultVector;\n this._isBrk = isBrk;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._dummyRead, this._state.p);\n\n @Immutable\n private _dummyRead = (): StateMachineInterface.Result => {\n if (this._isBrk) {\n this._state.p = (this._state.p + 1) & 0xffff;\n }\n\n return this._result.write(this._pushPch, 0x0100 + this._state.s, this._state.p >>> 8);\n };\n\n @Immutable\n private _pushPch = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s - 1) & 0xff;\n\n return this._result.write(this._pushPcl, 0x0100 + this._state.s, this._state.p & 0xff).poll(true);\n };\n\n @Immutable\n private _pushPcl = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s - 1) & 0xff;\n this._vector = this._state.nmi ? 0xfffa : this._defaultVector;\n\n return this._result.write(\n this._pushFlags,\n 0x0100 + this._state.s,\n this._isBrk ? this._state.flags | CpuInterface.Flags.b : this._state.flags & ~CpuInterface.Flags.b\n );\n };\n\n @Immutable\n private _pushFlags = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s - 1) & 0xff;\n\n return this._result.read(this._fetchPcl, this._vector);\n };\n\n @Immutable\n private _fetchPcl = (value: number): StateMachineInterface.Result => {\n this._state.flags |= CpuInterface.Flags.i;\n this._state.p = value;\n\n return this._result.read(this._fetchPch, ++this._vector);\n };\n\n @Immutable\n private _fetchPch = (value: number): null => {\n this._state.p = this._state.p | (value << 8);\n this._state.nmi = this._state.irq = false;\n\n return null;\n };\n\n private _vector = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _defaultVector: number;\n @Immutable private readonly _isBrk: boolean;\n}\n\nexport const brk = (state: CpuInterface.State) => new Interrupt(state, 0xfffe, true);\nexport const irq = (state: CpuInterface.State) => new Interrupt(state, 0xfffe, false);\nexport const nmi = (state: CpuInterface.State) => new Interrupt(state, 0xfffa, false);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass Instruction {\n constructor(\n public readonly operation: Instruction.Operation,\n public readonly addressingMode: Instruction.AddressingMode,\n public readonly effectiveAddressingMode = addressingMode\n ) {}\n\n getSize(): number {\n switch (this.effectiveAddressingMode) {\n case Instruction.AddressingMode.immediate:\n case Instruction.AddressingMode.zeroPage:\n case Instruction.AddressingMode.zeroPageX:\n case Instruction.AddressingMode.zeroPageY:\n case Instruction.AddressingMode.indexedIndirectX:\n case Instruction.AddressingMode.indirectIndexedY:\n case Instruction.AddressingMode.relative:\n return 2;\n\n case Instruction.AddressingMode.absolute:\n case Instruction.AddressingMode.absoluteX:\n case Instruction.AddressingMode.absoluteY:\n case Instruction.AddressingMode.indirect:\n return 3;\n\n default:\n return 1;\n }\n }\n}\n\nnamespace Instruction {\n export const enum Operation {\n adc,\n and,\n asl,\n bcc,\n bcs,\n beq,\n bit,\n bmi,\n bne,\n bpl,\n brk,\n bvc,\n bvs,\n clc,\n cld,\n cli,\n clv,\n cmp,\n cpx,\n cpy,\n dec,\n dex,\n dey,\n eor,\n inc,\n inx,\n iny,\n jmp,\n jsr,\n lda,\n ldx,\n ldy,\n lsr,\n nop,\n ora,\n pha,\n php,\n pla,\n plp,\n rol,\n ror,\n rti,\n rts,\n sbc,\n sec,\n sed,\n sei,\n sta,\n stx,\n sty,\n tax,\n tay,\n tsx,\n txa,\n txs,\n tya,\n // undocumented operations\n dop,\n top,\n alr,\n axs,\n dcp,\n lax,\n arr,\n slo,\n aax,\n lar,\n isc,\n aac,\n atx,\n rra,\n rla,\n invalid\n }\n\n export enum OperationMap {\n adc,\n and,\n asl,\n bcc,\n bcs,\n beq,\n bit,\n bmi,\n bne,\n bpl,\n brk,\n bvc,\n bvs,\n clc,\n cld,\n cli,\n clv,\n cmp,\n cpx,\n cpy,\n dec,\n dex,\n dey,\n eor,\n inc,\n inx,\n iny,\n jmp,\n jsr,\n lda,\n ldx,\n ldy,\n lsr,\n nop,\n ora,\n pha,\n php,\n pla,\n plp,\n rol,\n ror,\n rti,\n rts,\n sbc,\n sec,\n sed,\n sei,\n sta,\n stx,\n sty,\n tax,\n tay,\n tsx,\n txa,\n txs,\n tya,\n // undocumented operations\n dop,\n top,\n alr,\n axs,\n dcp,\n lax,\n arr,\n slo,\n aax,\n lar,\n isc,\n aac,\n atx,\n rra,\n rla,\n invalid\n }\n\n export const enum AddressingMode {\n implied,\n immediate,\n zeroPage,\n absolute,\n indirect,\n relative,\n zeroPageX,\n absoluteX,\n indexedIndirectX,\n zeroPageY,\n absoluteY,\n indirectIndexedY,\n invalid\n }\n\n export const opcodes = new Array<Instruction>(256);\n}\n\nexport { Instruction as default };\n\n// Opcodes init\n\nnamespace Instruction {\n export namespace __init {\n for (let i = 0; i < 256; i++) {\n opcodes[i] = new Instruction(Operation.invalid, AddressingMode.invalid);\n }\n\n let operation: Operation, addressingMode: AddressingMode, opcode: number;\n\n for (let i = 0; i < 8; i++) {\n switch (i) {\n case 0:\n operation = Operation.ora;\n break;\n case 1:\n operation = Operation.and;\n break;\n case 2:\n operation = Operation.eor;\n break;\n case 3:\n operation = Operation.adc;\n break;\n case 4:\n operation = Operation.sta;\n break;\n case 5:\n operation = Operation.lda;\n break;\n case 6:\n operation = Operation.cmp;\n break;\n case 7:\n operation = Operation.sbc;\n break;\n }\n for (let j = 0; j < 8; j++) {\n switch (j) {\n case 0:\n addressingMode = AddressingMode.indexedIndirectX;\n break;\n case 1:\n addressingMode = AddressingMode.zeroPage;\n break;\n case 2:\n addressingMode = AddressingMode.immediate;\n break;\n case 3:\n addressingMode = AddressingMode.absolute;\n break;\n case 4:\n addressingMode = AddressingMode.indirectIndexedY;\n break;\n case 5:\n addressingMode = AddressingMode.zeroPageX;\n break;\n case 6:\n addressingMode = AddressingMode.absoluteY;\n break;\n case 7:\n addressingMode = AddressingMode.absoluteX;\n break;\n }\n\n if (operation === Operation.sta && addressingMode === AddressingMode.immediate) {\n addressingMode = AddressingMode.invalid;\n }\n\n if (operation !== Operation.invalid && addressingMode !== AddressingMode.invalid) {\n opcode = (i << 5) | (j << 2) | 1;\n opcodes[opcode] = new Instruction(operation, addressingMode);\n }\n }\n }\n\n function set(\n _opcode: number,\n _operation: Operation,\n _addressingMode: AddressingMode,\n _effectiveAdressingMode?: AddressingMode\n ): void {\n if (opcodes[_opcode].operation !== Operation.invalid) {\n throw new Error('entry for opcode ' + _opcode + ' already exists');\n }\n\n opcodes[_opcode] = new Instruction(_operation, _addressingMode, _effectiveAdressingMode);\n }\n\n set(0x06, Operation.asl, AddressingMode.zeroPage);\n set(0x0a, Operation.asl, AddressingMode.implied);\n set(0x0e, Operation.asl, AddressingMode.absolute);\n set(0x16, Operation.asl, AddressingMode.zeroPageX);\n set(0x1e, Operation.asl, AddressingMode.absoluteX);\n\n set(0x26, Operation.rol, AddressingMode.zeroPage);\n set(0x2a, Operation.rol, AddressingMode.implied);\n set(0x2e, Operation.rol, AddressingMode.absolute);\n set(0x36, Operation.rol, AddressingMode.zeroPageX);\n set(0x3e, Operation.rol, AddressingMode.absoluteX);\n\n set(0x46, Operation.lsr, AddressingMode.zeroPage);\n set(0x4a, Operation.lsr, AddressingMode.implied);\n set(0x4e, Operation.lsr, AddressingMode.absolute);\n set(0x56, Operation.lsr, AddressingMode.zeroPageX);\n set(0x5e, Operation.lsr, AddressingMode.absoluteX);\n\n set(0x66, Operation.ror, AddressingMode.zeroPage);\n set(0x6a, Operation.ror, AddressingMode.implied);\n set(0x6e, Operation.ror, AddressingMode.absolute);\n set(0x76, Operation.ror, AddressingMode.zeroPageX);\n set(0x7e, Operation.ror, AddressingMode.absoluteX);\n\n set(0x86, Operation.stx, AddressingMode.zeroPage);\n set(0x8e, Operation.stx, AddressingMode.absolute);\n set(0x96, Operation.stx, AddressingMode.zeroPageY);\n\n set(0xa2, Operation.ldx, AddressingMode.immediate);\n set(0xa6, Operation.ldx, AddressingMode.zeroPage);\n set(0xae, Operation.ldx, AddressingMode.absolute);\n set(0xb6, Operation.ldx, AddressingMode.zeroPageY);\n set(0xbe, Operation.ldx, AddressingMode.absoluteY);\n\n set(0xc6, Operation.dec, AddressingMode.zeroPage);\n set(0xce, Operation.dec, AddressingMode.absolute);\n set(0xd6, Operation.dec, AddressingMode.zeroPageX);\n set(0xde, Operation.dec, AddressingMode.absoluteX);\n\n set(0xe6, Operation.inc, AddressingMode.zeroPage);\n set(0xee, Operation.inc, AddressingMode.absolute);\n set(0xf6, Operation.inc, AddressingMode.zeroPageX);\n set(0xfe, Operation.inc, AddressingMode.absoluteX);\n\n set(0x24, Operation.bit, AddressingMode.zeroPage);\n set(0x2c, Operation.bit, AddressingMode.absolute);\n\n set(0x4c, Operation.jmp, AddressingMode.absolute);\n set(0x6c, Operation.jmp, AddressingMode.indirect);\n\n set(0x84, Operation.sty, AddressingMode.zeroPage);\n set(0x8c, Operation.sty, AddressingMode.absolute);\n set(0x94, Operation.sty, AddressingMode.zeroPageX);\n\n set(0xa0, Operation.ldy, AddressingMode.immediate);\n set(0xa4, Operation.ldy, AddressingMode.zeroPage);\n set(0xac, Operation.ldy, AddressingMode.absolute);\n set(0xb4, Operation.ldy, AddressingMode.zeroPageX);\n set(0xbc, Operation.ldy, AddressingMode.absoluteX);\n\n set(0xc0, Operation.cpy, AddressingMode.immediate);\n set(0xc4, Operation.cpy, AddressingMode.zeroPage);\n set(0xcc, Operation.cpy, AddressingMode.absolute);\n\n set(0xe0, Operation.cpx, AddressingMode.immediate);\n set(0xe4, Operation.cpx, AddressingMode.zeroPage);\n set(0xec, Operation.cpx, AddressingMode.absolute);\n\n set(0x10, Operation.bpl, AddressingMode.relative);\n set(0x30, Operation.bmi, AddressingMode.relative);\n set(0x50, Operation.bvc, AddressingMode.relative);\n set(0x70, Operation.bvs, AddressingMode.relative);\n set(0x90, Operation.bcc, AddressingMode.relative);\n set(0xb0, Operation.bcs, AddressingMode.relative);\n set(0xd0, Operation.bne, AddressingMode.relative);\n set(0xf0, Operation.beq, AddressingMode.relative);\n\n set(0x00, Operation.brk, AddressingMode.implied);\n set(0x20, Operation.jsr, AddressingMode.implied, AddressingMode.absolute);\n set(0x40, Operation.rti, AddressingMode.implied);\n set(0x60, Operation.rts, AddressingMode.implied);\n set(0x08, Operation.php, AddressingMode.implied);\n set(0x28, Operation.plp, AddressingMode.implied);\n set(0x48, Operation.pha, AddressingMode.implied);\n set(0x68, Operation.pla, AddressingMode.implied);\n set(0x88, Operation.dey, AddressingMode.implied);\n set(0xa8, Operation.tay, AddressingMode.implied);\n set(0xc8, Operation.iny, AddressingMode.implied);\n set(0xe8, Operation.inx, AddressingMode.implied);\n set(0x18, Operation.clc, AddressingMode.implied);\n set(0x38, Operation.sec, AddressingMode.implied);\n set(0x58, Operation.cli, AddressingMode.implied);\n set(0x78, Operation.sei, AddressingMode.implied);\n set(0x98, Operation.tya, AddressingMode.implied);\n set(0xb8, Operation.clv, AddressingMode.implied);\n set(0xd8, Operation.cld, AddressingMode.implied);\n set(0xf8, Operation.sed, AddressingMode.implied);\n set(0x8a, Operation.txa, AddressingMode.implied);\n set(0x9a, Operation.txs, AddressingMode.implied);\n set(0xaa, Operation.tax, AddressingMode.implied);\n set(0xba, Operation.tsx, AddressingMode.implied);\n set(0xca, Operation.dex, AddressingMode.implied);\n set(0xea, Operation.nop, AddressingMode.implied);\n\n // instructions for undocumented opcodes\n set(0x1a, Operation.nop, AddressingMode.implied);\n set(0x3a, Operation.nop, AddressingMode.implied);\n set(0x5a, Operation.nop, AddressingMode.implied);\n set(0x7a, Operation.nop, AddressingMode.implied);\n set(0xda, Operation.nop, AddressingMode.implied);\n set(0xfa, Operation.nop, AddressingMode.implied);\n\n set(0x04, Operation.dop, AddressingMode.zeroPage);\n set(0x14, Operation.dop, AddressingMode.zeroPageX);\n set(0x34, Operation.dop, AddressingMode.zeroPageX);\n set(0x44, Operation.dop, AddressingMode.zeroPage);\n set(0x54, Operation.dop, AddressingMode.zeroPageX);\n set(0x64, Operation.dop, AddressingMode.zeroPage);\n set(0x74, Operation.dop, AddressingMode.zeroPageX);\n set(0x80, Operation.dop, AddressingMode.immediate);\n set(0x82, Operation.dop, AddressingMode.immediate);\n set(0x89, Operation.dop, AddressingMode.immediate);\n set(0xc2, Operation.dop, AddressingMode.immediate);\n set(0xd4, Operation.dop, AddressingMode.zeroPageX);\n set(0xe2, Operation.dop, AddressingMode.immediate);\n set(0xf4, Operation.dop, AddressingMode.zeroPageX);\n\n set(0x0c, Operation.top, AddressingMode.absolute);\n set(0x1c, Operation.top, AddressingMode.absoluteX);\n set(0x3c, Operation.top, AddressingMode.absoluteX);\n set(0x5c, Operation.top, AddressingMode.absoluteX);\n set(0x7c, Operation.top, AddressingMode.absoluteX);\n set(0xdc, Operation.top, AddressingMode.absoluteX);\n set(0xfc, Operation.top, AddressingMode.absoluteX);\n\n set(0xeb, Operation.sbc, AddressingMode.immediate);\n\n set(0x4b, Operation.alr, AddressingMode.immediate);\n\n set(0xcb, Operation.axs, AddressingMode.immediate);\n\n set(0xc7, Operation.dcp, AddressingMode.zeroPage);\n set(0xd7, Operation.dcp, AddressingMode.zeroPageX);\n set(0xcf, Operation.dcp, AddressingMode.absolute);\n set(0xdf, Operation.dcp, AddressingMode.absoluteX);\n set(0xdb, Operation.dcp, AddressingMode.absoluteY);\n set(0xc3, Operation.dcp, AddressingMode.indexedIndirectX);\n set(0xd3, Operation.dcp, AddressingMode.indirectIndexedY);\n\n set(0xa7, Operation.lax, AddressingMode.zeroPage);\n set(0xb7, Operation.lax, AddressingMode.zeroPageY);\n set(0xaf, Operation.lax, AddressingMode.absolute);\n set(0xbf, Operation.lax, AddressingMode.absoluteY);\n set(0xa3, Operation.lax, AddressingMode.indexedIndirectX);\n set(0xb3, Operation.lax, AddressingMode.indirectIndexedY);\n\n set(0x6b, Operation.arr, AddressingMode.immediate);\n\n set(0x07, Operation.slo, AddressingMode.zeroPage);\n set(0x17, Operation.slo, AddressingMode.zeroPageX);\n set(0x0f, Operation.slo, AddressingMode.absolute);\n set(0x1f, Operation.slo, AddressingMode.absoluteX);\n set(0x1b, Operation.slo, AddressingMode.absoluteY);\n set(0x03, Operation.slo, AddressingMode.indexedIndirectX);\n set(0x13, Operation.slo, AddressingMode.indirectIndexedY);\n\n set(0x87, Operation.aax, AddressingMode.zeroPage);\n set(0x97, Operation.aax, AddressingMode.zeroPageY);\n set(0x83, Operation.aax, AddressingMode.indexedIndirectX);\n set(0x8f, Operation.aax, AddressingMode.absolute);\n\n set(0xbb, Operation.lar, AddressingMode.absoluteY);\n\n set(0xe7, Operation.isc, AddressingMode.zeroPage);\n set(0xf7, Operation.isc, AddressingMode.zeroPageX);\n set(0xef, Operation.isc, AddressingMode.absolute);\n set(0xff, Operation.isc, AddressingMode.absoluteX);\n set(0xfb, Operation.isc, AddressingMode.absoluteY);\n set(0xe3, Operation.isc, AddressingMode.indexedIndirectX);\n set(0xf3, Operation.isc, AddressingMode.indirectIndexedY);\n\n set(0x0b, Operation.aac, AddressingMode.immediate);\n set(0x2b, Operation.aac, AddressingMode.immediate);\n\n set(0xab, Operation.atx, AddressingMode.immediate);\n\n set(0x67, Operation.rra, AddressingMode.zeroPage);\n set(0x77, Operation.rra, AddressingMode.zeroPageX);\n set(0x6f, Operation.rra, AddressingMode.absolute);\n set(0x7f, Operation.rra, AddressingMode.absoluteX);\n set(0x7b, Operation.rra, AddressingMode.absoluteY);\n set(0x63, Operation.rra, AddressingMode.indexedIndirectX);\n set(0x73, Operation.rra, AddressingMode.indirectIndexedY);\n\n set(0x27, Operation.rla, AddressingMode.zeroPage);\n set(0x37, Operation.rla, AddressingMode.zeroPageX);\n set(0x2f, Operation.rla, AddressingMode.absolute);\n set(0x3f, Operation.rla, AddressingMode.absoluteX);\n set(0x3b, Operation.rla, AddressingMode.absoluteY);\n set(0x23, Operation.rla, AddressingMode.indexedIndirectX);\n set(0x33, Operation.rla, AddressingMode.indirectIndexedY);\n }\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass Absolute implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._state = state;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchLo, this._state.p);\n\n @Immutable\n private _fetchLo = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._fetchHi, this._state.p);\n };\n\n @Immutable\n private _fetchHi = (value: number): StateMachineInterface.Result | null => {\n this._operand |= value << 8;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const absolute = (state: CpuInterface.State, next: NextStep) => new Absolute(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\n\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass AbsoluteIndexed implements StateMachineInterface {\n private constructor(\n state: CpuInterface.State,\n indexExtractor: AbsoluteIndexed.IndexExtractor,\n next: NextStep = () => null,\n writeOp = false\n ) {\n this._state = state;\n this._indexExtractor = indexExtractor;\n this._next = next;\n this._writeOp = writeOp;\n\n freezeImmutables(this);\n }\n\n @Immutable\n static absoluteX(state: CpuInterface.State, next: NextStep, writeOp: boolean): AbsoluteIndexed {\n return new AbsoluteIndexed(state, s => s.x, next, writeOp);\n }\n\n @Immutable\n static absoluteY(state: CpuInterface.State, next: NextStep, writeOp: boolean): AbsoluteIndexed {\n return new AbsoluteIndexed(state, s => s.y, next, writeOp);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchLo, this._state.p);\n\n @Immutable\n private _fetchLo = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._fetchHi, this._state.p);\n };\n\n @Immutable\n private _fetchHi = (value: number): StateMachineInterface.Result | null => {\n this._operand |= value << 8;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n const index = this._indexExtractor(this._state);\n this._carry = (this._operand & 0xff) + index > 0xff;\n this._operand = (this._operand & 0xff00) | ((this._operand + index) & 0xff);\n\n return this._carry || this._writeOp\n ? this._result.read(this._dereferenceAndCarry, this._operand)\n : this._next(this._operand, this._state);\n };\n\n @Immutable\n private _dereferenceAndCarry = (value: number): StateMachineInterface.Result | null => {\n if (this._carry) {\n this._operand = (this._operand + 0x0100) & 0xffff;\n }\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n private _carry = false;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _indexExtractor: AbsoluteIndexed.IndexExtractor;\n @Immutable private readonly _next: NextStep;\n @Immutable private readonly _writeOp: boolean;\n}\n\nnamespace AbsoluteIndexed {\n export interface IndexExtractor {\n (s: CpuInterface.State): number;\n }\n}\n\nexport const absoluteX = (state: CpuInterface.State, next: NextStep, writeOp: boolean) =>\n AbsoluteIndexed.absoluteX(state, next, writeOp);\n\nexport const absoluteY = (state: CpuInterface.State, next: NextStep, writeOp: boolean) =>\n AbsoluteIndexed.absoluteY(state, next, writeOp);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\nimport CpuInterface from '../../CpuInterface';\n\nclass Dereference implements StateMachineInterface<number> {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._next = next;\n this._state = state;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (operand: number): StateMachineInterface.Result => this._result.read(this._dereference, operand);\n\n @Immutable\n private _dereference = (value: number): StateMachineInterface.Result | null => this._next(value, this._state);\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const dereference = (state: CpuInterface.State, next: NextStep) => new Dereference(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport StateMachineInterface from '../StateMachineInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass Immediate implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._state = state;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchOperand, this._state.p);\n\n @Immutable\n private _fetchOperand = (value: number): StateMachineInterface.Result | null => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const immediate = (state: CpuInterface.State, next: NextStep) => new Immediate(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass IndexedIndirectX implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._state = state;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchAddress, this._state.p);\n\n @Immutable\n private _fetchAddress = (value: number): StateMachineInterface.Result => {\n this._address = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._addIndex, this._address);\n };\n\n @Immutable\n private _addIndex = (value: number): StateMachineInterface.Result => {\n this._address = (this._address + this._state.x) & 0xff;\n\n return this._result.read(this._fetchLo, this._address);\n };\n\n @Immutable\n private _fetchLo = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n this._address = (this._address + 1) & 0xff;\n\n return this._result.read(this._fetchHi, this._address);\n };\n\n @Immutable\n private _fetchHi = (value: number): StateMachineInterface.Result | null => {\n this._operand |= value << 8;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n private _address = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const indexedIndirectX = (state: CpuInterface.State, next: NextStep) => new IndexedIndirectX(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass IndexedIndirectY implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null, writeOp: boolean) {\n this._state = state;\n this._next = next;\n this._writeOp = writeOp;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchAddress, this._state.p);\n\n @Immutable\n private _fetchAddress = (value: number): StateMachineInterface.Result => {\n this._address = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._fetchLo, this._address);\n };\n\n @Immutable\n private _fetchLo = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n this._address = (this._address + 1) & 0xff;\n\n return this._result.read(this._fetchHi, this._address);\n };\n\n @Immutable\n private _fetchHi = (value: number): StateMachineInterface.Result | null => {\n this._operand |= value << 8;\n\n this._carry = (this._operand & 0xff) + this._state.y > 0xff;\n this._operand = (this._operand & 0xff00) | ((this._operand + this._state.y) & 0xff);\n\n return this._carry || this._writeOp\n ? this._result.read(this._dereferenceAndCarry, this._operand)\n : this._next(this._operand, this._state);\n };\n\n @Immutable\n private _dereferenceAndCarry = (value: number): StateMachineInterface.Result | null => {\n if (this._carry) {\n this._operand = (this._operand + 0x0100) & 0xffff;\n }\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n private _address = 0;\n private _carry = false;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n @Immutable private readonly _writeOp: boolean;\n}\n\nexport const indirectIndexedY = (state: CpuInterface.State, next: NextStep, writeOp: boolean) =>\n new IndexedIndirectY(state, next, writeOp);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass ZeroPage implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._state = state;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchAddress, this._state.p);\n\n @Immutable\n private _fetchAddress = (value: number): StateMachineInterface.Result | null => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const zeroPage = (state: CpuInterface.State, next: NextStep) => new ZeroPage(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass ZeroPageIndexed implements StateMachineInterface {\n private constructor(state: CpuInterface.State, indexExtractor: ZeroPageIndexed.IndexExtractor, next: NextStep) {\n this._state = state;\n this._indexExtractor = indexExtractor;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n static zeroPageX(state: CpuInterface.State, next: NextStep = () => null): ZeroPageIndexed {\n return new ZeroPageIndexed(state, s => s.x, next);\n }\n\n static zeroPageY(state: CpuInterface.State, next: NextStep = () => null): ZeroPageIndexed {\n return new ZeroPageIndexed(state, s => s.y, next);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchAddress, this._state.p);\n\n @Immutable\n private _fetchAddress = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._addIndex, this._operand);\n };\n\n @Immutable\n private _addIndex = (value: number): StateMachineInterface.Result | null => {\n this._operand = (this._operand + this._indexExtractor(this._state)) & 0xff;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n @Immutable private readonly _indexExtractor: ZeroPageIndexed.IndexExtractor;\n}\n\nnamespace ZeroPageIndexed {\n export interface IndexExtractor {\n (s: CpuInterface.State): number;\n }\n}\n\nexport const zeroPageX = (state: CpuInterface.State, next: NextStep) => ZeroPageIndexed.zeroPageX(state, next);\n\nexport const zeroPageY = (state: CpuInterface.State, next: NextStep) => ZeroPageIndexed.zeroPageY(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Branch implements StateMachineInterface {\n constructor(state: CpuInterface.State, predicate: Branch.Predicate) {\n this._state = state;\n this._predicate = predicate;\n\n freezeImmutables(this);\n }\n\n @Immutable\n reset = (): StateMachineInterface.Result => this._result.read(this._fetchTarget, this._state.p).poll(true);\n\n @Immutable\n private _fetchTarget = (value: number): StateMachineInterface.Result | null => {\n this._operand = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._predicate(this._state.flags) ? this._result.read(this._firstDummyRead, this._state.p) : null;\n };\n\n @Immutable\n private _firstDummyRead = (value: number): StateMachineInterface.Result | null => {\n this._target = (this._state.p + (this._operand & 0x80 ? this._operand - 256 : this._operand)) & 0xffff;\n\n if ((this._target & 0xff00) === (this._state.p & 0xff00)) {\n this._state.p = this._target;\n return null;\n }\n\n return this._result.read(this._secondDummyRead, (this._state.p & 0xff00) | (this._target & 0x00ff)).poll(true);\n };\n\n @Immutable\n private _secondDummyRead = (value: number): null => {\n this._state.p = this._target;\n return null;\n };\n\n private _target = 0;\n private _operand = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _predicate: Branch.Predicate;\n}\n\nnamespace Branch {\n export interface Predicate {\n (flags: number): boolean;\n }\n}\n\nexport const branch = (state: CpuInterface.State, predicate: Branch.Predicate) => new Branch(state, predicate);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Jsr implements StateMachineInterface {\n constructor(state: CpuInterface.State) {\n this._state = state;\n\n freezeImmutables(this);\n }\n\n reset = (): StateMachineInterface.Result => this._result.read(this._fetchPcl, this._state.p);\n\n @Immutable\n private _fetchPcl = (value: number): StateMachineInterface.Result => {\n this._addressLo = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._dummyStackRead, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _dummyStackRead = (): StateMachineInterface.Result =>\n this._result.write(this._pushPch, 0x0100 + this._state.s, this._state.p >>> 8);\n\n @Immutable\n private _pushPch = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s - 1) & 0xff;\n\n return this._result.write(this._pushPcl, 0x0100 + this._state.s, this._state.p & 0xff);\n };\n\n @Immutable\n private _pushPcl = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s - 1) & 0xff;\n\n return this._result.read(this._fetchPch, this._state.p);\n };\n\n @Immutable\n private _fetchPch = (value: number): null => {\n this._state.p = this._addressLo | (value << 8);\n\n return null;\n };\n\n private _addressLo = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n}\n\nexport const jsr = (state: CpuInterface.State) => new Jsr(state);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass ReadModifyWrite implements StateMachineInterface<number> {\n constructor(state: CpuInterface.State, operation: ReadModifyWrite.Operation) {\n this._state = state;\n this._operation = operation;\n\n freezeImmutables(this);\n }\n\n @Immutable\n reset = (address: number): StateMachineInterface.Result => {\n this._address = address;\n\n return this._result.read(this._read, address);\n };\n\n @Immutable\n private _read = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n\n return this._result.write(this._dummyWrite, this._address, this._operand);\n };\n\n @Immutable\n private _dummyWrite = (value: number): StateMachineInterface.Result =>\n this._result.write(this._write, this._address, this._operation(this._operand, this._state));\n\n @Immutable private _write = (): null => null;\n\n private _address: number;\n private _operand: number;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _operation: ReadModifyWrite.Operation;\n}\n\nnamespace ReadModifyWrite {\n export interface Operation {\n (o: number, s: CpuInterface.State): number;\n }\n}\n\nexport const readModifyWrite = (state: CpuInterface.State, operation: ReadModifyWrite.Operation) =>\n new ReadModifyWrite(state, operation);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Rts implements StateMachineInterface {\n constructor(state: CpuInterface.State) {\n this._state = state;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._dummyOperandRead, this._state.p);\n\n @Immutable\n private _dummyOperandRead = (): StateMachineInterface.Result =>\n this._result.read(this._dummyStackRead, 0x0100 + this._state.s);\n\n @Immutable\n private _dummyStackRead = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._popPcl, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _popPcl = (value: number): StateMachineInterface.Result => {\n this._state.p = (this._state.p & 0xff00) | value;\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._popPch, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _popPch = (value: number): StateMachineInterface.Result => {\n this._state.p = (this._state.p & 0xff) | (value << 8);\n\n return this._result.read(this._incrementP, this._state.p);\n };\n\n @Immutable\n private _incrementP = (): null => {\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return null;\n };\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n}\n\nexport const rts = (state: CpuInterface.State) => new Rts(state);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass NullaryOneCycle implements StateMachineInterface<number> {\n constructor(state: CpuInterface.State, operation: UnaryOneCycle.Operation) {\n this._state = state;\n this._operation = operation;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = () => this._result.read(this._executeOperation, this._state.p).poll(true);\n\n @Immutable\n private _executeOperation = (): null => {\n this._operation(this._state);\n\n return null;\n };\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _operation: UnaryOneCycle.Operation;\n}\n\nnamespace UnaryOneCycle {\n export interface Operation {\n (s: CpuInterface.State): void;\n }\n}\n\nexport const nullaryOneCycle = (state: CpuInterface.State, operation: UnaryOneCycle.Operation) =>\n new NullaryOneCycle(state, operation);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport StateMachineInterface from '../StateMachineInterface';\nimport ResultImpl from '../ResultImpl';\nimport CpuInterface from '../../CpuInterface';\n\nclass Pull implements StateMachineInterface {\n constructor(state: CpuInterface.State, operation: Pull.Operation) {\n this._state = state;\n this._operation = operation;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._dummyRead, this._state.p).poll(true);\n\n @Immutable\n private _dummyRead = (): StateMachineInterface.Result =>\n this._result.read(this._incrementS, 0x0100 + this._state.s);\n\n @Immutable\n private _incrementS = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._pull, 0x0100 + this._state.s);\n };\n\n @Immutable private _pull = (value: number): null => (this._operation(this._state, value), null);\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _operation: Pull.Operation;\n}\n\nnamespace Pull {\n export interface Operation {\n (state: CpuInterface.State, ooperand: number): void;\n }\n}\n\nexport const pull = (state: CpuInterface.State, operation: Pull.Operation) => new Pull(state, operation);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport CpuInterface from '../../CpuInterface';\nimport StateMachineInterface from '../StateMachineInterface';\nimport ResultImpl from '../ResultImpl';\n\nclass Push implements StateMachineInterface {\n constructor(state: CpuInterface.State, operation: Push.Operation) {\n this._state = state;\n this._operation = operation;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._dummyRead, this._state.p);\n\n @Immutable\n private _dummyRead = (): StateMachineInterface.Result =>\n this._result.write(this._push, 0x0100 + this._state.s, this._operation(this._state));\n\n @Immutable\n private _push = (): null => {\n this._state.s = (this._state.s - 1) & 0xff;\n\n return null;\n };\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _operation: Push.Operation;\n}\n\nnamespace Push {\n export interface Operation {\n (s: CpuInterface.State): number;\n }\n}\n\nexport const push = (state: CpuInterface.State, operation: Push.Operation) => new Push(state, operation);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Rti implements StateMachineInterface {\n constructor(state: CpuInterface.State) {\n this._state = state;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._dummyOperandRead, this._state.p);\n\n @Immutable\n private _dummyOperandRead = (): StateMachineInterface.Result =>\n this._result.read(this._dummyStackRead, 0x0100 + this._state.s);\n\n @Immutable\n private _dummyStackRead = (): StateMachineInterface.Result => {\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._popP, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _popP = (value: number): StateMachineInterface.Result => {\n this._state.flags = (value | CpuInterface.Flags.e) & ~CpuInterface.Flags.b;\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._popPcl, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _popPcl = (value: number): StateMachineInterface.Result => {\n this._state.p = (this._state.p & 0xff00) | value;\n this._state.s = (this._state.s + 1) & 0xff;\n\n return this._result.read(this._popPch, 0x0100 + this._state.s);\n };\n\n @Immutable\n private _popPch = (value: number): null => {\n this._state.p = (this._state.p & 0xff) | (value << 8);\n\n return null;\n };\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n}\n\nexport const rti = (state: CpuInterface.State) => new Rti(state);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport StateMachineInterface from '../StateMachineInterface';\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\n\nclass Write implements StateMachineInterface<number> {\n constructor(state: CpuInterface.State, operation: Write.Operation) {\n this._state = state;\n this._operation = operation;\n\n freezeImmutables(this);\n }\n\n @Immutable\n reset = (operand: number): StateMachineInterface.Result =>\n this._result.write(() => null, operand, this._operation(this._state));\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _operation: Write.Operation;\n}\n\nnamespace Write {\n export interface Operation {\n (s: CpuInterface.State): number;\n }\n}\n\nexport const write = (state: CpuInterface.State, operation: Write.Operation) => new Write(state, operation);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../CpuInterface';\n\nfunction setFlagsNZ(operand: number, state: CpuInterface.State): void {\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z)) |\n (operand & 0x80) |\n (operand ? 0 : CpuInterface.Flags.z);\n}\n\nexport function genRmw(operand: number, state: CpuInterface.State, operation: (x: number) => number): number {\n const result = operation(operand);\n setFlagsNZ(result, state);\n\n return result;\n}\n\nexport function genNullary(state: CpuInterface.State, operation: (state: CpuInterface.State) => number): void {\n setFlagsNZ(operation(state), state);\n}\n\nexport function genUnary(\n operand: number,\n state: CpuInterface.State,\n operation: (operand: number, state: CpuInterface.State) => number\n): null {\n setFlagsNZ(operation(operand, state), state);\n\n return null;\n}\n\nexport function adc(operand: number, state: CpuInterface.State): null {\n if (state.flags & CpuInterface.Flags.d) {\n const d0 = (operand & 0x0f) + (state.a & 0x0f) + (state.flags & CpuInterface.Flags.c),\n d1 = (operand >>> 4) + (state.a >>> 4) + (d0 > 9 ? 1 : 0);\n\n state.a = d0 % 10 | (d1 % 10 << 4);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) | // negative\n (state.a ? 0 : CpuInterface.Flags.z) | // zero\n (d1 > 9 ? CpuInterface.Flags.c : 0); // carry\n } else {\n const sum = state.a + operand + (state.flags & CpuInterface.Flags.c),\n result = sum & 0xff;\n\n state.flags =\n (state.flags &\n ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c | CpuInterface.Flags.v)) |\n (result & 0x80) | // negative\n (result ? 0 : CpuInterface.Flags.z) | // zero\n (sum >>> 8) | // carry\n ((~(operand ^ state.a) & (result ^ operand) & 0x80) >>> 1); // overflow\n\n state.a = result;\n }\n\n return null;\n}\n\nexport function aslImmediate(state: CpuInterface.State): void {\n const old = state.a;\n state.a = (state.a << 1) & 0xff;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function aslRmw(operand: number, state: CpuInterface.State): number {\n const result = (operand << 1) & 0xff;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (result & 0x80) |\n (result ? 0 : CpuInterface.Flags.z) |\n (operand >>> 7);\n\n return result;\n}\n\nexport function bit(operand: number, state: CpuInterface.State): null {\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.v | CpuInterface.Flags.z)) |\n (operand & (CpuInterface.Flags.n | CpuInterface.Flags.v)) |\n (operand & state.a ? 0 : CpuInterface.Flags.z);\n\n return null;\n}\n\nexport function cmp(\n operand: number,\n state: CpuInterface.State,\n getRegister: (state: CpuInterface.State) => number\n): void {\n const diff = getRegister(state) + (~operand & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n}\n\nexport function sbc(operand: number, state: CpuInterface.State): null {\n if (state.flags & CpuInterface.Flags.d) {\n const d0 = (state.a & 0x0f) - (operand & 0x0f) - (~state.flags & CpuInterface.Flags.c),\n d1 = (state.a >>> 4) - (operand >>> 4) - (d0 < 0 ? 1 : 0);\n\n state.a = (d0 < 0 ? 10 + d0 : d0) | ((d1 < 0 ? 10 + d1 : d1) << 4);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) | // negative\n (state.a ? 0 : CpuInterface.Flags.z) | // zero\n (d1 < 0 ? 0 : CpuInterface.Flags.c); // carry / borrow\n } else {\n operand = ~operand & 0xff;\n\n const sum = state.a + operand + (state.flags & CpuInterface.Flags.c),\n result = sum & 0xff;\n\n state.flags =\n (state.flags &\n ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c | CpuInterface.Flags.v)) |\n (result & 0x80) | // negative\n (result ? 0 : CpuInterface.Flags.z) | // zero\n (sum >>> 8) | // carry / borrow\n ((~(operand ^ state.a) & (result ^ operand) & 0x80) >>> 1); // overflow\n\n state.a = result;\n }\n\n return null;\n}\n\nexport function lsrImmediate(state: CpuInterface.State): void {\n const old = state.a;\n state.a = state.a >>> 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function lsrRmw(operand: number, state: CpuInterface.State): number {\n const result = operand >>> 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (result & 0x80) |\n (result ? 0 : CpuInterface.Flags.z) |\n (operand & CpuInterface.Flags.c);\n\n return result;\n}\n\nexport function rolImmediate(state: CpuInterface.State): void {\n const old = state.a;\n state.a = ((state.a << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function rolRmw(operand: number, state: CpuInterface.State): number {\n const result = ((operand << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (result & 0x80) |\n (result ? 0 : CpuInterface.Flags.z) |\n (operand >>> 7);\n\n return result;\n}\n\nexport function rorImmediate(state: CpuInterface.State): void {\n const old = state.a;\n state.a = (state.a >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function rorRmw(operand: number, state: CpuInterface.State): number {\n const result = (operand >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (result & 0x80) |\n (result ? 0 : CpuInterface.Flags.z) |\n (operand & CpuInterface.Flags.c);\n\n return result;\n}\n\n// Undocumented opcodes\n\nexport function arr(operand: number, state: CpuInterface.State): void {\n state.a = ((state.a & operand) >>> 1) | (state.flags & CpuInterface.Flags.c ? 0x80 : 0);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.c | CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.v)) |\n ((state.a & 0x40) >>> 6) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (state.a & 0x80) |\n ((state.a & 0x40) ^ ((state.a & 0x20) << 1));\n}\n\nexport function alr(operand: number, state: CpuInterface.State): null {\n const i = state.a & operand;\n state.a = i >>> 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (i & CpuInterface.Flags.c);\n\n return null;\n}\n\nexport function dcp(operand: number, state: CpuInterface.State): number {\n const result = (operand + 0xff) & 0xff;\n const diff = state.a + (~result & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n\n return result;\n}\n\nexport function axs(operand: number, state: CpuInterface.State): null {\n const value = (state.a & state.x) + (~operand & 0xff) + 1;\n\n state.x = value & 0xff;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.x & 0x80) |\n (state.x & 0xff ? 0 : CpuInterface.Flags.z) |\n (value >>> 8);\n\n return null;\n}\n\nexport function rra(operand: number, state: CpuInterface.State): number {\n const result = (operand >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (operand & CpuInterface.Flags.c);\n\n adc(result, state);\n\n return result;\n}\n\nexport function rla(operand: number, state: CpuInterface.State): number {\n const result = ((operand << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (operand >>> 7);\n\n setFlagsNZ((state.a &= result), state);\n\n return result;\n}\n\nexport function slo(operand: number, state: CpuInterface.State): number {\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (operand >>> 7);\n const result = (operand << 1) & 0xff;\n\n state.a = state.a | result;\n setFlagsNZ(state.a, state);\n\n return result;\n}\n\nexport function aax(state: CpuInterface.State): number {\n const result = state.a & state.x;\n setFlagsNZ(result, state);\n\n return result;\n}\n\nexport function isc(operand: number, state: CpuInterface.State): number {\n const result = (operand + 1) & 0xff;\n\n sbc(result, state);\n\n return result;\n}\n\nexport function aac(operand: number, state: CpuInterface.State): null {\n state.a &= operand;\n setFlagsNZ(state.a, state);\n state.flags = (state.flags & ~CpuInterface.Flags.c) | ((state.a & 0x80) >>> 7);\n\n return null;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../../CpuInterface';\nimport ResultImpl from '../ResultImpl';\nimport StateMachineInterface from '../StateMachineInterface';\nimport { freezeImmutables, Immutable } from '../../../../tools/decorators';\nimport NextStep from './NextStep';\n\nclass Indirect implements StateMachineInterface {\n constructor(state: CpuInterface.State, next: NextStep = () => null) {\n this._state = state;\n this._next = next;\n\n freezeImmutables(this);\n }\n\n @Immutable reset = (): StateMachineInterface.Result => this._result.read(this._fetchAddressLo, this._state.p);\n\n @Immutable\n private _fetchAddressLo = (value: number): StateMachineInterface.Result => {\n this._address = value;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._fetchAddressHi, this._state.p);\n };\n\n @Immutable\n private _fetchAddressHi = (value: number): StateMachineInterface.Result => {\n this._address |= value << 8;\n this._state.p = (this._state.p + 1) & 0xffff;\n\n return this._result.read(this._fetchLo, this._address);\n };\n\n @Immutable\n private _fetchLo = (value: number): StateMachineInterface.Result => {\n this._operand = value;\n\n if ((this._address & 0xff) === 0xff) {\n this._address &= 0xff00;\n } else {\n this._address = (this._address + 1) & 0xffff;\n }\n\n return this._result.read(this._fetchHi, this._address);\n };\n\n @Immutable\n private _fetchHi = (value: number): StateMachineInterface.Result | null => {\n this._operand |= value << 8;\n\n return this._next(this._operand, this._state);\n };\n\n private _operand = 0;\n private _address = 0;\n\n @Immutable private readonly _result = new ResultImpl();\n\n @Immutable private readonly _state: CpuInterface.State;\n @Immutable private readonly _next: NextStep;\n}\n\nexport const indirect = (state: CpuInterface.State, next: NextStep) => new Indirect(state, next);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from '../CpuInterface';\nimport StateMachineInterface from './StateMachineInterface';\nimport Instruction from '../Instruction';\nimport {\n immediate,\n dereference,\n zeroPage,\n absolute,\n zeroPageX,\n zeroPageY,\n absoluteX,\n absoluteY,\n indexedIndirectX,\n indirectIndexedY\n} from './addressing';\nimport { nullaryOneCycle, readModifyWrite, jsr, push, pull, rti, rts, write, branch } from './instruction';\nimport * as ops from './ops';\nimport { indirect } from './addressing/indirect';\nimport NextStep from './addressing/NextStep';\nimport { brk } from './vector';\n\nclass Compiler {\n constructor(private readonly _state: CpuInterface.State) {}\n\n compile(op: number): StateMachineInterface | null {\n const instruction = Instruction.opcodes[op];\n\n switch (instruction.operation) {\n case Instruction.Operation.adc:\n return this._createAddressing(instruction.addressingMode, ops.adc, {\n deref: true\n });\n\n case Instruction.Operation.and:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.a = state.a & operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.asl:\n return instruction.addressingMode === Instruction.AddressingMode.implied\n ? nullaryOneCycle(this._state, ops.aslImmediate)\n : this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, ops.aslRmw).reset,\n { writeOp: true }\n );\n\n case Instruction.Operation.bit:\n return this._createAddressing(instruction.addressingMode, ops.bit, {\n deref: true\n });\n\n case Instruction.Operation.brk:\n return brk(this._state);\n\n case Instruction.Operation.cmp:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => (ops.cmp(o, s, state => state.a), null),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.cpx:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => (ops.cmp(o, s, state => state.x), null),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.cpy:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => (ops.cmp(o, s, state => state.y), null),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.dec:\n return this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, (s, o) => ops.genRmw(s, o, x => (x - 1) & 0xff)).reset,\n {\n writeOp: true\n }\n );\n\n case Instruction.Operation.dex:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.x = (state.x - 1) & 0xff)));\n\n case Instruction.Operation.dey:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.y = (state.y - 1) & 0xff)));\n\n case Instruction.Operation.inc:\n return this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, (s, o) => ops.genRmw(s, o, x => (x + 1) & 0xff)).reset,\n {\n writeOp: true\n }\n );\n\n case Instruction.Operation.inx:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.x = (state.x + 1) & 0xff)));\n\n case Instruction.Operation.iny:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.y = (state.y + 1) & 0xff)));\n\n case Instruction.Operation.eor:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.a = state.a ^ operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.jmp:\n return this._createAddressing(instruction.addressingMode, (o, s) => ((s.p = o), null));\n\n case Instruction.Operation.jsr:\n return jsr(this._state);\n\n case Instruction.Operation.lda:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.a = operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.ldx:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.x = operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.ldy:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.y = operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.lsr:\n return instruction.addressingMode === Instruction.AddressingMode.implied\n ? nullaryOneCycle(this._state, ops.lsrImmediate)\n : this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, ops.lsrRmw).reset,\n { writeOp: true }\n );\n\n case Instruction.Operation.nop:\n return nullaryOneCycle(this._state, () => undefined);\n\n case Instruction.Operation.ora:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.a |= operand)),\n { deref: true }\n );\n\n case Instruction.Operation.pha:\n return push(this._state, s => s.a);\n\n case Instruction.Operation.php:\n return push(this._state, s => s.flags | CpuInterface.Flags.b);\n\n case Instruction.Operation.pla:\n return pull(this._state, (s, o) => ops.genNullary(s, state => (state.a = o)));\n\n case Instruction.Operation.plp:\n return pull(this._state, (s, o) => (s.flags = (o | CpuInterface.Flags.e) & ~CpuInterface.Flags.b));\n\n case Instruction.Operation.rol:\n return instruction.addressingMode === Instruction.AddressingMode.implied\n ? nullaryOneCycle(this._state, ops.rolImmediate)\n : this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, ops.rolRmw).reset,\n { writeOp: true }\n );\n\n case Instruction.Operation.ror:\n return instruction.addressingMode === Instruction.AddressingMode.implied\n ? nullaryOneCycle(this._state, ops.rorImmediate)\n : this._createAddressing(\n instruction.addressingMode,\n readModifyWrite(this._state, ops.rorRmw).reset,\n { writeOp: true }\n );\n\n case Instruction.Operation.rti:\n return rti(this._state);\n\n case Instruction.Operation.rts:\n return rts(this._state);\n\n case Instruction.Operation.sbc:\n return this._createAddressing(instruction.addressingMode, ops.sbc, {\n deref: true\n });\n\n case Instruction.Operation.stx:\n return this._createAddressing(instruction.addressingMode, write(this._state, s => s.x).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.sty:\n return this._createAddressing(instruction.addressingMode, write(this._state, s => s.y).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.tax:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.x = state.a)));\n\n case Instruction.Operation.tay:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.y = state.a)));\n\n case Instruction.Operation.tsx:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.x = state.s)));\n\n case Instruction.Operation.txa:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.a = state.x)));\n\n case Instruction.Operation.txs:\n return nullaryOneCycle(this._state, s => (s.s = s.x));\n\n case Instruction.Operation.tya:\n return nullaryOneCycle(this._state, s => ops.genNullary(s, state => (state.a = state.y)));\n\n // Bramches\n\n case Instruction.Operation.bcc:\n return branch(this._state, flags => (flags & CpuInterface.Flags.c) === 0);\n\n case Instruction.Operation.bcs:\n return branch(this._state, flags => (flags & CpuInterface.Flags.c) > 0);\n\n case Instruction.Operation.bne:\n return branch(this._state, flags => (flags & CpuInterface.Flags.z) === 0);\n\n case Instruction.Operation.beq:\n return branch(this._state, flags => (flags & CpuInterface.Flags.z) > 0);\n\n case Instruction.Operation.bpl:\n return branch(this._state, flags => (flags & CpuInterface.Flags.n) === 0);\n\n case Instruction.Operation.bmi:\n return branch(this._state, flags => (flags & CpuInterface.Flags.n) > 0);\n\n case Instruction.Operation.bvc:\n return branch(this._state, flags => (flags & CpuInterface.Flags.v) === 0);\n\n case Instruction.Operation.bvs:\n return branch(this._state, flags => (flags & CpuInterface.Flags.v) > 0);\n\n // Flags\n\n case Instruction.Operation.sec:\n return nullaryOneCycle(this._state, s => (s.flags |= CpuInterface.Flags.c));\n\n case Instruction.Operation.sed:\n return nullaryOneCycle(this._state, s => (s.flags |= CpuInterface.Flags.d));\n\n case Instruction.Operation.sei:\n return nullaryOneCycle(this._state, s => (s.flags |= CpuInterface.Flags.i));\n\n case Instruction.Operation.sta:\n return this._createAddressing(instruction.addressingMode, write(this._state, s => s.a).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.clc:\n return nullaryOneCycle(this._state, s => (s.flags &= ~CpuInterface.Flags.c));\n\n case Instruction.Operation.cld:\n return nullaryOneCycle(this._state, s => (s.flags &= ~CpuInterface.Flags.d));\n\n case Instruction.Operation.cli:\n return nullaryOneCycle(this._state, s => (s.flags &= ~CpuInterface.Flags.i));\n\n case Instruction.Operation.clv:\n return nullaryOneCycle(this._state, s => (s.flags &= ~CpuInterface.Flags.v));\n\n // Undocumented opcodes\n\n case Instruction.Operation.dop:\n case Instruction.Operation.top:\n return this._createAddressing(instruction.addressingMode, () => null, { deref: true });\n\n case Instruction.Operation.aac:\n return this._createAddressing(instruction.addressingMode, ops.aac);\n\n case Instruction.Operation.aax:\n return this._createAddressing(instruction.addressingMode, write(this._state, ops.aax).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.alr:\n return this._createAddressing(instruction.addressingMode, ops.alr, {\n deref: true\n });\n\n case Instruction.Operation.arr:\n return this._createAddressing(instruction.addressingMode, (o, s) => (ops.arr(o, s), null), {\n deref: true\n });\n\n case Instruction.Operation.axs:\n return this._createAddressing(instruction.addressingMode, ops.axs, {\n deref: true\n });\n\n case Instruction.Operation.atx:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.x = state.a = state.a & operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.dcp:\n return this._createAddressing(instruction.addressingMode, readModifyWrite(this._state, ops.dcp).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.isc:\n return this._createAddressing(instruction.addressingMode, readModifyWrite(this._state, ops.isc).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.lax:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.a = state.x = operand)),\n {\n deref: true\n }\n );\n\n case Instruction.Operation.lar:\n return this._createAddressing(\n instruction.addressingMode,\n (o, s) => ops.genUnary(o, s, (operand, state) => (state.s = state.x = state.a = state.s & operand)),\n { deref: true }\n );\n\n case Instruction.Operation.rla:\n return this._createAddressing(instruction.addressingMode, readModifyWrite(this._state, ops.rla).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.rra:\n return this._createAddressing(instruction.addressingMode, readModifyWrite(this._state, ops.rra).reset, {\n writeOp: true\n });\n\n case Instruction.Operation.slo:\n return this._createAddressing(instruction.addressingMode, readModifyWrite(this._state, ops.slo).reset, {\n writeOp: true\n });\n\n default:\n return null;\n }\n }\n\n private _createAddressing(\n addressingMode: Instruction.AddressingMode,\n next: NextStep,\n { deref = false, writeOp = false } = {}\n ): StateMachineInterface {\n if (deref && addressingMode !== Instruction.AddressingMode.immediate) {\n next = dereference(this._state, next).reset;\n }\n\n switch (addressingMode) {\n case Instruction.AddressingMode.immediate:\n return immediate(this._state, next);\n\n case Instruction.AddressingMode.zeroPage:\n return zeroPage(this._state, next);\n\n case Instruction.AddressingMode.absolute:\n return absolute(this._state, next);\n\n case Instruction.AddressingMode.zeroPageX:\n return zeroPageX(this._state, next);\n\n case Instruction.AddressingMode.zeroPageY:\n return zeroPageY(this._state, next);\n\n case Instruction.AddressingMode.absoluteX:\n return absoluteX(this._state, next, writeOp);\n\n case Instruction.AddressingMode.absoluteY:\n return absoluteY(this._state, next, writeOp);\n\n case Instruction.AddressingMode.indexedIndirectX:\n return indexedIndirectX(this._state, next);\n\n case Instruction.AddressingMode.indirectIndexedY:\n return indirectIndexedY(this._state, next, writeOp);\n\n case Instruction.AddressingMode.indirect:\n return indirect(this._state, next);\n\n default:\n throw new Error(`invalid addressing mode ${addressingMode}`);\n }\n }\n}\n\nexport default Compiler;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from './CpuInterface';\nimport StateMachineInterface from './statemachine/StateMachineInterface';\nimport BusInterface from '../bus/BusInterface';\nimport RngInterface from '../../tools/rng/GeneratorInterface';\nimport { boot, irq, nmi } from './statemachine/vector';\nimport Compiler from './statemachine/Compiler';\n\nclass StateMachineCpu implements CpuInterface {\n constructor(private _bus: BusInterface, private _rng?: RngInterface) {\n this._opBoot = boot(this.state);\n this._opIrq = irq(this.state);\n this._opNmi = nmi(this.state);\n\n const compiler = new Compiler(this.state);\n for (let op = 0; op < 256; op++) {\n this._operations[op] = compiler.compile(op);\n }\n\n this.reset();\n }\n\n reset(): this {\n this.state.a = this._rng ? this._rng.int(0xff) : 0;\n this.state.x = this._rng ? this._rng.int(0xff) : 0;\n this.state.y = this._rng ? this._rng.int(0xff) : 0;\n this.state.s = 0xfd;\n this.state.p = this._rng ? this._rng.int(0xffff) : 0;\n this.state.flags =\n (this._rng ? this._rng.int(0xff) : 0) | CpuInterface.Flags.i | CpuInterface.Flags.e | CpuInterface.Flags.b;\n this.state.irq = false;\n this.state.nmi = false;\n\n this.executionState = CpuInterface.ExecutionState.boot;\n this._interruptPending = false;\n this._nmiPending = false;\n this._halt = false;\n this._lastResult = this._opBoot.reset(undefined);\n this._lastInstructionPointer = 0;\n\n return this;\n }\n\n setInterrupt(i: boolean): this {\n this._interruptPending = i;\n\n return this;\n }\n\n isInterrupt(): boolean {\n return this._interruptPending;\n }\n\n nmi(): this {\n this._nmiPending = true;\n\n return this;\n }\n\n halt(): this {\n this._halt = true;\n\n return this;\n }\n\n resume(): this {\n this._halt = false;\n\n return this;\n }\n\n isHalt(): boolean {\n return this._halt;\n }\n\n setInvalidInstructionCallback(callback: CpuInterface.InvalidInstructionCallbackInterface): this {\n this._invalidInstructionCallback = callback;\n\n return this;\n }\n\n getInvalidInstructionCallback(): CpuInterface.InvalidInstructionCallbackInterface {\n return this._invalidInstructionCallback;\n }\n\n getLastInstructionPointer(): number {\n return this._lastInstructionPointer;\n }\n\n cycle(): this {\n if (this._halt && (!this._lastResult || this._lastResult.cycleType === StateMachineInterface.CycleType.read)) {\n return this;\n }\n\n if (this.executionState === CpuInterface.ExecutionState.fetch) {\n this._fetch();\n return this;\n }\n\n let value: number;\n\n switch (this._lastResult.cycleType) {\n case StateMachineInterface.CycleType.read:\n value = this._bus.read(this._lastResult.address);\n break;\n\n case StateMachineInterface.CycleType.write:\n value = this._lastResult.value;\n this._bus.write(this._lastResult.address, value);\n break;\n\n default:\n throw new Error('invalid cycle type');\n }\n\n if (this._lastResult.pollInterrupts) {\n this._pollInterrupts();\n\n this._lastResult.pollInterrupts = false;\n this._pollInterruptsAfterLastInstruction = false;\n }\n\n this._lastResult = this._lastResult.nextStep(value);\n if (this._lastResult === null) {\n this.executionState = CpuInterface.ExecutionState.fetch;\n }\n\n return this;\n }\n\n private _fetch(): void {\n if (this._pollInterruptsAfterLastInstruction) {\n this._pollInterrupts();\n }\n\n this._lastInstructionPointer = this.state.p;\n\n let operation: StateMachineInterface;\n const opcode = this._bus.read(this.state.p);\n\n if (this.state.nmi) {\n operation = this._opNmi;\n this._pollInterruptsAfterLastInstruction = false;\n } else if (this.state.irq) {\n operation = this._opIrq;\n this._pollInterruptsAfterLastInstruction = false;\n } else {\n operation = this._operations[opcode];\n this.state.p = (this.state.p + 1) & 0xffff;\n this._pollInterruptsAfterLastInstruction = true;\n }\n\n if (!operation) {\n if (this._invalidInstructionCallback) {\n this._invalidInstructionCallback(this);\n }\n\n return;\n }\n\n this.executionState = CpuInterface.ExecutionState.execute;\n\n this._lastResult = operation.reset(undefined);\n }\n\n private _pollInterrupts(): void {\n this.state.irq = false;\n\n if (this._nmiPending) {\n this.state.nmi = true;\n this._nmiPending = false;\n\n return;\n }\n\n if (this._interruptPending && !this.state.nmi && !(this.state.flags & CpuInterface.Flags.i)) {\n this.state.irq = true;\n }\n }\n\n executionState = CpuInterface.ExecutionState.boot;\n state = new CpuInterface.State();\n\n private _invalidInstructionCallback: CpuInterface.InvalidInstructionCallbackInterface = null;\n\n private _lastResult: StateMachineInterface.Result;\n private _interruptPending = false;\n private _nmiPending = false;\n private _halt = false;\n private _pollInterruptsAfterLastInstruction = false;\n\n private _lastInstructionPointer = 0;\n\n private _opBoot: StateMachineInterface;\n private _opNmi: StateMachineInterface;\n private _opIrq: StateMachineInterface;\n private _operations = new Array<StateMachineInterface>(255);\n}\n\nexport default StateMachineCpu;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuInterface from './CpuInterface';\nimport BusInterface from '../bus/BusInterface';\nimport Instruction from './Instruction';\n\nfunction restoreFlagsFromStack(state: CpuInterface.State, bus: BusInterface): void {\n state.s = (state.s + 0x01) & 0xff;\n state.flags = (bus.read(0x0100 + state.s) | CpuInterface.Flags.e) & ~CpuInterface.Flags.b;\n}\n\nfunction setFlagsNZ(state: CpuInterface.State, operand: number): void {\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z)) |\n (operand & 0x80) |\n (operand ? 0 : CpuInterface.Flags.z);\n}\n\nexport function opAdc(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n if (state.flags & CpuInterface.Flags.d) {\n const d0 = (operand & 0x0f) + (state.a & 0x0f) + (state.flags & CpuInterface.Flags.c),\n d1 = (operand >>> 4) + (state.a >>> 4) + (d0 > 9 ? 1 : 0);\n\n state.a = d0 % 10 | (d1 % 10 << 4);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) | // negative\n (state.a ? 0 : CpuInterface.Flags.z) | // zero\n (d1 > 9 ? CpuInterface.Flags.c : 0); // carry\n } else {\n const sum = state.a + operand + (state.flags & CpuInterface.Flags.c),\n result = sum & 0xff;\n\n state.flags =\n (state.flags &\n ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c | CpuInterface.Flags.v)) |\n (result & 0x80) | // negative\n (result ? 0 : CpuInterface.Flags.z) | // zero\n (sum >>> 8) | // carry\n ((~(operand ^ state.a) & (result ^ operand) & 0x80) >>> 1); // overflow\n\n state.a = result;\n }\n}\n\nexport function opAnd(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a &= operand;\n setFlagsNZ(state, state.a);\n}\n\nexport function opAslAcc(state: CpuInterface.State): void {\n const old = state.a;\n state.a = (state.a << 1) & 0xff;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function opAslMem(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = (old << 1) & 0xff;\n bus.write(operand, value);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (value & 0x80) |\n (value ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function opBit(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.v | CpuInterface.Flags.z)) |\n (operand & (CpuInterface.Flags.n | CpuInterface.Flags.v)) |\n (operand & state.a ? 0 : CpuInterface.Flags.z);\n}\n\nexport function opBrk(state: CpuInterface.State, bus: BusInterface): void {\n const nextOpAddr = (state.p + 1) & 0xffff;\n let vector = 0xfffe;\n\n if (state.nmi) {\n vector = 0xfffa;\n state.nmi = false;\n }\n\n state.nmi = state.irq = false;\n\n bus.write(state.s + 0x0100, (nextOpAddr >>> 8) & 0xff);\n state.s = (state.s + 0xff) & 0xff;\n bus.write(state.s + 0x0100, nextOpAddr & 0xff);\n state.s = (state.s + 0xff) & 0xff;\n\n bus.write(state.s + 0x0100, state.flags | CpuInterface.Flags.b);\n state.s = (state.s + 0xff) & 0xff;\n\n state.flags |= CpuInterface.Flags.i;\n\n state.p = bus.readWord(vector);\n}\n\nexport function opClc(state: CpuInterface.State): void {\n state.flags &= ~CpuInterface.Flags.c;\n}\n\nexport function opCld(state: CpuInterface.State): void {\n state.flags &= ~CpuInterface.Flags.d;\n}\n\nexport function opCli(state: CpuInterface.State): void {\n state.flags &= ~CpuInterface.Flags.i;\n}\n\nexport function opClv(state: CpuInterface.State): void {\n state.flags &= ~CpuInterface.Flags.v;\n}\n\nexport function opCmp(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const diff = state.a + (~operand & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n}\n\nexport function opCpx(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const diff = state.x + (~operand & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n}\n\nexport function opCpy(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const diff = state.y + (~operand & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n}\n\nexport function opDec(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = (bus.read(operand) + 0xff) & 0xff;\n bus.write(operand, value);\n setFlagsNZ(state, value);\n}\n\nexport function opDex(state: CpuInterface.State): void {\n state.x = (state.x + 0xff) & 0xff;\n setFlagsNZ(state, state.x);\n}\n\nexport function opEor(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a = state.a ^ operand;\n setFlagsNZ(state, state.a);\n}\n\nexport function opDey(state: CpuInterface.State): void {\n state.y = (state.y + 0xff) & 0xff;\n setFlagsNZ(state, state.y);\n}\n\nexport function opInc(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = (bus.read(operand) + 1) & 0xff;\n bus.write(operand, value);\n setFlagsNZ(state, value);\n}\n\nexport function opInx(state: CpuInterface.State): void {\n state.x = (state.x + 0x01) & 0xff;\n setFlagsNZ(state, state.x);\n}\n\nexport function opIny(state: CpuInterface.State): void {\n state.y = (state.y + 0x01) & 0xff;\n setFlagsNZ(state, state.y);\n}\n\nexport function opJmp(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.p = operand;\n}\n\nexport function opJsr(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const returnPtr = (state.p + 1) & 0xffff,\n addrLo = bus.read(state.p);\n\n bus.read(0x0100 + state.s);\n bus.write(0x0100 + state.s, returnPtr >>> 8);\n state.s = (state.s + 0xff) & 0xff;\n bus.write(0x0100 + state.s, returnPtr & 0xff);\n state.s = (state.s + 0xff) & 0xff;\n\n state.p = addrLo | (bus.read((state.p + 1) & 0xffff) << 8);\n}\n\nexport function opLda(\n state: CpuInterface.State,\n bus: BusInterface,\n operand: number,\n addressingMode: Instruction.AddressingMode\n): void {\n state.a = addressingMode === Instruction.AddressingMode.immediate ? operand : bus.read(operand);\n setFlagsNZ(state, state.a);\n}\n\nexport function opLdx(\n state: CpuInterface.State,\n bus: BusInterface,\n operand: number,\n addressingMode: Instruction.AddressingMode\n): void {\n state.x = addressingMode === Instruction.AddressingMode.immediate ? operand : bus.read(operand);\n setFlagsNZ(state, state.x);\n}\n\nexport function opLdy(\n state: CpuInterface.State,\n bus: BusInterface,\n operand: number,\n addressingMode: Instruction.AddressingMode\n): void {\n state.y = addressingMode === Instruction.AddressingMode.immediate ? operand : bus.read(operand);\n setFlagsNZ(state, state.y);\n}\n\nexport function opLsrAcc(state: CpuInterface.State): void {\n const old = state.a;\n state.a = state.a >>> 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function opLsrMem(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = old >>> 1;\n bus.write(operand, value);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (value & 0x80) |\n (value ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function opNop(): void {}\n\nexport function opOra(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a |= operand;\n setFlagsNZ(state, state.a);\n}\n\nexport function opPhp(state: CpuInterface.State, bus: BusInterface): void {\n bus.write(0x0100 + state.s, state.flags | CpuInterface.Flags.b);\n state.s = (state.s + 0xff) & 0xff;\n}\n\nexport function opPlp(state: CpuInterface.State, bus: BusInterface): void {\n restoreFlagsFromStack(state, bus);\n}\n\nexport function opPha(state: CpuInterface.State, bus: BusInterface): void {\n bus.write(0x0100 + state.s, state.a);\n state.s = (state.s + 0xff) & 0xff;\n}\n\nexport function opPla(state: CpuInterface.State, bus: BusInterface): void {\n state.s = (state.s + 0x01) & 0xff;\n state.a = bus.read(0x0100 + state.s);\n setFlagsNZ(state, state.a);\n}\n\nexport function opRolAcc(state: CpuInterface.State): void {\n const old = state.a;\n state.a = ((state.a << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function opRolMem(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = ((old << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n bus.write(operand, value);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (value & 0x80) |\n (value ? 0 : CpuInterface.Flags.z) |\n (old >>> 7);\n}\n\nexport function opRorAcc(state: CpuInterface.State): void {\n const old = state.a;\n state.a = (state.a >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function opRorMem(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = (old >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n bus.write(operand, value);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (value & 0x80) |\n (value ? 0 : CpuInterface.Flags.z) |\n (old & CpuInterface.Flags.c);\n}\n\nexport function opRti(state: CpuInterface.State, bus: BusInterface): void {\n let returnPtr: number;\n\n restoreFlagsFromStack(state, bus);\n\n state.s = (state.s + 1) & 0xff;\n returnPtr = bus.read(0x0100 + state.s);\n state.s = (state.s + 1) & 0xff;\n returnPtr |= bus.read(0x0100 + state.s) << 8;\n\n state.p = returnPtr;\n}\n\nexport function opRts(state: CpuInterface.State, bus: BusInterface): void {\n let returnPtr: number;\n\n bus.read(0x0100 + state.s);\n state.s = (state.s + 1) & 0xff;\n returnPtr = bus.read(0x0100 + state.s);\n state.s = (state.s + 1) & 0xff;\n returnPtr += bus.read(0x0100 + state.s) << 8;\n\n state.p = (returnPtr + 1) & 0xffff;\n}\n\nexport function opSbc(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n if (state.flags & CpuInterface.Flags.d) {\n const d0 = (state.a & 0x0f) - (operand & 0x0f) - (~state.flags & CpuInterface.Flags.c),\n d1 = (state.a >>> 4) - (operand >>> 4) - (d0 < 0 ? 1 : 0);\n\n state.a = (d0 < 0 ? 10 + d0 : d0) | ((d1 < 0 ? 10 + d1 : d1) << 4);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) | // negative\n (state.a ? 0 : CpuInterface.Flags.z) | // zero\n (d1 < 0 ? 0 : CpuInterface.Flags.c); // carry / borrow\n } else {\n operand = ~operand & 0xff;\n\n const sum = state.a + operand + (state.flags & CpuInterface.Flags.c),\n result = sum & 0xff;\n\n state.flags =\n (state.flags &\n ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c | CpuInterface.Flags.v)) |\n (result & 0x80) | // negative\n (result ? 0 : CpuInterface.Flags.z) | // zero\n (sum >>> 8) | // carry / borrow\n ((~(operand ^ state.a) & (result ^ operand) & 0x80) >>> 1); // overflow\n\n state.a = result;\n }\n}\n\nexport function opSec(state: CpuInterface.State): void {\n state.flags |= CpuInterface.Flags.c;\n}\n\nexport function opSed(state: CpuInterface.State): void {\n state.flags |= CpuInterface.Flags.d;\n}\n\nexport function opSei(state: CpuInterface.State): void {\n state.flags |= CpuInterface.Flags.i;\n}\n\nexport function opSta(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n bus.write(operand, state.a);\n}\n\nexport function opStx(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n bus.write(operand, state.x);\n}\n\nexport function opSty(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n bus.write(operand, state.y);\n}\n\nexport function opTax(state: CpuInterface.State): void {\n state.x = state.a;\n setFlagsNZ(state, state.a);\n}\n\nexport function opTay(state: CpuInterface.State): void {\n state.y = state.a;\n setFlagsNZ(state, state.a);\n}\n\nexport function opTsx(state: CpuInterface.State): void {\n state.x = state.s;\n setFlagsNZ(state, state.x);\n}\n\nexport function opTxa(state: CpuInterface.State): void {\n state.a = state.x;\n setFlagsNZ(state, state.a);\n}\n\nexport function opTxs(state: CpuInterface.State): void {\n state.s = state.x;\n}\n\nexport function opTya(state: CpuInterface.State): void {\n state.a = state.y;\n setFlagsNZ(state, state.a);\n}\n\nexport function opAlr(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const i = state.a & operand;\n state.a = i >>> 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.a & 0x80) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (i & CpuInterface.Flags.c);\n}\n\nexport function opAxs(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = (state.a & state.x) + (~operand & 0xff) + 1;\n\n state.x = value & 0xff;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (state.x & 0x80) |\n (state.x & 0xff ? 0 : CpuInterface.Flags.z) |\n (value >>> 8);\n}\n\nexport function opDcp(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = (bus.read(operand) + 0xff) & 0xff;\n bus.write(operand, value);\n\n const diff = state.a + (~value & 0xff) + 1;\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.c)) |\n (diff & 0x80) |\n (diff & 0xff ? 0 : CpuInterface.Flags.z) |\n (diff >>> 8);\n}\n\nexport function opLax(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a = operand;\n state.x = operand;\n setFlagsNZ(state, operand);\n}\n\nexport function opArr(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a = ((state.a & operand) >>> 1) | (state.flags & CpuInterface.Flags.c ? 0x80 : 0);\n\n state.flags =\n (state.flags & ~(CpuInterface.Flags.c | CpuInterface.Flags.n | CpuInterface.Flags.z | CpuInterface.Flags.v)) |\n ((state.a & 0x40) >>> 6) |\n (state.a ? 0 : CpuInterface.Flags.z) |\n (state.a & 0x80) |\n ((state.a & 0x40) ^ ((state.a & 0x20) << 1));\n}\n\nexport function opSlo(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n let value = bus.read(operand);\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (value >>> 7);\n value = (value << 1) & 0xff;\n\n bus.write(operand, value);\n\n state.a = state.a | value;\n setFlagsNZ(state, state.a);\n}\n\nexport function opAax(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = state.x & state.a;\n bus.write(operand, value);\n setFlagsNZ(state, value);\n}\n\nexport function opLar(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.s = state.a = state.x = state.s & operand;\n setFlagsNZ(state, state.a);\n}\n\nexport function opIsc(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const value = (bus.read(operand) + 1) & 0xff;\n bus.write(operand, value);\n\n opSbc(state, bus, value);\n}\n\nexport function opAac(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a &= operand;\n setFlagsNZ(state, state.a);\n state.flags = (state.flags & ~CpuInterface.Flags.c) | ((state.a & 0x80) >>> 7);\n}\n\nexport function opAtx(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n state.a &= operand;\n state.x = state.a;\n setFlagsNZ(state, state.a);\n}\n\nexport function opRra(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = (old >>> 1) | ((state.flags & CpuInterface.Flags.c) << 7);\n bus.write(operand, value);\n\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (old & CpuInterface.Flags.c);\n\n opAdc(state, bus, value);\n}\n\nexport function opRla(state: CpuInterface.State, bus: BusInterface, operand: number): void {\n const old = bus.read(operand),\n value = ((old << 1) & 0xff) | (state.flags & CpuInterface.Flags.c);\n bus.write(operand, value);\n\n state.flags = (state.flags & ~CpuInterface.Flags.c) | (old >>> 7);\n\n opAnd(state, bus, value);\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Instruction from './Instruction';\nimport BusInterface from '../bus/BusInterface';\nimport CpuInterface from './CpuInterface';\nimport * as ops from './ops';\n\nimport RngInterface from '../../tools/rng/GeneratorInterface';\n\nconst enum InterruptCheck {\n endOfInstruction,\n beforeOp\n}\nexport function opBoot(state: CpuInterface.State, bus: BusInterface): void {\n state.p = bus.readWord(0xfffc);\n}\n\nfunction dispatchInterrupt(state: CpuInterface.State, bus: BusInterface, vector: number): void {\n const nextOpAddr = state.p;\n\n if (state.nmi) {\n vector = 0xfffa;\n }\n\n state.nmi = state.irq = false;\n\n bus.write(state.s + 0x0100, (nextOpAddr >>> 8) & 0xff);\n state.s = (state.s + 0xff) & 0xff;\n bus.write(state.s + 0x0100, nextOpAddr & 0xff);\n state.s = (state.s + 0xff) & 0xff;\n\n bus.write(state.s + 0x0100, state.flags & ~CpuInterface.Flags.b);\n state.s = (state.s + 0xff) & 0xff;\n\n state.flags |= CpuInterface.Flags.i;\n\n state.p = bus.readWord(vector);\n}\n\nexport function opIrq(state: CpuInterface.State, bus: BusInterface) {\n dispatchInterrupt(state, bus, 0xfffe);\n}\n\nexport function opNmi(state: CpuInterface.State, bus: BusInterface) {\n dispatchInterrupt(state, bus, 0xfffa);\n}\n\nclass BatchedAccessCpu {\n constructor(private _bus: BusInterface, private _rng?: RngInterface) {\n this.reset();\n }\n\n setInterrupt(irq: boolean): BatchedAccessCpu {\n this._interruptPending = irq;\n return this;\n }\n\n isInterrupt(): boolean {\n return this._interruptPending;\n }\n\n nmi(): BatchedAccessCpu {\n this._nmiPending = true;\n return this;\n }\n\n halt(): BatchedAccessCpu {\n this._halted = true;\n return this;\n }\n\n resume(): BatchedAccessCpu {\n this._halted = false;\n return this;\n }\n\n isHalt(): boolean {\n return this._halted;\n }\n\n setInvalidInstructionCallback(callback: CpuInterface.InvalidInstructionCallbackInterface): BatchedAccessCpu {\n this._invalidInstructionCallback = callback;\n return this;\n }\n\n getInvalidInstructionCallback(): CpuInterface.InvalidInstructionCallbackInterface {\n return this._invalidInstructionCallback;\n }\n\n getLastInstructionPointer(): number {\n return this._lastInstructionPointer;\n }\n\n reset(): BatchedAccessCpu {\n this.state.a = this._rng ? this._rng.int(0xff) : 0;\n this.state.x = this._rng ? this._rng.int(0xff) : 0;\n this.state.y = this._rng ? this._rng.int(0xff) : 0;\n this.state.s = 0xfd;\n this.state.p = this._rng ? this._rng.int(0xffff) : 0;\n this.state.flags =\n (this._rng ? this._rng.int(0xff) : 0) | CpuInterface.Flags.i | CpuInterface.Flags.e | CpuInterface.Flags.b;\n this.state.irq = false;\n this.state.nmi = false;\n\n this.executionState = CpuInterface.ExecutionState.boot;\n this._opCycles = 7;\n this._interruptPending = false;\n this._nmiPending = false;\n\n this._instructionCallback = opBoot;\n\n return this;\n }\n\n cycle(): BatchedAccessCpu {\n if (this._halted) {\n return this;\n }\n\n switch (this.executionState) {\n case CpuInterface.ExecutionState.boot:\n case CpuInterface.ExecutionState.execute:\n if (--this._opCycles === 0) {\n if (this._dereference) {\n this._operand = this._bus.read(this._operand);\n }\n\n if (this._interuptCheck === InterruptCheck.beforeOp) {\n this._checkForInterrupts();\n }\n\n this._instructionCallback(this.state, this._bus, this._operand, this._currentAddressingMode);\n this.executionState = CpuInterface.ExecutionState.fetch;\n\n if (this._interuptCheck === InterruptCheck.endOfInstruction) {\n this._checkForInterrupts();\n }\n }\n\n break;\n\n case CpuInterface.ExecutionState.fetch:\n if (this.state.nmi) {\n this._instructionCallback = opNmi;\n this._opCycles = 6;\n this.state.nmi = this.state.irq = false;\n this._interuptCheck = InterruptCheck.beforeOp;\n this.executionState = CpuInterface.ExecutionState.execute;\n\n return this;\n }\n\n if (this.state.irq) {\n this._instructionCallback = opIrq;\n this._opCycles = 6;\n this.state.nmi = this.state.irq = false;\n this._interuptCheck = InterruptCheck.beforeOp;\n this.executionState = CpuInterface.ExecutionState.execute;\n\n return this;\n }\n\n this._fetch();\n break;\n }\n\n return this;\n }\n\n private _fetch() {\n const instruction = Instruction.opcodes[this._bus.read(this.state.p)];\n\n let addressingMode = instruction.addressingMode,\n dereference = false,\n slowIndexedAccess = false;\n\n this._lastInstructionPointer = this.state.p;\n this._currentAddressingMode = addressingMode;\n this._interuptCheck = InterruptCheck.endOfInstruction;\n\n switch (instruction.operation) {\n case Instruction.Operation.adc:\n this._opCycles = 0;\n this._instructionCallback = ops.opAdc;\n dereference = true;\n break;\n\n case Instruction.Operation.and:\n this._opCycles = 0;\n this._instructionCallback = ops.opAnd;\n dereference = true;\n break;\n\n case Instruction.Operation.asl:\n if (addressingMode === Instruction.AddressingMode.implied) {\n this._opCycles = 1;\n this._instructionCallback = ops.opAslAcc;\n } else {\n this._opCycles = 3;\n this._instructionCallback = ops.opAslMem;\n slowIndexedAccess = true;\n }\n break;\n\n case Instruction.Operation.bcc:\n if (this.state.flags & CpuInterface.Flags.c) {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n } else {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n }\n break;\n\n case Instruction.Operation.bcs:\n if (this.state.flags & CpuInterface.Flags.c) {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n } else {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n }\n break;\n\n case Instruction.Operation.beq:\n if (this.state.flags & CpuInterface.Flags.z) {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n } else {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n }\n break;\n\n case Instruction.Operation.bit:\n this._opCycles = 0;\n this._instructionCallback = ops.opBit;\n dereference = true;\n break;\n\n case Instruction.Operation.bmi:\n if (this.state.flags & CpuInterface.Flags.n) {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n } else {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n }\n break;\n\n case Instruction.Operation.bne:\n if (this.state.flags & CpuInterface.Flags.z) {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n } else {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n }\n break;\n\n case Instruction.Operation.bpl:\n if (this.state.flags & CpuInterface.Flags.n) {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n } else {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n }\n break;\n\n case Instruction.Operation.bvc:\n if (this.state.flags & CpuInterface.Flags.v) {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n } else {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n }\n break;\n\n case Instruction.Operation.bvs:\n if (this.state.flags & CpuInterface.Flags.v) {\n this._instructionCallback = ops.opJmp;\n this._opCycles = 0;\n } else {\n addressingMode = Instruction.AddressingMode.implied;\n this._instructionCallback = ops.opNop;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles = 1;\n }\n break;\n\n case Instruction.Operation.brk:\n this._opCycles = 6;\n this._instructionCallback = ops.opBrk;\n this._interuptCheck = InterruptCheck.beforeOp;\n break;\n\n case Instruction.Operation.clc:\n this._opCycles = 1;\n this._instructionCallback = ops.opClc;\n break;\n\n case Instruction.Operation.cld:\n this._opCycles = 1;\n this._instructionCallback = ops.opCld;\n break;\n\n case Instruction.Operation.cli:\n this._opCycles = 1;\n this._instructionCallback = ops.opCli;\n this._interuptCheck = InterruptCheck.beforeOp;\n break;\n\n case Instruction.Operation.clv:\n this._opCycles = 1;\n this._instructionCallback = ops.opClv;\n break;\n\n case Instruction.Operation.cmp:\n this._opCycles = 0;\n this._instructionCallback = ops.opCmp;\n dereference = true;\n break;\n\n case Instruction.Operation.cpx:\n this._opCycles = 0;\n this._instructionCallback = ops.opCpx;\n dereference = true;\n break;\n\n case Instruction.Operation.cpy:\n this._opCycles = 0;\n this._instructionCallback = ops.opCpy;\n dereference = true;\n break;\n\n case Instruction.Operation.dec:\n this._opCycles = 3;\n this._instructionCallback = ops.opDec;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.dex:\n this._opCycles = 1;\n this._instructionCallback = ops.opDex;\n break;\n\n case Instruction.Operation.dey:\n this._opCycles = 1;\n this._instructionCallback = ops.opDey;\n break;\n\n case Instruction.Operation.eor:\n this._opCycles = 0;\n this._instructionCallback = ops.opEor;\n dereference = true;\n break;\n\n case Instruction.Operation.inc:\n this._opCycles = 3;\n this._instructionCallback = ops.opInc;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.inx:\n this._opCycles = 1;\n this._instructionCallback = ops.opInx;\n break;\n\n case Instruction.Operation.iny:\n this._opCycles = 1;\n this._instructionCallback = ops.opIny;\n break;\n\n case Instruction.Operation.jmp:\n this._opCycles = 0;\n this._instructionCallback = ops.opJmp;\n break;\n\n case Instruction.Operation.jsr:\n this._opCycles = 5;\n this._instructionCallback = ops.opJsr;\n break;\n\n case Instruction.Operation.lda:\n this._opCycles = addressingMode === Instruction.AddressingMode.immediate ? 0 : 1;\n this._instructionCallback = ops.opLda;\n break;\n\n case Instruction.Operation.ldx:\n this._opCycles = addressingMode === Instruction.AddressingMode.immediate ? 0 : 1;\n this._instructionCallback = ops.opLdx;\n break;\n\n case Instruction.Operation.ldy:\n this._opCycles = addressingMode === Instruction.AddressingMode.immediate ? 0 : 1;\n this._instructionCallback = ops.opLdy;\n break;\n\n case Instruction.Operation.lsr:\n if (addressingMode === Instruction.AddressingMode.implied) {\n this._opCycles = 1;\n this._instructionCallback = ops.opLsrAcc;\n } else {\n this._opCycles = 3;\n this._instructionCallback = ops.opLsrMem;\n slowIndexedAccess = true;\n }\n break;\n\n case Instruction.Operation.nop:\n this._opCycles = 1;\n\n this._instructionCallback = ops.opNop;\n break;\n\n case Instruction.Operation.dop:\n case Instruction.Operation.top:\n this._opCycles = 0;\n dereference = true;\n\n this._instructionCallback = ops.opNop;\n break;\n\n case Instruction.Operation.ora:\n this._opCycles = 0;\n this._instructionCallback = ops.opOra;\n dereference = true;\n break;\n\n case Instruction.Operation.php:\n this._opCycles = 2;\n this._instructionCallback = ops.opPhp;\n break;\n\n case Instruction.Operation.pha:\n this._opCycles = 2;\n this._instructionCallback = ops.opPha;\n break;\n\n case Instruction.Operation.pla:\n this._opCycles = 3;\n this._instructionCallback = ops.opPla;\n break;\n\n case Instruction.Operation.plp:\n this._opCycles = 3;\n this._instructionCallback = ops.opPlp;\n this._interuptCheck = InterruptCheck.beforeOp;\n break;\n\n case Instruction.Operation.rol:\n if (addressingMode === Instruction.AddressingMode.implied) {\n this._opCycles = 1;\n this._instructionCallback = ops.opRolAcc;\n } else {\n this._opCycles = 3;\n this._instructionCallback = ops.opRolMem;\n slowIndexedAccess = true;\n }\n break;\n\n case Instruction.Operation.ror:\n if (addressingMode === Instruction.AddressingMode.implied) {\n this._opCycles = 1;\n this._instructionCallback = ops.opRorAcc;\n } else {\n this._opCycles = 3;\n this._instructionCallback = ops.opRorMem;\n slowIndexedAccess = true;\n }\n break;\n\n case Instruction.Operation.rti:\n this._opCycles = 5;\n this._instructionCallback = ops.opRti;\n break;\n\n case Instruction.Operation.rts:\n this._opCycles = 5;\n this._instructionCallback = ops.opRts;\n break;\n\n case Instruction.Operation.sbc:\n this._opCycles = 0;\n this._instructionCallback = ops.opSbc;\n dereference = true;\n break;\n\n case Instruction.Operation.sec:\n this._opCycles = 1;\n this._instructionCallback = ops.opSec;\n break;\n\n case Instruction.Operation.sed:\n this._opCycles = 1;\n this._instructionCallback = ops.opSed;\n break;\n\n case Instruction.Operation.sei:\n this._opCycles = 1;\n this._instructionCallback = ops.opSei;\n this._interuptCheck = InterruptCheck.beforeOp;\n break;\n\n case Instruction.Operation.sta:\n this._opCycles = 1;\n this._instructionCallback = ops.opSta;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.stx:\n this._opCycles = 1;\n this._instructionCallback = ops.opStx;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.sty:\n this._opCycles = 1;\n this._instructionCallback = ops.opSty;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.tax:\n this._opCycles = 1;\n this._instructionCallback = ops.opTax;\n break;\n\n case Instruction.Operation.tay:\n this._opCycles = 1;\n this._instructionCallback = ops.opTay;\n break;\n\n case Instruction.Operation.tsx:\n this._opCycles = 1;\n this._instructionCallback = ops.opTsx;\n break;\n\n case Instruction.Operation.txa:\n this._opCycles = 1;\n this._instructionCallback = ops.opTxa;\n break;\n\n case Instruction.Operation.txs:\n this._opCycles = 1;\n this._instructionCallback = ops.opTxs;\n break;\n\n case Instruction.Operation.tya:\n this._opCycles = 1;\n this._instructionCallback = ops.opTya;\n break;\n\n case Instruction.Operation.arr:\n this._opCycles = 0;\n this._instructionCallback = ops.opArr;\n break;\n\n case Instruction.Operation.alr:\n this._opCycles = 0;\n this._instructionCallback = ops.opAlr;\n break;\n\n case Instruction.Operation.axs:\n this._opCycles = 0;\n this._instructionCallback = ops.opAxs;\n break;\n\n case Instruction.Operation.dcp:\n this._opCycles = 3;\n this._instructionCallback = ops.opDcp;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.lax:\n this._opCycles = 0;\n this._instructionCallback = ops.opLax;\n dereference = true;\n break;\n\n case Instruction.Operation.slo:\n this._opCycles = 3;\n this._instructionCallback = ops.opSlo;\n slowIndexedAccess = true;\n dereference = false;\n break;\n\n case Instruction.Operation.aax:\n this._opCycles = 1;\n this._instructionCallback = ops.opAax;\n break;\n\n case Instruction.Operation.lar:\n this._opCycles = 0;\n this._instructionCallback = ops.opLar;\n dereference = true;\n break;\n\n case Instruction.Operation.isc:\n this._opCycles = 3;\n this._instructionCallback = ops.opIsc;\n slowIndexedAccess = true;\n break;\n\n case Instruction.Operation.aac:\n this._opCycles = 0;\n this._instructionCallback = ops.opAac;\n break;\n\n case Instruction.Operation.atx:\n this._opCycles = 0;\n this._instructionCallback = ops.opAtx;\n break;\n\n case Instruction.Operation.rra:\n this._opCycles = 3;\n dereference = false;\n slowIndexedAccess = true;\n this._instructionCallback = ops.opRra;\n break;\n\n case Instruction.Operation.rla:\n this._opCycles = 3;\n dereference = false;\n slowIndexedAccess = true;\n this._instructionCallback = ops.opRla;\n break;\n\n default:\n if (this._invalidInstructionCallback) {\n this._invalidInstructionCallback(this);\n }\n return;\n }\n\n this.state.p = (this.state.p + 1) & 0xffff;\n\n let value: number, base: number;\n\n switch (addressingMode) {\n case Instruction.AddressingMode.immediate:\n this._operand = this._bus.read(this.state.p);\n dereference = false;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles++;\n break;\n\n case Instruction.AddressingMode.zeroPage:\n this._operand = this._bus.read(this.state.p);\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles++;\n break;\n\n case Instruction.AddressingMode.absolute:\n this._operand = this._bus.readWord(this.state.p);\n this.state.p = (this.state.p + 2) & 0xffff;\n this._opCycles += 2;\n break;\n\n case Instruction.AddressingMode.indirect:\n value = this._bus.readWord(this.state.p);\n if ((value & 0xff) === 0xff) {\n this._operand = this._bus.read(value) + (this._bus.read(value & 0xff00) << 8);\n } else {\n this._operand = this._bus.readWord(value);\n }\n this.state.p = (this.state.p + 2) & 0xffff;\n this._opCycles += 4;\n break;\n\n case Instruction.AddressingMode.relative:\n value = this._bus.read(this.state.p);\n value = value & 0x80 ? -(~(value - 1) & 0xff) : value;\n this._operand = (this.state.p + value + 0x10001) & 0xffff;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles += (this._operand & 0xff00) !== (this.state.p & 0xff00) ? 3 : 2;\n break;\n\n case Instruction.AddressingMode.zeroPageX:\n base = this._bus.read(this.state.p);\n this._bus.read(base);\n\n this._operand = (base + this.state.x) & 0xff;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles += 2;\n break;\n\n case Instruction.AddressingMode.absoluteX:\n value = this._bus.readWord(this.state.p);\n this._operand = (value + this.state.x) & 0xffff;\n\n if ((this._operand & 0xff00) !== (value & 0xff00)) {\n this._bus.read((value & 0xff00) | (this._operand & 0xff));\n }\n\n this._opCycles += slowIndexedAccess || (this._operand & 0xff00) !== (value & 0xff00) ? 3 : 2;\n this.state.p = (this.state.p + 2) & 0xffff;\n break;\n\n case Instruction.AddressingMode.zeroPageY:\n base = this._bus.read(this.state.p);\n this._bus.read(base);\n\n this._operand = (base + this.state.y) & 0xff;\n this.state.p = (this.state.p + 1) & 0xffff;\n this._opCycles += 2;\n break;\n\n case Instruction.AddressingMode.absoluteY:\n value = this._bus.readWord(this.state.p);\n this._operand = (value + this.state.y) & 0xffff;\n\n if ((this._operand & 0xff00) !== (value & 0xff00)) {\n this._bus.read((value & 0xff00) | (this._operand & 0xff));\n }\n\n this._opCycles += slowIndexedAccess || (this._operand & 0xff00) !== (value & 0xff00) ? 3 : 2;\n this.state.p = (this.state.p + 2) & 0xffff;\n break;\n\n case Instruction.AddressingMode.indexedIndirectX:\n base = this._bus.read(this.state.p);\n this._bus.read(base);\n\n value = (base + this.state.x) & 0xff;\n\n if (value === 0xff) {\n this._operand = this._bus.read(0xff) + (this._bus.read(0x00) << 8);\n } else {\n this._operand = this._bus.readWord(value);\n }\n\n this._opCycles += 4;\n this.state.p = (this.state.p + 1) & 0xffff;\n break;\n\n case Instruction.AddressingMode.indirectIndexedY:\n value = this._bus.read(this.state.p);\n\n if (value === 0xff) {\n value = this._bus.read(0xff) + (this._bus.read(0x00) << 8);\n } else {\n value = this._bus.readWord(value);\n }\n\n this._operand = (value + this.state.y) & 0xffff;\n\n if ((this._operand & 0xff00) !== (value & 0xff00)) {\n this._bus.read((value & 0xff00) | (this._operand & 0xff));\n }\n\n this._opCycles += slowIndexedAccess || (value & 0xff00) !== (this._operand & 0xff00) ? 4 : 3;\n this.state.p = (this.state.p + 1) & 0xffff;\n break;\n }\n\n this._dereference = dereference;\n if (dereference) {\n this._opCycles++;\n }\n\n this.executionState = CpuInterface.ExecutionState.execute;\n }\n\n private _checkForInterrupts(): void {\n if (this._nmiPending) {\n this.state.irq = false;\n this.state.nmi = true;\n this._nmiPending = false;\n }\n\n if (this._interruptPending && !this.state.nmi && !(this.state.flags & CpuInterface.Flags.i)) {\n this.state.irq = true;\n }\n }\n\n executionState: CpuInterface.ExecutionState = CpuInterface.ExecutionState.boot;\n state: CpuInterface.State = new CpuInterface.State();\n\n private _opCycles: number = 0;\n private _instructionCallback: InstructionCallbackInterface = null;\n private _invalidInstructionCallback: CpuInterface.InvalidInstructionCallbackInterface = null;\n\n private _interruptPending: boolean = false;\n private _nmiPending: boolean = false;\n private _interuptCheck = InterruptCheck.endOfInstruction;\n\n private _halted: boolean = false;\n\n private _operand: number = 0;\n private _lastInstructionPointer: number = 0;\n private _currentAddressingMode: Instruction.AddressingMode = Instruction.AddressingMode.invalid;\n\n private _dereference = false;\n}\n\ninterface InstructionCallbackInterface {\n (\n state?: CpuInterface.State,\n bus?: BusInterface,\n operand?: number,\n addressingMode?: Instruction.AddressingMode\n ): void;\n}\n\nexport { BatchedAccessCpu as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport RngInterface from '../../tools/rng/GeneratorInterface';\nimport BusInterface from '../bus/BusInterface';\nimport CpuInterface from './CpuInterface';\nimport StateMachineCpu from './StateMachineCpu';\nimport BatchedAccessCpu from './BatchedAccessCpu';\n\nclass Factory {\n constructor(private _type: Factory.Type) {}\n\n create(bus: BusInterface, rng?: RngInterface): CpuInterface {\n switch (this._type) {\n case Factory.Type.stateMachine:\n return new StateMachineCpu(bus, rng);\n\n case Factory.Type.batchedAccess:\n return new BatchedAccessCpu(bus, rng);\n\n default:\n throw new Error('invalid CPU type');\n }\n }\n}\n\nnamespace Factory {\n export enum Type {\n stateMachine,\n batchedAccess\n }\n}\n\nexport default Factory;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CpuFactory from '../cpu/Factory';\n\ninterface Config {\n tvMode: Config.TvMode;\n enableAudio: boolean;\n randomSeed: number;\n emulatePaddles: boolean;\n frameStart: number;\n pcmAudio: boolean;\n cpuType: CpuFactory.Type;\n}\n\nnamespace Config {\n export const enum TvMode {\n ntsc,\n pal,\n secam\n }\n\n export function create(config: Partial<Config> = {}): Config {\n return {\n tvMode: TvMode.ntsc,\n enableAudio: true,\n randomSeed: -1,\n emulatePaddles: true,\n frameStart: -1,\n pcmAudio: false,\n cpuType: CpuFactory.Type.stateMachine,\n\n ...config\n };\n }\n\n export function getClockHz(config: Config): number {\n switch (config.tvMode) {\n case Config.TvMode.ntsc:\n return 262 * 228 * 60;\n\n case Config.TvMode.pal:\n case Config.TvMode.secam:\n return 312 * 228 * 50;\n }\n }\n}\n\nexport { Config as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst encodingsString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n encodings = new Uint8Array(256);\n\nexport namespace __init {\n let i: number;\n\n for (i = 0; i < 256; i++) {\n encodings[i] = 255;\n }\n for (i = 0; i < 64; i++) {\n encodings[encodingsString.charCodeAt(i)] = i;\n }\n\n encodings['='.charCodeAt(0)] = 0;\n}\n\nfunction decodeChar(data: string, idx: number): number {\n const value = encodings[data.charCodeAt(idx)];\n\n if (value > 63) {\n throw new Error('invalid base64 character \"' + data[idx] + '\" at index ' + idx);\n }\n\n return value;\n}\n\nfunction decodeNibble(data: string, idx: number): number {\n return (\n (decodeChar(data, idx) << 18) +\n (decodeChar(data, idx + 1) << 12) +\n (decodeChar(data, idx + 2) << 6) +\n decodeChar(data, idx + 3)\n );\n}\n\nfunction getPadding(data: string): number {\n let padding = 0,\n idx = data.length - 1;\n\n while (idx >= 0 && data[idx--] === '=') {\n padding++;\n }\n\n return padding;\n}\n\nexport function decode(data: string): Uint8Array {\n if (data.length % 4 !== 0) {\n throw new Error('invalid base64 data --- char count mismatch');\n }\n\n const nibbles = data.length / 4,\n decodedSize = nibbles * 3 - getPadding(data),\n decoded = new Uint8Array(decodedSize);\n\n let idx = 0;\n\n for (let i = 0; i < nibbles; i++) {\n const nibble = decodeNibble(data, i * 4);\n\n for (let j = 0; j < 3 && idx < decodedSize; j++) {\n decoded[idx++] = (nibble >>> (8 * (2 - j))) & 0xff;\n }\n }\n\n return decoded;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/*\n * The tone generator has been heavily influenced by the code found at\n * http://www.biglist.com/lists/stella/archives/200311/msg00156.html with following licence:\n *\n * sound.c\n * version 0.2\n *\n * Copyright (c) 2003 Adam Wozniak (adam@wozniakconsulting.com)\n * All Rights Reserved\n *\n * Permission granted to freely copy and use for any purpose, provided\n * this copyright header remains intact.\n */\nimport Config from '../Config';\nimport AudioOutputBuffer from '../../../tools/AudioOutputBuffer';\nimport { decode as decodeBase64 } from '../../../tools/base64';\n\nconst FREQUENCY_DIVISIORS = decodeBase64('AQEPAQEBAQEBAQEBAwMDAQ==');\n\n// all ones\nconst POLY0 = new Int8Array([1]);\n\n// 50% duty cycle\nconst POLY1 = new Int8Array([1, 1]);\n\n// 16/31 duty cycle\nconst POLY2 = new Int8Array([16, 15]);\n\n// 4 bit LFSR\nconst POLY4 = decodeBase64('AQICAQEBBAM=');\n\n// 5 bit LFSR\nconst POLY5 = decodeBase64('AQIBAQICBQQCAQMBAQEBBA==');\n\n// 9 bit LFSR\nconst POLY9 = decodeBase64(\n 'AQQBAwIEAQIDAgEBAQEBAQIEAgEEAQECAgEDAgEDAQEBBAEBAQECAQECBgECAgECAQIBAQIBBg' +\n 'IBAgIBAQEBAgICAgcCAwICAQEBAwIBAQIBAQcBAQMBAQIDAwEBAQICAQECAgQDBQEDAQEFAgEB' +\n 'AQIBAgEDAQIFAQECAQEBBQEBAQEBAQEBBgEBAQIBAQEBBAIBAQMBAwYDAgMBAQIBAgQBAQEDAQ' +\n 'EBAQMBAgEEAgIDBAEBBAECAQICAgEBBAMBBAQJBQQBBQMBAQMCAgIBBQECAQEBAgMBAgEBAwQC' +\n 'BQICAQIDAQEBAQECAQMDAwIBAgEBAQEBAwMBAgIDAQMBCA=='\n);\n\n// used by mode 15\nconst POLY68 = decodeBase64('BQYEBQoFAwcECgYDBgQJBg==');\n\n// used by mode 3\nconst POLY465 = decodeBase64(\n 'AgMCAQQBBgoCBAIBAQQFCQMDBAEBAQgFBQUEAQEBCAQCCAMDAQEHBAIHBQEDAQcEAQQIAgEDBA' +\n 'cBAwcDAgEGBgICBAUDAgYGAQMDAgUDBwMEAwICAgUJAwEFAwECAgsFAQUDAQECDAUBAgUCAQEM' +\n 'BgECBQECAQoGAwICBAECBgo='\n);\n\nconst POLYS = [\n POLY0,\n POLY4,\n POLY4,\n POLY465,\n POLY1,\n POLY1,\n POLY2,\n POLY5,\n POLY9,\n POLY5,\n POLY2,\n POLY0,\n POLY1,\n POLY1,\n POLY2,\n POLY68\n];\n\nclass ToneGenerator {\n constructor(private _config?: Config) {}\n\n setConfig(config: Config) {\n this._config = config;\n }\n\n getKey(tone: number, frequency: number): number {\n // Hack: this is at the boundary of hearing anyway and causes nasty artifacts during\n // resampling, so we kill it right away.\n if (POLYS[tone] === POLY1 && FREQUENCY_DIVISIORS[tone] * (frequency + 1) === 1) {\n return 0;\n }\n\n return (tone << 5) | frequency;\n }\n\n getBuffer(key: number): AudioOutputBuffer {\n const tone = (key >>> 5) & 0x0f,\n frequency = key & 0x1f;\n\n const poly = POLYS[tone];\n\n let length = 0;\n for (let i = 0; i < poly.length; i++) {\n length += poly[i];\n }\n\n length = length * FREQUENCY_DIVISIORS[tone] * (frequency + 1);\n\n const content = new Float32Array(length);\n\n const sampleRate = Config.getClockHz(this._config) / 114;\n\n let f = 0;\n let count = 0;\n let offset = 0;\n let state = true;\n\n for (let i = 0; i < length; i++) {\n f++;\n\n if (f === FREQUENCY_DIVISIORS[tone] * (frequency + 1)) {\n f = 0;\n count++;\n\n if (count === poly[offset]) {\n offset++;\n count = 0;\n\n if (poly.length === offset) {\n offset = 0;\n }\n }\n\n state = !(offset & 0x01);\n }\n\n content[i] = state ? 1 : -1;\n }\n\n return new AudioOutputBuffer(content, sampleRate);\n }\n}\n\nexport { ToneGenerator as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport AudioOutputBuffer from '../../../tools/AudioOutputBuffer';\nimport WaveformAudioOutputInterface from '../../io/WaveformAudioOutputInterface';\nimport Config from '../Config';\nimport ToneGenerator from './ToneGenerator';\nimport AudioInterface from './AudioInterface';\n\nexport default class WaveformAudio implements WaveformAudioOutputInterface, AudioInterface {\n constructor(private _config: Config) {\n this._toneGenerator = new ToneGenerator(this._config);\n\n this.reset();\n }\n\n reset(): void {\n this._volume = -1;\n this._tone = -1;\n this._frequency = -1;\n }\n\n audc(value: number): void {\n value &= 0x0f;\n\n if (value === this._tone) {\n return;\n }\n\n this._tone = value;\n this._dispatchBufferChanged();\n }\n\n audf(value: number): void {\n value &= 0x1f;\n\n if (value === this._frequency) {\n return;\n }\n\n this._frequency = value;\n this._dispatchBufferChanged();\n }\n\n audv(value: number): void {\n value &= 0x0f;\n\n if (value === this._volume) {\n return;\n }\n\n this._volume = value / 15;\n this.volumeChanged.dispatch(this._volume);\n }\n\n setActive(active: boolean): void {\n this._active = active;\n\n if (active) {\n this._dispatchBufferChanged();\n } else {\n this.stop.dispatch(undefined);\n }\n }\n\n getVolume(): number {\n return this._volume >= 0 ? this._volume : 0;\n }\n\n getBuffer(key: number): AudioOutputBuffer {\n return this._toneGenerator.getBuffer(key);\n }\n\n protected _getKey(): number {\n return this._toneGenerator.getKey(this._tone, this._frequency);\n }\n\n protected _dispatchBufferChanged() {\n if (this._active && this.bufferChanged.hasHandlers) {\n this.bufferChanged.dispatch(this._getKey());\n }\n }\n\n bufferChanged = new Event<number>();\n volumeChanged = new Event<number>();\n stop = new Event<void>();\n\n private _volume = -1;\n private _tone = -1;\n private _frequency = -1;\n private _active = false;\n private _toneGenerator: ToneGenerator = null;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass PCMChannel {\n constructor() {\n this.reset();\n }\n\n reset(): void {\n this._audc = this._audf = this._audv = 0;\n\n this._clkEnable = false;\n this._noiseFeedback = false;\n this._noiseCounterBit4 = false;\n this._pulseCounterHold = false;\n\n this._divCounter = 0;\n this._noiseCounter = 0;\n this._pulseCounter = 0;\n }\n\n phase0(): void {\n if (this._clkEnable) {\n this._noiseCounterBit4 = !!(this._noiseCounter & 0x01);\n\n switch (this._audc & 0x03) {\n case 0x00:\n case 0x01:\n this._pulseCounterHold = false;\n break;\n\n case 0x02:\n this._pulseCounterHold = (this._noiseCounter & 0x1e) !== 0x02;\n break;\n\n case 0x03:\n this._pulseCounterHold = !this._noiseCounterBit4;\n break;\n }\n\n switch (this._audc & 0x03) {\n case 0x00:\n this._noiseFeedback =\n !!((this._pulseCounter ^ this._noiseCounter) & 0x01) ||\n !(this._noiseCounter !== 0 || this._pulseCounter !== 0x0a) ||\n !(this._audc & 0x0c);\n\n break;\n\n default:\n this._noiseFeedback =\n !!((this._noiseCounter & 0x04 ? 1 : 0) ^ (this._noiseCounter & 0x01)) ||\n this._noiseCounter === 0;\n\n break;\n }\n }\n\n this._clkEnable = this._divCounter === this._audf;\n\n if (this._divCounter === this._audf || this._divCounter === 0x1f) {\n this._divCounter = 0;\n } else {\n this._divCounter++;\n }\n }\n\n phase1(): number {\n let pulseFeedback = false;\n\n if (this._clkEnable) {\n switch (this._audc >>> 2) {\n case 0x00:\n pulseFeedback =\n !!((this._pulseCounter & 0x02 ? 1 : 0) ^ (this._pulseCounter & 0x01)) &&\n this._pulseCounter !== 0x0a &&\n !!(this._audc & 0x03);\n\n break;\n\n case 0x01:\n pulseFeedback = !(this._pulseCounter & 0x08);\n break;\n\n case 0x02:\n pulseFeedback = !this._noiseCounterBit4;\n break;\n\n case 0x03:\n pulseFeedback = !(!!(this._pulseCounter & 0x02) || !(this._pulseCounter & 0x0e));\n break;\n }\n\n this._noiseCounter >>>= 1;\n if (this._noiseFeedback) {\n this._noiseCounter |= 0x10;\n }\n\n if (!this._pulseCounterHold) {\n this._pulseCounter = ~(this._pulseCounter >>> 1) & 0x07;\n\n if (pulseFeedback) {\n this._pulseCounter |= 0x08;\n }\n }\n }\n\n return (this._pulseCounter & 0x01) * this._audv;\n }\n\n audc(value: number): void {\n this._audc = value & 0x0f;\n }\n\n audf(value: number): void {\n this._audf = value & 0x1f;\n }\n\n audv(value: number): void {\n this._audv = value & 0x0f;\n }\n\n private _audv = 0;\n private _audc = 0;\n private _audf = 0;\n\n private _clkEnable = false;\n private _noiseFeedback = false;\n private _noiseCounterBit4 = false;\n private _pulseCounterHold = false;\n\n private _divCounter = 0;\n private _noiseCounter = 0;\n private _pulseCounter = 0;\n}\n\nexport { PCMChannel as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport PCMAudioInterface from '../../io/PCMAudioOutputInterface';\nimport AudioInterface from './AudioInterface';\nimport AudioOutputBuffer from '../../../tools/AudioOutputBuffer';\nimport StellaConfig from '../Config';\nimport PCMChannel from './PCMChannel';\n\n// The highest resistance in the resistor network is 30kOhms, the others follow from division\n// by powers of two: 30 -> 15 -> 7.5 -> 3.75\nconst R_MAX = 30;\n\n// The second resistor in the divider (1kOhms)\nconst R = 1;\n\n// The maximum sum of the individual volume of the two channels: 0x1e = 0xf + 0xf\nconst VOL_MAX = 0x1e;\n\nconst mixingTable = new Float32Array(VOL_MAX + 1);\n\nexport namespace __init {\n for (let vol = 0; vol <= VOL_MAX; vol++) {\n mixingTable[vol] = vol / VOL_MAX * (R_MAX + R * VOL_MAX) / (R_MAX + R * vol);\n }\n}\n\nclass PCMAudio implements PCMAudioInterface {\n constructor(private _config: StellaConfig) {\n this._sampleRate = (this._config.tvMode === StellaConfig.TvMode.ntsc ? 60 * 262 : 50 * 312) * 2;\n this._frameSize = (this._config.tvMode === StellaConfig.TvMode.ntsc ? 262 : 312) * 4;\n\n this.reset();\n }\n\n getChannels(): Array<AudioInterface> {\n return [\n {\n audv: value => this._channel0.audv(value),\n audc: value => this._channel0.audc(value),\n audf: value => this._channel0.audf(value),\n reset: () => this.reset(),\n setActive: active => this.setActive(active)\n },\n {\n audv: value => this._channel1.audv(value),\n audc: value => this._channel1.audc(value),\n audf: value => this._channel1.audf(value),\n reset: () => undefined,\n setActive: () => undefined\n }\n ];\n }\n\n reset() {\n this._bufferIndex = 0;\n this._counter = 0;\n\n this._channel0.reset();\n this._channel1.reset();\n }\n\n tick(): void {\n switch (this._counter) {\n case 9:\n case 81:\n this._channel0.phase0();\n this._channel1.phase0();\n break;\n\n case 37:\n case 149:\n this._currentOutputBuffer.getContent()[this._bufferIndex++] =\n mixingTable[this._channel0.phase1() + this._channel1.phase1()];\n\n if (this._bufferIndex === this._currentOutputBuffer.getLength()) {\n this._dispatchBuffer();\n }\n\n break;\n }\n\n if (++this._counter === 228) {\n this._counter = 0;\n }\n }\n\n isPaused(): boolean {\n return !this._isActive;\n }\n\n setActive(isActive: boolean): void {\n if (isActive === this._isActive) {\n return;\n }\n\n this._isActive = isActive;\n\n this.togglePause.dispatch(!isActive);\n }\n\n getSampleRate(): number {\n return this._sampleRate;\n }\n\n getFrameSize(): number {\n return this._frameSize;\n }\n\n setFrameBufferFactory(factory: PCMAudioInterface.FrameBufferFactory): void {\n this._bufferFactory = factory;\n\n if (!this._currentOutputBuffer && factory) {\n this._currentOutputBuffer = factory();\n this._bufferIndex = 0;\n }\n }\n\n private _dispatchBuffer(): void {\n this.newFrame.dispatch(this._currentOutputBuffer);\n this._currentOutputBuffer = this._bufferFactory ? this._bufferFactory() : null;\n this._bufferIndex = 0;\n }\n\n newFrame = new Event<AudioOutputBuffer>();\n\n togglePause = new Event<boolean>();\n\n private _currentOutputBuffer: AudioOutputBuffer = null;\n\n private _bufferIndex = 0;\n private _sampleRate = 0;\n private _frameSize: number;\n private _counter = 0;\n private _isActive = false;\n\n private _bufferFactory: PCMAudioInterface.FrameBufferFactory;\n\n private _channel0 = new PCMChannel();\n private _channel1 = new PCMChannel();\n}\n\nexport { PCMAudio as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst decodes0 = new Uint8Array(160),\n decodes1 = new Uint8Array(160),\n decodes2 = new Uint8Array(160),\n decodes3 = new Uint8Array(160),\n decodes4 = new Uint8Array(160),\n decodes6 = new Uint8Array(160);\n\nexport const decodesMissile: Array<Uint8Array> = [\n decodes0,\n decodes1,\n decodes2,\n decodes3,\n decodes4,\n decodes0,\n decodes6,\n decodes0\n];\n\nexport const decodesPlayer: Array<Uint8Array> = [\n decodes0,\n decodes1,\n decodes2,\n decodes3,\n decodes4,\n decodes0,\n decodes6,\n decodes0\n];\n\n[decodes0, decodes1, decodes2, decodes3, decodes4, decodes6].forEach(decodes => {\n for (let i = 0; i < 160; i++) {\n decodes[i] = 0;\n }\n\n decodes[156] = 1;\n});\n\ndecodes1[12] = 1;\ndecodes2[28] = 1;\ndecodes3[12] = decodes3[28] = 1;\ndecodes4[60] = 1;\ndecodes6[28] = decodes6[60] = 1;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { decodesMissile } from './drawCounterDecodes';\n\nimport Player from './Player';\n\nconst enum Count {\n renderCounterOffset = -4\n}\n\nclass Missile {\n constructor(private _collisionMask: number, private _flushLineCache: () => void) {\n this.reset();\n }\n\n reset(): void {\n this.color = 0xffffffff;\n this._width = 1;\n this._enabled = false;\n this._counter = 0;\n this._rendering = false;\n this._renderCounter = Count.renderCounterOffset;\n this._moving = false;\n this._hmmClocks = 0;\n this._decodes = decodesMissile[0];\n this._resmp = 0;\n this._enam = false;\n this._effectiveWidth = 0;\n this._lastMovementTick = 0;\n }\n\n enam(value: number): void {\n const enam = (value & 2) > 0,\n enabled = enam && this._resmp === 0;\n\n if (enam !== this._enam || enabled !== this._enabled) {\n this._flushLineCache();\n }\n\n this._enam = enam;\n this._enabled = enabled;\n }\n\n hmm(value: number): void {\n // Shift and flip the highest bit --- this gives us the necessary movement to the right\n this._hmmClocks = (value >>> 4) ^ 0x8;\n }\n\n resm(counter: number, hblank: boolean): void {\n this._counter = counter;\n\n if (this._rendering) {\n if (this._renderCounter < 0) {\n this._renderCounter = Count.renderCounterOffset + (counter - 157);\n } else {\n switch (this._width) {\n case 8:\n this._renderCounter = counter - 157 + (this._renderCounter >= 4 ? 4 : 0);\n break;\n\n case 4:\n this._renderCounter = counter - 157;\n break;\n\n case 2:\n if (hblank) {\n this._rendering = this._renderCounter > 1;\n } else if (this._renderCounter === 0) {\n this._renderCounter++;\n }\n\n break;\n\n default:\n if (hblank) {\n this._rendering = this._renderCounter > 0;\n }\n\n break;\n }\n }\n }\n }\n\n resmp(value: number, player: Player) {\n const resmp = value & 0x02;\n\n if (resmp === this._resmp) {\n return;\n }\n\n this._flushLineCache();\n\n this._resmp = resmp;\n\n if (resmp) {\n this._enabled = false;\n } else {\n this._enabled = this._enam;\n this._counter = player.getRespClock();\n }\n }\n\n nusiz(value: number): void {\n this._width = this._widths[(value & 0x30) >>> 4];\n this._decodes = decodesMissile[value & 0x07];\n\n if (this._rendering && this._renderCounter >= this._width) {\n this._rendering = false;\n }\n }\n\n startMovement(): void {\n this._moving = true;\n }\n\n movementTick(clock: number, apply: boolean): boolean {\n this._lastMovementTick = this._counter;\n\n // Stop movement only if the clock matches exactly --- this is crucial for cosmic ark type hacks\n if (clock === this._hmmClocks) {\n this._moving = false;\n }\n\n if (this._moving && apply) {\n this.tick(false);\n }\n\n return this._moving;\n }\n\n tick(isReceivingHclock: boolean): void {\n this.collision = this._rendering && this._renderCounter >= 0 && this._enabled ? 0 : this._collisionMask;\n\n const starfieldEffect = this._moving && isReceivingHclock;\n\n if (this._decodes[this._counter] && !this._resmp) {\n const starfieldDelta = (this._counter - this._lastMovementTick + 160) % 4;\n\n this._rendering = true;\n this._renderCounter = Count.renderCounterOffset;\n\n if (starfieldEffect && starfieldDelta === 3 && this._width < 4) {\n this._renderCounter++;\n }\n\n switch (starfieldDelta) {\n case 3:\n this._effectiveWidth = this._width === 1 ? 2 : this._width;\n break;\n\n case 2:\n this._effectiveWidth = 0;\n break;\n\n default:\n this._effectiveWidth = this._width;\n break;\n }\n } else if (this._rendering && ++this._renderCounter >= (starfieldEffect ? this._effectiveWidth : this._width)) {\n this._rendering = false;\n }\n\n if (++this._counter >= 160) {\n this._counter = 0;\n }\n }\n\n getPixel(colorIn: number): number {\n return this.collision ? colorIn : this.color;\n }\n\n setColor(color: number): void {\n if (color !== this.color && this._enabled) {\n this._flushLineCache();\n }\n\n this.color = color;\n }\n\n color = 0xffffffff;\n collision = 0;\n\n private _enabled = false;\n private _enam = false;\n private _resmp = -1;\n\n private _hmmClocks = 0;\n private _counter = 0;\n private _moving = false;\n private _width = 1;\n private _effectiveWidth = 0;\n private _lastMovementTick = 0;\n\n private _rendering = false;\n private _renderCounter = Count.renderCounterOffset;\n\n private _decodes: Uint8Array;\n private _widths = new Uint8Array([1, 2, 4, 8]);\n}\n\nexport { Missile as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst enum ColorMode {\n normal,\n score\n}\n\nclass Playfield {\n constructor(private _collisionMask: number, private _flushLineCache: () => void) {\n this.reset();\n }\n\n reset() {\n this._pattern = 0;\n this._reflected = false;\n this._refp = false;\n\n this._pf0 = 0;\n this._pf1 = 0;\n this._pf2 = 0;\n\n this._color = 0;\n this._colorP0 = 0;\n this._colorP1 = 0;\n this._colorMode = ColorMode.normal;\n this._applyColors();\n }\n\n pf0(value: number) {\n if (this._pf0 === value >>> 4) {\n return;\n }\n\n this._flushLineCache();\n this._pf0 = value >>> 4;\n\n this._pattern = (this._pattern & 0x000ffff0) | this._pf0;\n }\n\n pf1(value: number) {\n if (this._pf1 === value) {\n return;\n }\n\n this._flushLineCache();\n this._pf1 = value;\n\n this._pattern =\n (this._pattern & 0x000ff00f) |\n ((value & 0x80) >>> 3) |\n ((value & 0x40) >>> 1) |\n ((value & 0x20) << 1) |\n ((value & 0x10) << 3) |\n ((value & 0x08) << 5) |\n ((value & 0x04) << 7) |\n ((value & 0x02) << 9) |\n ((value & 0x01) << 11);\n }\n\n pf2(value: number) {\n if (this._pf2 === value) {\n return;\n }\n\n this._flushLineCache();\n this._pf2 = value;\n\n this._pattern = (this._pattern & 0x00000fff) | ((value & 0xff) << 12);\n }\n\n ctrlpf(value: number): void {\n const reflected = (value & 0x01) > 0,\n colorMode = (value & 0x06) === 0x02 ? ColorMode.score : ColorMode.normal;\n\n if (reflected === this._reflected && colorMode === this._colorMode) {\n return;\n }\n\n this._flushLineCache();\n\n this._reflected = reflected;\n this._colorMode = colorMode;\n\n this._applyColors();\n }\n\n setColor(color: number): void {\n if (color !== this._color && this._colorMode === ColorMode.normal) {\n this._flushLineCache();\n }\n\n this._color = color;\n this._applyColors();\n }\n\n setColorP0(color: number): void {\n if (color !== this._colorP0 && this._colorMode === ColorMode.score) {\n this._flushLineCache();\n }\n\n this._colorP0 = color;\n this._applyColors();\n }\n\n setColorP1(color: number): void {\n if (color !== this._colorP1 && this._colorMode === ColorMode.score) {\n this._flushLineCache();\n }\n\n this._colorP1 = color;\n this._applyColors();\n }\n\n tick(x: number) {\n this._x = x;\n\n if (x === 80 || x === 0) {\n this._refp = this._reflected;\n }\n\n if (x & 0x03) {\n return;\n }\n\n let currentPixel: number;\n\n if (this._pattern === 0) {\n currentPixel = 0;\n } else if (x < 80) {\n currentPixel = this._pattern & (1 << (x >>> 2));\n } else if (this._refp) {\n currentPixel = this._pattern & (1 << (39 - (x >>> 2)));\n } else {\n currentPixel = this._pattern & (1 << ((x >>> 2) - 20));\n }\n\n this.collision = currentPixel ? 0 : this._collisionMask;\n }\n\n getPixel(colorIn: number): number {\n if (!this.collision) {\n return this._x < 80 ? this._colorLeft : this._colorRight;\n }\n\n return colorIn;\n }\n\n private _applyColors(): void {\n switch (this._colorMode) {\n case ColorMode.normal:\n this._colorLeft = this._colorRight = this._color;\n break;\n\n case ColorMode.score:\n this._colorLeft = this._colorP0;\n this._colorRight = this._colorP1;\n break;\n }\n }\n\n collision = 0;\n\n private _colorLeft = 0;\n private _colorRight = 0;\n private _color = 0;\n private _colorP0 = 0;\n private _colorP1 = 0;\n private _colorMode = ColorMode.normal;\n\n private _pattern = 0;\n private _refp = false;\n private _reflected = false;\n\n private _pf0 = 0;\n private _pf1 = 0;\n private _pf2 = 0;\n\n private _x = 0;\n}\n\nexport { Playfield as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { decodesPlayer } from './drawCounterDecodes';\n\nconst enum Count {\n renderCounterOffset = -5\n}\n\nexport default class Player {\n constructor(private _collisionMask: number, private _flushLineCache: () => void) {\n this.reset();\n }\n\n reset(): void {\n this.color = 0xffffffff;\n this.collision = 0;\n this._hmmClocks = 0;\n this._counter = 0;\n this._moving = false;\n this._rendering = false;\n this._renderCounter = Count.renderCounterOffset;\n this._decodes = decodesPlayer[0];\n this._patternNew = 0;\n this._patternOld = 0;\n this._pattern = 0;\n this._reflected = false;\n this._delaying = false;\n this._sampleCounter = 0;\n this._dividerPending = 0;\n this._dividerChangeCounter = -1;\n\n this._setDivider(1);\n }\n\n grp(pattern: number) {\n if (pattern === this._patternNew) {\n return;\n }\n\n this._patternNew = pattern;\n\n if (!this._delaying) {\n this._flushLineCache();\n this._updatePattern();\n }\n }\n\n hmp(value: number): void {\n this._hmmClocks = (value >>> 4) ^ 0x8;\n }\n\n nusiz(value: number, hblank: boolean): void {\n const masked = value & 0x07;\n\n switch (masked) {\n case 5:\n this._dividerPending = 2;\n break;\n\n case 7:\n this._dividerPending = 4;\n break;\n\n default:\n this._dividerPending = 1;\n }\n\n const oldDecodes = this._decodes;\n\n this._decodes = decodesPlayer[masked];\n\n if (\n this._decodes !== oldDecodes &&\n this._rendering &&\n this._renderCounter - Count.renderCounterOffset < 2 &&\n !this._decodes[(this._counter - this._renderCounter + Count.renderCounterOffset + 159) % 160]\n ) {\n this._rendering = false;\n }\n\n if (this._dividerPending === this._divider) {\n return;\n }\n\n if (!this._rendering) {\n this._setDivider(this._dividerPending);\n return;\n }\n\n const delta = this._renderCounter - Count.renderCounterOffset;\n\n switch ((this._divider << 4) | this._dividerPending) {\n case 0x12:\n case 0x14:\n if (hblank) {\n if (delta < 4) {\n this._setDivider(this._dividerPending);\n } else {\n this._dividerChangeCounter = delta < 5 ? 1 : 0;\n }\n } else {\n if (delta < 3) {\n this._setDivider(this._dividerPending);\n } else {\n this._dividerChangeCounter = 1;\n }\n }\n\n break;\n\n case 0x21:\n case 0x41:\n if (delta < (hblank ? 4 : 3)) {\n this._setDivider(this._dividerPending);\n } else if (delta < (hblank ? 6 : 5)) {\n this._setDivider(this._dividerPending);\n this._renderCounter--;\n } else {\n this._dividerChangeCounter = hblank ? 0 : 1;\n }\n\n break;\n\n case 0x42:\n case 0x24:\n if (this._renderCounter < 1 || (hblank && this._renderCounter % this._divider === 1)) {\n this._setDivider(this._dividerPending);\n } else {\n this._dividerChangeCounter = this._divider - (this._renderCounter - 1) % this._divider;\n }\n\n break;\n\n default:\n throw new Error('cannot happen');\n }\n }\n\n resp(counter: number): void {\n this._counter = counter;\n\n if (this._rendering && this._renderCounter - Count.renderCounterOffset < 4) {\n this._renderCounter = Count.renderCounterOffset + (counter - 157);\n }\n }\n\n refp(value: number): void {\n const oldReflected = this._reflected;\n\n this._reflected = (value & 0x08) > 0;\n\n if (this._reflected !== oldReflected) {\n this._flushLineCache();\n this._updatePattern();\n }\n }\n\n vdelp(value: number): void {\n const oldDelaying = this._delaying;\n\n this._delaying = (value & 0x01) > 0;\n\n if (this._delaying !== oldDelaying) {\n this._flushLineCache();\n this._updatePattern();\n }\n }\n\n startMovement(): void {\n this._moving = true;\n }\n\n movementTick(clock: number, apply: boolean): boolean {\n // Stop movement only if the clock matches exactly --- this is crucial for cosmic ark type hacks\n if (clock === this._hmmClocks) {\n this._moving = false;\n }\n\n if (this._moving && apply) {\n this.tick();\n }\n\n return this._moving;\n }\n\n tick(): void {\n this.collision =\n this._rendering &&\n this._renderCounter >= this._renderCounterTripPoint &&\n this._pattern & (1 << this._sampleCounter)\n ? 0\n : this._collisionMask;\n\n if (this._decodes[this._counter]) {\n this._rendering = true;\n this._renderCounter = Count.renderCounterOffset;\n this._sampleCounter = 0;\n } else if (this._rendering) {\n this._renderCounter++;\n\n switch (this._divider) {\n case 1:\n if (this._renderCounter > 0) {\n this._sampleCounter++;\n }\n\n if (\n this._renderCounter >= 0 &&\n this._dividerChangeCounter >= 0 &&\n this._dividerChangeCounter-- === 0\n ) {\n this._setDivider(this._dividerPending);\n }\n\n break;\n\n default:\n if (this._renderCounter > 1 && (this._renderCounter - 1) % this._divider === 0) {\n this._sampleCounter++;\n }\n\n if (\n this._renderCounter > 0 &&\n this._dividerChangeCounter >= 0 &&\n this._dividerChangeCounter-- === 0\n ) {\n this._setDivider(this._dividerPending);\n }\n\n break;\n }\n\n if (this._sampleCounter > 7) {\n this._rendering = false;\n }\n }\n\n if (++this._counter >= 160) {\n this._counter = 0;\n }\n }\n\n getPixel(colorIn: number): number {\n return this.collision ? colorIn : this.color;\n }\n\n shufflePatterns(): void {\n const oldPatternOld = this._patternOld;\n\n this._patternOld = this._patternNew;\n\n if (this._delaying && oldPatternOld !== this._patternOld) {\n this._flushLineCache();\n this._updatePattern();\n }\n }\n\n getRespClock(): number {\n switch (this._divider) {\n case 1:\n return (this._counter - 5 + 160) % 160;\n\n case 2:\n return (this._counter - 9 + 160) % 160;\n\n case 4:\n return (this._counter - 12 + 160) % 160;\n\n default:\n throw new Error(`cannot happen: invalid divider ${this._divider}`);\n }\n }\n\n setColor(color: number): void {\n if (color !== this.color && this._pattern) {\n this._flushLineCache();\n }\n\n this.color = color;\n }\n\n private _updatePattern(): void {\n this._pattern = this._delaying ? this._patternOld : this._patternNew;\n\n if (!this._reflected) {\n this._pattern =\n ((this._pattern & 0x01) << 7) |\n ((this._pattern & 0x02) << 5) |\n ((this._pattern & 0x04) << 3) |\n ((this._pattern & 0x08) << 1) |\n ((this._pattern & 0x10) >>> 1) |\n ((this._pattern & 0x20) >>> 3) |\n ((this._pattern & 0x40) >>> 5) |\n ((this._pattern & 0x80) >>> 7);\n }\n }\n\n private _setDivider(divider: number): void {\n this._divider = divider;\n this._renderCounterTripPoint = divider === 1 ? 0 : 1;\n }\n\n color = 0xffffffff;\n collision = 0;\n\n private _hmmClocks = 0;\n private _counter = 0;\n private _moving = false;\n private _divider = 1;\n private _dividerPending = 1;\n private _dividerChangeCounter = -1;\n private _sampleCounter = 0;\n\n private _rendering = false;\n private _renderCounter = Count.renderCounterOffset;\n private _renderCounterTripPoint = 0;\n\n private _decodes: Uint8Array;\n\n private _patternNew = 0;\n private _patternOld = 0;\n private _pattern = 0;\n\n private _reflected = false;\n private _delaying = false;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst enum Count {\n renderCounterOffset = -4\n}\n\nexport default class Ball {\n constructor(private _collisionMask: number, private _flushLineCache: () => void) {\n this.reset();\n }\n\n reset(): void {\n this.color = 0xffffffff;\n this.collision = 0;\n this._width = 1;\n this._enabledOld = false;\n this._enabledNew = false;\n this._enabled = false;\n this._counter = 0;\n this._rendering = false;\n this._renderCounter = Count.renderCounterOffset;\n this._moving = false;\n this._hmmClocks = 0;\n this._delaying = false;\n this._effectiveWidth = 0;\n this._lastMovementTick = 0;\n }\n\n enabl(value: number): void {\n const enabledNewOldValue = this._enabledNew;\n\n this._enabledNew = (value & 2) > 0;\n\n if (enabledNewOldValue !== this._enabledNew && !this._delaying) {\n this._flushLineCache();\n this._updateEnabled();\n }\n }\n\n hmbl(value: number): void {\n // Shift and flip the highest bit --- this gives us the necessary movement to the right\n this._hmmClocks = (value >>> 4) ^ 0x8;\n }\n\n resbl(counter: number): void {\n this._counter = counter;\n\n this._rendering = true;\n this._renderCounter = Count.renderCounterOffset + (counter - 157);\n }\n\n ctrlpf(value: number): void {\n const width = this._widths[(value & 0x30) >>> 4];\n\n if (width !== this._width) {\n this._flushLineCache();\n }\n\n this._width = width;\n }\n\n vdelbl(value: number): void {\n const oldDelaying = this._delaying;\n\n this._delaying = (value & 0x01) > 0;\n\n if (oldDelaying !== this._delaying) {\n this._flushLineCache();\n this._updateEnabled();\n }\n }\n\n startMovement(): void {\n this._moving = true;\n }\n\n movementTick(clock: number, apply: boolean): boolean {\n this._lastMovementTick = this._counter;\n\n // Stop movement only if the clock matches exactly --- this is crucial for cosmic ark type hacks\n if (clock === this._hmmClocks) {\n this._moving = false;\n }\n\n if (this._moving && apply) {\n this.tick(false);\n }\n\n return this._moving;\n }\n\n tick(isReceivingHclock: boolean): void {\n this.collision = this._rendering && this._renderCounter >= 0 && this._enabled ? 0 : this._collisionMask;\n\n const starfieldEffect = this._moving && isReceivingHclock;\n\n if (this._counter === 156) {\n const starfieldDelta = (this._counter - this._lastMovementTick + 160) % 4;\n\n this._rendering = true;\n this._renderCounter = Count.renderCounterOffset;\n\n if (starfieldEffect && starfieldDelta === 3 && this._width < 4) {\n this._renderCounter++;\n }\n\n switch (starfieldDelta) {\n case 3:\n this._effectiveWidth = this._width === 1 ? 2 : this._width;\n break;\n\n case 2:\n this._effectiveWidth = 0;\n break;\n\n default:\n this._effectiveWidth = this._width;\n break;\n }\n } else if (this._rendering && ++this._renderCounter >= (starfieldEffect ? this._effectiveWidth : this._width)) {\n this._rendering = false;\n }\n\n if (++this._counter >= 160) {\n this._counter = 0;\n }\n }\n\n getPixel(colorIn: number): number {\n return this.collision ? colorIn : this.color;\n }\n\n shuffleStatus(): void {\n const oldEnabledOld = this._enabledOld;\n\n this._enabledOld = this._enabledNew;\n\n if (this._delaying && this._enabledOld !== oldEnabledOld) {\n this._flushLineCache();\n this._updateEnabled();\n }\n }\n\n setColor(color: number): void {\n if (color !== this.color && this._enabled) {\n this._flushLineCache();\n }\n\n this.color = color;\n }\n\n private _updateEnabled(): void {\n this._enabled = this._delaying ? this._enabledOld : this._enabledNew;\n }\n\n color = 0xffffffff;\n collision = 0;\n\n private _enabledOld = false;\n private _enabledNew = false;\n private _enabled = false;\n\n private _hmmClocks = 0;\n private _counter = 0;\n private _moving = false;\n private _width = 1;\n private _effectiveWidth = 0;\n private _lastMovementTick = 0;\n\n private _rendering = false;\n private _renderCounter = Count.renderCounterOffset;\n\n private _widths = new Uint8Array([1, 2, 4, 8]);\n\n private _delaying = false;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SwitchInterface from '../../io/SwitchInterface';\n\nexport default class LatchedInput {\n constructor(private _switch: SwitchInterface) {\n this.reset();\n }\n\n reset(): void {\n this._modeLatched = false;\n this._latchedValue = 0;\n }\n\n vblank(value: number): void {\n if (value & 0x40) {\n this._modeLatched = true;\n } else {\n this._modeLatched = false;\n this._latchedValue = 0x80;\n }\n }\n\n inpt(): number {\n let value = this._switch.read() ? 0 : 0x80;\n\n if (this._modeLatched) {\n this._latchedValue &= value;\n value = this._latchedValue;\n }\n\n return value;\n }\n\n private _modeLatched = false;\n private _latchedValue = 0;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Paddle from '../../io/Paddle';\n\nconst C = 68e-9, // capacitor\n RPOT = 1e6, // total paddle resistance\n R0 = 1.8e3, // series resistor\n U = 5, // supply voltage\n LINES_FULL = 380; // treshold voltage in terms of scanline count\n\nexport default class PaddleReader {\n constructor(clockFreq: number, private _paddle: Paddle) {\n this._uThresh = U * (1 - Math.exp(-LINES_FULL * 228 / clockFreq / (RPOT + R0) / C));\n\n this._paddle.valueChanged.addHandler((value: number) => {\n this._updateValue();\n this._value = value;\n });\n\n this.reset();\n }\n\n setCpuTimeProvider(provider: () => number): void {\n this._cpuTimeProvider = provider;\n this._timestamp = this._cpuTimeProvider();\n }\n\n reset(): void {\n this._u = 0;\n this._value = this._paddle.getValue();\n this._dumped = false;\n this._timestamp = this._cpuTimeProvider ? this._cpuTimeProvider() : 0;\n }\n\n vblank(value: number): void {\n const oldValue = this._dumped;\n\n if (value & 0x80) {\n this._dumped = true;\n this._u = 0;\n } else if (oldValue) {\n this._dumped = false;\n this._timestamp = this._cpuTimeProvider();\n }\n }\n\n inpt(): number {\n this._updateValue();\n\n const state = this._dumped ? false : this._u >= this._uThresh;\n\n return state ? 0x80 : 0;\n }\n\n private _updateValue(): void {\n if (this._dumped) {\n return;\n }\n\n const timestamp = this._cpuTimeProvider();\n\n // Update the voltage with the integral between the two timestamps\n this._u =\n U * (1 - (1 - this._u / U) * Math.exp(-(timestamp - this._timestamp) / (this._value * RPOT + R0) / C));\n\n this._timestamp = timestamp;\n }\n\n private _uThresh = 0;\n private _u = 0;\n private _dumped = false;\n private _value = 0.5;\n private _timestamp = 0;\n\n private _cpuTimeProvider: () => number = null;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport VideoOutputInterface from '../../io/VideoOutputInterface';\nimport RGBASurfaceInterface from '../../../video/surface/RGBASurfaceInterface';\nimport Config from '../Config';\n\nconst enum Metrics {\n vblankNTSC = 40,\n vblankPAL = 48,\n kernelNTSC = 192,\n kernelPAL = 228,\n overscanNTSC = 30,\n overscanPAL = 36,\n vsync = 3,\n visibleOverscan = 20,\n maxUnderscan = 10,\n maxLinesWithoutVsync = 150\n}\n\nconst enum State {\n waitForVsyncStart,\n waitForVsyncEnd,\n waitForFrameStart,\n frame,\n overscan\n}\n\nexport default class FrameManager {\n constructor(private _config: Config) {\n switch (this._config.tvMode) {\n case Config.TvMode.ntsc:\n this._vblankLines = Metrics.vblankNTSC;\n this._kernelLines = Metrics.kernelNTSC;\n this._overscanLines = Metrics.overscanNTSC;\n break;\n\n case Config.TvMode.pal:\n case Config.TvMode.secam:\n this._vblankLines = Metrics.vblankPAL;\n this._kernelLines = Metrics.kernelPAL;\n this._overscanLines = Metrics.overscanPAL;\n break;\n\n default:\n throw new Error(`invalid tv mode ${this._config.tvMode}`);\n }\n\n this._frameStart = this._config.frameStart;\n\n this.reset();\n }\n\n reset(): void {\n this.vblank = false;\n this.surfaceBuffer = null;\n this._linesWithoutVsync = 0;\n this._state = State.waitForVsyncStart;\n this._vsync = false;\n this._lineInState = 0;\n this._surface = null;\n }\n\n nextLine(): void {\n if (!this._surfaceFactory) {\n return;\n }\n\n this._lineInState++;\n\n switch (this._state) {\n case State.waitForVsyncStart:\n case State.waitForVsyncEnd:\n if (++this._linesWithoutVsync > Metrics.maxLinesWithoutVsync) {\n this._setState(State.waitForFrameStart);\n }\n\n break;\n\n case State.waitForFrameStart:\n if (this._frameStart >= 0) {\n if (this._lineInState > this._frameStart) {\n this._startFrame();\n }\n } else {\n if (\n this._lineInState >=\n (this.vblank ? this._vblankLines : this._vblankLines - Metrics.maxUnderscan)\n ) {\n this._startFrame();\n }\n }\n\n break;\n\n case State.frame:\n if (this._lineInState >= this._kernelLines + Metrics.visibleOverscan) {\n this._finalizeFrame();\n }\n break;\n\n case State.overscan:\n if (this._lineInState >= this._overscanLines - Metrics.visibleOverscan) {\n this._setState(State.waitForVsyncStart);\n }\n break;\n }\n }\n\n isRendering(): boolean {\n return this._state === State.frame && !!this._surface;\n }\n\n setVblank(vblank: boolean): void {\n if (this._surfaceFactory) {\n this.vblank = vblank;\n }\n }\n\n setVsync(vsync: boolean): void {\n if (!this._surfaceFactory || vsync === this._vsync) {\n return;\n }\n\n this._vsync = vsync;\n\n switch (this._state) {\n case State.waitForVsyncStart:\n this._linesWithoutVsync = 0;\n case State.waitForFrameStart:\n case State.overscan:\n if (vsync) {\n this._setState(State.waitForVsyncEnd);\n }\n break;\n\n case State.waitForVsyncEnd:\n if (!vsync) {\n this._setState(State.waitForFrameStart);\n }\n break;\n\n case State.frame:\n if (vsync) {\n // State is reset by finalizeFrame\n this._finalizeFrame();\n }\n break;\n }\n }\n\n getHeight(): number {\n return this._kernelLines + Metrics.visibleOverscan;\n }\n\n setSurfaceFactory(factory: VideoOutputInterface.SurfaceFactoryInterface): void {\n this._surfaceFactory = factory;\n }\n\n getCurrentLine(): number {\n return this._state === State.frame ? this._lineInState : 0;\n }\n\n getDebugState(): string {\n return `${this._getReadableState()}, line = ${this._lineInState}, ` + `vblank = ${this.vblank ? '1' : '0'}`;\n }\n\n private _getReadableState(): string {\n switch (this._state) {\n case State.waitForVsyncStart:\n return `wait for vsync start`;\n\n case State.waitForVsyncEnd:\n return `wait for vsync end`;\n\n case State.waitForFrameStart:\n return `wait for frame start`;\n\n case State.frame:\n return `frame`;\n\n case State.overscan:\n return `overscan`;\n }\n }\n\n private _startFrame(): void {\n this._setState(State.frame);\n this._surface = this._surfaceFactory();\n this.surfaceBuffer = this._surface.getBuffer();\n }\n\n private _finalizeFrame(): void {\n if (this._state !== State.frame) {\n throw new Error(`finalize frame in invalid state ${this._state}`);\n }\n\n this.newFrame.dispatch(this._surface);\n this._setState(State.overscan);\n }\n\n private _setState(newState: State) {\n this._state = newState;\n this._lineInState = 0;\n }\n\n newFrame = new Event<RGBASurfaceInterface>();\n\n vblank = false;\n surfaceBuffer: RGBASurfaceInterface.BufferInterface = null;\n\n private _vblankLines = 0;\n private _kernelLines = 0;\n private _overscanLines = 0;\n\n private _linesWithoutVsync = 0;\n private _state = State.waitForVsyncStart;\n\n private _vsync = false;\n private _lineInState = 0;\n\n private _surfaceFactory: VideoOutputInterface.SurfaceFactoryInterface = null;\n private _surface: RGBASurfaceInterface = null;\n\n private _frameStart = -1;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass DelayQueue {\n constructor(private _length: number, size: number) {\n this._queue = new Array<QueueEntry>(this._length);\n\n for (let i = 0; i < this._length; i++) {\n this._queue[i] = new QueueEntry(size);\n }\n }\n\n reset() {\n for (let i = 0; i < this._length; i++) {\n this._queue[i].nextIndex = 0;\n }\n }\n\n push(address: number, value: number, delay: number): this {\n if (delay >= this._length) {\n throw new Error('delay exceeds queue length');\n }\n\n const currentIndex = this._indices[address];\n\n if (currentIndex < this._length) {\n this._queue[currentIndex].remove(address);\n }\n\n const index = (this._nextIndex + delay) % this._length;\n this._queue[index].push(address, value);\n\n this._indices[address] = index;\n\n return this;\n }\n\n execute<T>(handler: (address: number, value: number, scope: T) => void, scope?: T): void {\n const entry = this._queue[this._nextIndex];\n this._nextIndex = (this._nextIndex + 1) % this._length;\n\n for (let i = 0; i < entry.nextIndex; i++) {\n handler(entry.addresses[i], entry.values[i], scope);\n this._indices[entry.addresses[i]] = 0xff;\n }\n\n entry.nextIndex = 0;\n }\n\n private _queue: Array<QueueEntry>;\n private _nextIndex = 0;\n private _indices = new Uint8Array(0xff);\n}\n\nclass QueueEntry {\n constructor(public size: number) {\n this.addresses = new Uint8Array(size);\n this.values = new Uint8Array(size);\n }\n\n push(address: number, value: number): void {\n if (this.nextIndex >= this.size) {\n throw new Error('delay queue overflow');\n }\n\n this.addresses[this.nextIndex] = address;\n this.values[this.nextIndex] = value;\n\n this.nextIndex++;\n }\n\n remove(address: number): void {\n let i: number;\n\n for (i = 0; i < this.nextIndex; i++) {\n if (this.addresses[i] === address) {\n break;\n }\n }\n\n if (i < this.nextIndex) {\n this.addresses[i] = this.addresses[this.nextIndex - 1];\n this.values[i] = this.values[this.nextIndex - 1];\n this.nextIndex--;\n }\n }\n\n addresses: Uint8Array;\n values: Uint8Array;\n nextIndex = 0;\n}\n\nexport { DelayQueue as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport const NTSC = new Uint32Array([\n 0xff000000,\n 0xff4a4a4a,\n 0xff6f6f6f,\n 0xff8e8e8e,\n 0xffaaaaaa,\n 0xffc0c0c0,\n 0xffd6d6d6,\n 0xffececec,\n 0xff004848,\n 0xff0f6969,\n 0xff1d8686,\n 0xff2aa2a2,\n 0xff35bbbb,\n 0xff40d2d2,\n 0xff4ae8e8,\n 0xff54fcfc,\n 0xff002c7c,\n 0xff114890,\n 0xff2162a2,\n 0xff307ab4,\n 0xff3d90c3,\n 0xff4aa4d2,\n 0xff55b7df,\n 0xff60c8ec,\n 0xff001c90,\n 0xff1539a3,\n 0xff2853b5,\n 0xff3a6cc6,\n 0xff4a82d5,\n 0xff5997e3,\n 0xff67aaf0,\n 0xff74bcfc,\n 0xff000094,\n 0xff1a1aa7,\n 0xff3232b8,\n 0xff4848c8,\n 0xff5c5cd6,\n 0xff6f6fe4,\n 0xff8080f0,\n 0xff9090fc,\n 0xff640084,\n 0xff7a1997,\n 0xff8f30a8,\n 0xffa246b8,\n 0xffb359c6,\n 0xffc36cd4,\n 0xffd27ce0,\n 0xffe08cec,\n 0xff840050,\n 0xff9a1968,\n 0xffad307d,\n 0xffc04692,\n 0xffd059a4,\n 0xffe06cb5,\n 0xffee7cc5,\n 0xfffc8cd4,\n 0xff900014,\n 0xffa31a33,\n 0xffb5324e,\n 0xffc64868,\n 0xffd55c7f,\n 0xffe36f95,\n 0xfff080a9,\n 0xfffc90bc,\n 0xff940000,\n 0xffa71a18,\n 0xffb8322d,\n 0xffc84842,\n 0xffd65c54,\n 0xffe46f65,\n 0xfff08075,\n 0xfffc9084,\n 0xff881c00,\n 0xff9d3b18,\n 0xffb0572d,\n 0xffc27242,\n 0xffd28a54,\n 0xffe1a065,\n 0xffefb575,\n 0xfffcc884,\n 0xff643000,\n 0xff805018,\n 0xff986d2d,\n 0xffb08842,\n 0xffc5a054,\n 0xffd9b765,\n 0xffebcc75,\n 0xfffce084,\n 0xff304000,\n 0xff4e6218,\n 0xff69812d,\n 0xff829e42,\n 0xff99b854,\n 0xffaed165,\n 0xffc2e775,\n 0xffd4fc84,\n 0xff004400,\n 0xff1a661a,\n 0xff328432,\n 0xff48a048,\n 0xff5cba5c,\n 0xff6fd26f,\n 0xff80e880,\n 0xff90fc90,\n 0xff003c14,\n 0xff185f35,\n 0xff2d7e52,\n 0xff429c6e,\n 0xff54b787,\n 0xff65d09e,\n 0xff75e7b4,\n 0xff84fcc8,\n 0xff003830,\n 0xff165950,\n 0xff2b766d,\n 0xff3e9288,\n 0xff4faba0,\n 0xff5fc2b7,\n 0xff6ed8cc,\n 0xff7cece0,\n 0xff002c48,\n 0xff144d69,\n 0xff266a86,\n 0xff3886a2,\n 0xff479fbb,\n 0xff56b6d2,\n 0xff63cce8,\n 0xff70e0fc\n]);\n\nexport const PAL = new Uint32Array([\n 0xff000000,\n 0xff2b2b2b,\n 0xff525252,\n 0xff767676,\n 0xff979797,\n 0xffb6b6b6,\n 0xffd2d2d2,\n 0xffececec,\n 0xff000000,\n 0xff2b2b2b,\n 0xff525252,\n 0xff767676,\n 0xff979797,\n 0xffb6b6b6,\n 0xffd2d2d2,\n 0xffececec,\n 0xff005880,\n 0xff1a7196,\n 0xff3287ab,\n 0xff489cbe,\n 0xff5cafcf,\n 0xff6fc0df,\n 0xff80d1ee,\n 0xff90e0fc,\n 0xff005c44,\n 0xff1a795e,\n 0xff329376,\n 0xff48ac8c,\n 0xff5cc2a0,\n 0xff6fd7b3,\n 0xff80eac4,\n 0xff90fcd4,\n 0xff003470,\n 0xff1a5189,\n 0xff326ba0,\n 0xff4884b6,\n 0xff5c9ac9,\n 0xff6fafdc,\n 0xff80c2ec,\n 0xff90d4fc,\n 0xff146400,\n 0xff35801a,\n 0xff529832,\n 0xff6eb048,\n 0xff87c55c,\n 0xff9ed96f,\n 0xffb4eb80,\n 0xffc8fc90,\n 0xff140070,\n 0xff351a89,\n 0xff5232a0,\n 0xff6e48b6,\n 0xff875cc9,\n 0xff9e6fdc,\n 0xffb480ec,\n 0xffc890fc,\n 0xff5c5c00,\n 0xff76761a,\n 0xff8e8e32,\n 0xffa4a448,\n 0xffb8b85c,\n 0xffcbcb6f,\n 0xffdcdc80,\n 0xffecec90,\n 0xff5c0070,\n 0xff741a84,\n 0xff893296,\n 0xff9e48a8,\n 0xffb05cb7,\n 0xffc16fc6,\n 0xffd180d3,\n 0xffe090e0,\n 0xff703c00,\n 0xff895a19,\n 0xffa0752f,\n 0xffb68e44,\n 0xffc9a557,\n 0xffdcba68,\n 0xffecce79,\n 0xfffce088,\n 0xff700058,\n 0xff891a6e,\n 0xffa03283,\n 0xffb64896,\n 0xffc95ca7,\n 0xffdc6fb7,\n 0xffec80c6,\n 0xfffc90d4,\n 0xff702000,\n 0xff893f19,\n 0xffa05a2f,\n 0xffb67444,\n 0xffc98b57,\n 0xffdca168,\n 0xffecb579,\n 0xfffcc888,\n 0xff800034,\n 0xff961a4a,\n 0xffab325f,\n 0xffbe4872,\n 0xffcf5c83,\n 0xffdf6f93,\n 0xffee80a2,\n 0xfffc90b0,\n 0xff880000,\n 0xff9d1a1a,\n 0xffb03232,\n 0xffc24848,\n 0xffd25c5c,\n 0xffe16f6f,\n 0xffef8080,\n 0xfffc9090,\n 0xff000000,\n 0xff2b2b2b,\n 0xff525252,\n 0xff767676,\n 0xff979797,\n 0xffb6b6b6,\n 0xffd2d2d2,\n 0xffececec,\n 0xff000000,\n 0xff2b2b2b,\n 0xff525252,\n 0xff767676,\n 0xff979797,\n 0xffb6b6b6,\n 0xffd2d2d2,\n 0xffececec\n]);\n\nexport const SECAM = new Uint32Array([\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff,\n 0xff000000,\n 0xffff2121,\n 0xff793cf0,\n 0xffff50ff,\n 0xff00ff7f,\n 0xffffff7f,\n 0xff3fffff,\n 0xffffffff\n]);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport VideoOutputInterface from '../../io/VideoOutputInterface';\nimport WaveformAudioOutputInterface from '../../io/WaveformAudioOutputInterface';\nimport PCMAudioOutputInterface from '../../io/PCMAudioOutputInterface';\nimport DigitalJoystickInterface from '../../io/DigitalJoystickInterface';\nimport RGBASurfaceInterface from '../../../video/surface/RGBASurfaceInterface';\nimport Config from '../Config';\nimport CpuInterface from '../../cpu/CpuInterface';\nimport WaveformAudio from './WaveformAudio';\nimport PCMAudio from './PCMAudio';\nimport AudioInterface from './AudioInterface';\nimport Paddle from '../../io/Paddle';\nimport Bus from '../Bus';\n\nimport Missile from './Missile';\nimport Playfield from './Playfield';\nimport Player from './Player';\nimport Ball from './Ball';\nimport LatchedInput from './LatchedInput';\nimport PaddleReader from './PaddleReader';\nimport FrameManager from './FrameManager';\nimport DelayQueue from './DelayQueue';\nimport * as palette from './palette';\n\nconst enum Metrics {\n frameLinesPAL = 312,\n frameLinesNTSC = 262\n}\n\nconst enum Delay {\n hmove = 6,\n pf = 2,\n grp = 1,\n shufflePlayer = 1,\n shuffleBall = 1,\n hmp = 2,\n hmm = 2,\n hmbl = 2,\n hmclr = 2,\n refp = 1,\n vblank = 1,\n enabl = 1,\n enam = 1\n}\n\nconst enum ResxCounter {\n hblank = 159,\n lateHblank = 158,\n frame = 157,\n // This parameter still has room for tuning. If we go lower than 73, long005 will show\n // a slight artifact (still have to crosscheck on real hardware), if we go lower than\n // 70, the G.I. Joe will show an artifact (hole in roof).\n lateHblankThreshold = 73\n}\n\n// Each bit in the collision mask identifies a single collision pair\nconst enum CollisionMask {\n player0 = 0b0111110000000000,\n player1 = 0b0100001111000000,\n missile0 = 0b0010001000111000,\n missile1 = 0b0001000100100110,\n ball = 0b0000100010010101,\n playfield = 0b0000010001001011\n}\n\nconst enum HState {\n blank,\n frame\n}\nconst enum Priority {\n normal,\n pfp,\n score\n}\n\nclass Tia implements VideoOutputInterface {\n constructor(\n private _config: Config,\n joystick0: DigitalJoystickInterface,\n joystick1: DigitalJoystickInterface,\n paddles: Array<Paddle>\n ) {\n this._frameManager = new FrameManager(this._config);\n this._frameManager.newFrame.addHandler(Tia._onNewFrame, this);\n\n this._palette = this._getPalette(this._config);\n this._input0 = new LatchedInput(joystick0.getFire());\n this._input1 = new LatchedInput(joystick1.getFire());\n\n this._pcmAudio = new PCMAudio(this._config);\n const pcmChannels = this._pcmAudio.getChannels();\n\n for (let i = 0; i < 2; i++) {\n this._waveformAudio[i] = new WaveformAudio(this._config);\n\n this._audio[i] = this._config.pcmAudio ? pcmChannels[i] : this._waveformAudio[i];\n }\n\n const clockFreq = this._getClockFreq(this._config);\n\n this._paddles = new Array(4);\n for (let i = 0; i < 4; i++) {\n this._paddles[i] = new PaddleReader(clockFreq, paddles[i]);\n }\n\n this.reset();\n }\n\n reset(): void {\n this._hctr = 0;\n this._movementInProgress = false;\n this._extendedHblank = false;\n this._movementClock = 0;\n this._priority = Priority.normal;\n this._hstate = HState.blank;\n this._collisionMask = 0;\n this._colorBk = 0xff000000;\n this._linesSinceChange = 0;\n this._collisionUpdateRequired = false;\n this._maxLinesTotal = 0;\n this._xDelta = 0;\n\n this._delayQueue.reset();\n this._frameManager.reset();\n\n this._missile0.reset();\n this._missile1.reset();\n this._player0.reset();\n this._player1.reset();\n this._playfield.reset();\n this._ball.reset();\n\n this._audio[0].reset();\n this._audio[1].reset();\n\n this._input0.reset();\n this._input1.reset();\n\n for (let i = 0; i < 4; i++) {\n this._paddles[i].reset();\n }\n\n if (this._cpu) {\n this._cpu.resume();\n }\n }\n\n setCpu(cpu: CpuInterface): Tia {\n this._cpu = cpu;\n\n return this;\n }\n\n setCpuTimeProvider(provider: () => number): this {\n for (let i = 0; i < 4; i++) {\n this._paddles[i].setCpuTimeProvider(provider);\n }\n\n return this;\n }\n\n getWidth(): number {\n return 160;\n }\n\n getHeight(): number {\n return this._frameManager.getHeight();\n }\n\n setSurfaceFactory(factory: VideoOutputInterface.SurfaceFactoryInterface): Tia {\n this._frameManager.setSurfaceFactory(factory);\n\n return this;\n }\n\n getWaveformChannel(i: number): WaveformAudioOutputInterface {\n return this._waveformAudio[i];\n }\n\n getPCMChannel(): PCMAudioOutputInterface {\n return this._pcmAudio;\n }\n\n setAudioEnabled(state: boolean): void {\n this._audio[0].setActive(state && this._config.enableAudio);\n this._audio[1].setActive(state && this._config.enableAudio);\n }\n\n read(address: number): number {\n const lastDataBusValue = this._bus.getLastDataBusValue();\n\n let result: number;\n\n // Only keep the lowest four bits\n switch (address & 0x0f) {\n case Tia.Registers.inpt0:\n result = (this._config.emulatePaddles ? this._paddles[0].inpt() : 0) | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.inpt1:\n result = (this._config.emulatePaddles ? this._paddles[1].inpt() : 0) | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.inpt2:\n result = (this._config.emulatePaddles ? this._paddles[2].inpt() : 0) | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.inpt3:\n result = (this._config.emulatePaddles ? this._paddles[3].inpt() : 0) | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.inpt4:\n result = this._input0.inpt() | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.inpt5:\n result = this._input1.inpt() | (lastDataBusValue & 0x40);\n break;\n\n case Tia.Registers.cxm0p:\n result =\n (this._collisionMask & CollisionMask.missile0 & CollisionMask.player0 ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.missile0 & CollisionMask.player1 ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxm1p:\n result =\n (this._collisionMask & CollisionMask.missile1 & CollisionMask.player1 ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.missile1 & CollisionMask.player0 ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxp0fb:\n result =\n (this._collisionMask & CollisionMask.player0 & CollisionMask.ball ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.player0 & CollisionMask.playfield ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxp1fb:\n result =\n (this._collisionMask & CollisionMask.player1 & CollisionMask.ball ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.player1 & CollisionMask.playfield ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxm0fb:\n result =\n (this._collisionMask & CollisionMask.missile0 & CollisionMask.ball ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.missile0 & CollisionMask.playfield ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxm1fb:\n result =\n (this._collisionMask & CollisionMask.missile1 & CollisionMask.ball ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.missile1 & CollisionMask.playfield ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxppmm:\n result =\n (this._collisionMask & CollisionMask.missile0 & CollisionMask.missile1 ? 0x40 : 0) |\n (this._collisionMask & CollisionMask.player0 & CollisionMask.player1 ? 0x80 : 0);\n break;\n\n case Tia.Registers.cxblpf:\n result = this._collisionMask & CollisionMask.ball & CollisionMask.playfield ? 0x80 : 0;\n break;\n\n default:\n result = 0;\n break;\n }\n\n return (result & 0xc0) | (lastDataBusValue & 0x3f);\n }\n\n peek(address: number): number {\n return this.read(address);\n }\n\n write(address: number, value: number): void {\n let v = 0;\n\n // Mask out A6 - A15\n switch (address & 0x3f) {\n case Tia.Registers.wsync:\n this._cpu.halt();\n break;\n\n case Tia.Registers.rsync:\n this._flushLineCache();\n this._rsync();\n break;\n\n case Tia.Registers.vsync:\n this._frameManager.setVsync((value & 0x02) > 0);\n break;\n\n case Tia.Registers.vblank:\n this._input0.vblank(value);\n this._input1.vblank(value);\n\n for (let i = 0; i < 4; i++) {\n this._paddles[i].vblank(value);\n }\n\n this._delayQueue.push(Tia.Registers.vblank, value, Delay.vblank);\n break;\n\n case Tia.Registers.enam0:\n this._delayQueue.push(Tia.Registers.enam0, value, Delay.enam);\n break;\n\n case Tia.Registers.enam1:\n this._delayQueue.push(Tia.Registers.enam1, value, Delay.enam);\n break;\n\n case Tia.Registers.hmm0:\n this._delayQueue.push(Tia.Registers.hmm0, value, Delay.hmm);\n break;\n\n case Tia.Registers.hmm1:\n this._delayQueue.push(Tia.Registers.hmm1, value, Delay.hmm);\n break;\n\n case Tia.Registers.resm0:\n this._flushLineCache();\n this._missile0.resm(this._resxCounter(), this._hstate === HState.blank);\n break;\n\n case Tia.Registers.resm1:\n this._flushLineCache();\n this._missile1.resm(this._resxCounter(), this._hstate === HState.blank);\n break;\n\n case Tia.Registers.resmp0:\n this._missile0.resmp(value, this._player0);\n break;\n\n case Tia.Registers.resmp1:\n this._missile1.resmp(value, this._player1);\n break;\n\n case Tia.Registers.hmclr:\n this._delayQueue.push(Tia.Registers.hmclr, value, Delay.hmclr);\n break;\n\n case Tia.Registers.nusiz0:\n this._flushLineCache();\n this._missile0.nusiz(value);\n this._player0.nusiz(value, this._hstate === HState.blank);\n break;\n\n case Tia.Registers.nusiz1:\n this._flushLineCache();\n this._missile1.nusiz(value);\n this._player1.nusiz(value, this._hstate === HState.blank);\n break;\n\n case Tia.Registers.hmove:\n this._delayQueue.push(Tia.Registers.hmove, value, Delay.hmove);\n break;\n\n case Tia.Registers.colubk:\n this._flushLineCache();\n this._colorBk = this._palette[(value & 0xff) >>> 1];\n break;\n\n case Tia.Registers.colup0:\n v = this._palette[(value & 0xff) >>> 1];\n this._missile0.setColor(v);\n this._player0.setColor(v);\n this._playfield.setColorP0(v);\n\n break;\n\n case Tia.Registers.colup1:\n v = this._palette[(value & 0xff) >>> 1];\n this._missile1.setColor(v);\n this._player1.setColor(v);\n this._playfield.setColorP1(v);\n\n break;\n\n case Tia.Registers.pf0:\n this._delayQueue.push(Tia.Registers.pf0, value, Delay.pf);\n break;\n\n case Tia.Registers.pf1:\n this._delayQueue.push(Tia.Registers.pf1, value, Delay.pf);\n break;\n\n case Tia.Registers.pf2:\n this._delayQueue.push(Tia.Registers.pf2, value, Delay.pf);\n break;\n\n case Tia.Registers.ctrlpf:\n this._setPriority(value);\n this._playfield.ctrlpf(value);\n this._ball.ctrlpf(value);\n break;\n\n case Tia.Registers.colupf:\n this._flushLineCache();\n v = this._palette[(value & 0xff) >>> 1];\n this._playfield.setColor(v);\n this._ball.color = v;\n break;\n\n case Tia.Registers.grp0:\n this._delayQueue\n .push(Tia.Registers.grp0, value, Delay.grp)\n .push(Tia.Registers._shuffleP1, 0, Delay.shufflePlayer);\n\n break;\n\n case Tia.Registers.grp1:\n this._delayQueue\n .push(Tia.Registers.grp1, value, Delay.grp)\n .push(Tia.Registers._shuffleP0, 0, Delay.shufflePlayer)\n .push(Tia.Registers._shuffleBL, 0, Delay.shuffleBall);\n\n break;\n\n case Tia.Registers.resp0:\n this._flushLineCache();\n this._player0.resp(this._resxCounter());\n break;\n\n case Tia.Registers.resp1:\n this._flushLineCache();\n this._player1.resp(this._resxCounter());\n break;\n\n case Tia.Registers.refp0:\n this._delayQueue.push(Tia.Registers.refp0, value, Delay.refp);\n break;\n\n case Tia.Registers.refp1:\n this._delayQueue.push(Tia.Registers.refp1, value, Delay.refp);\n break;\n\n case Tia.Registers.hmp0:\n this._delayQueue.push(Tia.Registers.hmp0, value, Delay.hmp);\n break;\n\n case Tia.Registers.hmp1:\n this._delayQueue.push(Tia.Registers.hmp1, value, Delay.hmp);\n break;\n\n case Tia.Registers.vdelp0:\n this._player0.vdelp(value);\n break;\n\n case Tia.Registers.vdelp1:\n this._player1.vdelp(value);\n break;\n\n case Tia.Registers.enabl:\n this._delayQueue.push(Tia.Registers.enabl, value, Delay.enabl);\n break;\n\n case Tia.Registers.hmbl:\n this._delayQueue.push(Tia.Registers.hmbl, value, Delay.hmbl);\n break;\n\n case Tia.Registers.resbl:\n this._flushLineCache();\n this._ball.resbl(this._resxCounter());\n break;\n\n case Tia.Registers.vdelbl:\n this._ball.vdelbl(value);\n break;\n\n case Tia.Registers.cxclr:\n this._flushLineCache();\n this._collisionMask = 0;\n break;\n\n case Tia.Registers.audc0:\n this._audio[0].audc(value);\n break;\n\n case Tia.Registers.audc1:\n this._audio[1].audc(value);\n break;\n\n case Tia.Registers.audf0:\n this._audio[0].audf(value);\n break;\n\n case Tia.Registers.audf1:\n this._audio[1].audf(value);\n break;\n\n case Tia.Registers.audv0:\n this._audio[0].audv(value);\n break;\n\n case Tia.Registers.audv1:\n this._audio[1].audv(value);\n break;\n }\n }\n\n getDebugState(): string {\n return (\n '' +\n `hclock: ${this._hctr} line: ${this._frameManager.getCurrentLine()}\\n` +\n this._frameManager.getDebugState()\n );\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n cycle(): void {\n this._delayQueue.execute(Tia._delayedWrite, this);\n\n this._collisionUpdateRequired = false;\n\n if (this._linesSinceChange < 2) {\n this._tickMovement();\n\n if (this._hstate === HState.blank) {\n this._tickHblank();\n } else {\n this._tickHframe();\n }\n\n if (this._collisionUpdateRequired && !this._frameManager.vblank) {\n this._updateCollision();\n }\n } else {\n if (this._hctr === 0) {\n this._cpu.resume();\n }\n }\n\n if (++this._hctr >= 228) {\n this._nextLine();\n }\n\n if (this._config.pcmAudio) {\n this._pcmAudio.tick();\n }\n }\n\n private static _delayedWrite(address: number, value: number, self: Tia): void {\n switch (address) {\n case Tia.Registers.vblank:\n self._flushLineCache();\n self._frameManager.setVblank((value & 0x02) > 0);\n break;\n\n case Tia.Registers.hmove:\n self._flushLineCache();\n\n // Start the timer and increase hblank\n self._movementClock = 0;\n self._movementInProgress = true;\n\n if (!self._extendedHblank) {\n self._clearHmoveComb();\n self._extendedHblank = true;\n }\n\n // Start sprite movement\n self._missile0.startMovement();\n self._missile1.startMovement();\n self._player0.startMovement();\n self._player1.startMovement();\n self._ball.startMovement();\n\n break;\n\n case Tia.Registers.pf0:\n self._playfield.pf0(value);\n break;\n\n case Tia.Registers.pf1:\n self._playfield.pf1(value);\n break;\n\n case Tia.Registers.pf2:\n self._playfield.pf2(value);\n break;\n\n case Tia.Registers.grp0:\n self._player0.grp(value);\n break;\n\n case Tia.Registers.grp1:\n self._player1.grp(value);\n break;\n\n case Tia.Registers._shuffleP0:\n self._player0.shufflePatterns();\n break;\n\n case Tia.Registers._shuffleP1:\n self._player1.shufflePatterns();\n break;\n\n case Tia.Registers.hmp0:\n self._player0.hmp(value);\n break;\n\n case Tia.Registers.hmp1:\n self._player1.hmp(value);\n break;\n\n case Tia.Registers.hmm0:\n self._missile0.hmm(value);\n break;\n\n case Tia.Registers.hmm1:\n self._missile1.hmm(value);\n break;\n\n case Tia.Registers.hmbl:\n self._ball.hmbl(value);\n break;\n\n case Tia.Registers.hmclr:\n self._missile0.hmm(0);\n self._missile1.hmm(0);\n self._player0.hmp(0);\n self._player1.hmp(0);\n self._ball.hmbl(0);\n break;\n\n case Tia.Registers.refp0:\n self._player0.refp(value);\n break;\n\n case Tia.Registers.refp1:\n self._player1.refp(value);\n break;\n\n case Tia.Registers._shuffleBL:\n self._ball.shuffleStatus();\n break;\n\n case Tia.Registers.enabl:\n self._ball.enabl(value);\n break;\n\n case Tia.Registers.enam0:\n self._missile0.enam(value);\n break;\n\n case Tia.Registers.enam1:\n self._missile1.enam(value);\n break;\n }\n }\n\n private static _onNewFrame(surface: RGBASurfaceInterface, self: Tia): void {\n const linesTotal = self._frameManager.getCurrentLine();\n\n if (linesTotal > self._maxLinesTotal) {\n self._maxLinesTotal = linesTotal;\n }\n\n if (linesTotal < self._maxLinesTotal) {\n const buffer = surface.getBuffer(),\n base = 160 * linesTotal,\n boundary = self._maxLinesTotal * 160;\n\n for (let i = base; i < boundary; i++) {\n buffer[i] = 0xff000000;\n }\n }\n\n self.newFrame.dispatch(surface);\n }\n\n private _tickMovement(): void {\n if (!this._movementInProgress) {\n return;\n }\n\n // color clock mod 4\n if ((this._hctr & 0x3) === 0) {\n // The tick is only propagated to the sprite counters if we are in blank\n // mode --- in frame mode, it overlaps with the sprite clock and is gobbled.\n const apply = this._hstate === HState.blank;\n\n // did any sprite receive the clock?\n let m = false;\n\n const movementCounter = this._movementClock > 15 ? 0 : this._movementClock;\n\n m = this._missile0.movementTick(movementCounter, apply) || m;\n m = this._missile1.movementTick(movementCounter, apply) || m;\n m = this._player0.movementTick(movementCounter, apply) || m;\n m = this._player1.movementTick(movementCounter, apply) || m;\n m = this._ball.movementTick(movementCounter, apply) || m;\n\n // stop collision counter if all latches were cleared\n this._movementInProgress = m;\n\n // the collision latches must be updated if any sprite received a tick\n this._collisionUpdateRequired = m;\n\n this._movementClock++;\n }\n }\n\n private _tickHblank() {\n switch (this._hctr) {\n case 0:\n this._extendedHblank = false;\n this._cpu.resume();\n break;\n\n case 67:\n if (!this._extendedHblank) {\n this._hstate = HState.frame;\n }\n\n break;\n\n case 75:\n if (this._extendedHblank) {\n this._hstate = HState.frame;\n }\n\n break;\n }\n\n if (this._extendedHblank && this._hctr > 67) {\n this._playfield.tick(this._hctr - 68 + this._xDelta);\n }\n }\n\n private _tickHframe() {\n const y = this._frameManager.getCurrentLine(),\n x = this._hctr - 68 + this._xDelta;\n\n // collision latches must be updated if we cannot use cached line daa\n this._collisionUpdateRequired = true;\n\n // The playfield does not have its own counter and must be cycled before rendering the sprites.\n this._playfield.tick(x);\n\n // spin sprite timers\n this._tickSprites();\n\n // render pixel data\n if (this._frameManager.isRendering()) {\n this._renderPixel(x, y);\n }\n }\n\n private _tickSprites() {\n this._missile0.tick(true);\n this._missile1.tick(true);\n this._player0.tick();\n this._player1.tick();\n this._ball.tick(true);\n }\n\n private _nextLine() {\n if (this._linesSinceChange >= 2) {\n this._cloneLastLine();\n }\n\n // Reset the counters\n this._hctr = 0;\n\n this._playfield.tick(0);\n\n if (!this._movementInProgress) {\n this._linesSinceChange++;\n }\n\n this._hstate = HState.blank;\n this._xDelta = 0;\n\n this._frameManager.nextLine();\n\n if (this._frameManager.isRendering() && this._frameManager.getCurrentLine() === 0) {\n this._flushLineCache();\n }\n }\n\n private _cloneLastLine(): void {\n const y = this._frameManager.getCurrentLine();\n\n if (!this._frameManager.isRendering() || y === 0) {\n return;\n }\n\n const delta = y * 160,\n prevDelta = (y - 1) * 160;\n\n for (let x = 0; x < 160; x++) {\n this._frameManager.surfaceBuffer[delta + x] = this._frameManager.surfaceBuffer[prevDelta + x];\n }\n }\n\n private _getPalette(config: Config) {\n switch (config.tvMode) {\n case Config.TvMode.ntsc:\n return palette.NTSC;\n\n case Config.TvMode.pal:\n return palette.PAL;\n\n case Config.TvMode.secam:\n return palette.SECAM;\n\n default:\n throw new Error('invalid TV mode');\n }\n }\n\n private _getClockFreq(config: Config) {\n return config.tvMode === Config.TvMode.ntsc\n ? 60 * 228 * Metrics.frameLinesNTSC\n : 50 * 228 * Metrics.frameLinesPAL;\n }\n\n private _renderPixel(x: number, y: number): void {\n if (this._frameManager.vblank) {\n this._frameManager.surfaceBuffer[y * 160 + x] = 0xff000000;\n return;\n }\n\n let color = this._colorBk;\n\n switch (this._priority) {\n case Priority.normal:\n color = this._playfield.getPixel(color);\n color = this._ball.getPixel(color);\n color = this._missile1.getPixel(color);\n color = this._player1.getPixel(color);\n color = this._missile0.getPixel(color);\n color = this._player0.getPixel(color);\n break;\n\n case Priority.pfp:\n color = this._missile1.getPixel(color);\n color = this._player1.getPixel(color);\n color = this._missile0.getPixel(color);\n color = this._player0.getPixel(color);\n color = this._playfield.getPixel(color);\n color = this._ball.getPixel(color);\n break;\n\n case Priority.score:\n color = this._ball.getPixel(color);\n color = this._missile1.getPixel(color);\n color = this._player1.getPixel(color);\n color = this._playfield.getPixel(color);\n color = this._missile0.getPixel(color);\n color = this._player0.getPixel(color);\n break;\n\n default:\n throw new Error('invalid priority');\n }\n\n this._frameManager.surfaceBuffer[y * 160 + x] = color;\n }\n\n private _updateCollision() {\n this._collisionMask |=\n ~this._player0.collision &\n ~this._player1.collision &\n ~this._missile0.collision &\n ~this._missile1.collision &\n ~this._ball.collision &\n ~this._playfield.collision;\n }\n\n private _clearHmoveComb(): void {\n if (this._frameManager.isRendering() && this._hstate === HState.blank) {\n const offset = this._frameManager.getCurrentLine() * 160;\n\n for (let i = 0; i < 8; i++) {\n this._frameManager.surfaceBuffer[offset + i] = 0xff000000;\n }\n }\n }\n\n private _resxCounter(): number {\n return this._hstate === HState.blank\n ? this._hctr >= ResxCounter.lateHblankThreshold\n ? ResxCounter.lateHblank\n : ResxCounter.hblank\n : ResxCounter.frame;\n }\n\n private _rsync(): void {\n const x = this._hctr > 68 ? this._hctr - 68 : 0;\n\n this._xDelta = 157 - x;\n\n if (this._frameManager.isRendering()) {\n const y = this._frameManager.getCurrentLine(),\n base = y * 160 + x,\n boundary = base + (y + 1) * 160;\n\n for (let i = base; i < boundary; i++) {\n this._frameManager.surfaceBuffer[i] = 0xff000000;\n }\n }\n\n this._hctr = 225;\n }\n\n private _setPriority(value: number): void {\n const priority = value & 0x04 ? Priority.pfp : value & 0x02 ? Priority.score : Priority.normal;\n\n if (priority !== this._priority) {\n this._flushLineCache();\n this._priority = priority;\n }\n }\n\n private _flushLineCache(): void {\n const wasCaching = this._linesSinceChange >= 2;\n\n this._linesSinceChange = 0;\n\n if (wasCaching) {\n const rewindCycles = this._hctr;\n\n for (this._hctr = 0; this._hctr < rewindCycles; this._hctr++) {\n if (this._hstate === HState.blank) {\n this._tickHblank();\n } else {\n this._tickHframe();\n }\n }\n }\n }\n\n newFrame = new Event<RGBASurfaceInterface>();\n\n trap = new Event<Tia.TrapPayload>();\n\n private _cpu: CpuInterface = null;\n private _bus: Bus = null;\n\n private _frameManager: FrameManager;\n private _delayQueue = new DelayQueue(10, 20);\n\n private _palette: Uint32Array;\n\n private _hstate = HState.blank;\n\n // hclock counter\n private _hctr = 0;\n // collision latch update required?\n private _collisionUpdateRequired = false;\n // Count the extra clocks triggered by move\n private _movementClock = 0;\n // Is the movement clock active and shoud pulse?\n private _movementInProgress = false;\n // do we have an extended hblank triggered by hmove?\n private _extendedHblank = false;\n // Delta during x calculation. Can become temporarily nonzero aftern a rsync.\n private _xDelta = 0;\n\n // Lines since the last cache-invalidating change. If this is > 1 we can safely use the linecache\n private _linesSinceChange = 0;\n\n // Max total lines. Used to clear garbage lines.\n private _maxLinesTotal = 0;\n\n private _colorBk = 0xff000000;\n private _priority = Priority.normal;\n // bitfield with collision latches\n private _collisionMask = 0;\n\n private _player0 = new Player(CollisionMask.player0, () => this._flushLineCache());\n private _player1 = new Player(CollisionMask.player1, () => this._flushLineCache());\n private _missile0 = new Missile(CollisionMask.missile0, () => this._flushLineCache());\n private _missile1 = new Missile(CollisionMask.missile1, () => this._flushLineCache());\n private _playfield = new Playfield(CollisionMask.playfield, () => this._flushLineCache());\n private _ball = new Ball(CollisionMask.ball, () => this._flushLineCache());\n\n private _waveformAudio = new Array<WaveformAudio>(2);\n private _pcmAudio: PCMAudio = null;\n private _audio = new Array<AudioInterface>(2);\n\n private _input0: LatchedInput;\n private _input1: LatchedInput;\n\n private _paddles: Array<PaddleReader>;\n}\n\nnamespace Tia {\n export const enum Registers {\n vsync = 0x00,\n vblank = 0x01,\n wsync = 0x02,\n rsync = 0x03,\n nusiz0 = 0x04,\n nusiz1 = 0x05,\n colup0 = 0x06,\n colup1 = 0x07,\n colupf = 0x08,\n colubk = 0x09,\n ctrlpf = 0x0a,\n refp0 = 0x0b,\n refp1 = 0x0c,\n pf0 = 0x0d,\n pf1 = 0x0e,\n pf2 = 0x0f,\n resp0 = 0x10,\n resp1 = 0x11,\n resm0 = 0x12,\n resm1 = 0x13,\n resbl = 0x14,\n audc0 = 0x15,\n audc1 = 0x16,\n audf0 = 0x17,\n audf1 = 0x18,\n audv0 = 0x19,\n audv1 = 0x1a,\n grp0 = 0x1b,\n grp1 = 0x1c,\n enam0 = 0x1d,\n enam1 = 0x1e,\n enabl = 0x1f,\n hmp0 = 0x20,\n hmp1 = 0x21,\n hmm0 = 0x22,\n hmm1 = 0x23,\n hmbl = 0x24,\n vdelp0 = 0x25,\n vdelp1 = 0x26,\n vdelbl = 0x27,\n resmp0 = 0x28,\n resmp1 = 0x29,\n hmove = 0x2a,\n hmclr = 0x2b,\n cxclr = 0x2c,\n cxm0p = 0x00,\n cxm1p = 0x01,\n cxp0fb = 0x02,\n cxp1fb = 0x03,\n cxm0fb = 0x04,\n cxm1fb = 0x05,\n cxblpf = 0x06,\n cxppmm = 0x07,\n inpt0 = 0x08,\n inpt1 = 0x09,\n inpt2 = 0x0a,\n inpt3 = 0x0b,\n inpt4 = 0x0c,\n inpt5 = 0x0d,\n\n // These \"registers\" are not exposed to the system and only used in delaying\n // internal processes.\n _shuffleP0 = 0xf0,\n _shuffleP1 = 0xf1,\n _shuffleBL = 0xf2\n }\n\n export const enum TrapReason {\n invalidRead,\n invalidWrite\n }\n\n export class TrapPayload {\n constructor(public reason: TrapReason, public tia: Tia, public message?: string) {}\n }\n}\n\nexport { Tia as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport SwitchInterface from './SwitchInterface';\n\nexport default class Switch implements SwitchInterface {\n constructor(private _state: boolean = false) {}\n\n read(): boolean {\n this.beforeRead.dispatch(this);\n return this._state;\n }\n\n peek(): boolean {\n return this._state;\n }\n\n toggle(state: boolean): void {\n if (this._state === state) {\n return;\n }\n\n this._state = state;\n this.stateChanged.dispatch(state);\n }\n\n stateChanged = new Event<boolean>();\n beforeRead = new Event<this>();\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Switch from '../io/Switch';\nimport SwitchInterface from '../io/SwitchInterface';\nimport ControlPanelInterface from './ControlPanelInterface';\n\nclass ControlPanel implements ControlPanelInterface {\n getSelectSwitch(): SwitchInterface {\n return this._selectSwitch;\n }\n\n getResetButton(): SwitchInterface {\n return this._resetButton;\n }\n\n getColorSwitch(): SwitchInterface {\n return this._colorSwitch;\n }\n\n getDifficultySwitchP0(): SwitchInterface {\n return this._difficutlyP0;\n }\n\n getDifficultySwitchP1(): SwitchInterface {\n return this._difficutlyP1;\n }\n\n private _selectSwitch = new Switch();\n private _resetButton = new Switch();\n private _colorSwitch = new Switch();\n private _difficutlyP0 = new Switch();\n private _difficutlyP1 = new Switch();\n}\n\nexport { ControlPanel as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport DigitalJoystickInterface from './DigitalJoystickInterface';\nimport Switch from './Switch';\nimport SwitchInterface from './SwitchInterface';\n\nexport default class DigitalJoystick implements DigitalJoystickInterface {\n getLeft(): SwitchInterface {\n return this._left;\n }\n\n getRight(): SwitchInterface {\n return this._right;\n }\n\n getUp(): SwitchInterface {\n return this._up;\n }\n\n getDown(): SwitchInterface {\n return this._down;\n }\n\n getFire(): SwitchInterface {\n return this._fire;\n }\n\n private _left = new Switch();\n private _right = new Switch();\n private _up = new Switch();\n private _down = new Switch();\n\n private _fire = new Switch();\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport Switch from './Switch';\nimport PaddleInterface from './PaddleInterface';\n\nexport default class Paddle implements PaddleInterface {\n setValue(value: number): void {\n this._value = value;\n this.valueChanged.dispatch(value);\n }\n\n getValue(): number {\n return this._value;\n }\n\n getFire(): Switch {\n return this._fireSwitch;\n }\n\n valueChanged = new Event<number>();\n\n protected _fireSwitch = new Switch();\n protected _value = 0.5;\n}\n","// A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","export default {};\n","/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { EventInterface } from 'microevent.ts';\n\nimport CartridgeInfo from './CartridgeInfo';\nimport Cpuinterface from '../../cpu/CpuInterface';\nimport BusInterface from '../../bus/BusInterface';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\ninterface CartridgeInterface {\n init(): Promise<void>;\n\n reset(): void;\n\n read(address: number): number;\n\n peek(address: number): number;\n\n write(address: number, value: number): void;\n\n getType(): CartridgeInfo.CartridgeType;\n\n setCpu(cpu: Cpuinterface): this;\n\n setBus(bus: BusInterface): this;\n\n setRng(rng: RngInterface): this;\n\n setCpuTimeProvider(provider: () => number): this;\n\n notifyCpuCycleComplete(): void;\n\n randomize(rng: RngInterface): void;\n\n trap: EventInterface<CartridgeInterface.TrapPayload>;\n}\n\nnamespace CartridgeInterface {\n export const enum TrapReason {\n invalidRead,\n invalidWrite,\n other\n }\n\n export class TrapPayload {\n constructor(public reason: TrapReason, public cartridge: CartridgeInterface, public message?: string) { }\n }\n}\n\nexport { CartridgeInterface as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nnamespace CartridgeInfo {\n export enum CartridgeType {\n vanilla_2k = 'vanilla_2k',\n vanilla_4k = 'vanilla_4k',\n\n bankswitch_2k_cv = 'bankswitch_2k_cv',\n\n bankswitch_8k_F8 = 'bankswitch_8k_F8',\n bankswitch_8k_E0 = 'bankswitch_8k_E0',\n bankswitch_8k_3F = 'bankswitch_8k_3F',\n bankswitch_8k_FE = 'bankswitch_8k_FE',\n bankswitch_8k_UA = 'bankswitch_8k_UA',\n bankswitch_8k_DPC = 'bankswitch_8k_DPC',\n bankswitch_8k_econobanking = 'bankswitch_8k_econobanking',\n bankswitch_8k_pp = 'bankswitch_8k_pp',\n\n bankswitch_12k_FA = 'bankswitch_12k_FA',\n\n bankswitch_16k_F6 = 'bankswitch_16k_F6',\n bankswitch_16k_E7 = 'bankswitch_16k_E7',\n\n bankswitch_FA2 = 'bankswitch_FA2',\n\n bankswitch_32k_F4 = 'bankswitch_32k_F4',\n\n bankswitch_64k_F0 = 'bankswitch_64k_F0',\n bankswitch_64k_EF = 'bankswitch_64k_EF',\n\n bankswitch_3E = 'bankswitch_3E',\n bankswitch_supercharger = 'bankswitch_supercharger',\n bankswitch_dpc_plus = 'bankswitch_dpc_plus',\n bankswitch_cdf = 'bankswitch_cdf',\n\n unknown = 'unknown'\n }\n\n export function getAllTypes(): Array<CartridgeType> {\n return [\n CartridgeType.vanilla_2k,\n CartridgeType.vanilla_4k,\n CartridgeType.bankswitch_2k_cv,\n CartridgeType.bankswitch_8k_F8,\n CartridgeType.bankswitch_8k_E0,\n CartridgeType.bankswitch_8k_3F,\n CartridgeType.bankswitch_8k_FE,\n CartridgeType.bankswitch_8k_UA,\n CartridgeType.bankswitch_8k_econobanking,\n CartridgeType.bankswitch_8k_pp,\n CartridgeType.bankswitch_12k_FA,\n CartridgeType.bankswitch_8k_DPC,\n CartridgeType.bankswitch_16k_F6,\n CartridgeType.bankswitch_16k_E7,\n CartridgeType.bankswitch_FA2,\n CartridgeType.bankswitch_32k_F4,\n CartridgeType.bankswitch_3E,\n CartridgeType.bankswitch_64k_F0,\n CartridgeType.bankswitch_64k_EF,\n CartridgeType.bankswitch_supercharger,\n CartridgeType.bankswitch_dpc_plus,\n CartridgeType.bankswitch_cdf,\n CartridgeType.unknown\n ];\n }\n\n export function describeCartridgeType(cartridgeType: CartridgeType): string {\n switch (cartridgeType) {\n case CartridgeType.vanilla_2k:\n return 'plain 2k';\n\n case CartridgeType.vanilla_4k:\n return 'plain 4k';\n\n case CartridgeType.bankswitch_2k_cv:\n return '2k CommaVideo scheme';\n\n case CartridgeType.bankswitch_8k_F8:\n return 'bankswitched 8k, F8 (Atari) scheme';\n\n case CartridgeType.bankswitch_8k_E0:\n return 'bankswitched 8k, E0 (Parker Bros.) scheme';\n\n case CartridgeType.bankswitch_8k_3F:\n return 'bankswitched 8k, 3F (Tigervision) scheme';\n\n case CartridgeType.bankswitch_8k_FE:\n return 'bankswitched 8k, FE (Activision) scheme';\n\n case CartridgeType.bankswitch_8k_UA:\n return 'bankswitched 8k, UA (Pleiades) scheme';\n\n case CartridgeType.bankswitch_8k_pp:\n return 'bankswitched 8k, Pink Panther scheme';\n\n case CartridgeType.bankswitch_12k_FA:\n return 'bankswitched 12k, FA (CBS) scheme';\n\n case CartridgeType.bankswitch_8k_DPC:\n return 'bankswitched 8k + DPC';\n\n case CartridgeType.bankswitch_8k_econobanking:\n return 'bankswitched 8k, econobanking scheme';\n\n case CartridgeType.bankswitch_16k_F6:\n return 'bankswitched 16k, F6 (Atari) scheme';\n\n case CartridgeType.bankswitch_16k_E7:\n return 'bankswitched 16k, E7 (M-Network) scheme';\n\n case CartridgeType.bankswitch_FA2:\n return 'bankswitched 28k/29k, FA2 (modified CBS) scheme';\n\n case CartridgeType.bankswitch_32k_F4:\n return 'bankswitched 32k, F4 (Atari) scheme';\n\n case CartridgeType.bankswitch_3E:\n return 'bankswitched 3E (Tigervision + RAM) scheme';\n\n case CartridgeType.bankswitch_64k_F0:\n return 'bankswitched 64k, F0 (Megaboy) scheme';\n\n case CartridgeType.bankswitch_64k_EF:\n return 'bankswitched 64k, EFSC (Homestar Runner) scheme';\n\n case CartridgeType.bankswitch_supercharger:\n return 'bankswitched supercharger';\n\n case CartridgeType.bankswitch_dpc_plus:\n return 'bankswitched DPC+';\n\n case CartridgeType.bankswitch_cdf:\n return 'bankswitched CDF';\n\n case CartridgeType.unknown:\n return 'unknown';\n }\n }\n}\n\nexport { CartridgeInfo as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport GeneratorInterface from './GeneratorInterface';\n\nexport interface SeedrandomPrng {\n quick(): number;\n int32(): number;\n double(): number;\n state(): any;\n}\n\nclass SeedrandomGenerator implements GeneratorInterface {\n constructor(private _rng: SeedrandomPrng) {}\n\n single(): number {\n return this._rng.quick();\n }\n\n double(): number {\n return this._rng.double();\n }\n\n int32(): number {\n return this._rng.int32();\n }\n\n int(max: number) {\n return (this._rng.int32() >>> 0) % (max + 1);\n }\n\n saveState(): any {\n return this._rng.state();\n }\n}\n\nexport { SeedrandomGenerator as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport BoardInterface from '../board/BoardInterface';\nimport CpuInterface from '../cpu/CpuInterface';\nimport Bus from './Bus';\nimport BusInterface from '../bus/BusInterface';\nimport Pia from './Pia';\nimport Tia from './tia/Tia';\nimport CartridgeInterface from './cartridge/CartridgeInterface';\nimport Config from './Config';\n\nimport VideoOutputInterface from '../io/VideoOutputInterface';\nimport WaveformAudioOutputInterface from '../io/WaveformAudioOutputInterface';\nimport PCMAudioOutputInterface from '../io/PCMAudioOutputInterface';\nimport ControlPanel from './ControlPanel';\nimport ControlPanelInterface from './ControlPanelInterface';\nimport DigitalJoystickInterface from '../io/DigitalJoystickInterface';\nimport DigitalJoystick from '../io/DigitalJoystick';\nimport PaddleInterface from '../io/PaddleInterface';\nimport Paddle from '../io/Paddle';\n\nimport TimerInterface from '../board/TimerInterface';\nimport SchedulerInterface from '../../tools/scheduler/SchedulerInterface';\nimport TaskInterface from '../../tools/scheduler/TaskInterface';\nimport RngInterface from '../../tools/rng/GeneratorInterface';\nimport { createRng } from '../../tools/rng/factory';\nimport CpuFactory from '../cpu/Factory';\n\nclass Board implements BoardInterface {\n constructor(\n private _config: Config,\n cartridge: CartridgeInterface,\n cpuFactory?: (bus: BusInterface, rng?: RngInterface) => CpuInterface\n ) {\n this._rng = createRng(_config.randomSeed < 0 ? Math.random() : _config.randomSeed);\n cartridge.randomize(this._rng);\n\n const bus = new Bus();\n\n if (typeof cpuFactory === 'undefined') {\n cpuFactory = (_bus, rng) => new CpuFactory(_config.cpuType).create(_bus, rng);\n }\n\n const controlPanel = new ControlPanel(),\n joystick0 = new DigitalJoystick(),\n joystick1 = new DigitalJoystick(),\n paddles = new Array(4);\n\n for (let i = 0; i < 4; i++) {\n paddles[i] = new Paddle();\n }\n\n const cpu = cpuFactory(bus, this._rng);\n const pia = new Pia(controlPanel, joystick0, joystick1, this._rng);\n const tia = new Tia(_config, joystick0, joystick1, paddles);\n\n cpu.setInvalidInstructionCallback(() => this._onInvalidInstruction());\n\n tia.setCpu(cpu)\n .setBus(bus)\n .setCpuTimeProvider(() => this.getCpuTime());\n\n cartridge\n .setCpu(cpu)\n .setBus(bus)\n .setCpuTimeProvider(() => this.getCpuTime())\n .setRng(this._rng);\n\n pia.setBus(bus);\n\n bus.setTia(tia).setPia(pia).setCartridge(cartridge);\n\n this._bus = bus;\n this._cpu = cpu;\n this._tia = tia;\n this._pia = pia;\n this._cartridge = cartridge;\n this._controlPanel = controlPanel;\n this._joystick0 = joystick0;\n this._joystick1 = joystick1;\n this._paddles = paddles;\n\n this._bus.event.trap.addHandler((payload: Bus.TrapPayload) =>\n this.triggerTrap(BoardInterface.TrapReason.bus, payload.message)\n );\n\n this._clockHz = Config.getClockHz(_config);\n this._sliceSize = 228 * (_config.tvMode === Config.TvMode.ntsc ? 262 : 312);\n\n this.reset();\n }\n\n getCpu(): CpuInterface {\n return this._cpu;\n }\n\n getBus(): Bus {\n return this._bus;\n }\n\n getVideoOutput(): VideoOutputInterface {\n return this._tia;\n }\n\n getWaveformChannels(): Array<WaveformAudioOutputInterface> {\n return [0, 1].map((i) => this._tia.getWaveformChannel(i));\n }\n\n getPCMChannel(): PCMAudioOutputInterface {\n return this._tia.getPCMChannel();\n }\n\n getTimer(): TimerInterface {\n return this._timer;\n }\n\n getConfig(): Config {\n return this._config;\n }\n\n reset(): Board {\n this._cpu.reset();\n this._tia.reset();\n this._pia.reset();\n this._cartridge.reset();\n\n this._controlPanel.getResetButton().toggle(false);\n this._controlPanel.getSelectSwitch().toggle(false);\n this._controlPanel.getColorSwitch().toggle(false);\n this._controlPanel.getDifficultySwitchP0().toggle(true);\n this._controlPanel.getDifficultySwitchP1().toggle(true);\n\n this._subClock = 0;\n this._cpuCycles = 0;\n\n this.systemReset.dispatch();\n\n return this;\n }\n\n boot(): Board {\n let cycles = 0,\n cpuCycles = 0;\n\n this.reset();\n\n if (this._cpu.executionState !== CpuInterface.ExecutionState.boot) {\n throw new Error('Already booted!');\n }\n\n while ((this._cpu.executionState as CpuInterface.ExecutionState) !== CpuInterface.ExecutionState.fetch) {\n this._cycle();\n\n cycles++;\n if (this._subClock === 0) {\n cpuCycles++;\n }\n }\n\n this.cpuClock.dispatch(cpuCycles);\n this.clock.dispatch(cycles);\n return this;\n }\n\n suspend(): void {\n this._suspended = true;\n this._updateAudioState();\n }\n\n resume(): void {\n this._suspended = false;\n this._updateAudioState();\n }\n\n setAudioEnabled(state: boolean) {\n this._audioEnabled = state;\n this._updateAudioState();\n }\n\n triggerTrap(reason: BoardInterface.TrapReason, message?: string): Board {\n this._stop();\n\n this._trap = true;\n\n if (this.trap.hasHandlers) {\n this.trap.dispatch(new BoardInterface.TrapPayload(reason, this, message));\n } else {\n throw new Error(message);\n }\n\n return this;\n }\n\n getControlPanel(): ControlPanelInterface {\n return this._controlPanel;\n }\n\n getJoystick0(): DigitalJoystickInterface {\n return this._joystick0;\n }\n\n getJoystick1(): DigitalJoystickInterface {\n return this._joystick1;\n }\n\n getBoardStateDebug(): string {\n const sep = '============';\n\n return (\n 'TIA:\\n' +\n sep +\n '\\n' +\n this._tia.getDebugState() +\n '\\n' +\n `\\n` +\n `PIA:\\n` +\n `${sep}\\n` +\n `${this._pia.getDebugState()}\\n`\n );\n }\n\n setClockMode(clockMode: BoardInterface.ClockMode): Board {\n this._clockMode = clockMode;\n\n return this;\n }\n\n getClockMode(): BoardInterface.ClockMode {\n return this._clockMode;\n }\n\n getPaddle(idx: number): PaddleInterface {\n return this._paddles[idx];\n }\n\n getCpuTime(): number {\n return (this._cpuCycles / Config.getClockHz(this._config)) * 3;\n }\n\n tick(requestedCycles: number): number {\n let i = 0,\n cycles = 0,\n cpuCycles = 0,\n lastExecutionState = this._cpu.executionState;\n\n this._trap = false;\n\n while (i++ < requestedCycles && !this._trap) {\n this._cycle();\n cycles++;\n\n if (this._subClock === 0) {\n cpuCycles++;\n this._cpuCycles++;\n }\n\n if (lastExecutionState !== this._cpu.executionState) {\n lastExecutionState = this._cpu.executionState;\n\n if (this._cpu.executionState === CpuInterface.ExecutionState.fetch) {\n this._cartridge.notifyCpuCycleComplete();\n\n if (\n this._clockMode === BoardInterface.ClockMode.instruction &&\n cpuCycles > 0 &&\n this.cpuClock.hasHandlers\n ) {\n this.cpuClock.dispatch(cpuCycles);\n cpuCycles = 0;\n }\n }\n }\n }\n\n if (cpuCycles > 0 && this.cpuClock.hasHandlers) {\n this.cpuClock.dispatch(cpuCycles);\n }\n\n if (cycles > 0 && this.clock.hasHandlers) {\n this.clock.dispatch(cycles);\n }\n\n return cycles;\n }\n\n getSubclock(): number {\n return this._subClock;\n }\n\n private static _executeSlice(board: Board, _timeSlice?: number) {\n const slice = _timeSlice ? Math.round((_timeSlice * board._clockHz) / 1000) : board._sliceSize;\n\n return (board.tick(slice) / board._clockHz) * 1000;\n }\n\n private _updateAudioState(): void {\n this._tia.setAudioEnabled(this._audioEnabled && !this._suspended);\n }\n\n private _cycle(): void {\n this._tia.cycle();\n\n if (this._subClock++ >= 2) {\n this._pia.cycle();\n this._cpu.cycle();\n this._subClock = 0;\n }\n }\n\n private _start(scheduler: SchedulerInterface) {\n if (this._runTask) {\n return;\n }\n\n this._runTask = scheduler.start(\n Board._executeSlice,\n this,\n 1000 / (this._config.tvMode === Config.TvMode.ntsc ? 60 : 50)\n );\n }\n\n private _stop() {\n if (!this._runTask) {\n return;\n }\n\n this._runTask.stop();\n\n this._runTask = undefined;\n }\n\n private _onInvalidInstruction() {\n this.triggerTrap(BoardInterface.TrapReason.cpu, 'invalid instruction');\n }\n\n trap = new Event<BoardInterface.TrapPayload>();\n\n clock = new Event<number>();\n\n cpuClock = new Event<number>();\n\n systemReset = new Event<void>();\n\n private _cpu: CpuInterface;\n private _bus: Bus;\n private _tia: Tia;\n private _pia: Pia;\n private _cartridge: CartridgeInterface;\n private _controlPanel: ControlPanel;\n private _joystick0: DigitalJoystick;\n private _joystick1: DigitalJoystick;\n private _paddles: Array<Paddle>;\n\n private _runTask: TaskInterface;\n private _clockMode = BoardInterface.ClockMode.lazy;\n private _cpuCycles = 0;\n private _trap = false;\n\n private _audioEnabled = true;\n private _suspended = true;\n\n private _subClock = 0;\n\n private _clockHz = 0;\n private _sliceSize = 0;\n\n private _timer = {\n tick: (clocks: number): number => this.tick(clocks),\n start: (scheduler: SchedulerInterface): void => this._start(scheduler),\n stop: (): void => this._stop(),\n isRunning: (): boolean => !!this._runTask,\n };\n\n private _rng: RngInterface;\n}\n\nexport { Board as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as seedrandom from 'seedrandom';\n\nimport GeneratorInterface from './GeneratorInterface';\nimport SeedrandomGenerator from './SeedrandomGenerator';\n\nexport function createRng(seed: number): GeneratorInterface {\n if (seed < 0) {\n seed = Math.random();\n }\n\n return new SeedrandomGenerator(\n seedrandom.alea(seed as any, {\n state: true\n })\n );\n}\n\nexport function restoreRng(state: any): GeneratorInterface {\n return new SeedrandomGenerator(\n seedrandom.alea('', {\n state\n })\n );\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport CartridgeInterface from './CartridgeInterface';\nimport CartridgeInfo from './CartridgeInfo';\nimport CpuInterface from '../../cpu/CpuInterface';\nimport Bus from '../Bus';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass AbstractCartridge implements CartridgeInterface {\n async init(): Promise<void> { }\n\n reset(): void { }\n\n read(address: number): number {\n return 0;\n }\n\n peek(address: number): number {\n return this.read(address);\n }\n\n write(address: number, value: number) { }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.unknown;\n }\n\n setCpu(cpu: CpuInterface): this {\n return this;\n }\n\n setBus(bus: Bus): this {\n return this;\n }\n\n setRng(rng: RngInterface): this {\n return this;\n }\n\n setCpuTimeProvider(provider: () => number) {\n return this;\n }\n\n notifyCpuCycleComplete(): void { }\n\n randomize(rng: RngInterface): void { }\n\n protected triggerTrap(reason: CartridgeInterface.TrapReason, message: string) {\n if (this.trap.hasHandlers) {\n this.trap.dispatch(new CartridgeInterface.TrapPayload(reason, this, message));\n } else {\n throw new Error(message);\n }\n }\n\n trap = new Event<CartridgeInterface.TrapPayload>();\n}\n\nexport { AbstractCartridge as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\n\nfunction nextPowerOfTwo(x: number): number {\n let v = 1;\n\n while (v < x) {\n v *= 2;\n }\n\n return v;\n}\n\nfunction padBuffer(buffer: ArrayLike<number>): ArrayLike<number> {\n const paddedLength = nextPowerOfTwo(buffer.length);\n\n if (paddedLength === buffer.length) {\n return buffer;\n }\n\n const paddedBuffer = new Uint8Array(paddedLength);\n\n for (let i = 0; i < paddedLength; i++) {\n paddedBuffer[paddedLength - i - 1] = i < buffer.length ? buffer[buffer.length - i - 1] : 0;\n }\n\n return paddedBuffer;\n}\n\nclass Cartridge2k extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }) {\n super();\n\n if (buffer.length > 0x0800) {\n throw new Error(`buffer is not a 2k cartridge image: wrong length ${buffer.length}`);\n }\n\n const paddedBuffer = padBuffer(buffer);\n\n for (let i = 0; i < 0x0800; i++) {\n this._rom[i] = buffer[i % paddedBuffer.length];\n }\n }\n\n read(address: number): number {\n // Mask out A11 - A15\n return this._rom[address & 0x07ff];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.vanilla_2k;\n }\n\n // A11 - A15 masked out -> 0x0800 bytes of ROM\n protected _rom = new Uint8Array(0x0800);\n}\n\nexport { Cartridge2k as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\n\nclass Cartridge4k extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }) {\n super();\n\n if (buffer.length !== 0x1000) {\n console.warn(`buffer has invalid size for 4K image: ${buffer.length} bytes`);\n }\n\n const len = Math.min(0x1000, buffer.length);\n\n for (let i = 0; i < 0x1000 && i < buffer.length; i++) {\n this._rom[0x0fff - i] = buffer[len - 1 - i];\n }\n }\n\n read(address: number): number {\n // Mask out A12 - A15\n return this._rom[address & 0x0fff];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.vanilla_4k;\n }\n\n // A12 - A15 masked out -> 0x1000 bytes of ROM\n protected _rom = new Uint8Array(0x1000);\n}\n\nexport { Cartridge4k as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport interface BufferInterface {\n [index: number]: number;\n length: number;\n}\n\nexport function searchForSignatures(buffer: BufferInterface, signatures: Array<Array<number>>): Array<number> {\n interface Candidate {\n signature: number;\n nextIndex: number;\n }\n\n const candidates: Array<Candidate> = [],\n counts = signatures.map((signature: Array<number>) => 0);\n\n for (let i = 0; i < buffer.length; i++) {\n for (let iCandidate = 0; iCandidate < candidates.length; iCandidate++) {\n const candidate = candidates[iCandidate],\n signature = signatures[candidate.signature];\n\n if (buffer[i] === signature[candidate.nextIndex]) {\n if (++candidate.nextIndex === signature.length) {\n counts[candidate.signature]++;\n candidates.splice(iCandidate, 1);\n iCandidate--;\n }\n } else {\n candidates.splice(iCandidate, 1);\n iCandidate--;\n }\n }\n\n for (let iSignature = 0; iSignature < signatures.length; iSignature++) {\n const signature = signatures[iSignature];\n\n if (signature.length > 0 && buffer[i] === signature[0]) {\n if (signature.length === 1) {\n counts[iSignature]++;\n } else {\n candidates.push({\n signature: iSignature,\n nextIndex: 1\n });\n }\n }\n }\n }\n\n return counts;\n}\n\nexport function searchForSignature(buffer: BufferInterface, signature: Array<number>): number {\n for (let i = 0; i < buffer.length; i++) {\n let j: number;\n\n for (j = 0; j < signature.length && (buffer[i + j] === signature[j] || signature[j] < 0); j++) {}\n\n if (j === signature.length) {\n return i;\n }\n }\n\n return -1;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport RngGeneratorInterface from '../../../tools/rng/GeneratorInterface';\nimport Bus from '../Bus';\nimport { BufferInterface, searchForSignatures } from './util';\n\nclass CartridgeCV extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }) {\n super();\n\n if (buffer.length !== 0x0800) {\n throw new Error(`buffer is not a 2k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x0800; i++) {\n this._rom[i] = buffer[i];\n }\n }\n\n static matchesBuffer(buffer: BufferInterface): boolean {\n // Signatures shamelessly stolen from Stella\n const signatureCounts = searchForSignatures(buffer, [[0x9d, 0xff, 0xf3], [0x99, 0x00, 0xf4]]);\n\n return signatureCounts[0] > 0 || signatureCounts[1] > 0;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n randomize(rng: RngGeneratorInterface): void {\n for (let i = 0; i < 0x0400; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n read(address: number): number {\n address &= 0x0fff;\n\n if (address < 0x0400) {\n return this._ram[address];\n }\n\n if (address < 0x0800) {\n return (this._ram[address & 0x03ff] = this._bus.getLastDataBusValue());\n }\n\n return this._rom[address & 0x07ff];\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n if (address >= 0x0400 && address < 0x0800) {\n this._ram[address & 0x03ff] = value;\n }\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (address < 0x0400) {\n return this._ram[address];\n }\n\n if (address < 0x0800) {\n return 0;\n }\n\n return this._rom[address & 0x07ff];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_2k_cv;\n }\n\n private _rom = new Uint8Array(0x0800);\n private _ram = new Uint8Array(0x0400);\n\n private _bus: Bus;\n}\n\nexport default CartridgeCV;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport * as cartridgeUtil from './util';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass CartridgeF8 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface, private _supportSC = true) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(\n buffer,\n [[0x8d, 0xf9, 0x1f]] // STA $1FF9\n );\n\n return signatureCounts[0] >= 2;\n }\n\n reset(): void {\n this._bank = this._bank1;\n this._hasSC = false;\n }\n\n read(address: number): number {\n this._access(address & 0x0fff, this._bus.getLastDataBusValue());\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (this._hasSC && address >= 0x0080 && address < 0x0100) {\n return this._saraRAM[address - 0x80];\n }\n\n return this._bank[address];\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n if (address < 0x80 && this._supportSC) {\n this._hasSC = true;\n }\n\n this._access(address, value);\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_F8;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._saraRAM.length; i++) {\n this._saraRAM[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n private _access(address: number, value: number): void {\n if (address < 0x80 && this._hasSC) {\n this._saraRAM[address] = value & 0xff;\n return;\n }\n\n switch (address) {\n case 0x0ff8:\n this._bank = this._bank0;\n break;\n\n case 0x0ff9:\n this._bank = this._bank1;\n break;\n }\n }\n\n private _bank: Uint8Array = null;\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n\n private _hasSC = false;\n private _saraRAM = new Uint8Array(0x80);\n\n private _bus: Bus = null;\n}\n\nexport { CartridgeF8 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass CartridgeF6 extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }, private _supportSC: boolean = true) {\n super();\n\n if (buffer.length !== 0x4000) {\n throw new Error(`buffer is not a 16k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n this._bank2[i] = buffer[0x2000 + i];\n this._bank3[i] = buffer[0x3000 + i];\n }\n\n this.reset();\n }\n\n reset(): void {\n this._bank = this._bank0;\n this._hasSC = false;\n }\n\n read(address: number): number {\n this._access(address & 0x0fff, this._bus.getLastDataBusValue());\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (this._hasSC && address >= 0x0080 && address < 0x0100) {\n return this._saraRAM[address - 0x80];\n }\n\n return this._bank[address];\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n if (address < 0x80 && this._supportSC) {\n this._hasSC = true;\n }\n\n this._access(address, value);\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_16k_F6;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._saraRAM.length; i++) {\n this._saraRAM[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n private _access(address: number, value: number): void {\n if (address < 0x80 && this._hasSC) {\n this._saraRAM[address] = value & 0xff;\n return;\n }\n\n switch (address) {\n case 0x0ff6:\n this._bank = this._bank0;\n break;\n\n case 0x0ff7:\n this._bank = this._bank1;\n break;\n\n case 0x0ff8:\n this._bank = this._bank2;\n break;\n\n case 0x0ff9:\n this._bank = this._bank3;\n break;\n }\n }\n\n private _bank: Uint8Array = null;\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n private _bank2 = new Uint8Array(0x1000);\n private _bank3 = new Uint8Array(0x1000);\n\n private _hasSC = false;\n private _saraRAM = new Uint8Array(0x80);\n\n private _bus: Bus = null;\n}\n\nexport { CartridgeF6 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport * as cartridgeUtil from './util';\nimport CartridgeInfo from './CartridgeInfo';\n\nclass CartridgeE0 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: invalid length ${buffer.length}`);\n }\n\n for (let i = 0; i < 8; i++) {\n this._banks[i] = new Uint8Array(0x0400);\n }\n\n for (let i = 0; i < 0x0400; i++) {\n for (let j = 0; j < 8; j++) {\n this._banks[j][i] = buffer[j * 0x0400 + i];\n }\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0x8d, 0xe0, 0x1f], // STA $1FE0\n [0x8d, 0xe0, 0x5f], // STA $5FE0\n [0x8d, 0xe9, 0xff], // STA $FFE9\n [0x0c, 0xe0, 0x1f], // NOP $1FE0\n [0xad, 0xe0, 0x1f], // LDA $1FE0\n [0xad, 0xe9, 0xff], // LDA $FFE9\n [0xad, 0xed, 0xff], // LDA $FFED\n [0xad, 0xf3, 0xbf] // LDA $BFF3\n ]);\n\n for (let i = 0; i < signatureCounts.length; i++) {\n if (signatureCounts[i] > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n for (let i = 0; i < 4; i++) {\n this._activeBanks[i] = this._banks[7];\n }\n }\n\n read(address: number): number {\n address &= 0x0fff;\n\n if (address >= 0x0fe0 && address < 0x0ff8) {\n this._handleBankswitch(address);\n }\n\n return this._activeBanks[address >> 10][address & 0x03ff];\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n return this._activeBanks[address >> 10][address & 0x03ff];\n }\n\n write(address: number, value: number): void {\n const addressMasked = address & 0x0fff;\n\n if (addressMasked >= 0x0fe0 && addressMasked < 0x0ff8) {\n this._handleBankswitch(addressMasked);\n }\n\n return super.write(address, value);\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_E0;\n }\n\n private _handleBankswitch(address: number): void {\n if (address < 0x0fe8) {\n this._activeBanks[0] = this._banks[address - 0x0fe0];\n } else if (address < 0x0ff0) {\n this._activeBanks[1] = this._banks[address - 0x0fe8];\n } else {\n this._activeBanks[2] = this._banks[address - 0x0ff0];\n }\n }\n\n private _banks = new Array<Uint8Array>(8);\n private _activeBanks = new Array<Uint8Array>(4);\n}\n\nexport { CartridgeE0 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport Bus from '../Bus';\nimport CartridgeInfo from './CartridgeInfo';\nimport * as cartridgeUtil from './util';\n\nclass CartridgeFE extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0x20, 0x00, 0xd0, 0xc6, 0xc5], // JSR $D000; DEC $C5\n [0x20, 0xc3, 0xf8, 0xa5, 0x82], // JSR $F8C3; LDA $82\n [0xd0, 0xfb, 0x20, 0x73, 0xfe], // BNE $FB; JSR $FE73\n [0x20, 0x00, 0xf0, 0x84, 0xd6] // JSR $F000; STY $D6\n ]);\n\n for (let i = 0; i < signatureCounts.length; i++) {\n if (signatureCounts[i] > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n this._bank = this._bank0;\n this._lastAccessWasFE = false;\n this._lastAddressBusValue = -1;\n }\n\n read(address: number): number {\n return this._bank[address & 0x0fff];\n }\n\n write(address: number, value: number): void {\n super.write(address, value);\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n this._bus.event.read.addHandler(CartridgeFE._onBusAccess, this);\n this._bus.event.write.addHandler(CartridgeFE._onBusAccess, this);\n\n return this;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_FE;\n }\n\n private static _onBusAccess(accessType: Bus.AccessType, self: CartridgeFE): void {\n const previousAddressBusValue = self._lastAddressBusValue;\n self._lastAddressBusValue = self._bus.getLastAddresBusValue() & 0x1fff;\n\n if (self._lastAddressBusValue === previousAddressBusValue) {\n return;\n }\n\n if (self._lastAccessWasFE) {\n const dataBusHiBits = self._bus.getLastDataBusValue() & 0xe0;\n\n self._bank =\n dataBusHiBits === 0\n ? self._bank0\n : (self._bus.getLastDataBusValue() & 0x20) > 0\n ? self._bank0\n : self._bank1;\n }\n\n self._lastAccessWasFE = self._lastAddressBusValue === 0x01fe;\n }\n\n private _bus: Bus;\n\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n private _bank: Uint8Array;\n\n private _lastAccessWasFE = false;\n private _lastAddressBusValue = -1;\n}\n\nexport { CartridgeFE as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport * as cartridgeUtil from './util';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\n\nclass Cartridge3F extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: invalid length ${buffer.length}`);\n }\n\n for (let i = 0; i < 4; i++) {\n this._banks[i] = new Uint8Array(0x0800);\n }\n\n this._bank1 = this._banks[3];\n this._bank0 = this._banks[0];\n\n for (let i = 0; i < 0x0800; i++) {\n for (let j = 0; j < 4; j++) {\n this._banks[j][i] = buffer[0x0800 * j + i];\n }\n }\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signature shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(\n buffer,\n [[0x85, 0x3f]] // STA $3F\n );\n\n return signatureCounts[0] >= 2;\n }\n\n reset(): void {\n this._bank0 = this._banks[0];\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n this._bus.event.read.addHandler(Cartridge3F._onBusAccess, this);\n this._bus.event.write.addHandler(Cartridge3F._onBusAccess, this);\n\n return this;\n }\n\n read(address: number): number {\n address &= 0x0fff;\n\n return address < 0x0800 ? this._bank0[address] : this._bank1[address & 0x07ff];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_3F;\n }\n\n private static _onBusAccess(accessType: Bus.AccessType, self: Cartridge3F): void {\n if (self._bus.getLastAddresBusValue() === 0x003f) {\n self._bank0 = self._banks[self._bus.getLastDataBusValue() & 0x03];\n }\n }\n\n private _banks = new Array<Uint8Array>(4);\n private _bank0: Uint8Array;\n private _bank1: Uint8Array;\n private _bus: Bus = null;\n}\n\nexport { Cartridge3F as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport * as cartridgeUtil from './util';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass Cartridge3E extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if ((buffer.length & 0x07ff) !== 0) {\n throw new Error(`buffer length ${buffer.length} is not a multiple of 2k`);\n }\n\n const bankCount = buffer.length >>> 11;\n if (bankCount < 2) {\n throw new Error('image must have at least 2k');\n }\n\n this._banks = new Array<Uint8Array>(bankCount);\n\n for (let i = 0; i < bankCount; i++) {\n this._banks[i] = new Uint8Array(0x0800);\n }\n\n for (let i = 0; i <= 0xff; i++) {\n this._ramBanks[i] = new Uint8Array(0x0400);\n }\n\n this._ramBank = this._ramBanks[0];\n this._bank1 = this._banks[bankCount - 1];\n this._bank0 = this._banks[0];\n\n for (let i = 0; i < 0x0800; i++) {\n for (let j = 0; j < bankCount; j++) {\n this._banks[j][i] = buffer[0x0800 * j + i];\n }\n }\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signature shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(\n buffer,\n [[0x85, 0x3e, 0xa9, 0x00]] // STA $3E, LDA #0\n );\n\n return signatureCounts[0] >= 1;\n }\n\n reset(): void {\n this._bank0 = this._banks[0];\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._ramBanks.length; i++) {\n for (let j = 0; j < 0x0400; j++) {\n this._ramBanks[i][j] = rng.int(0xff);\n }\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n this._bus.event.read.addHandler(Cartridge3E._onBusAccess, this);\n this._bus.event.write.addHandler(Cartridge3E._onBusAccess, this);\n\n return this;\n }\n\n read(address: number): number {\n address &= 0x0fff;\n\n if (this._ramSelect) {\n if (address < 0x0400) {\n return this._ramBank[address];\n }\n\n if (address < 0x0800) {\n return (this._ramBank[address & 0x03ff] = this._bus.getLastDataBusValue());\n }\n\n return this._bank1[address & 0x07ff];\n }\n\n return address < 0x0800 ? this._bank0[address] : this._bank1[address & 0x07ff];\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (this._ramSelect) {\n if (address < 0x0400) {\n return this._ramBank[address];\n }\n\n if (address < 0x0800) {\n return this._bus.getLastDataBusValue();\n }\n\n return this._bank1[address & 0x07ff];\n }\n\n return address < 0x0800 ? this._bank0[address] : this._bank1[address & 0x07ff];\n }\n\n write(address: number, value: number): void {\n if (!this._ramSelect) {\n return;\n }\n\n address &= 0x0fff;\n\n if (address >= 0x0400 && address < 0x0800) {\n this._ramBank[address & 0x03ff] = value;\n }\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_3E;\n }\n\n private static _onBusAccess(accessType: Bus.AccessType, self: Cartridge3E): void {\n switch (self._bus.getLastAddresBusValue()) {\n case 0x003f:\n self._ramSelect = false;\n self._bank0 = self._banks[self._bus.getLastDataBusValue() % self._banks.length];\n break;\n\n case 0x003e:\n self._ramSelect = true;\n self._ramBank = self._ramBanks[self._bus.getLastDataBusValue() % 32];\n break;\n }\n }\n\n private _banks: Array<Uint8Array> = null;\n private _bank0: Uint8Array;\n private _bank1: Uint8Array;\n\n private _ramSelect = false;\n private _ramBanks = new Array<Uint8Array>(0x0100);\n private _ramBank: Uint8Array;\n\n private _bus: Bus = null;\n}\n\nexport { Cartridge3E as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport * as cartridgeUtil from './util';\nimport Bus from '../Bus';\n\nclass CartridgeUA extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0x8d, 0x40, 0x02], // STA $240\n [0xad, 0x40, 0x02], // LDA $240\n [0xbd, 0x1f, 0x02] // LDA $21F,X\n ]);\n\n for (let i = 0; i < signatureCounts.length; i++) {\n if (signatureCounts[i] > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n this._bank = this._bank0;\n }\n\n read(address: number): number {\n return this._bank[address & 0x0fff];\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n bus.event.read.addHandler(CartridgeUA._onBusAccess, this);\n bus.event.write.addHandler(CartridgeUA._onBusAccess, this);\n\n return this;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_UA;\n }\n\n private static _onBusAccess(accessType: Bus.AccessType, self: CartridgeUA): void {\n switch (self._bus.getLastAddresBusValue()) {\n case 0x0220:\n self._bank = self._bank0;\n break;\n\n case 0x0240:\n self._bank = self._bank1;\n break;\n }\n }\n\n private _bus: Bus = null;\n\n private _bank: Uint8Array = null;\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n}\n\nexport { CartridgeUA as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\nimport * as cartridgeUtil from './util';\n\nclass CartridgeFA extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x3000) {\n throw new Error(`buffer is not a 12k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n this._bank2[i] = buffer[0x2000 + i];\n }\n\n this.reset();\n }\n\n reset(): void {\n this._bank = this._bank0;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._ram.length; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n read(address: number): number {\n this._handleBankswitch(address & 0x0fff);\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (address >= 0x0100 && address < 0x0200) {\n return this._ram[address & 0xff];\n } else {\n return this._bank[address];\n }\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n this._handleBankswitch(address);\n\n if (address < 0x0100) {\n this._ram[address] = value & 0xff;\n } else {\n super.write(address, value);\n }\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_12k_FA;\n }\n\n private _handleBankswitch(address: number): void {\n switch (address) {\n case 0x0ff8:\n this._bank = this._bank0;\n break;\n\n case 0x0ff9:\n this._bank = this._bank1;\n break;\n\n case 0x0ffa:\n this._bank = this._bank2;\n break;\n }\n }\n\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n private _bank2 = new Uint8Array(0x1000);\n\n private _bank: Uint8Array;\n\n private _ram = new Uint8Array(0x0100);\n}\n\nexport { CartridgeFA as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport * as cartridgeUtil from './util';\nimport CartridgeInfo from './CartridgeInfo';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass CartrdigeE7 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x4000) {\n throw new Error(`buffer is not a 16k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 8; i++) {\n this._banks[i] = new Uint8Array(0x0800);\n }\n\n for (let i = 0; i < 4; i++) {\n this._ram1Banks[i] = new Uint8Array(0x100);\n }\n\n for (let i = 0; i < 0x0800; i++) {\n for (let j = 0; j < 8; j++) {\n this._banks[j][i] = buffer[j * 0x0800 + i];\n }\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0xad, 0xe2, 0xff], // LDA $FFE2\n [0xad, 0xe5, 0xff], // LDA $FFE5\n [0xad, 0xe5, 0x1f], // LDA $1FE5\n [0xad, 0xe7, 0x1f], // LDA $1FE7\n [0x0c, 0xe7, 0x1f], // NOP $1FE7\n [0x8d, 0xe7, 0xff], // STA $FFE7\n [0x8d, 0xe7, 0x1f] // STA $1FE7\n ]);\n\n for (let i = 0; i < signatureCounts.length; i++) {\n if (signatureCounts[i] > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n this._bank0 = this._banks[0];\n this._ram1 = this._ram1Banks[0];\n this._ram0Enabled = false;\n }\n\n read(address: number): number {\n this._handleBankswitch(address & 0x0fff);\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n // 0 -> 0x07FF: bank 0 - 6 or RAM\n if (address < 0x0800) {\n // RAM enabled?\n if (this._ram0Enabled) {\n // 0x0000 - 0x03FF is write, 0x0400 - 0x07FF is read\n return address >= 0x0400 ? this._ram0[address - 0x0400] : 0;\n } else {\n // bank 0 - 6\n return this._bank0[address];\n }\n }\n\n // 0x0800 -> 0x9FF is RAM\n if (address <= 0x09ff) {\n // 0x0800 - 0x08FF is write, 0x0900 - 0x09FF is read\n return address >= 0x0900 ? this._ram1[address - 0x0900] : 0;\n }\n\n // Higher address are the remaining 1.5k of bank 7\n return this._banks[7][0x07ff - (0x0fff - address)];\n }\n\n write(address: number, value: number) {\n address &= 0x0fff;\n\n this._handleBankswitch(address);\n\n if (address < 0x0400) {\n if (this._ram0Enabled) {\n this._ram0[address] = value;\n } else {\n super.write(address, value);\n }\n } else if (address < 0x0800) {\n super.write(address, value);\n } else if (address < 0x08ff) {\n this._ram1[address - 0x0800] = value;\n } else {\n super.write(address, value);\n }\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_16k_E7;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < this._ram1Banks[i].length; j++) {\n this._ram1Banks[i][j] = rng.int(0xff);\n }\n }\n\n for (let i = 0; i < this._ram0.length; i++) {\n this._ram0[i] = rng.int(0xff);\n }\n }\n\n private _handleBankswitch(address: number): void {\n if (address < 0x0fe0) {\n return;\n }\n\n if (address <= 0x0fe6) {\n this._bank0 = this._banks[address & 0x000f];\n this._ram0Enabled = false;\n } else if (address === 0x0fe7) {\n this._ram0Enabled = true;\n } else if (address <= 0x0feb) {\n this._ram1 = this._ram1Banks[address - 0x0fe8];\n }\n }\n\n private _banks = new Array<Uint8Array>(8);\n private _bank0: Uint8Array;\n\n private _ram0 = new Uint8Array(0x0400);\n private _ram1Banks = new Array<Uint8Array>(4);\n private _ram1: Uint8Array;\n private _ram0Enabled = false;\n}\n\nexport { CartrdigeE7 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport * as cartridgeUtil from './util';\nimport CartridgeInfo from './CartridgeInfo';\n\nclass CartridgeF0 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x10000) {\n throw new Error(`buffer is not a 64k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 16; i++) {\n this._banks[i] = new Uint8Array(0x1000);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n for (let j = 0; j < 16; j++) {\n this._banks[j][i] = buffer[j * 0x1000 + i];\n }\n }\n\n this.reset();\n }\n\n reset(): void {\n this._bankIdx = 0;\n this._currentBank = this._banks[this._bankIdx];\n }\n\n read(address: number): number {\n address &= 0x0fff;\n\n this._handleBankswitch(address);\n\n return this._currentBank[address];\n }\n\n peek(address: number): number {\n return this._currentBank[address & 0x0fff];\n }\n\n write(address: number, value: number) {\n address &= 0xfff;\n\n this._handleBankswitch(address);\n\n super.write(address, value);\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_64k_F0;\n }\n\n private _handleBankswitch(address: number): void {\n if (address === 0x0ff0) {\n this._bankIdx = (this._bankIdx + 1) & 0x0f;\n this._currentBank = this._banks[this._bankIdx];\n }\n }\n\n private _banks = new Array<Uint8Array>(16);\n private _currentBank: Uint8Array;\n private _bankIdx = 0;\n}\n\nexport { CartridgeF0 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport * as cartridgeUtil from './util';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass CartridgeEF extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }, private _supportSC: boolean = true) {\n super();\n\n if (buffer.length !== 0x10000) {\n throw new Error(`buffer is not a 64k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 16; i++) {\n this._banks[i] = new Uint8Array(0x1000);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n for (let j = 0; j < 16; j++) {\n this._banks[j][i] = buffer[j * 0x1000 + i];\n }\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n const matchMagic = (magicString: string): boolean => {\n const magic = magicString.split('').map(x => x.charCodeAt(0));\n\n for (let i = 0; i < magic.length; i++) {\n if (magic[i] !== buffer[0xfff8 + i]) {\n return false;\n }\n }\n\n return true;\n };\n\n if (buffer.length !== 0x10000) {\n return false;\n }\n\n if (matchMagic('efef') || matchMagic('efsc')) {\n return true;\n }\n\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0x0c, 0xe0, 0xff], // NOP $FFE0\n [0xad, 0xe0, 0xff], // LDA $FFE0\n [0x0c, 0xe0, 0x1f], // NOP $1FE0\n [0xad, 0xe0, 0x1f] // LDA $1FE0\n ]);\n\n for (let i = 0; i < 4; i++) {\n if (signatureCounts[i] > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n this._bank = this._banks[15];\n this._hasSC = false;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_64k_EF;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._ram.length; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n read(address: number): number {\n this._access(address & 0x0fff, this._bus.getLastDataBusValue());\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (this._hasSC && address >= 0x0080 && address < 0x0100) {\n return this._ram[address - 0x80];\n } else {\n return this._bank[address];\n }\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n if (address < 0x80 && this._supportSC) {\n this._hasSC = true;\n }\n\n this._access(address, value);\n }\n\n private _access(address: number, value: number): void {\n if (address < 0x80 && this._hasSC) {\n this._ram[address] = value;\n return;\n }\n\n if (address >= 0x0fe0 && address <= 0x0fef) {\n this._bank = this._banks[address - 0x0fe0];\n }\n }\n\n private _bus: Bus = null;\n\n private _bank: Uint8Array;\n private _banks = new Array<Uint8Array>(16);\n private _ram = new Uint8Array(0x80);\n private _hasSC = false;\n}\n\nexport { CartridgeEF as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\n\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nclass CartridgeF4 extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }, private _supportSC: boolean = true) {\n super();\n\n if (buffer.length !== 0x8000) {\n throw new Error(`buffer is not a 32k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 8; i++) {\n this._banks[i] = new Uint8Array(0x1000);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n for (let j = 0; j < 8; j++) {\n this._banks[j][i] = buffer[j * 0x1000 + i];\n }\n }\n\n this.reset();\n }\n\n reset(): void {\n this._bank = this._banks[0];\n this._hasSC = false;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_32k_F4;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._ram.length; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n read(address: number): number {\n this._access(address & 0x0fff, this._bus.getLastDataBusValue());\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (this._hasSC && address >= 0x0080 && address < 0x0100) {\n return this._ram[address - 0x80];\n } else {\n return this._bank[address];\n }\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n if (address < 0x80 && this._supportSC) {\n this._hasSC = true;\n }\n\n this._access(address, value);\n }\n\n private _access(address: number, value: number): void {\n if (address < 0x80 && this._hasSC) {\n this._ram[address] = value;\n return;\n }\n\n if (address >= 0x0ff4 && address <= 0x0ffb) {\n this._bank = this._banks[address - 0x0ff4];\n }\n }\n\n private _bus: Bus = null;\n\n private _bank: Uint8Array;\n private _banks = new Array<Uint8Array>(8);\n private _ram = new Uint8Array(0x80);\n private _hasSC = false;\n}\n\nexport { CartridgeF4 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\nimport Bus from '../Bus';\nimport * as cartridgeUtil from './util';\n\nconst enum IODelay {\n load = 10,\n save = 100\n}\n\nclass CartridgeFA2 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x7000 && buffer.length !== 0x7400) {\n throw new Error(`buffer is not a 28k/29k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 7; i++) {\n this._banks[i] = new Uint8Array(0x1000);\n }\n\n const offset = buffer.length === 0x7000 ? 0 : 0x0400;\n\n for (let i = 0; i < 0x1000; i++) {\n for (let j = 0; j < 7; j++) {\n this._banks[j][i] = buffer[j * 0x1000 + i + offset];\n }\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from Stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0xa0, 0xc1, 0x1f, 0xe0],\n [0x00, 0x80, 0x02, 0xe0]\n ]);\n\n return signatureCounts[0] > 0 || signatureCounts[1] > 0;\n }\n\n reset(): void {\n this._accessCounter = 0;\n this._accessCounterLimit = 0;\n this._bank = this._banks[0];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_FA2;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < this._ram.length; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n read(address: number): number {\n this.write(address & 0x0fff, this._bus.getLastDataBusValue());\n\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (address >= 0x0100 && address < 0x0200) {\n return this._ram[address - 0x0100];\n } else if (address === 0x0ff4) {\n return this._accessCounter >= this._accessCounterLimit\n ? // bit 6 zero: operation complete\n this._bank[address] & ~0x40\n : // bit 6 one: operation pending\n this._bank[address] | 0x40;\n } else {\n return this._bank[address];\n }\n }\n\n write(address: number, value: number): void {\n address &= 0x0fff;\n\n this._accessCounter++;\n\n if (address < 0x0100) {\n this._ram[address] = value;\n return;\n }\n\n if (address === 0x0ff4) {\n return this._handleIo();\n }\n\n if (address >= 0x0ff5 && address <= 0x0ffb) {\n this._bank = this._banks[address - 0x0ff5];\n }\n }\n\n private _handleIo(): void {\n if (this._accessCounter < this._accessCounterLimit) {\n return;\n }\n\n if (this._ram[0xff] === 1) {\n for (let i = 0; i < 0x100; i++) {\n this._ram[i] = this._savedRam[i];\n }\n\n this._accessCounterLimit = IODelay.load;\n } else if (this._ram[0xff] === 2) {\n for (let i = 0; i < 0x100; i++) {\n this._savedRam[i] = this._ram[i];\n }\n\n this._accessCounterLimit = IODelay.save;\n } else {\n return;\n }\n\n this._accessCounter = 0;\n this._ram[0xff] = 0;\n }\n\n private _bank: Uint8Array;\n private _banks = new Array<Uint8Array>(7);\n private _ram = new Uint8Array(0x100);\n\n private _savedRam = new Uint8Array(0x100);\n private _accessCounter = 0;\n private _accessCounterLimit = 0;\n\n private _bus: Bus;\n}\n\nexport { CartridgeFA2 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass Header {\n constructor(buffer: { [idx: number]: number; length: number }) {\n this.startAddressLow = buffer[0x2000];\n this.startAddressHigh = buffer[0x2001];\n this.controlWord = buffer[0x2002];\n this.blockCount = buffer[0x2003];\n this.checksum = buffer[0x2004];\n this.multiloadId = buffer[0x2005];\n this.progressBarSpeedLow = buffer[0x2006];\n this.progressBarSpeedHigh = buffer[0x2007];\n\n this.blockLocation = new Uint8Array(this.blockCount);\n this.blockChecksum = new Uint8Array(this.blockCount);\n\n for (let i = 0; i < this.blockCount; i++) {\n this.blockLocation[i] = buffer[0x2000 + 16 + i];\n this.blockChecksum[i] = buffer[0x2000 + 64 + i];\n }\n }\n\n verify(): boolean {\n const checksum =\n this.startAddressLow +\n this.startAddressHigh +\n this.controlWord +\n this.blockCount +\n this.checksum +\n this.multiloadId +\n this.progressBarSpeedLow +\n this.progressBarSpeedHigh;\n\n return (checksum & 0xff) === 0x55;\n }\n\n startAddressLow: number;\n startAddressHigh: number;\n controlWord: number;\n blockCount: number;\n checksum: number;\n multiloadId: number;\n progressBarSpeedLow: number;\n progressBarSpeedHigh: number;\n\n blockLocation: Uint8Array = null;\n blockChecksum: Uint8Array = null;\n}\n\nexport { Header as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { decode } from '../../../../tools/base64';\n\nexport const bios = decode(\n 'pfpMGPj//3jYqQCi/5qqqJUA6ND7TBj4ogKGAa4G8I74/6AAoiiUBMoQ+6KAoACUAOjQ+6ILvGj4lPDKEPhM8ACiBr1z+JXwyhD4rvD/hoC8APCt8f+u8v+G9K7z/4b1ov+gAJpM8ACN+f+t+//Q+0xB+I34/0wAAA=='\n);\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\n\nimport Header from './supercharger/Header';\nimport { bios } from './supercharger/blob';\n\nconst enum BankType {\n ram,\n rom\n}\n\nclass CartridgeSupercharger extends AbstractCartridge {\n constructor(buffer: { [i: number]: number; length: number }) {\n super();\n\n if (buffer.length % 8448 !== 0) {\n throw new Error(`not a supercharger image --- invalid size`);\n }\n\n this._loadCount = buffer.length / 8448;\n\n this._loads = new Array<Uint8Array>(this._loadCount);\n this._headers = new Array<Header>(this._loadCount);\n\n for (let i = 0; i < this._loadCount; i++) {\n this._loads[i] = new Uint8Array(8448);\n }\n\n for (let i = 0; i < 8448; i++) {\n for (let j = 0; j < this._loadCount; j++) {\n this._loads[j][i] = buffer[j * 8448 + i];\n }\n }\n\n for (let i = 0; i < this._loadCount; i++) {\n this._headers[i] = new Header(this._loads[i]);\n\n if (!this._headers[i].verify()) {\n console.log(`load ${i} has invalid checksum`);\n }\n }\n\n for (let i = 0; i < 3; i++) {\n this._ramBanks[i] = new Uint8Array(0x0800);\n }\n\n this._setupRom();\n\n this.reset();\n }\n\n reset() {\n this._setBankswitchMode(0);\n this._transitionCount = 0;\n this._pendingWrite = false;\n this._pendingWriteData = 0;\n this._lastAddressBusValue = -1;\n this._writeRamEnabled = false;\n this._loadInProgress = false;\n this._loadTimestamp = 0;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n this._bus.event.read.addHandler(CartridgeSupercharger._onBusAccess, this);\n this._bus.event.write.addHandler(CartridgeSupercharger._onBusAccess, this);\n\n return this;\n }\n\n setCpuTimeProvider(provider: () => number): this {\n this._cpuTimeProvider = provider;\n\n return this;\n }\n\n setRng(rng: RngInterface): this {\n this._rng = rng;\n\n return this;\n }\n\n read(address: number): number {\n return this._access(address, this._bus.getLastDataBusValue());\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n return address < 0x0800 ? this._bank0[address] : this._bank1[address & 0x07ff];\n }\n\n write(address: number, value: number): void {\n this._access(address, value);\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_supercharger;\n }\n\n private static _onBusAccess(type: Bus.AccessType, self: CartridgeSupercharger) {\n const address = self._bus.getLastAddresBusValue();\n\n if (address !== self._lastAddressBusValue && !self._loadInProgress) {\n if (self._transitionCount <= 5) {\n self._transitionCount++;\n }\n\n self._lastAddressBusValue = address;\n }\n }\n\n private _access(address: number, value: number): number {\n address &= 0x0fff;\n\n if (this._loadInProgress) {\n if ((this._cpuTimeProvider() - this._loadTimestamp) > 1E-3) {\n this._loadInProgress = false;\n } else {\n return value;\n }\n }\n\n const readValue = address < 0x0800 ? this._bank0[address] : this._bank1[address & 0x07ff];\n\n if ((address & 0x0f00) === 0 && (!this._pendingWrite || !this._writeRamEnabled)) {\n this._pendingWriteData = address & 0x00ff;\n this._transitionCount = 0;\n this._pendingWrite = true;\n\n return readValue;\n }\n\n if (address === 0x0ff8) {\n this._setBankswitchMode((this._pendingWriteData & 28) >>> 2);\n this._writeRamEnabled = (this._pendingWriteData & 0x02) > 0;\n\n this._pendingWrite = false;\n\n return readValue;\n }\n\n if (address === 0x0ff9 && this._bank1Type === BankType.rom && ((this._lastAddressBusValue & 0x1fff) < 0xff)) {\n this._loadIntoRam(value);\n\n return readValue;\n }\n\n if (this._pendingWrite && this._writeRamEnabled && this._transitionCount === 5) {\n this._pendingWrite = false;\n\n if (address < 0x0800) {\n this._bank0[address] = this._pendingWriteData;\n } else if (this._bank1Type === BankType.ram) {\n this._bank1[address & 0x07ff] = this._pendingWriteData;\n } else {\n return readValue;\n }\n\n return this._pendingWriteData;\n }\n\n return readValue;\n }\n\n private _setBankswitchMode(mode: number): void {\n switch (mode) {\n case 0:\n return this._configureBanks(2, BankType.rom);\n\n case 1:\n return this._configureBanks(0, BankType.rom);\n\n case 2:\n return this._configureBanks(2, BankType.ram, 0);\n\n case 3:\n return this._configureBanks(0, BankType.ram, 2);\n\n case 4:\n return this._configureBanks(2, BankType.rom);\n\n case 5:\n return this._configureBanks(1, BankType.rom);\n\n case 6:\n return this._configureBanks(2, BankType.ram, 1);\n\n case 7:\n return this._configureBanks(1, BankType.ram, 2);\n\n default:\n throw new Error('invalid bankswitching mode');\n }\n }\n\n private _configureBanks(bank0: number, bank1Type: BankType, bank1 = 0): void {\n this._bank0 = this._ramBanks[bank0];\n this._bank1Type = bank1Type;\n this._bank1 = bank1Type === BankType.ram ? this._ramBanks[bank1] : this._rom;\n }\n\n private _setupRom() {\n for (let i = 0; i < 0x0800; i++) {\n this._rom[i] = 0;\n }\n\n for (let i = 0; i < bios.length; i++) {\n this._rom[i] = bios[i];\n }\n\n this._rom[0x07ff] = this._rom[0x07fd] = 0xf8;\n this._rom[0x07fe] = this._rom[0x07fc] = 0x07;\n }\n\n private _loadIntoRam(loadId: number) {\n let loadIndex: number;\n\n for (loadIndex = 0; loadIndex < this._loadCount; loadIndex++) {\n if (this._headers[loadIndex].multiloadId === loadId || this._loadCount === 1) {\n break;\n }\n }\n\n if (loadIndex >= this._loadCount) {\n console.log(`no load with id ${loadId}`);\n }\n\n const header = this._headers[loadIndex],\n load = this._loads[loadIndex];\n\n for (let blockIdx = 0; blockIdx < header.blockCount; blockIdx++) {\n const location = header.blockLocation[blockIdx];\n\n let bank = location & 0x03;\n\n if (bank > 2) {\n bank = 0;\n console.log(`invalid bank for block ${blockIdx}, load ${loadIndex}`);\n }\n\n const base = ((location & 28) >>> 2) * 256;\n let checksum = location + header.blockChecksum[blockIdx];\n\n for (let i = 0; i < 256; i++) {\n checksum += load[256 * blockIdx + i];\n this._ramBanks[bank][base + i] = load[256 * blockIdx + i];\n }\n\n if ((checksum & 0xff) !== 0x55) {\n console.log(`load ${loadIndex}, block ${blockIdx}: invalid checksum`);\n }\n }\n\n this._rom[0x7f0] = header.controlWord;\n this._rom[0x7f1] = this._rng.int(0xff);\n this._rom[0x7f2] = header.startAddressLow;\n this._rom[0x7f3] = header.startAddressHigh;\n\n this._loadInProgress = true;\n this._loadTimestamp = this._cpuTimeProvider();\n }\n\n private _bus: Bus;\n\n private _loadCount = 0;\n private _loads: Array<Uint8Array> = null;\n private _headers: Array<Header> = null;\n\n private _rom = new Uint8Array(0x800);\n private _ramBanks = new Array<Uint8Array>(3);\n\n private _bank0: Uint8Array = null;\n private _bank1: Uint8Array = null;\n private _bank1Type = BankType.rom;\n\n private _transitionCount = 0;\n private _pendingWriteData = 0;\n private _pendingWrite = false;\n private _lastAddressBusValue = -1;\n private _writeRamEnabled = false;\n private _loadInProgress = false;\n private _loadTimestamp = 0;\n\n private _rng: RngInterface;\n private _cpuTimeProvider: () => number = null;\n}\n\nexport { CartridgeSupercharger as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport * as cartridgeUtil from './util';\n\nconst mixerTable = new Uint8Array([0x0, 0x4, 0x5, 0x9, 0x6, 0xa, 0xb, 0xf]);\n\nclass CartridgeDPC extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length < 0x2800) {\n throw new Error(`buffer is not a DPC image: too small ${buffer.length}`);\n }\n\n for (let i = 0; i < 8; i++) {\n this._fetchers[i] = new Fetcher();\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n }\n\n for (let i = 0; i < 0x0800; i++) {\n this._fetcherData[i] = buffer[0x2000 + i];\n }\n\n this.reset();\n }\n\n reset(): void {\n this._bank = this._bank1;\n this._rng = 1;\n this._fetchers.forEach(fetcher => fetcher.reset());\n this._lastCpuTime = 0;\n this._clockAccumulator = 0;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_DPC;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n setCpuTimeProvider(provider: () => number): this {\n this._cpuTimeProvider = provider;\n\n return this;\n }\n\n read(address: number): number {\n return this._access(address, this._bus.getLastDataBusValue());\n }\n\n peek(address: number): number {\n return this._bank[address & 0x0fff];\n }\n\n write(address: number, value: number): void {\n this._access(address, value);\n }\n\n private _access(address: number, value: number): number {\n address &= 0x0fff;\n\n if (address > 0x7f) {\n switch (address) {\n case 0x0ff8:\n this._bank = this._bank0;\n break;\n\n case 0x0ff9:\n this._bank = this._bank1;\n break;\n\n default:\n break;\n }\n\n return this._bank[address];\n }\n\n if (address < 0x08) {\n if (address & 0x04) {\n this._clockMusicFetchers();\n\n return mixerTable[\n (this._fetchers[5].mask & 0x4) | (this._fetchers[6].mask & 0x2) | (this._fetchers[7].mask & 0x1)\n ];\n } else {\n return this._randomNext();\n }\n }\n\n if (address < 0x40) {\n const fetcher = this._fetchers[(address - 8) & 0x07],\n mask = fetcher.mask;\n\n let fetchedData = this._fetcherData[0x07ff - fetcher.pointer];\n\n fetcher.next();\n\n switch ((address - 8) >>> 3) {\n case 0:\n return fetchedData;\n\n case 1:\n return fetchedData & mask;\n\n case 2:\n fetchedData &= mask;\n return ((fetchedData << 4) | (fetchedData >>> 4)) & 0xff;\n\n case 3:\n fetchedData &= mask;\n\n return (\n ((fetchedData & 0x01) << 7) |\n ((fetchedData & 0x02) << 5) |\n ((fetchedData & 0x04) << 3) |\n ((fetchedData & 0x08) << 1) |\n ((fetchedData & 0x10) >>> 1) |\n ((fetchedData & 0x20) >>> 3) |\n ((fetchedData & 0x40) >>> 5) |\n ((fetchedData & 0x80) >>> 7)\n );\n\n case 4:\n return (fetchedData & mask) >>> 1;\n\n case 5:\n return (fetchedData << 1) & mask;\n\n case 6:\n return mask;\n }\n }\n\n if (address < 0x60) {\n const fetcher = this._fetchers[(address - 0x40) & 0x07];\n\n switch ((address - 0x40) >>> 3) {\n case 0:\n this._clockMusicFetchers();\n fetcher.setStart(value);\n break;\n\n case 1:\n this._clockMusicFetchers();\n fetcher.setEnd(value);\n break;\n\n case 2:\n fetcher.setLow(value);\n break;\n\n case 3:\n fetcher.setHigh(value);\n\n if (address > 0x5c) {\n fetcher.setMusicMode(value);\n }\n\n break;\n }\n\n return this._bank[address];\n }\n\n if (address >= 0x70 && address < 0x78) {\n this._rng = 1;\n\n return this._bank[address];\n }\n\n return this._bank[address];\n }\n\n private _randomNext(): number {\n const oldRng = this._rng;\n\n this._rng =\n ((this._rng << 1) |\n (~((this._rng >>> 7) ^ (this._rng >>> 5) ^ ((this._rng >>> 4) ^ (this._rng >>> 3))) & 0x01)) &\n 0xff;\n\n return oldRng;\n }\n\n private _clockMusicFetchers(): void {\n const cpuTime = this._cpuTimeProvider();\n this._clockAccumulator += (cpuTime - this._lastCpuTime) * 20000;\n this._lastCpuTime = cpuTime;\n\n const clocks = Math.floor(this._clockAccumulator);\n this._clockAccumulator -= clocks;\n\n if (clocks === 0) {\n return;\n }\n\n for (let i = 5; i < 8; i++) {\n this._fetchers[i].forwardClock(clocks);\n }\n }\n\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n\n private _bank: Uint8Array;\n\n private _fetcherData = new Uint8Array(0x0800);\n private _fetchers: Array<Fetcher> = new Array(8);\n\n private _rng = 1;\n\n private _bus: Bus;\n\n private _cpuTimeProvider: () => number = null;\n private _lastCpuTime = 0;\n private _clockAccumulator = 0;\n}\n\nclass Fetcher {\n contructor() {\n this.reset();\n }\n\n reset() {\n this.pointer = this.start = this.end = this.mask = 0;\n this.musicMode = false;\n }\n\n next(): void {\n if (this.musicMode) {\n return;\n }\n\n this.pointer = (this.pointer + 0x07ff) & 0x07ff;\n\n this._updateMask();\n }\n\n setStart(start: number): void {\n this.start = start;\n this.mask = 0x00;\n\n this._updateMask();\n }\n\n setEnd(end: number): void {\n this.end = end;\n\n this._updateMask();\n }\n\n setLow(value: number): void {\n this.pointer = (this.pointer & 0x0700) | value;\n\n this._updateMask();\n }\n\n setHigh(value: number): void {\n this.pointer = (this.pointer & 0xff) | ((value & 0x07) << 8);\n\n this._updateMask();\n }\n\n setMusicMode(value: number): void {\n this.musicMode = (value & 0x10) !== 0;\n }\n\n forwardClock(clocks: number) {\n if (!this.musicMode) {\n return;\n }\n\n const period = this.start + 1,\n newPointerLow = ((this.pointer & 0xff) + period - clocks % period) % period,\n distanceStart = (256 + this.start - newPointerLow) & 0xff,\n distanceEnd = (256 + this.end - newPointerLow) & 0xff;\n\n this.pointer = (this.pointer & 0x0700) | newPointerLow;\n\n this.mask = distanceStart > distanceEnd ? 0 : 0xff;\n }\n\n private _updateMask(): void {\n if ((this.pointer & 0xff) === this.start) {\n this.mask = 0xff;\n }\n\n if ((this.pointer & 0xff) === this.end) {\n this.mask = 0x00;\n }\n }\n\n pointer = 0;\n start = 0;\n end = 0;\n musicMode = false;\n mask = 0x00;\n}\n\nexport { CartridgeDPC as default };\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","export default (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});\n","// shim for using process in browser\n// based off https://github.com/defunctzombie/node-process/blob/master/browser.js\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\nvar cachedSetTimeout = defaultSetTimout;\nvar cachedClearTimeout = defaultClearTimeout;\nif (typeof global.setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n}\nif (typeof global.clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n}\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\nexport function nextTick(fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nexport var title = 'browser';\nexport var platform = 'browser';\nexport var browser = true;\nexport var env = {};\nexport var argv = [];\nexport var version = ''; // empty string to avoid regexp issues\nexport var versions = {};\nexport var release = {};\nexport var config = {};\n\nfunction noop() {}\n\nexport var on = noop;\nexport var addListener = noop;\nexport var once = noop;\nexport var off = noop;\nexport var removeListener = noop;\nexport var removeAllListeners = noop;\nexport var emit = noop;\n\nexport function binding(name) {\n throw new Error('process.binding is not supported');\n}\n\nexport function cwd () { return '/' }\nexport function chdir (dir) {\n throw new Error('process.chdir is not supported');\n};\nexport function umask() { return 0; }\n\n// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js\nvar performance = global.performance || {}\nvar performanceNow =\n performance.now ||\n performance.mozNow ||\n performance.msNow ||\n performance.oNow ||\n performance.webkitNow ||\n function(){ return (new Date()).getTime() }\n\n// generate timestamp or delta\n// see http://nodejs.org/api/process.html#process_process_hrtime\nexport function hrtime(previousTimestamp){\n var clocktime = performanceNow.call(performance)*1e-3\n var seconds = Math.floor(clocktime)\n var nanoseconds = Math.floor((clocktime%1)*1e9)\n if (previousTimestamp) {\n seconds = seconds - previousTimestamp[0]\n nanoseconds = nanoseconds - previousTimestamp[1]\n if (nanoseconds<0) {\n seconds--\n nanoseconds += 1e9\n }\n }\n return [seconds,nanoseconds]\n}\n\nvar startTime = new Date();\nexport function uptime() {\n var currentTime = new Date();\n var dif = currentTime - startTime;\n return dif / 1000;\n}\n\nexport default {\n nextTick: nextTick,\n title: title,\n browser: browser,\n env: env,\n argv: argv,\n version: version,\n versions: versions,\n on: on,\n addListener: addListener,\n once: once,\n off: off,\n removeListener: removeListener,\n removeAllListeners: removeAllListeners,\n emit: emit,\n binding: binding,\n cwd: cwd,\n chdir: chdir,\n umask: umask,\n hrtime: hrtime,\n platform: platform,\n release: release,\n config: config,\n uptime: uptime\n};\n","export default '/Users/pestix/git/6502ts/6502.ts/node_modules/thumbulator.ts/lib/native'","\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\nvar inited = false;\nfunction init () {\n inited = true;\n var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n for (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n }\n\n revLookup['-'.charCodeAt(0)] = 62\n revLookup['_'.charCodeAt(0)] = 63\n}\n\nexport function toByteArray (b64) {\n if (!inited) {\n init();\n }\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\n // base64 is 4/3 + up to two characters of the original data\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nexport function fromByteArray (uint8) {\n if (!inited) {\n init();\n }\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n","\nexport function read (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexport function write (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nexport default Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\nimport * as base64 from './base64'\nimport * as ieee754 from './ieee754'\nimport isArray from './isArray'\n\nexport var INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : true\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nvar _kMaxLength = kMaxLength()\nexport {_kMaxLength as kMaxLength};\nfunction typedArraySupport () {\n return true;\n // rollup issues\n // try {\n // var arr = new Uint8Array(1)\n // arr.__proto__ = {\n // __proto__: Uint8Array.prototype,\n // foo: function () { return 42 }\n // }\n // return arr.foo() === 42 && // typed array instances can be augmented\n // typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n // arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n // } catch (e) {\n // return false\n // }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nexport function Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n // Object.defineProperty(Buffer, Symbol.species, {\n // value: null,\n // configurable: true\n // })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (internalIsBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nexport function SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\nBuffer.isBuffer = isBuffer;\nfunction internalIsBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!internalIsBuffer(a) || !internalIsBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!internalIsBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (internalIsBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!internalIsBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (internalIsBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!internalIsBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = internalIsBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nexport function isBuffer(obj) {\n return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))\n}\n\nfunction isFastBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexport function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexport function normalize(path) {\n var isPathAbsolute = isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isPathAbsolute).join('/');\n\n if (!path && !isPathAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isPathAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexport function isAbsolute(path) {\n return path.charAt(0) === '/';\n}\n\n// posix version\nexport function join() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n}\n\n\n// path.relative(from, to)\n// posix version\nexport function relative(from, to) {\n from = resolve(from).substr(1);\n to = resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n}\n\nexport var sep = '/';\nexport var delimiter = ':';\n\nexport function dirname(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n}\n\nexport function basename(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n}\n\n\nexport function extname(path) {\n return splitPath(path)[3];\n}\nexport default {\n extname: extname,\n basename: basename,\n dirname: dirname,\n sep: sep,\n delimiter: delimiter,\n relative: relative,\n join: join,\n isAbsolute: isAbsolute,\n normalize: normalize,\n resolve: resolve\n};\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b' ?\n function (str, start, len) { return str.substr(start, len) } :\n function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","\nvar Module = (function() {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n return (\nfunction(Module) {\n Module = Module || {};\n\nvar Module=typeof Module!==\"undefined\"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram=\"./this.program\";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window===\"object\";ENVIRONMENT_IS_WORKER=typeof importScripts===\"function\";ENVIRONMENT_HAS_NODE=typeof process===\"object\"&&typeof process.versions===\"object\"&&typeof process.versions.node===\"string\";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;read_=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=require(\"fs\");if(!nodePath)nodePath=require(\"path\");filename=nodePath[\"normalize\"](filename);ret=nodeFS[\"readFileSync\"](filename)}return binary?ret:ret.toString()};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"unhandledRejection\",abort);quit_=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!=\"undefined\"){read_=function shell_read(f){var data=tryParseAsDataURI(f);if(data){return intArrayToString(data)}return read(f)}}readBinary=function readBinary(f){var data;data=tryParseAsDataURI(f);if(data){return data}if(typeof readbuffer===\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data===\"object\");return data};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit===\"function\"){quit_=function(status){quit(status)}}if(typeof print!==\"undefined\"){if(typeof console===\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!==\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}read_=function shell_read(url){try{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){try{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)};setWindowTitle=function(title){document.title=title}}else{}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var STACK_ALIGN=16;function dynamicAlloc(size){var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end>_emscripten_get_heap_size()){abort()}HEAP32[DYNAMICTOP_PTR>>2]=end;return ret}function getNativeTypeSize(type){switch(type){case\"i1\":case\"i8\":return 1;case\"i16\":return 2;case\"i32\":return 4;case\"i64\":return 8;case\"float\":return 4;case\"double\":return 8;default:{if(type[type.length-1]===\"*\"){return 4}else if(type[0]===\"i\"){var bits=parseInt(type.substr(1));assert(bits%8===0,\"getNativeTypeSize invalid bits \"+bits+\", type \"+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}var jsCallStartIndex=1;var functionPointers=new Array(0);var funcWrappers={};function dynCall(sig,ptr,args){if(args&&args.length){return Module[\"dynCall_\"+sig].apply(null,[ptr].concat(args))}else{return Module[\"dynCall_\"+sig].call(null,ptr)}}var tempRet0=0;var setTempRet0=function(value){tempRet0=value};var getTempRet0=function(){return tempRet0};var GLOBAL_BASE=8;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime;if(Module[\"noExitRuntime\"])noExitRuntime=Module[\"noExitRuntime\"];function setValue(ptr,value,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";switch(type){case\"i1\":HEAP8[ptr>>0]=value;break;case\"i8\":HEAP8[ptr>>0]=value;break;case\"i16\":HEAP16[ptr>>1]=value;break;case\"i32\":HEAP32[ptr>>2]=value;break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case\"float\":HEAPF32[ptr>>2]=value;break;case\"double\":HEAPF64[ptr>>3]=value;break;default:abort(\"invalid type for setValue: \"+type)}}var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func.apply(null,cArgs);ret=convertReturnValue(ret);if(stack!==0)stackRestore(stack);return ret}var ALLOC_NONE=3;var UTF8Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf8\"):undefined;function UTF8ArrayToString(u8Array,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(u8Array[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str=\"\";while(idx<endPtr){var u0=u8Array[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|u8Array[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i<str.length;++i){HEAP8[buffer++>>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var STACK_BASE=3680,DYNAMIC_BASE=13920,DYNAMICTOP_PTR=3648;var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(Module[\"buffer\"]){buffer=Module[\"buffer\"]}else{buffer=new ArrayBuffer(INITIAL_TOTAL_MEMORY)}INITIAL_TOTAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback();continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){Module[\"dynCall_v\"](func)}else{Module[\"dynCall_vi\"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){runtimeExited=true}function postRun(){if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var Math_abs=Math.abs;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_min=Math.min;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module[\"preloadedImages\"]={};Module[\"preloadedAudios\"]={};var memoryInitializer=null;var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var tempDouble;var tempI64;var ASM_CONSTS=[function($0){return Module.trapOnInstructionFetch($0)},function($0){return Module.busRead32($0)},function($0,$1){Module.busWrite32($0,$1)},function($0){return Module.busRead16($0)},function($0,$1){return Module.trapOnBx32($0,$1)},function($0,$1){Module.busWrite16($0,$1)}];function _emscripten_asm_const_iii(code,a0,a1){return ASM_CONSTS[code](a0,a1)}function _emscripten_asm_const_ii(code,a0){return ASM_CONSTS[code](a0)}memoryInitializer=\"data:application/octet-stream;base64,AAAAAAAAAAARAAoAERERAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABEADwoREREDCgcAARMJCwsAAAkGCwAACwAGEQAAABEREQAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAARAAoKERERAAoAAAIACQsAAAAJAAsAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA0AAAAEDQAAAAAJDgAAAAAADgAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAPAAAAAA8AAAAACRAAAAAAABAAABAAABIAAAASEhIAAAAAAAAAAAAA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kFOAC4=\";var tempDoublePtr=3664;function demangle(func){return func}function demangleAll(text){var regex=/\\b__Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return\"(no stack trace available)\"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module[\"extraStackTrace\"])js+=\"\\n\"+Module[\"extraStackTrace\"]();return demangleAll(js)}var PATH={splitPath:function(filename){var splitPathRe=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift(\"..\")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)===\"/\",trailingSlash=path.substr(-1)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path===\"/\")return\"/\";var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:function(l,r){return PATH.normalize(l+\"/\"+r)}};var SYSCALLS={buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function flush_NO_FILESYSTEM(){var fflush=Module[\"_fflush\"];if(fflush)fflush(0);var buffers=SYSCALLS.buffers;if(buffers[1].length)SYSCALLS.printChar(1,10);if(buffers[2].length)SYSCALLS.printChar(2,10)}function _fd_write(stream,iov,iovcnt,pnum){try{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAP32[iov+i*8>>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j<len;j++){SYSCALLS.printChar(stream,HEAPU8[ptr+j])}num+=len}HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___wasi_fd_write(){return _fd_write.apply(null,arguments)}function _emscripten_get_heap_size(){return HEAP8.length}function _exit(status){exit(status)}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest)}function ___setErrNo(value){if(Module[\"___errno_location\"])HEAP32[Module[\"___errno_location\"]()>>2]=value;return value}function abortOnCannotGrowMemory(requestedSize){abort(\"OOM\")}function _emscripten_resize_heap(requestedSize){abortOnCannotGrowMemory(requestedSize)}var ASSERTIONS=false;function intArrayToString(array){var ret=[];for(var i=0;i<array.length;i++){var chr=array[i];if(chr>255){if(ASSERTIONS){assert(false,\"Character code \"+chr+\" (\"+String.fromCharCode(chr)+\") at offset \"+i+\" not in 0x00-0xFF.\")}chr&=255}ret.push(String.fromCharCode(chr))}return ret.join(\"\")}var decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i<input.length);return output};function intArrayFromBase64(s){if(typeof ENVIRONMENT_IS_NODE===\"boolean\"&&ENVIRONMENT_IS_NODE){var buf;try{buf=Buffer.from(s,\"base64\")}catch(_){buf=new Buffer(s,\"base64\")}return new Uint8Array(buf.buffer,buf.byteOffset,buf.byteLength)}try{var decoded=decodeBase64(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i)}return bytes}catch(_){throw new Error(\"Converting base64 string to bytes failed.\")}}function tryParseAsDataURI(filename){if(!isDataURI(filename)){return}return intArrayFromBase64(filename.slice(dataURIPrefix.length))}var asmGlobalArg={\"Math\":Math,\"Int8Array\":Int8Array,\"Int16Array\":Int16Array,\"Int32Array\":Int32Array,\"Uint8Array\":Uint8Array,\"Uint16Array\":Uint16Array,\"Float32Array\":Float32Array,\"Float64Array\":Float64Array};var asmLibraryArg={\"a\":abort,\"b\":setTempRet0,\"c\":getTempRet0,\"d\":___setErrNo,\"e\":___syscall140,\"f\":___syscall6,\"g\":___wasi_fd_write,\"h\":_emscripten_asm_const_ii,\"i\":_emscripten_asm_const_iii,\"j\":_emscripten_get_heap_size,\"k\":_emscripten_memcpy_big,\"l\":_emscripten_resize_heap,\"m\":_exit,\"n\":_fd_write,\"o\":abortOnCannotGrowMemory,\"p\":demangle,\"q\":demangleAll,\"r\":flush_NO_FILESYSTEM,\"s\":jsStackTrace,\"t\":stackTrace,\"u\":tempDoublePtr,\"v\":DYNAMICTOP_PTR};// EMSCRIPTEN_START_ASM\nvar asm=(/** @suppress {uselessCode} */ function(global,env,buffer) {\n\"use asm\";var a=new global.Int8Array(buffer),b=new global.Int16Array(buffer),c=new global.Int32Array(buffer),d=new global.Uint8Array(buffer),e=new global.Uint16Array(buffer),f=new global.Float32Array(buffer),g=new global.Float64Array(buffer),h=env.u|0,i=env.v|0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=global.Math.imul,s=global.Math.clz32,t=env.a,u=env.b,v=env.c,w=env.d,x=env.e,y=env.f,z=env.g,A=env.h,B=env.i,C=env.j,D=env.k,E=env.l,F=env.m,G=env.n,H=env.o,I=env.p,J=env.q,K=env.r,L=env.s,M=env.t,N=3680,O=13920,P=0.0;\n// EMSCRIPTEN_START_FUNCS\nfunction V(a){a=a|0;var b=0;b=N;N=N+a|0;N=N+15&-16;return b|0}function W(){return N|0}function X(a){a=a|0;N=a}function Y(a,b){a=a|0;b=b|0;N=a;O=b}function Z(a){a=a|0;c[712]=a;return}function _(){return 888}function $(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;c[713]=0;if(!a){f=0;return f|0}b=0;d=0;while(1){g=fa()|0;e=(c[713]|0)!=0;d=(g|0)==0?d:g;b=b+1|0;if(e|(g|0)==0^1)break;if(b>>>0>=a>>>0){b=0;f=6;break}}if((f|0)==6)return b|0;g=e?10:d;return g|0}function aa(){c[713]=1;return}function ba(b){b=b|0;a[3440]=b;return}function ca(a){a=a|0;var b=0,d=0;d=N;N=N+16|0;b=c[2784+((a&15)<<2)>>2]|0;if((a&15|0)!=15){N=d;return b|0}if(b&1|0){a=c[160]|0;c[d>>2]=b;va(a,1028,d)|0}b=b&-2;N=d;return b|0}function da(a,b){a=a|0;b=b|0;c[2784+((a&15)<<2)>>2]=(a&15|0)==15?b&-2:b;return}function ea(){c[714]=4;c[715]=0;c[716]=0;c[717]=0;c[718]=0;return 0}function fa(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;o=N;N=N+1232|0;d=c[711]|0;if(d&1|0){n=c[160]|0;c[o>>2]=d;va(n,1028,o)|0}b=c[712]|0;if(!b){b=A(0,(d&-2)+-2|0)|0;if(b|0){n=b;N=o;return n|0}}else if(((d&-2)+-2|0)==(b|0)){n=20;N=o;return n|0}if((d&-2)>>>0>4026531839&(c[717]|0)!=0){c[717]=0;n=c[709]|0;c[696]=A(1,n|0)|0;c[697]=A(1,n+4|0)|0;c[698]=A(1,n+8|0)|0;c[699]=A(1,n+12|0)|0;c[708]=A(1,n+16|0)|0;c[710]=A(1,n+20|0)|0;e=A(1,n+24|0)|0;c[718]=A(1,n+28|0)|0;c[709]=n+32}else e=d&-2;b=c[714]|0;do if(b&1){d=c[716]|0;if(!d){c[716]=c[715];c[714]=b|65536;b=b|65536;break}else{c[716]=d+-1;break}}while(0);if((b&3|0)==3?(b&65536|0)!=0&(c[717]|0)==0:0){f=c[709]|0;d=c[718]|0;a:do if((f+-4&-268435456|0)==-536870912)switch((f+536813548|0)>>>2|f+536813548<<30|0){case 0:{c[714]=d&65543;if((b&1|0)!=0|(d&1|0)==0)break a;c[716]=c[715];break a}case 1:{c[715]=d&16777215;break a}case 2:{c[716]=d&16777215;break a}case 3:break a;default:break a}else B(2,f+-4|0,d|0)|0;while(0);b:do if((f+-8&-268435456|0)==-536870912)switch((f+536813544|0)>>>2|f+536813544<<30|0){case 0:{n=c[714]|0;c[714]=e&65543;if((e&1|0)==0|(n&1|0)!=0)break b;c[716]=c[715];break b}case 1:{c[715]=e&16777215;break b}case 2:{c[716]=e&16777215;break b}case 3:break b;default:break b}else B(2,f+-8|0,e|0)|0;while(0);b=c[710]|0;c:do if((f+-12&-268435456|0)==-536870912)switch((f+536813540|0)>>>2|f+536813540<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break c;c[716]=c[715];break c}case 1:{c[715]=b&16777215;break c}case 2:{c[716]=b&16777215;break c}case 3:break c;default:break c}else B(2,f+-12|0,b|0)|0;while(0);b=c[708]|0;d:do if((f+-16&-268435456|0)==-536870912)switch((f+536813536|0)>>>2|f+536813536<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break d;c[716]=c[715];break d}case 1:{c[715]=b&16777215;break d}case 2:{c[716]=b&16777215;break d}case 3:break d;default:break d}else B(2,f+-16|0,b|0)|0;while(0);b=c[699]|0;e:do if((f+-20&-268435456|0)==-536870912)switch((f+536813532|0)>>>2|f+536813532<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break e;c[716]=c[715];break e}case 1:{c[715]=b&16777215;break e}case 2:{c[716]=b&16777215;break e}case 3:break e;default:break e}else B(2,f+-20|0,b|0)|0;while(0);b=c[698]|0;f:do if((f+-24&-268435456|0)==-536870912)switch((f+536813528|0)>>>2|f+536813528<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break f;c[716]=c[715];break f}case 1:{c[715]=b&16777215;break f}case 2:{c[716]=b&16777215;break f}case 3:break f;default:break f}else B(2,f+-24|0,b|0)|0;while(0);b=c[697]|0;g:do if((f+-28&-268435456|0)==-536870912)switch((f+536813524|0)>>>2|f+536813524<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break g;c[716]=c[715];break g}case 1:{c[715]=b&16777215;break g}case 2:{c[716]=b&16777215;break g}case 3:break g;default:break g}else B(2,f+-28|0,b|0)|0;while(0);b=c[696]|0;h:do if((f+-32&-268435456|0)==-536870912)switch((f+536813520|0)>>>2|f+536813520<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break h;c[716]=c[715];break h}case 1:{c[715]=b&16777215;break h}case 2:{c[716]=b&16777215;break h}case 3:break h;default:break h}else B(2,f+-32|0,b|0)|0;while(0);c[709]=f+-32;e=(A(1,60)|0)+2|0;c[710]=-7;c[717]=1}g=e+-2|0;n=A(3,g|0)|0;m=e+2|0;c[711]=m&-2;if(a[3440]|0){l=c[160]|0;c[o+8>>2]=g;c[o+8+4>>2]=n;va(l,1099,o+8|0)|0}if((n&65472|0)==16704){if(a[3440]|0){m=c[160]|0;c[o+16>>2]=n&7;c[o+16+4>>2]=n>>>3&7;va(m,1119,o+16|0)|0}d=c[2784+((n&7)<<2)>>2]|0;e=c[2784+((n>>>3&7)<<2)>>2]|0;m=c[718]|0;c[2784+((n&7)<<2)>>2]=e+d+(m>>>29&1);b=(e+d+(m>>>29&1)|0)<0?m|-2147483648:m&2147483647;b=(e+d+(m>>>29&1)|0)==0?b|1073741824:b&-1073741825;c[718]=b;if(!(b&536870912)){n=((e>>>31)+(d>>>31)+(((e&2147483647)+(d&2147483647)|0)>>>31)&2|0)==0?b&-536870913:b|536870912;c[718]=(((e&2147483647)+(d&2147483647)|0)>>>31|0)==(((e>>>31)+(d>>>31)+(((e&2147483647)+(d&2147483647)|0)>>>31)|0)>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}else{m=(e>>>31)+(d>>>31)+(((e&2147483647)+(d&2147483647)+1|0)>>>31)|0;n=(m&2|0)==0?b&-536870913:b|536870912;c[718]=(((e&2147483647)+(d&2147483647)+1|0)>>>31|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}}if((n&65024|0)==7168?n>>>6&7|0:0){if(a[3440]|0){m=c[160]|0;c[o+24>>2]=n&7;c[o+24+4>>2]=n>>>3&7;c[o+24+8>>2]=n>>>6&7;va(m,1132,o+24|0)|0}l=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=l+(n>>>6&7);m=c[718]|0;m=(l+(n>>>6&7)|0)<0?m|-2147483648:m&2147483647;m=(l+(n>>>6&7)|0)==0?m|1073741824:m&-1073741825;m=((((l&2147483647)+(n>>>6&7)|0)>>>31)+(l>>>31)&2|0)==0?m&-536870913:m|536870912;c[718]=(((l&2147483647)+(n>>>6&7)|0)>>>31|0)==(((((l&2147483647)+(n>>>6&7)|0)>>>31)+(l>>>31)|0)>>>1|0)?m&-268435457:m|268435456;n=0;N=o;return n|0}if((n&63488|0)==12288){if(a[3440]|0){m=c[160]|0;c[o+40>>2]=n>>>8&7;c[o+40+4>>2]=n&255;va(m,1152,o+40|0)|0}l=c[2784+((n>>>8&7)<<2)>>2]|0;c[2784+((n>>>8&7)<<2)>>2]=l+(n&255);m=c[718]|0;m=(l+(n&255)|0)<0?m|-2147483648:m&2147483647;m=(l+(n&255)|0)==0?m|1073741824:m&-1073741825;m=((((l&2147483647)+(n&255)|0)>>>31)+(l>>>31)&2|0)==0?m&-536870913:m|536870912;c[718]=(((l&2147483647)+(n&255)|0)>>>31|0)==(((((l&2147483647)+(n&255)|0)>>>31)+(l>>>31)|0)>>>1|0)?m&-268435457:m|268435456;n=0;N=o;return n|0}if((n&65024|0)==6144){if(a[3440]|0){m=c[160]|0;c[o+48>>2]=n&7;c[o+48+4>>2]=n>>>3&7;c[o+48+8>>2]=n>>>6&7;va(m,1170,o+48|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;l=c[2784+((n>>>6&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=l+m;n=c[718]|0;n=(l+m|0)<0?n|-2147483648:n&2147483647;n=(l+m|0)==0?n|1073741824:n&-1073741825;n=((l>>>31)+(m>>>31)+(((l&2147483647)+(m&2147483647)|0)>>>31)&2|0)==0?n&-536870913:n|536870912;c[718]=(((l&2147483647)+(m&2147483647)|0)>>>31|0)==(((l>>>31)+(m>>>31)+(((l&2147483647)+(m&2147483647)|0)>>>31)|0)>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}if((n&65280|0)==17408){if(a[3440]|0){l=c[160]|0;c[o+64>>2]=n>>>4&8|n&7;c[o+64+4>>2]=n>>>3&15;va(l,1188,o+64|0)|0}b=c[2784+((n>>>4&8|n&7)<<2)>>2]|0;if((n>>>4&8|n&7|0)==15){if(b&1|0){l=c[160]|0;c[o+72>>2]=b;va(l,1028,o+72|0)|0}b=b&-2}d=c[2784+((n>>>3&15)<<2)>>2]|0;if((n>>>3&15|0)==15){if(d&1|0){l=c[160]|0;c[o+80>>2]=d;va(l,1028,o+80|0)|0}d=d&-2}b=d+b|0;if((n>>>4&8|n&7|0)!=15){c[2784+((n>>>4&8|n&7)<<2)>>2]=b;n=0;N=o;return n|0}if(!(b&1)){n=c[160]|0;c[o+88>>2]=m;c[o+88+4>>2]=b;va(n,1201,o+88|0)|0;F(1)}c[711]=b+2&-2;n=0;N=o;return n|0}d=n&63488;switch(d<<16>>16){case -24576:{if(a[3440]|0){m=c[160]|0;c[o+96>>2]=n>>>8&7;c[o+96+4>>2]=n<<2&1020;va(m,1251,o+96|0)|0}b=c[711]|0;if(b&1|0){m=c[160]|0;c[o+104>>2]=b;va(m,1028,o+104|0)|0}c[2784+((n>>>8&7)<<2)>>2]=(b&-4)+(n<<2&1020);n=0;N=o;return n|0}case -22528:{if(a[3440]|0){m=c[160]|0;c[o+112>>2]=n>>>8&7;c[o+112+4>>2]=n<<2&1020;va(m,1271,o+112|0)|0}c[2784+((n>>>8&7)<<2)>>2]=(c[709]|0)+(n<<2&1020);n=0;N=o;return n|0}default:{if((n&65408|0)==45056){if(a[3440]|0){m=c[160]|0;c[o+120>>2]=n<<2&508;va(m,1291,o+120|0)|0}c[709]=(c[709]|0)+(n<<2&508);n=0;N=o;return n|0}if((n&65472|0)==16384){if(a[3440]|0){m=c[160]|0;c[o+128>>2]=n&7;c[o+128+4>>2]=n>>>3&7;va(m,1307,o+128|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]&c[2784+((n&7)<<2)>>2];c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}if((n&63488|0)==4096){if(a[3440]|0){m=c[160]|0;c[o+136>>2]=n&7;c[o+136+4>>2]=n>>>3&7;c[o+136+8>>2]=n>>>6&31;va(m,1321,o+136|0)|0}d=c[2784+((n>>>3&7)<<2)>>2]|0;do if(!(n>>>6&31)){b=c[718]|0;if((d|0)<0){c[718]=b|536870912;c[2784+((n&7)<<2)>>2]=-1;b=b|536870912;h=141;break}else{c[718]=b&-536870913;c[2784+((n&7)<<2)>>2]=0;b=b&1610612735;h=143;break}}else{b=c[718]|0;b=(d&1<<(n>>>6&31)+-1|0)==0?b&-536870913:b|536870912;c[718]=b;d=((d|0)<0?-1<<32-(n>>>6&31):0)|d>>>(n>>>6&31);c[2784+((n&7)<<2)>>2]=d;if((d|0)>=0)if(!d){b=b&1073741823;h=143}else b=b&1073741823;else h=141}while(0);if((h|0)==141)b=b&1073741823|-2147483648;else if((h|0)==143)b=b|1073741824;c[718]=b;n=0;N=o;return n|0}if((n&65472|0)==16640){if(a[3440]|0){m=c[160]|0;c[o+152>>2]=n&7;c[o+152+4>>2]=n>>>3&7;va(m,1341,o+152|0)|0}d=c[2784+((n&7)<<2)>>2]|0;b=c[2784+((n>>>3&7)<<2)>>2]&255;do if(b){if(b>>>0<32){h=c[718]|0;h=(1<<b+-1&d|0)==0?h&-536870913:h|536870912;c[718]=h;b=((d|0)<0?-1<<32-b:0)|d>>>b;d=h;h=155;break}b=c[718]|0;if((d|0)<0){c[718]=b|536870912;c[2784+((n&7)<<2)>>2]=-1;b=b|-1610612736;h=156;break}else{c[718]=b&-536870913;c[2784+((n&7)<<2)>>2]=0;b=b&536870911;h=158;break}}else{b=d;d=c[718]|0;h=155}while(0);do if((h|0)==155){c[2784+((n&7)<<2)>>2]=b;if((b|0)<0){b=d|-2147483648;h=156;break}if(!b){b=d&2147483647;h=158}else b=d&1073741823}while(0);if((h|0)==156)b=b&-1073741825;else if((h|0)==158)b=b|1073741824;c[718]=b;n=0;N=o;return n|0}i:do if((n&61440|0)==53248){f=(((n&128|0)==0?n&255:n|-256)<<1)+m|0;do switch(n>>>8&15){case 0:{if(a[3440]|0){n=c[160]|0;c[o+160>>2]=f+-1;va(n,1355,o+160|0)|0}if(!(c[718]&1073741824)){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 1:{if(a[3440]|0){n=c[160]|0;c[o+168>>2]=f+-1;va(n,1367,o+168|0)|0}if(c[718]&1073741824|0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 2:{if(a[3440]|0){n=c[160]|0;c[o+176>>2]=f+-1;va(n,1379,o+176|0)|0}if(!(c[718]&536870912)){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 3:{if(a[3440]|0){n=c[160]|0;c[o+184>>2]=f+-1;va(n,1391,o+184|0)|0}if(c[718]&536870912|0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 4:{if(a[3440]|0){n=c[160]|0;c[o+192>>2]=f+-1;va(n,1403,o+192|0)|0}if((c[718]|0)>=0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 5:{if(a[3440]|0){n=c[160]|0;c[o+200>>2]=f+-1;va(n,1415,o+200|0)|0}if((c[718]|0)<0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 6:{if(a[3440]|0){n=c[160]|0;c[o+208>>2]=f+-1;va(n,1427,o+208|0)|0}if(!(c[718]&268435456)){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 7:{if(a[3440]|0){n=c[160]|0;c[o+216>>2]=f+-1;va(n,1439,o+216|0)|0}if(c[718]&268435456|0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 8:{if(a[3440]|0){n=c[160]|0;c[o+224>>2]=f+-1;va(n,1451,o+224|0)|0}if((c[718]&1610612736|0)!=536870912){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 9:{if(a[3440]|0){n=c[160]|0;c[o+232>>2]=f+-1;va(n,1463,o+232|0)|0}if((c[718]&1610612736|0)==536870912){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 10:{if(a[3440]|0){n=c[160]|0;c[o+240>>2]=f+-1;va(n,1475,o+240|0)|0}b=c[718]&-1879048192;j:do if((b|0)<0){switch(b|0){case -1879048192:break j;default:b=0}N=o;return b|0}else{switch(b|0){case 0:break j;default:b=0}N=o;return b|0}while(0);c[711]=f+2&-2;n=0;N=o;return n|0}case 11:{if(a[3440]|0){n=c[160]|0;c[o+248>>2]=f+-1;va(n,1487,o+248|0)|0}b=c[718]&-1879048192;k:do if((b|0)<268435456){switch(b|0){case -2147483648:break k;default:b=0}N=o;return b|0}else{switch(b|0){case 268435456:break k;default:b=0}N=o;return b|0}while(0);c[711]=f+2&-2;n=0;N=o;return n|0}case 12:{if(a[3440]|0){n=c[160]|0;c[o+256>>2]=f+-1;va(n,1499,o+256|0)|0}n=c[718]|0;if(n&1073741824|0?1:(((n&-1879048192|0)==0?((n&-1879048192|0)==-1879048192?2:1):(n&-1879048192|0)==-1879048192&1)|0)==0){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}case 13:{if(a[3440]|0){n=c[160]|0;c[o+264>>2]=f+-1;va(n,1511,o+264|0)|0}n=c[718]|0;if((((n&-1879048192|0)==-2147483648?((n&-1879048192|0)==268435456?2:1):(n&-1879048192|0)==268435456&1)|0)==(0-(n>>>30&1)|0)){n=0;N=o;return n|0}c[711]=f+2&-2;n=0;N=o;return n|0}default:break i}while(0)}while(0);if((n&63488|0)==57344){b=(((n&1024|0)==0?n&2047:n|-2048)<<1)+m|0;if(a[3440]|0){n=c[160]|0;c[o+272>>2]=b+-1;va(n,1523,o+272|0)|0}c[711]=b+2&-2;n=0;N=o;return n|0}if((n&65472|0)==17280){if(a[3440]|0){m=c[160]|0;c[o+280>>2]=n&7;c[o+280+4>>2]=n>>>3&7;va(m,1533,o+280|0)|0}m=c[2784+((n&7)<<2)>>2]&~c[2784+((n>>>3&7)<<2)>>2];c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}if((n&65280|0)==48640){m=c[160]|0;c[o+288>>2]=n&255;va(m,1547,o+288|0)|0;n=1;N=o;return n|0}l:do if((n&57344|0)==57344){if((n&6144)<4096){switch(n&6144){case 2048:break;default:break l}b=(c[710]|0)+(n<<1&4094)&-4|2;if(a[3440]|0){n=c[160]|0;c[o+304>>2]=b+-3;va(n,1560,o+304|0)|0}c[710]=e|1;c[711]=b;n=0;N=o;return n|0}switch(n&6144){case 4096:{if(a[3440]|0)Na(10,c[160]|0)|0;c[710]=(((n&1024|0)==0?n&2047:n|1046528)<<12)+m;n=0;N=o;return n|0}case 6144:{b=(c[710]|0)+(n<<1&4094)|0;if(a[3440]|0){n=c[160]|0;c[o+296>>2]=b+-1;va(n,1560,o+296|0)|0}c[710]=e|1;c[711]=b+2&-2;n=0;N=o;return n|0}default:break l}}while(0);switch((n&65415)<<16>>16){case 18304:{if(a[3440]|0){l=c[160]|0;c[o+312>>2]=n>>>3&15;va(l,1571,o+312|0)|0}b=c[2784+((n>>>3&15)<<2)>>2]|0;if((n>>>3&15|0)==15){if(b&1|0){l=c[160]|0;c[o+320>>2]=b;va(l,1028,o+320|0)|0}b=b&-2}b=b+2|0;if(!(b&1)){l=c[160]|0;c[o+328>>2]=m;c[o+328+4>>2]=n;va(l,1580,o+328|0)|0;n=2;N=o;return n|0}else{c[710]=e|1;c[711]=b&-2;n=0;N=o;return n|0}}case 18176:{if(a[3440]|0){m=c[160]|0;c[o+336>>2]=n>>>3&15;va(m,1616,o+336|0)|0}b=c[2784+((n>>>3&15)<<2)>>2]|0;if((n>>>3&15|0)==15){if(b&1|0){n=c[160]|0;c[o+344>>2]=b;va(n,1028,o+344|0)|0}b=b&-2}b=b+2|0;if(b&1|0){c[711]=b&-2;n=0;N=o;return n|0}b=B(4,g|0,b|0)|0;if(b|0){n=b;N=o;return n|0}c[711]=(c[710]|0)+2&-2;n=0;N=o;return n|0}default:{if((n&65472|0)==17088){if(a[3440]|0){m=c[160]|0;c[o+352>>2]=n&7;c[o+352+4>>2]=n>>>3&7;va(m,1662,o+352|0)|0}m=c[2784+((n&7)<<2)>>2]|0;l=c[2784+((n>>>3&7)<<2)>>2]|0;n=c[718]|0;n=(l+m|0)<0?n|-2147483648:n&2147483647;n=(l+m|0)==0?n|1073741824:n&-1073741825;n=((l>>>31)+(m>>>31)+(((l&2147483647)+(m&2147483647)|0)>>>31)&2|0)==0?n&-536870913:n|536870912;c[718]=(((l&2147483647)+(m&2147483647)|0)>>>31|0)==(((l>>>31)+(m>>>31)+(((l&2147483647)+(m&2147483647)|0)>>>31)|0)>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}if((n&63488|0)==10240){if(a[3440]|0){m=c[160]|0;c[o+360>>2]=n>>>8&7;c[o+360+4>>2]=n&255;va(m,1676,o+360|0)|0}k=c[2784+((n>>>8&7)<<2)>>2]|0;m=c[718]|0;m=(k-(n&255)|0)<0?m|-2147483648:m&2147483647;m=(k-(n&255)|0)==0?m|1073741824:m&-1073741825;l=(k>>>31)+1+((-2147483648-(n&255)+(k&2147483647)|0)>>>31)|0;m=(l&2|0)==0?m&-536870913:m|536870912;c[718]=((-2147483648-(n&255)+(k&2147483647)|0)>>>31|0)==(l>>>1&1|0)?m&-268435457:m|268435456;n=0;N=o;return n|0}if((n&65472|0)==17024){if(a[3440]|0){m=c[160]|0;c[o+368>>2]=n&7;c[o+368+4>>2]=n>>>3&7;va(m,1693,o+368|0)|0}k=c[2784+((n&7)<<2)>>2]|0;l=c[2784+((n>>>3&7)<<2)>>2]|0;n=c[718]|0;n=(k-l|0)<0?n|-2147483648:n&2147483647;n=(k-l|0)==0?n|1073741824:n&-1073741825;m=(~l>>>31)+(k>>>31)+(((k&2147483647)+1+(~l&2147483647)|0)>>>31)|0;n=(m&2|0)==0?n&-536870913:n|536870912;c[718]=(((k&2147483647)+1+(~l&2147483647)|0)>>>31|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}if((n&65280|0)==17664){if(a[3440]|0){m=c[160]|0;c[o+376>>2]=n>>>4&8|n&7;c[o+376+4>>2]=n>>>3&15;va(m,1693,o+376|0)|0}b=c[2784+((n>>>4&8|n&7)<<2)>>2]|0;if((n>>>4&8|n&7|0)==15){if(b&1|0){m=c[160]|0;c[o+384>>2]=b;va(m,1028,o+384|0)|0}d=b&-2}else d=b;b=c[2784+((n>>>3&15)<<2)>>2]|0;if((n>>>3&15|0)==15){if(b&1|0){n=c[160]|0;c[o+392>>2]=b;va(n,1028,o+392|0)|0}b=b&-2}m=d-b|0;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;n=(m|0)==0?n|1073741824:n&-1073741825;m=~b;l=((d&2147483647)+1+(m&2147483647)|0)>>>31;m=(m>>>31)+(d>>>31)+l|0;n=(m&2|0)==0?n&-536870913:n|536870912;c[718]=(l|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}if((n&65512|0)==46688&(a[3440]|0)!=0)oa(1707,9,1,c[160]|0)|0;b=n&65472;switch(b<<16>>16){case 17920:{if(a[3440]|0){m=c[160]|0;c[o+400>>2]=n&7;c[o+400+4>>2]=n>>>3&7;va(m,1717,o+400|0)|0}c[2784+((n&7)<<2)>>2]=c[2784+((n>>>3&7)<<2)>>2];n=0;N=o;return n|0}case 16448:{if(a[3440]|0){m=c[160]|0;c[o+408>>2]=n&7;c[o+408+4>>2]=n>>>3&7;va(m,1730,o+408|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]^c[2784+((n&7)<<2)>>2];c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}default:{m:do if(d<<16>>16<26624){switch(d<<16>>16){case -14336:break;default:break m}if(!(a[3440]|0))d=n&1;else{d=c[160]|0;c[o+416>>2]=n>>>8&7;va(d,1744,o+416|0)|0;if(!(n&1))b=0;else{c[o+424>>2]=0;va(d,1757,o+424|0)|0;b=1}if(n&2){if(b|0)Na(44,d)|0;c[o+1168>>2]=1;va(d,1757,o+1168|0)|0;b=b+1|0}if(n&4){if(b|0)Na(44,d)|0;c[o+1176>>2]=2;va(d,1757,o+1176|0)|0;b=b+1|0}if(n&8){if(b|0)Na(44,d)|0;c[o+1184>>2]=3;va(d,1757,o+1184|0)|0;b=b+1|0}if(n&16){if(b|0)Na(44,d)|0;c[o+1192>>2]=4;va(d,1757,o+1192|0)|0;b=b+1|0}if(n&32){if(b|0)Na(44,d)|0;c[o+1200>>2]=5;va(d,1757,o+1200|0)|0;b=b+1|0}if(n&64){if(b|0)Na(44,d)|0;c[o+1208>>2]=6;va(d,1757,o+1208|0)|0;b=b+1|0}if(n&128|0){if(b|0)Na(44,d)|0;c[o+1216>>2]=7;va(d,1757,o+1216|0)|0}oa(1761,2,1,d)|0;d=n&1}b=c[2784+((n>>>8&7)<<2)>>2]|0;if(d){c[696]=A(1,b|0)|0;b=b+4|0}if(n&2){c[697]=A(1,b|0)|0;b=b+4|0}if(n&4){c[698]=A(1,b|0)|0;b=b+4|0}if(n&8){c[699]=A(1,b|0)|0;b=b+4|0}if(n&16){c[700]=A(1,b|0)|0;b=b+4|0}if(n&32){c[701]=A(1,b|0)|0;b=b+4|0}if(n&64){c[702]=A(1,b|0)|0;b=b+4|0}if(n&128){c[703]=A(1,b|0)|0;b=b+4|0}if(1<<(n>>>8&7)&n|0){n=0;N=o;return n|0}c[2784+((n>>>8&7)<<2)>>2]=b;n=0;N=o;return n|0}else{switch(d<<16>>16){case 26624:break;default:break m}if(a[3440]|0){m=c[160]|0;c[o+432>>2]=n&7;c[o+432+4>>2]=n>>>3&7;c[o+432+8>>2]=n>>>4&124;va(m,1764,o+432|0)|0}c[2784+((n&7)<<2)>>2]=A(1,(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>4&124)|0)|0;n=0;N=o;return n|0}while(0);if((n&65024|0)==22528){if(a[3440]|0){m=c[160]|0;c[o+448>>2]=n&7;c[o+448+4>>2]=n>>>3&7;c[o+448+8>>2]=n>>>6&7;va(m,1785,o+448|0)|0}c[2784+((n&7)<<2)>>2]=A(1,(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0)|0;n=0;N=o;return n|0}n:do if(d<<16>>16<18432){switch(d<<16>>16){case -26624:break;default:break n}if(a[3440]|0){m=c[160]|0;c[o+480>>2]=n>>>8&7;c[o+480+4>>2]=n<<2&1020;va(m,1824,o+480|0)|0}c[2784+((n>>>8&7)<<2)>>2]=A(1,(c[709]|0)+(n<<2&1020)|0)|0;n=0;N=o;return n|0}else{if(d<<16>>16>=30720){switch(d<<16>>16){case 30720:break;default:break n}if(a[3440]|0){m=c[160]|0;c[o+488>>2]=n&7;c[o+488+4>>2]=n>>>3&7;c[o+488+8>>2]=n>>>6&31;va(m,1844,o+488|0)|0}l=(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>6&31)|0;m=A(3,l&-2|0)|0;c[2784+((n&7)<<2)>>2]=((l&1|0)==0?m:m>>>8)&255;n=0;N=o;return n|0}switch(d<<16>>16){case 18432:break;default:break n}if(a[3440]|0){m=c[160]|0;c[o+464>>2]=n>>>8&7;c[o+464+4>>2]=n<<2&1020;va(m,1804,o+464|0)|0}b=c[711]|0;if(b&1|0){m=c[160]|0;c[o+472>>2]=b;va(m,1028,o+472|0)|0}c[2784+((n>>>8&7)<<2)>>2]=A(1,(b&-4)+(n<<2&1020)|0)|0;n=0;N=o;return n|0}while(0);if((n&65024|0)==23552){if(a[3440]|0){m=c[160]|0;c[o+504>>2]=n&7;c[o+504+4>>2]=n>>>3&7;c[o+504+8>>2]=n>>>6&7;va(m,1866,o+504|0)|0}l=(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0;m=A(3,l&-2|0)|0;c[2784+((n&7)<<2)>>2]=((l&1|0)==0?m:m>>>8)&255;n=0;N=o;return n|0}if((n&63488|0)==34816){if(a[3440]|0){m=c[160]|0;c[o+520>>2]=n&7;c[o+520+4>>2]=n>>>3&7;c[o+520+8>>2]=n>>>5&62;va(m,1886,o+520|0)|0}c[2784+((n&7)<<2)>>2]=(A(3,(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>5&62)|0)|0)&65535;n=0;N=o;return n|0}switch((n&65024)<<16>>16){case 23040:{if(a[3440]|0){m=c[160]|0;c[o+536>>2]=n&7;c[o+536+4>>2]=n>>>3&7;c[o+536+8>>2]=n>>>6&7;va(m,1908,o+536|0)|0}c[2784+((n&7)<<2)>>2]=(A(3,(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0)|0)&65535;n=0;N=o;return n|0}case 22016:{if(a[3440]|0){m=c[160]|0;c[o+552>>2]=n&7;c[o+552+4>>2]=n>>>3&7;c[o+552+8>>2]=n>>>6&7;va(m,1928,o+552|0)|0}l=(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0;m=A(3,l&-2|0)|0;m=(l&1|0)==0?m:m>>>8;c[2784+((n&7)<<2)>>2]=(m&128|0)==0?m&255:m|-256;n=0;N=o;return n|0}case 24064:{if(a[3440]|0){m=c[160]|0;c[o+568>>2]=n&7;c[o+568+4>>2]=n>>>3&7;c[o+568+8>>2]=n>>>6&7;va(m,1949,o+568|0)|0}m=A(3,(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0)|0;c[2784+((n&7)<<2)>>2]=(m&32768|0)==0?m&65535:m|-65536;n=0;N=o;return n|0}default:{if(!(n&63488)){if(a[3440]|0){m=c[160]|0;c[o+584>>2]=n&7;c[o+584+4>>2]=n>>>3&7;c[o+584+8>>2]=n>>>6&31;va(m,1970,o+584|0)|0}b=c[2784+((n>>>3&7)<<2)>>2]|0;if(!(n>>>6&31))d=c[718]|0;else{d=c[718]|0;d=(b&1<<32-(n>>>6&31)|0)==0?d&-536870913:d|536870912;c[718]=d;b=b<<(n>>>6&31)}c[2784+((n&7)<<2)>>2]=b;n=(b|0)<0?d|-2147483648:d&2147483647;c[718]=(b|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}if((n&65472|0)==16512){if(a[3440]|0){m=c[160]|0;c[o+600>>2]=n&7;c[o+600+4>>2]=n>>>3&7;va(m,1990,o+600|0)|0}b=c[2784+((n&7)<<2)>>2]|0;d=c[2784+((n>>>3&7)<<2)>>2]&255;do if(!d){d=c[718]|0;h=357}else{if(d>>>0<32){h=c[718]|0;h=(1<<32-d&b|0)==0?h&-536870913:h|536870912;c[718]=h;b=b<<d;d=h;h=357;break}if((d|0)==32){m=c[718]|0;b=(b&1|0)==0?m&-536870913:m|536870912}else b=c[718]&-536870913;c[718]=b;c[2784+((n&7)<<2)>>2]=0;b=b&1073741823;h=360}while(0);do if((h|0)==357){c[2784+((n&7)<<2)>>2]=b;if((b|0)>=0)if(!b){b=d&2147483647;h=360;break}else{b=d&1073741823;break}else{b=d&1073741823|-2147483648;break}}while(0);if((h|0)==360)b=b|1073741824;c[718]=b;n=0;N=o;return n|0}if((n&63488|0)==2048){if(a[3440]|0){m=c[160]|0;c[o+608>>2]=n&7;c[o+608+4>>2]=n>>>3&7;c[o+608+8>>2]=n>>>6&31;va(m,2004,o+608|0)|0}b=c[2784+((n>>>3&7)<<2)>>2]|0;do if(n>>>6&31){d=c[718]|0;d=(b&1<<(n>>>6&31)+-1|0)==0?d&-536870913:d|536870912;c[718]=d;c[2784+((n&7)<<2)>>2]=b>>>(n>>>6&31);if((b>>>(n>>>6&31)|0)>=0)if(!(b>>>(n>>>6&31))){b=d&1073741823;h=370;break}else{b=d&1073741823;break}else{b=d&1073741823|-2147483648;break}}else{h=c[718]|0;b=(b|0)>-1?h&-536870913:h|536870912;c[718]=b;c[2784+((n&7)<<2)>>2]=0;b=b&2147483647;h=370}while(0);if((h|0)==370)b=b|1073741824;c[718]=b;n=0;N=o;return n|0}if((n&65472|0)==16576){if(a[3440]|0){m=c[160]|0;c[o+624>>2]=n&7;c[o+624+4>>2]=n>>>3&7;va(m,2024,o+624|0)|0}b=c[2784+((n&7)<<2)>>2]|0;d=c[2784+((n>>>3&7)<<2)>>2]&255;do if(!d){d=c[718]|0;h=383}else{if(d>>>0<32){h=c[718]|0;h=(1<<d+-1&b|0)==0?h&-536870913:h|536870912;c[718]=h;b=b>>>d;d=h;h=383;break}if((d|0)==32){m=c[718]|0;b=(b|0)>-1?m&-536870913:m|536870912}else b=c[718]&-536870913;c[718]=b;c[2784+((n&7)<<2)>>2]=0;b=b&1073741823;h=386}while(0);do if((h|0)==383){c[2784+((n&7)<<2)>>2]=b;if((b|0)>=0)if(!b){b=d&2147483647;h=386;break}else{b=d&1073741823;break}else{b=d&1073741823|-2147483648;break}}while(0);if((h|0)==386)b=b|1073741824;c[718]=b;n=0;N=o;return n|0}if((n&63488|0)==8192){if(a[3440]|0){m=c[160]|0;c[o+632>>2]=n>>>8&7;c[o+632+4>>2]=n&255;va(m,2038,o+632|0)|0}c[2784+((n>>>8&7)<<2)>>2]=n&255;m=c[718]&1073741823;c[718]=(n&255|0)==0?m|1073741824:m;n=0;N=o;return n|0}if((n&65472|0)==7168){if(a[3440]|0){m=c[160]|0;c[o+640>>2]=n&7;c[o+640+4>>2]=n>>>3&7;va(m,2056,o+640|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=((m|0)==0?n|1073741824:n&-1879048193)&-805306369;n=0;N=o;return n|0}if((n&65280|0)==17920){if(a[3440]|0){m=c[160]|0;c[o+648>>2]=n>>>4&8|n&7;c[o+648+4>>2]=n>>>3&15;va(m,2070,o+648|0)|0}b=c[2784+((n>>>3&15)<<2)>>2]|0;if((n>>>3&15|0)==15){if(b&1|0){m=c[160]|0;c[o+656>>2]=b;va(m,1028,o+656|0)|0}b=b&-2}if((n>>>4&8|n&7|0)==15){c[711]=b+2&-2;n=0;N=o;return n|0}else{c[2784+((n>>>4&8|n&7)<<2)>>2]=b;n=0;N=o;return n|0}}switch(((n&65472)+-16960|0)>>>6&67108863|0){case 4:{if(a[3440]|0){m=c[160]|0;c[o+664>>2]=n&7;c[o+664+4>>2]=n>>>3&7;va(m,2083,o+664|0)|0}m=r(c[2784+((n>>>3&7)<<2)>>2]|0,c[2784+((n&7)<<2)>>2]|0)|0;c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}case 6:{if(a[3440]|0){m=c[160]|0;c[o+672>>2]=n&7;c[o+672+4>>2]=n>>>3&7;va(m,2097,o+672|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=~m;n=c[718]|0;n=(m|0)>-1?n|-2147483648:n&2147483647;c[718]=(m|0)==-1?n|1073741824:n&-1073741825;n=0;N=o;return n|0}case 0:{if(a[3440]|0){m=c[160]|0;c[o+680>>2]=n&7;c[o+680+4>>2]=n>>>3&7;va(m,2111,o+680|0)|0}l=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=0-l;n=c[718]|0;n=(0-l|0)<0?n|-2147483648:n&2147483647;n=(l|0)==0?n|1073741824:n&-1073741825;m=(((~l&2147483647)+1|0)>>>31)+(~l>>>31)|0;n=(m&2|0)==0?n&-536870913:n|536870912;c[718]=(((~l&2147483647)+1|0)>>>31|0)==(m>>>1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}case 3:{if(a[3440]|0){m=c[160]|0;c[o+688>>2]=n&7;c[o+688+4>>2]=n>>>3&7;va(m,2125,o+688|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|c[2784+((n&7)<<2)>>2];c[2784+((n&7)<<2)>>2]=m;n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}default:switch((n&65024)<<16>>16){case -17408:{if(!(a[3440]|0))d=n&1;else{d=c[160]|0;oa(2139,5,1,d)|0;if(!(n&1))b=0;else{c[o+696>>2]=0;va(d,1757,o+696|0)|0;b=1}if(n&2){if(b|0)Na(44,d)|0;c[o+1056>>2]=1;va(d,1757,o+1056|0)|0;b=b+1|0}if(n&4){if(b|0)Na(44,d)|0;c[o+1064>>2]=2;va(d,1757,o+1064|0)|0;b=b+1|0}if(n&8){if(b|0)Na(44,d)|0;c[o+1072>>2]=3;va(d,1757,o+1072|0)|0;b=b+1|0}if(n&16){if(b|0)Na(44,d)|0;c[o+1080>>2]=4;va(d,1757,o+1080|0)|0;b=b+1|0}if(n&32){if(b|0)Na(44,d)|0;c[o+1088>>2]=5;va(d,1757,o+1088|0)|0;b=b+1|0}if(n&64){if(b|0)Na(44,d)|0;c[o+1096>>2]=6;va(d,1757,o+1096|0)|0;b=b+1|0}if(n&128){if(b|0)Na(44,d)|0;c[o+1104>>2]=7;va(d,1757,o+1104|0)|0;b=b+1|0}if(n&256|0){if(b|0)Na(44,d)|0;oa(2145,2,1,d)|0}oa(1761,2,1,d)|0;d=n&1}b=c[709]|0;if(d){c[696]=A(1,b|0)|0;b=b+4|0}if(n&2){c[697]=A(1,b|0)|0;b=b+4|0}if(n&4){c[698]=A(1,b|0)|0;b=b+4|0}if(n&8){c[699]=A(1,b|0)|0;b=b+4|0}if(n&16){c[700]=A(1,b|0)|0;b=b+4|0}if(n&32){c[701]=A(1,b|0)|0;b=b+4|0}if(n&64){c[702]=A(1,b|0)|0;b=b+4|0}if(n&128){c[703]=A(1,b|0)|0;b=b+4|0}if(n&256){d=A(1,b|0)|0;if(!(d&1)){n=c[160]|0;c[o+704>>2]=m;c[o+704+4>>2]=d;va(n,2148,o+704|0)|0;d=d&-2}c[711]=d+2&-2;b=b+4|0}c[709]=b;n=0;N=o;return n|0}case -19456:{l=c[160]|0;if(!(a[3440]|0)){b=n&2;d=n&4;e=n&8;f=n&16;g=n&32;h=n&64;i=n&128;k=n&256;j=n&1}else{oa(2202,6,1,l)|0;if(!(n&1))b=0;else{c[o+712>>2]=0;va(l,1757,o+712|0)|0;b=1}if(n&2){if(b|0)Na(44,l)|0;c[o+1112>>2]=1;va(l,1757,o+1112|0)|0;b=b+1|0}if(n&4){if(b|0)Na(44,l)|0;c[o+1120>>2]=2;va(l,1757,o+1120|0)|0;b=b+1|0}if(n&8){if(b|0)Na(44,l)|0;c[o+1128>>2]=3;va(l,1757,o+1128|0)|0;b=b+1|0}if(n&16){if(b|0)Na(44,l)|0;c[o+1136>>2]=4;va(l,1757,o+1136|0)|0;b=b+1|0}if(n&32){if(b|0)Na(44,l)|0;c[o+1144>>2]=5;va(l,1757,o+1144|0)|0;b=b+1|0}if(n&64){if(b|0)Na(44,l)|0;c[o+1152>>2]=6;va(l,1757,o+1152|0)|0;b=b+1|0}if(n&128){if(b|0)Na(44,l)|0;c[o+1160>>2]=7;va(l,1757,o+1160|0)|0;b=b+1|0}if(n&256|0){if(b|0)Na(44,l)|0;oa(2209,2,1,l)|0}oa(1761,2,1,l)|0;b=n&2;d=n&4;e=n&8;f=n&16;g=n&32;h=n&64;i=n&128;k=n&256;j=n&1}g=(c[709]|0)-(j+(b>>>1)+(d>>>2)+(e>>>3)+(f>>>4)+(g>>>5)+(h>>>6)+(i>>>7)+(k>>>8)<<2)|0;b=g;e=0;f=1;while(1){if(!(f&n))d=b;else{d=c[2784+(e<<2)>>2]|0;o:do if((b&-268435456|0)==-536870912){j=b+536813552|0;switch(j>>>2|j<<30|0){case 0:{j=c[714]|0;c[714]=d&65543;if((d&1|0)==0|(j&1|0)!=0)break o;c[716]=c[715];break o}case 1:{c[715]=d&16777215;break o}case 2:{c[716]=d&16777215;break o}case 3:break o;default:break o}}else B(2,b|0,d|0)|0;while(0);d=b+4|0}e=e+1|0;if((e|0)==8)break;else{b=d;f=f<<1&254}}do if(k|0){b=c[710]|0;p:do if((d&-268435456|0)==-536870912){n=d+536813552|0;switch(n>>>2|n<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0)break p;c[716]=c[715];break p}case 1:{c[715]=b&16777215;break p}case 2:{c[716]=b&16777215;break p}case 3:break p;default:break p}}else B(2,d|0,b|0)|0;while(0);if(b&1|0)break;c[o+720>>2]=m;c[o+720+4>>2]=b;va(l,2212,o+720|0)|0}while(0);c[709]=g;n=0;N=o;return n|0}default:{q:do if(b<<16>>16<-17728)switch(b<<16>>16){case -17920:{if(a[3440]|0){m=c[160]|0;c[o+728>>2]=n&7;c[o+728+4>>2]=n>>>3&7;va(m,2267,o+728|0)|0}c[2784+((n&7)<<2)>>2]=Za(c[2784+((n>>>3&7)<<2)>>2]|0)|0;n=0;N=o;return n|0}case -17856:{if(a[3440]|0){m=c[160]|0;c[o+736>>2]=n&7;c[o+736+4>>2]=n>>>3&7;va(m,2280,o+736|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=m<<8&65280|m>>>8&255|m>>>16<<24|m>>>24<<16;n=0;N=o;return n|0}default:break q}else{if(b<<16>>16<16768){switch(b<<16>>16){case -17728:break;default:break q}if(a[3440]|0){m=c[160]|0;c[o+744>>2]=n&7;c[o+744+4>>2]=n>>>3&7;va(m,2295,o+744|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=(m&128|0)==0?m<<8&65280|m>>>8&255:m<<8&65280|m>>>8&255|-65536;n=0;N=o;return n|0}switch(b<<16>>16){case 16832:break;case 16768:{if(a[3440]|0){m=c[160]|0;c[o+760>>2]=n&7;c[o+760+4>>2]=n>>>3&7;va(m,2324,o+760|0)|0}d=c[2784+((n&7)<<2)>>2]|0;e=c[2784+((n>>>3&7)<<2)>>2]|0;m=c[718]|0;c[2784+((n&7)<<2)>>2]=d-e+-1+(m>>>29&1);b=(d-e+-1+(m>>>29&1)|0)<0?m|-2147483648:m&2147483647;b=(d-e+-1+(m>>>29&1)|0)==0?b|1073741824:b&-1073741825;c[718]=b;if(!(b&536870912)){m=(~e>>>31)+(d>>>31)+(((~e&2147483647)+(d&2147483647)|0)>>>31)|0;n=(m&2|0)==0?b&-536870913:b|536870912;c[718]=(((~e&2147483647)+(d&2147483647)|0)>>>31|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}else{m=(~e>>>31)+(d>>>31)+(((~e&2147483647)+(d&2147483647)+1|0)>>>31)|0;n=(m&2|0)==0?b&-536870913:b|536870912;c[718]=(((~e&2147483647)+(d&2147483647)+1|0)>>>31|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}}default:break q}if(a[3440]|0){m=c[160]|0;c[o+752>>2]=n&7;c[o+752+4>>2]=n>>>3&7;va(m,2310,o+752|0)|0}b=c[2784+((n&7)<<2)>>2]|0;d=c[2784+((n>>>3&7)<<2)>>2]|0;do if(d&255)if(!(d&31)){d=c[718]|0;d=(b|0)>-1?d&-536870913:d|536870912;c[718]=d;break}else{m=c[718]|0;m=(1<<(d&31)+-1&b|0)==0?m&-536870913:m|536870912;c[718]=m;b=b<<32-(d&31)|b>>>(d&31);d=m;break}else d=c[718]|0;while(0);c[2784+((n&7)<<2)>>2]=b;n=(b|0)<0?d|-2147483648:d&2147483647;c[718]=(b|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}while(0);if((n&65527|0)==46672){oa(2337,23,1,c[160]|0)|0;n=1;N=o;return n|0}r:do if(d<<16>>16<24576){switch(d<<16>>16){case -16384:break;default:break r}if(a[3440]|0){d=c[160]|0;c[o+768>>2]=n>>>8&7;va(d,2361,o+768|0)|0;if(!(n&1))b=0;else{c[o+776>>2]=0;va(d,1757,o+776|0)|0;b=1}if(n&2){if(b|0)Na(44,d)|0;c[o+1e3>>2]=1;va(d,1757,o+1e3|0)|0;b=b+1|0}if(n&4){if(b|0)Na(44,d)|0;c[o+1008>>2]=2;va(d,1757,o+1008|0)|0;b=b+1|0}if(n&8){if(b|0)Na(44,d)|0;c[o+1016>>2]=3;va(d,1757,o+1016|0)|0;b=b+1|0}if(n&16){if(b|0)Na(44,d)|0;c[o+1024>>2]=4;va(d,1757,o+1024|0)|0;b=b+1|0}if(n&32){if(b|0)Na(44,d)|0;c[o+1032>>2]=5;va(d,1757,o+1032|0)|0;b=b+1|0}if(n&64){if(b|0)Na(44,d)|0;c[o+1040>>2]=6;va(d,1757,o+1040|0)|0;b=b+1|0}if(n&128|0){if(b|0)Na(44,d)|0;c[o+1048>>2]=7;va(d,1757,o+1048|0)|0}oa(1761,2,1,d)|0}e=1;f=0;b=c[2784+((n>>>8&7)<<2)>>2]|0;while(1){if(e&n){d=c[2784+(f<<2)>>2]|0;s:do if((b&-268435456|0)==-536870912){m=b+536813552|0;switch(m>>>2|m<<30|0){case 0:{m=c[714]|0;c[714]=d&65543;if((d&1|0)==0|(m&1|0)!=0)break s;c[716]=c[715];break s}case 1:{c[715]=d&16777215;break s}case 2:{c[716]=d&16777215;break s}case 3:break s;default:break s}}else B(2,b|0,d|0)|0;while(0);b=b+4|0}f=f+1|0;if((f|0)==8)break;else e=e<<1&254}c[2784+((n>>>8&7)<<2)>>2]=b;n=0;N=o;return n|0}else{switch(d<<16>>16){case 24576:break;default:break r}if(a[3440]|0){m=c[160]|0;c[o+784>>2]=n&7;c[o+784+4>>2]=n>>>3&7;c[o+784+8>>2]=n>>>4&124;va(m,2374,o+784|0)|0}d=(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>4&124)|0;b=c[2784+((n&7)<<2)>>2]|0;if((d&-268435456|0)!=-536870912){B(2,d|0,b|0)|0;n=0;N=o;return n|0}switch((d+536813552|0)>>>2|d+536813552<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0){n=0;N=o;return n|0}c[716]=c[715];n=0;N=o;return n|0}case 1:{c[715]=b&16777215;n=0;N=o;return n|0}case 2:{c[716]=b&16777215;n=0;N=o;return n|0}case 3:{n=0;N=o;return n|0}default:{n=0;N=o;return n|0}}}while(0);if((n&65024|0)==20480){if(a[3440]|0){m=c[160]|0;c[o+800>>2]=n&7;c[o+800+4>>2]=n>>>3&7;c[o+800+8>>2]=n>>>6&7;va(m,2395,o+800|0)|0}d=(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0;b=c[2784+((n&7)<<2)>>2]|0;if((d&-268435456|0)!=-536870912){B(2,d|0,b|0)|0;n=0;N=o;return n|0}switch((d+536813552|0)>>>2|d+536813552<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0){n=0;N=o;return n|0}c[716]=c[715];n=0;N=o;return n|0}case 1:{c[715]=b&16777215;n=0;N=o;return n|0}case 2:{c[716]=b&16777215;n=0;N=o;return n|0}case 3:{n=0;N=o;return n|0}default:{n=0;N=o;return n|0}}}t:do if(d<<16>>16<28672){switch(d<<16>>16){case -28672:break;default:break t}if(a[3440]|0){m=c[160]|0;c[o+816>>2]=n>>>8&7;c[o+816+4>>2]=n<<2&1020;va(m,2414,o+816|0)|0}d=(c[709]|0)+(n<<2&1020)|0;b=c[2784+((n>>>8&7)<<2)>>2]|0;if((d&-268435456|0)!=-536870912){B(2,d|0,b|0)|0;n=0;N=o;return n|0}switch((d+536813552|0)>>>2|d+536813552<<30|0){case 0:{n=c[714]|0;c[714]=b&65543;if((b&1|0)==0|(n&1|0)!=0){n=0;N=o;return n|0}c[716]=c[715];n=0;N=o;return n|0}case 1:{c[715]=b&16777215;n=0;N=o;return n|0}case 2:{c[716]=b&16777215;n=0;N=o;return n|0}case 3:{n=0;N=o;return n|0}default:{n=0;N=o;return n|0}}}else{switch(d<<16>>16){case 28672:break;default:break t}if(a[3440]|0){m=c[160]|0;c[o+824>>2]=n&7;c[o+824+4>>2]=n>>>3&7;c[o+824+8>>2]=n>>>6&31;va(m,2434,o+824|0)|0}e=(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>6&31)|0;b=c[2784+((n&7)<<2)>>2]|0;d=A(3,e&-2|0)|0;if(!(e&1))b=d&65280|b&255;else b=d&255|b<<8;B(5,e&-2|0,b&65535|0)|0;n=0;N=o;return n|0}while(0);if((n&65024|0)==21504){if(a[3440]|0){m=c[160]|0;c[o+840>>2]=n&7;c[o+840+4>>2]=n>>>3&7;c[o+840+8>>2]=n>>>6&7;va(m,2456,o+840|0)|0}e=(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0;b=c[2784+((n&7)<<2)>>2]|0;d=A(3,e&-2|0)|0;if(!(e&1))b=d&65280|b&255;else b=d&255|b<<8;B(5,e&-2|0,b&65535|0)|0;n=0;N=o;return n|0}if((n&63488|0)==32768){if(a[3440]|0){m=c[160]|0;c[o+856>>2]=n&7;c[o+856+4>>2]=n>>>3&7;c[o+856+8>>2]=n>>>5&62;va(m,2476,o+856|0)|0}B(5,(c[2784+((n>>>3&7)<<2)>>2]|0)+(n>>>5&62)|0,c[2784+((n&7)<<2)>>2]&65535|0)|0;n=0;N=o;return n|0}u:do if((n&65024)<<16>>16<20992){switch((n&65024)<<16>>16){case 7680:break;default:break u}if(a[3440]|0){m=c[160]|0;c[o+888>>2]=n&7;c[o+888+4>>2]=n>>>3&7;c[o+888+8>>2]=n>>>6&7;va(m,2518,o+888|0)|0}k=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=k-(n>>>6&7);m=c[718]|0;m=(k-(n>>>6&7)|0)<0?m|-2147483648:m&2147483647;m=(k-(n>>>6&7)|0)==0?m|1073741824:m&-1073741825;l=(k>>>31)+1+((-2147483648-(n>>>6&7)+(k&2147483647)|0)>>>31)|0;m=(l&2|0)==0?m&-536870913:m|536870912;c[718]=((-2147483648-(n>>>6&7)+(k&2147483647)|0)>>>31|0)==(l>>>1&1|0)?m&-268435457:m|268435456;n=0;N=o;return n|0}else{switch((n&65024)<<16>>16){case 20992:break;default:break u}if(a[3440]|0){m=c[160]|0;c[o+872>>2]=n&7;c[o+872+4>>2]=n>>>3&7;c[o+872+8>>2]=n>>>6&7;va(m,2498,o+872|0)|0}B(5,(c[2784+((n>>>6&7)<<2)>>2]|0)+(c[2784+((n>>>3&7)<<2)>>2]|0)|0,c[2784+((n&7)<<2)>>2]&65535|0)|0;n=0;N=o;return n|0}while(0);if((n&63488|0)==14336){if(a[3440]|0){m=c[160]|0;c[o+904>>2]=n>>>8&7;c[o+904+4>>2]=n&255;va(m,2538,o+904|0)|0}k=c[2784+((n>>>8&7)<<2)>>2]|0;c[2784+((n>>>8&7)<<2)>>2]=k-(n&255);m=c[718]|0;m=(k-(n&255)|0)<0?m|-2147483648:m&2147483647;m=(k-(n&255)|0)==0?m|1073741824:m&-1073741825;l=(k>>>31)+1+((-2147483648-(n&255)+(k&2147483647)|0)>>>31)|0;m=(l&2|0)==0?m&-536870913:m|536870912;c[718]=((-2147483648-(n&255)+(k&2147483647)|0)>>>31|0)==(l>>>1&1|0)?m&-268435457:m|268435456;n=0;N=o;return n|0}if((n&65024|0)==6656){if(a[3440]|0){m=c[160]|0;c[o+912>>2]=n&7;c[o+912+4>>2]=n>>>3&7;c[o+912+8>>2]=n>>>6&7;va(m,2556,o+912|0)|0}k=c[2784+((n>>>3&7)<<2)>>2]|0;l=c[2784+((n>>>6&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=k-l;n=c[718]|0;n=(k-l|0)<0?n|-2147483648:n&2147483647;n=(k-l|0)==0?n|1073741824:n&-1073741825;m=(~l>>>31)+(k>>>31)+(((k&2147483647)+1+(~l&2147483647)|0)>>>31)|0;n=(m&2|0)==0?n&-536870913:n|536870912;c[718]=(((k&2147483647)+1+(~l&2147483647)|0)>>>31|0)==(m>>>1&1|0)?n&-268435457:n|268435456;n=0;N=o;return n|0}if((n&65408|0)==45184){if(a[3440]|0){m=c[160]|0;c[o+928>>2]=n<<2&508;va(m,2574,o+928|0)|0}c[709]=(c[709]|0)-(n<<2&508);n=0;N=o;return n|0}if((n&65280|0)==57088){if(a[3440]|0){m=c[160]|0;c[o+936>>2]=n&255;va(m,2590,o+936|0)|0}if((n&255|0)==204){c[696]=c[718];n=0;N=o;return n|0}else{m=c[160]|0;c[o+944>>2]=n&255;va(m,2602,o+944|0)|0;n=1;N=o;return n|0}}v:do if(b<<16>>16>=-19840){if(b<<16>>16<-19776){switch(b<<16>>16){case -19840:break;default:break v}if(a[3440]|0){m=c[160]|0;c[o+984>>2]=n&7;c[o+984+4>>2]=n>>>3&7;va(m,2671,o+984|0)|0}c[2784+((n&7)<<2)>>2]=c[2784+((n>>>3&7)<<2)>>2]&65535;n=0;N=o;return n|0}if(b<<16>>16<16896){switch(b<<16>>16){case -19776:break;default:break v}if(a[3440]|0){m=c[160]|0;c[o+976>>2]=n&7;c[o+976+4>>2]=n>>>3&7;va(m,2657,o+976|0)|0}c[2784+((n&7)<<2)>>2]=c[2784+((n>>>3&7)<<2)>>2]&255;n=0;N=o;return n|0}else{switch(b<<16>>16){case 16896:break;default:break v}if(a[3440]|0){m=c[160]|0;c[o+968>>2]=n&7;c[o+968+4>>2]=n>>>3&7;va(m,2644,o+968|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]&c[2784+((n&7)<<2)>>2];n=c[718]|0;n=(m|0)<0?n|-2147483648:n&2147483647;c[718]=(m|0)==0?n|1073741824:n&-1073741825;n=0;N=o;return n|0}}else switch(b<<16>>16){case -19904:{if(a[3440]|0){m=c[160]|0;c[o+952>>2]=n&7;c[o+952+4>>2]=n>>>3&7;va(m,2616,o+952|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=(m&128|0)==0?m&255:m|-256;n=0;N=o;return n|0}case -19968:{if(a[3440]|0){m=c[160]|0;c[o+960>>2]=n&7;c[o+960+4>>2]=n>>>3&7;va(m,2630,o+960|0)|0}m=c[2784+((n>>>3&7)<<2)>>2]|0;c[2784+((n&7)<<2)>>2]=(m&32768|0)==0?m&65535:m|-65536;n=0;N=o;return n|0}default:break v}while(0);m=c[160]|0;c[o+992>>2]=g;c[o+992+4>>2]=n;va(m,2685,o+992|0)|0;n=1;N=o;return n|0}}}}}}}}}}}return 0}function ga(a){a=a|0;var b=0;b=N;N=N+16|0;c[b>>2]=la(c[a+60>>2]|0)|0;a=ja(y(6,b|0)|0)|0;N=b;return a|0}function ha(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=N;N=N+32|0;g=c[a+28>>2]|0;c[h>>2]=g;g=(c[a+20>>2]|0)-g|0;c[h+4>>2]=g;c[h+8>>2]=b;c[h+12>>2]=d;f=2;b=g+d|0;g=h;while(1){if(!((z(c[a+60>>2]|0,g|0,f|0,h+16|0)|0)<<16>>16))e=c[h+16>>2]|0;else{c[h+16>>2]=-1;e=-1}if((b|0)==(e|0)){b=6;break}if((e|0)<0){b=8;break}k=c[g+4>>2]|0;j=e>>>0>k>>>0;i=j?g+8|0:g;k=e-(j?k:0)|0;c[i>>2]=(c[i>>2]|0)+k;c[i+4>>2]=(c[i+4>>2]|0)-k;f=f+(j<<31>>31)|0;b=b-e|0;g=i}if((b|0)==6){k=c[a+44>>2]|0;c[a+16>>2]=k+(c[a+48>>2]|0);c[a+28>>2]=k;c[a+20>>2]=k}else if((b|0)==8){c[a+16>>2]=0;c[a+28>>2]=0;c[a+20>>2]=0;c[a>>2]=c[a>>2]|32;if((f|0)==2)d=0;else d=d-(c[g+4>>2]|0)|0}N=h;return d|0}function ia(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=N;N=N+32|0;c[f+8>>2]=c[a+60>>2];c[f+8+4>>2]=d;c[f+8+8>>2]=b;c[f+8+12>>2]=f;c[f+8+16>>2]=e;if((ja(x(140,f+8|0)|0)|0)<0){c[f>>2]=-1;c[f+4>>2]=-1;a=-1;b=-1}else{a=c[f+4>>2]|0;b=c[f>>2]|0}u(a|0);N=f;return b|0}function ja(a){a=a|0;if(a>>>0>4294963200){c[(ka()|0)>>2]=0-a;a=-1}return a|0}function ka(){return 2940}function la(a){a=a|0;return a|0}function ma(a){a=a|0;return (a+-48|0)>>>0<10|0}function na(){return 644}function oa(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=r(d,b)|0;d=(b|0)==0?0:d;if((c[e+76>>2]|0)>-1){g=(qa(e)|0)==0;a=ta(a,f,e)|0;if(!g)pa(e)}else a=ta(a,f,e)|0;if((a|0)!=(f|0))d=(a>>>0)/(b>>>0)|0;return d|0}function pa(a){a=a|0;return}function qa(a){a=a|0;return 1}function ra(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0;i=N;N=N+16|0;a[i>>0]=e;f=c[b+16>>2]|0;if(!f)if(!(sa(b)|0)){g=c[b+16>>2]|0;h=4}else f=-1;else{g=f;h=4}do if((h|0)==4){f=c[b+20>>2]|0;if(f>>>0<g>>>0?(e&255|0)!=(a[b+75>>0]|0):0){c[b+20>>2]=f+1;a[f>>0]=e;f=e&255;break}if((S[c[b+36>>2]&1](b,i,1)|0)==1)f=d[i>>0]|0;else f=-1}while(0);N=i;return f|0}function sa(b){b=b|0;var d=0;d=a[b+74>>0]|0;a[b+74>>0]=d+255|d;d=c[b>>2]|0;if(!(d&8)){c[b+8>>2]=0;c[b+4>>2]=0;d=c[b+44>>2]|0;c[b+28>>2]=d;c[b+20>>2]=d;c[b+16>>2]=d+(c[b+48>>2]|0);b=0}else{c[b>>2]=d|32;b=-1}return b|0}function ta(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=c[e+16>>2]|0;if(!f)if(!(sa(e)|0)){g=c[e+16>>2]|0;h=5}else f=0;else{g=f;h=5}a:do if((h|0)==5){f=c[e+20>>2]|0;if((g-f|0)>>>0<d>>>0){f=S[c[e+36>>2]&1](e,b,d)|0;break}b:do if((a[e+75>>0]|0)<0|(d|0)==0){i=0;g=b}else{h=d;while(1){g=h+-1|0;if((a[b+g>>0]|0)==10)break;if(!g){i=0;g=b;break b}else h=g}f=S[c[e+36>>2]&1](e,b,h)|0;if(f>>>0<h>>>0)break a;i=h;g=b+h|0;d=d-h|0;f=c[e+20>>2]|0}while(0);_a(f|0,g|0,d|0)|0;c[e+20>>2]=(c[e+20>>2]|0)+d;f=i+d|0}while(0);return f|0}function ua(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;a:do if((e|0)!=0&(b&3|0)!=0){f=e;while(1){if((a[b>>0]|0)==(d&255)<<24>>24){g=6;break a}b=b+1|0;e=f+-1|0;if((e|0)!=0&(b&3|0)!=0)f=e;else{f=e;e=(e|0)!=0;g=5;break}}}else{f=e;e=(e|0)!=0;g=5}while(0);if((g|0)==5)if(e)g=6;else g=16;b:do if((g|0)==6){if((a[b>>0]|0)==(d&255)<<24>>24)if(!f){g=16;break}else break;e=r(d&255,16843009)|0;c:do if(f>>>0>3)while(1){h=c[b>>2]^e;if((h&-2139062144^-2139062144)&h+-16843009|0)break c;b=b+4|0;f=f+-4|0;if(f>>>0<=3){g=11;break}}else g=11;while(0);if((g|0)==11)if(!f){g=16;break}while(1){if((a[b>>0]|0)==(d&255)<<24>>24)break b;f=f+-1|0;if(!f){g=16;break}else b=b+1|0}}while(0);if((g|0)==16)b=0;return b|0}function va(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=N;N=N+16|0;c[e>>2]=d;d=wa(a,b,e)|0;N=e;return d|0}function wa(a,b,c){a=a|0;b=b|0;c=c|0;return za(a,b,c,1,1)|0}function xa(b,e,f,g,h,i){b=b|0;e=+e;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0.0,o=0,p=0,q=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0;B=N;N=N+560|0;c[B+536>>2]=0;A=B+540+12|0;La(e)|0;j=v()|0;if((j|0)<0){La(-e)|0;e=-e;z=1;x=2737;j=v()|0}else{z=(h&2049|0)!=0&1;x=(h&2048|0)==0?((h&1|0)==0?2738:2743):2740}do if(0==0&(j&2146435072|0)==2146435072){j=z+3|0;Ha(b,32,f,j,h&-65537);Ba(b,x,z);Ba(b,e!=e|0.0!=0.0?(i&32|0?2764:2768):i&32|0?2756:2760,3);Ha(b,32,f,j,h^8192)}else{n=+Ma(e,B+536|0)*2.0;if(n!=0.0)c[B+536>>2]=(c[B+536>>2]|0)+-1;if((i|32|0)==97){p=(i&32|0)==0?x:x+9|0;o=z|2;do if(!(g>>>0>11|(12-g|0)==0)){e=8.0;j=12-g|0;do{j=j+-1|0;e=e*16.0}while((j|0)!=0);if((a[p>>0]|0)==45){e=-(e+(-n-e));break}else{e=n+e-e;break}}else e=n;while(0);k=c[B+536>>2]|0;j=(k|0)<0?0-k|0:k;j=Ga(j,((j|0)<0)<<31>>31,A)|0;if((j|0)==(A|0)){a[B+540+11>>0]=48;j=B+540+11|0}a[j+-1>>0]=(k>>31&2)+43;m=j+-2|0;a[m>>0]=i+15;j=B;do{z=~~e;k=j+1|0;a[j>>0]=i&32|d[480+z>>0];e=(e-+(z|0))*16.0;if((k-B|0)==1?!((h&8|0)==0&((g|0)<1&e==0.0)):0){a[k>>0]=46;j=j+2|0}else j=k}while(e!=0.0);l=j;if((g|0)!=0?(-2-B+l|0)<(g|0):0){g=g+2+A-m|0;j=A;k=m}else{g=A-B-m+l|0;j=A;k=m}A=g+o|0;Ha(b,32,f,A,h);Ba(b,p,o);Ha(b,48,f,A,h^65536);Ba(b,B,l-B|0);j=j-k|0;Ha(b,48,g-(l-B+j)|0,0,0);Ba(b,m,j);Ha(b,32,f,A,h^8192);j=A;break}k=(g|0)<0?6:g;if(n!=0.0){j=(c[B+536>>2]|0)+-28|0;c[B+536>>2]=j;e=n*268435456.0}else{e=n;j=c[B+536>>2]|0}y=(j|0)<0?B+32|0:B+32+288|0;g=y;do{u=~~e>>>0;c[g>>2]=u;g=g+4|0;e=(e-+(u>>>0))*1.0e9}while(e!=0.0);if((j|0)>0){o=y;while(1){m=(j|0)<29?j:29;j=g+-4|0;if(j>>>0>=o>>>0){l=0;do{s=Ya(c[j>>2]|0,0,m|0)|0;s=Sa(s|0,v()|0,l|0,0)|0;t=v()|0;l=Wa(s|0,t|0,1e9,0)|0;u=Ra(l|0,v()|0,1e9,0)|0;u=Ta(s|0,t|0,u|0,v()|0)|0;v()|0;c[j>>2]=u;j=j+-4|0}while(j>>>0>=o>>>0);if(l){u=o+-4|0;c[u>>2]=l;l=u}else l=o}else l=o;a:do if(g>>>0>l>>>0){j=g;while(1){g=j+-4|0;if(c[g>>2]|0){g=j;break a}if(g>>>0>l>>>0)j=g;else break}}while(0);j=(c[B+536>>2]|0)-m|0;c[B+536>>2]=j;if((j|0)>0)o=l;else break}}else l=y;if((j|0)<0){do{o=0-j|0;o=(o|0)<9?o:9;if(l>>>0<g>>>0){m=0;j=l;do{u=c[j>>2]|0;c[j>>2]=(u>>>o)+m;m=r(u&(1<<o)+-1,1e9>>>o)|0;j=j+4|0}while(j>>>0<g>>>0);j=(c[l>>2]|0)==0?l+4|0:l;if(!m)l=j;else{c[g>>2]=m;g=g+4|0;l=j}}else l=(c[l>>2]|0)==0?l+4|0:l;j=(i|32|0)==102?y:l;g=(g-j>>2|0)>(((k+25|0)/9|0)+1|0)?j+(((k+25|0)/9|0)+1<<2)|0:g;j=(c[B+536>>2]|0)+o|0;c[B+536>>2]=j}while((j|0)<0);j=l}else j=l;if(j>>>0<g>>>0){l=(y-j>>2)*9|0;o=c[j>>2]|0;if(o>>>0>=10){m=10;do{m=m*10|0;l=l+1|0}while(o>>>0>=m>>>0)}}else l=0;m=k-((i|32|0)==102?0:l)+(((k|0)!=0&(i|32|0)==103)<<31>>31)|0;if((m|0)<(((g-y>>2)*9|0)+-9|0)){p=y+4+(((m+9216|0)/9|0)+-1024<<2)|0;m=m+9216-(((m+9216|0)/9|0)*9|0)|0;if((m|0)<8){o=10;while(1){o=o*10|0;if((m|0)<7)m=m+1|0;else break}}else o=10;s=c[p>>2]|0;m=(s>>>0)/(o>>>0)|0;t=s-(r(m,o)|0)|0;q=(p+4|0)==(g|0);if(!(q&(t|0)==0)){e=(m&1|0)==0?9007199254740992.0:9007199254740994.0;u=o>>>1;n=t>>>0<u>>>0?.5:q&(t|0)==(u|0)?1.0:1.5;if(z){u=(a[x>>0]|0)==45;n=u?-n:n;e=u?-e:e}c[p>>2]=s-t;if(e+n!=e){u=s-t+o|0;c[p>>2]=u;if(u>>>0>999999999){m=p;while(1){l=m+-4|0;c[m>>2]=0;if(l>>>0<j>>>0){j=j+-4|0;c[j>>2]=0}u=(c[l>>2]|0)+1|0;c[l>>2]=u;if(u>>>0>999999999)m=l;else{p=l;break}}}l=(y-j>>2)*9|0;o=c[j>>2]|0;if(o>>>0<10)m=p;else{m=10;do{m=m*10|0;l=l+1|0}while(o>>>0>=m>>>0);m=p}}else m=p}else m=p;t=m+4|0;g=g>>>0>t>>>0?t:g;t=j}else t=j;p=0-l|0;b:do if(g>>>0>t>>>0)while(1){j=g+-4|0;if(c[j>>2]|0){u=g;s=1;break b}if(j>>>0>t>>>0)g=j;else{u=j;s=0;break}}else{u=g;s=0}while(0);do if((i|32|0)==103){if((l|0)>-5?(k+(((k|0)!=0^1)&1)|0)>(l|0):0){m=i+-1|0;k=k+(((k|0)!=0^1)&1)+-1-l|0}else{m=i+-2|0;k=k+(((k|0)!=0^1)&1)+-1|0}if(!(h&8)){if(s?(w=c[u+-4>>2]|0,(w|0)!=0):0)if(!((w>>>0)%10|0)){j=0;g=10;do{g=g*10|0;j=j+1|0}while(!((w>>>0)%(g>>>0)|0|0))}else j=0;else j=9;g=((u-y>>2)*9|0)+-9|0;if((m|32|0)==102){i=g-j|0;i=(i|0)>0?i:0;k=(k|0)<(i|0)?k:i;break}else{i=g+l-j|0;i=(i|0)>0?i:0;k=(k|0)<(i|0)?k:i;break}}}else m=i;while(0);q=(k|0)!=0;g=q?1:h>>>3&1;o=(m|32|0)==102;if(o){p=0;j=(l|0)>0?l:0}else{j=(l|0)<0?p:l;j=Ga(j,((j|0)<0)<<31>>31,A)|0;if((A-j|0)<2)do{j=j+-1|0;a[j>>0]=48}while((A-j|0)<2);a[j+-1>>0]=(l>>31&2)+43;j=j+-2|0;a[j>>0]=m;p=j;j=A-j|0}j=z+1+k+g+j|0;Ha(b,32,f,j,h);Ba(b,x,z);Ha(b,48,f,j,h^65536);if(o){m=t>>>0>y>>>0?y:t;l=m;do{g=Ga(c[l>>2]|0,0,B+9|0)|0;if((l|0)==(m|0)){if((g|0)==(B+9|0)){a[B+8>>0]=48;g=B+8|0}}else if(g>>>0>B>>>0){$a(B|0,48,g-B|0)|0;do g=g+-1|0;while(g>>>0>B>>>0)}Ba(b,g,B+9-g|0);l=l+4|0}while(l>>>0<=y>>>0);if(!((h&8|0)==0&(q^1)))Ba(b,2772,1);if(l>>>0<u>>>0&(k|0)>0)while(1){g=Ga(c[l>>2]|0,0,B+9|0)|0;if(g>>>0>B>>>0){$a(B|0,48,g-B|0)|0;do g=g+-1|0;while(g>>>0>B>>>0)}Ba(b,g,(k|0)<9?k:9);l=l+4|0;g=k+-9|0;if(!(l>>>0<u>>>0&(k|0)>9)){k=g;break}else k=g}Ha(b,48,k+9|0,9,0)}else{o=s?u:t+4|0;if(t>>>0<o>>>0&(k|0)>-1){m=t;do{g=Ga(c[m>>2]|0,0,B+9|0)|0;if((g|0)==(B+9|0)){a[B+8>>0]=48;g=B+8|0}do if((m|0)==(t|0)){l=g+1|0;Ba(b,g,1);if((h&8|0)==0&(k|0)<1){g=l;break}Ba(b,2772,1);g=l}else{if(g>>>0<=B>>>0)break;$a(B|0,48,g+(0-B)|0)|0;do g=g+-1|0;while(g>>>0>B>>>0)}while(0);z=B+9-g|0;Ba(b,g,(k|0)>(z|0)?z:k);k=k-z|0;m=m+4|0}while(m>>>0<o>>>0&(k|0)>-1)}Ha(b,48,k+18|0,18,0);Ba(b,p,A-p|0)}Ha(b,32,f,j,h^8192)}while(0);N=B;return ((j|0)<(f|0)?f:j)|0}function ya(a,b){a=a|0;b=b|0;var d=0.0,e=0;e=(c[b>>2]|0)+(8-1)&~(8-1);d=+g[e>>3];c[b>>2]=e+8;g[a>>3]=d;return}function za(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;k=N;N=N+224|0;h=k+160|0;i=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(i|0));c[k+208>>2]=c[e>>2];if((Aa(0,d,k+208|0,k+80|0,k+160|0,f,g)|0)<0)e=-1;else{if((c[b+76>>2]|0)>-1)j=qa(b)|0;else j=0;i=c[b>>2]|0;if((a[b+74>>0]|0)<1)c[b>>2]=i&-33;if(!(c[b+48>>2]|0)){h=c[b+44>>2]|0;c[b+44>>2]=k;c[b+28>>2]=k;c[b+20>>2]=k;c[b+48>>2]=80;c[b+16>>2]=k+80;e=Aa(b,d,k+208|0,k+80|0,k+160|0,f,g)|0;if(h){S[c[b+36>>2]&1](b,0,0)|0;e=(c[b+20>>2]|0)==0?-1:e;c[b+44>>2]=h;c[b+48>>2]=0;c[b+16>>2]=0;c[b+28>>2]=0;c[b+20>>2]=0}}else e=Aa(b,d,k+208|0,k+80|0,k+160|0,f,g)|0;h=c[b>>2]|0;c[b>>2]=h|i&32;if(j|0)pa(b);e=(h&32|0)==0?e:-1}N=k;return e|0}function Aa(d,e,f,h,i,j,k){d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0;A=N;N=N+64|0;c[A+56>>2]=e;x=A+40|0;l=0;e=0;n=0;a:while(1){do{do if((e|0)>-1)if((l|0)>(2147483647-e|0)){c[(ka()|0)>>2]=75;e=-1;break}else{e=l+e|0;break}while(0);r=c[A+56>>2]|0;l=a[r>>0]|0;if(!(l<<24>>24)){w=92;break a}m=r;b:while(1){switch(l<<24>>24){case 37:{w=10;break b}case 0:{l=m;break b}default:{}}u=m+1|0;c[A+56>>2]=u;l=a[u>>0]|0;m=u}c:do if((w|0)==10){w=0;l=m;do{if((a[m+1>>0]|0)!=37)break c;l=l+1|0;m=m+2|0;c[A+56>>2]=m}while((a[m>>0]|0)==37)}while(0);l=l-r|0;if(d|0)Ba(d,r,l)}while((l|0)!=0);u=(ma(a[(c[A+56>>2]|0)+1>>0]|0)|0)==0;m=c[A+56>>2]|0;if(!u?(a[m+2>>0]|0)==36:0){s=(a[m+1>>0]|0)+-48|0;p=1;l=3}else{s=-1;p=n;l=1}l=m+l|0;c[A+56>>2]=l;m=a[l>>0]|0;if(((m<<24>>24)+-32|0)>>>0>31|(1<<(m<<24>>24)+-32&75913|0)==0)o=0;else{n=0;o=(m<<24>>24)+-32|0;do{n=1<<o|n;l=l+1|0;c[A+56>>2]=l;m=a[l>>0]|0;o=(m<<24>>24)+-32|0}while(!(o>>>0>31|(1<<o&75913|0)==0));o=n}if(m<<24>>24==42){if((ma(a[l+1>>0]|0)|0)!=0?(z=c[A+56>>2]|0,(a[z+2>>0]|0)==36):0){c[i+((a[z+1>>0]|0)+-48<<2)>>2]=10;l=c[h+((a[z+1>>0]|0)+-48<<3)>>2]|0;n=1;m=z+3|0}else{if(p|0){e=-1;break}if(d|0){u=(c[f>>2]|0)+(4-1)&~(4-1);l=c[u>>2]|0;c[f>>2]=u+4}else l=0;n=0;m=(c[A+56>>2]|0)+1|0}c[A+56>>2]=m;q=(l|0)<0;t=q?0-l|0:l;q=q?o|8192:o;u=n}else{l=Ca(A+56|0)|0;if((l|0)<0){e=-1;break}t=l;q=o;u=p;m=c[A+56>>2]|0}do if((a[m>>0]|0)==46){l=m+1|0;if((a[l>>0]|0)!=42){c[A+56>>2]=l;l=Ca(A+56|0)|0;m=c[A+56>>2]|0;break}if(ma(a[m+2>>0]|0)|0?(y=c[A+56>>2]|0,(a[y+3>>0]|0)==36):0){c[i+((a[y+2>>0]|0)+-48<<2)>>2]=10;l=c[h+((a[y+2>>0]|0)+-48<<3)>>2]|0;c[A+56>>2]=y+4;m=y+4|0;break}if(u|0){e=-1;break a}if(d|0){p=(c[f>>2]|0)+(4-1)&~(4-1);l=c[p>>2]|0;c[f>>2]=p+4}else l=0;m=(c[A+56>>2]|0)+2|0;c[A+56>>2]=m}else l=-1;while(0);p=0;while(1){if(((a[m>>0]|0)+-65|0)>>>0>57){e=-1;break a}n=m;m=m+1|0;c[A+56>>2]=m;n=a[(a[n>>0]|0)+-65+(16+(p*58|0))>>0]|0;if(((n&255)+-1|0)>>>0>=8)break;else p=n&255}if(!(n<<24>>24)){e=-1;break}o=(s|0)>-1;do if(n<<24>>24==19)if(o){e=-1;break a}else w=54;else{if(o){c[i+(s<<2)>>2]=n&255;s=h+(s<<3)|0;w=c[s+4>>2]|0;c[A+40>>2]=c[s>>2];c[A+40+4>>2]=w;w=54;break}if(!d){e=0;break a}Da(A+40|0,n&255,f,k);m=c[A+56>>2]|0;w=55}while(0);if((w|0)==54){w=0;if(d|0)w=55;else l=0}d:do if((w|0)==55){w=0;m=a[m+-1>>0]|0;m=(p|0)!=0&(m&15|0)==3?m&-33:m;n=q&-65537;s=(q&8192|0)==0?q:n;e:do switch(m|0){case 110:switch((p&255)<<24>>24){case 0:{c[c[A+40>>2]>>2]=e;l=0;break d}case 1:{c[c[A+40>>2]>>2]=e;l=0;break d}case 2:{l=c[A+40>>2]|0;c[l>>2]=e;c[l+4>>2]=((e|0)<0)<<31>>31;l=0;break d}case 3:{b[c[A+40>>2]>>1]=e;l=0;break d}case 4:{a[c[A+40>>2]>>0]=e;l=0;break d}case 6:{c[c[A+40>>2]>>2]=e;l=0;break d}case 7:{l=c[A+40>>2]|0;c[l>>2]=e;c[l+4>>2]=((e|0)<0)<<31>>31;l=0;break d}default:{l=0;break d}}case 112:{m=120;l=l>>>0>8?l:8;n=s|8;w=67;break}case 88:case 120:{n=s;w=67;break}case 111:{n=Fa(c[A+40>>2]|0,c[A+40+4>>2]|0,A+40|0)|0;q=n;o=0;p=2720;l=(s&8|0)==0|(l|0)>(x-n|0)?l:x-n+1|0;n=s;w=73;break}case 105:case 100:{m=c[A+40>>2]|0;n=c[A+40+4>>2]|0;if((n|0)<0){m=Ta(0,0,m|0,n|0)|0;n=v()|0;c[A+40>>2]=m;c[A+40+4>>2]=n;o=1;p=2720;w=72;break e}else{o=(s&2049|0)!=0&1;p=(s&2048|0)==0?((s&1|0)==0?2720:2722):2721;w=72;break e}}case 117:{o=0;p=2720;m=c[A+40>>2]|0;n=c[A+40+4>>2]|0;w=72;break}case 99:{a[A+39>>0]=c[A+40>>2];r=A+39|0;o=0;p=2720;q=1;m=n;l=x;break}case 115:{B=c[A+40>>2]|0;B=(B|0)==0?2730:B;s=ua(B,0,l)|0;r=B;o=0;p=2720;q=(s|0)==0?l:s-B|0;m=n;l=(s|0)==0?B+l|0:s;break}case 67:{c[A+48>>2]=c[A+40>>2];c[A+48+4>>2]=0;c[A+40>>2]=A+48;o=-1;w=79;break}case 83:{if(!l){Ha(d,32,t,0,s);l=0;w=89}else{o=l;w=79}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{l=R[j&1](d,+g[A+40>>3],t,l,s,m)|0;break d}default:{o=0;p=2720;q=l;m=s;l=x}}while(0);f:do if((w|0)==67){q=Ea(c[A+40>>2]|0,c[A+40+4>>2]|0,A+40|0,m&32)|0;p=(n&8|0)==0|((c[A+40>>2]|0)==0?(c[A+40+4>>2]|0)==0:0);o=p?0:2;p=p?2720:2720+(m>>>4)|0;w=73}else if((w|0)==72){q=Ga(m,n,A+40|0)|0;n=s;w=73}else if((w|0)==79){w=0;n=c[A+40>>2]|0;l=0;while(1){m=c[n>>2]|0;if(!m)break;m=Ia(A+60|0,m)|0;if((m|0)<0|m>>>0>(o-l|0)>>>0){w=83;break}l=m+l|0;if(o>>>0>l>>>0)n=n+4|0;else break}if((w|0)==83){w=0;if((m|0)<0){e=-1;break a}}Ha(d,32,t,l,s);if(!l){l=0;w=89}else{n=c[A+40>>2]|0;o=0;while(1){m=c[n>>2]|0;if(!m){w=89;break f}m=Ia(A+60|0,m)|0;o=m+o|0;if((o|0)>(l|0)){w=89;break f}Ba(d,A+60|0,m);if(o>>>0>=l>>>0){w=89;break}else n=n+4|0}}}while(0);if((w|0)==73){w=0;m=c[A+40>>2]|0?1:(c[A+40+4>>2]|0)!=0;B=(l|0)!=0|m;m=x-q+((m^1)&1)|0;r=B?q:A+40|0;q=B?((l|0)>(m|0)?l:m):0;m=(l|0)>-1?n&-65537:n;l=x}else if((w|0)==89){w=0;Ha(d,32,t,l,s^8192);l=(t|0)>(l|0)?t:l;break}s=l-r|0;q=(q|0)<(s|0)?s:q;B=q+o|0;l=(t|0)<(B|0)?B:t;Ha(d,32,l,B,m);Ba(d,p,o);Ha(d,48,l,B,m^65536);Ha(d,48,q,s,0);Ba(d,r,s);Ha(d,32,l,B,m^8192)}while(0);n=u}g:do if((w|0)==92)if(!d)if(!n)e=0;else{e=1;while(1){l=c[i+(e<<2)>>2]|0;if(!l)break;Da(h+(e<<3)|0,l,f,k);e=e+1|0;if(e>>>0>=10){e=1;break g}}while(1){if(c[i+(e<<2)>>2]|0){e=-1;break g}e=e+1|0;if(e>>>0>=10){e=1;break}}}while(0);N=A;return e|0}function Ba(a,b,d){a=a|0;b=b|0;d=d|0;if(!(c[a>>2]&32))ta(b,d,a)|0;return}function Ca(b){b=b|0;var d=0,e=0;if(!(ma(a[c[b>>2]>>0]|0)|0))d=0;else{d=0;do{e=c[b>>2]|0;d=(d*10|0)+-48+(a[e>>0]|0)|0;c[b>>2]=e+1}while((ma(a[e+1>>0]|0)|0)!=0)}return d|0}function Da(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{b=(c[d>>2]|0)+(4-1)&~(4-1);e=c[b>>2]|0;c[d>>2]=b+4;c[a>>2]=e;break a}case 10:{b=(c[d>>2]|0)+(4-1)&~(4-1);e=c[b>>2]|0;c[d>>2]=b+4;c[a>>2]=e;c[a+4>>2]=((e|0)<0)<<31>>31;break a}case 11:{b=(c[d>>2]|0)+(4-1)&~(4-1);e=c[b>>2]|0;c[d>>2]=b+4;c[a>>2]=e;c[a+4>>2]=0;break a}case 12:{f=(c[d>>2]|0)+(8-1)&~(8-1);b=c[f>>2]|0;e=c[f+4>>2]|0;c[d>>2]=f+8;c[a>>2]=b;c[a+4>>2]=e;break a}case 13:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=(f&65535)<<16>>16;c[a+4>>2]=(((f&65535)<<16>>16|0)<0)<<31>>31;break a}case 14:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=f&65535;c[a+4>>2]=0;break a}case 15:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=(f&255)<<24>>24;c[a+4>>2]=(((f&255)<<24>>24|0)<0)<<31>>31;break a}case 16:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=f&255;c[a+4>>2]=0;break a}case 17:{f=(c[d>>2]|0)+(8-1)&~(8-1);h=+g[f>>3];c[d>>2]=f+8;g[a>>3]=h;break a}case 18:{U[e&1](a,d);break a}default:break a}while(0);while(0);return}function Ea(b,c,e,f){b=b|0;c=c|0;e=e|0;f=f|0;if(!((b|0)==0&(c|0)==0))do{e=e+-1|0;a[e>>0]=d[480+(b&15)>>0]|0|f;b=Xa(b|0,c|0,4)|0;c=v()|0}while(!((b|0)==0&(c|0)==0));return e|0}function Fa(b,c,d){b=b|0;c=c|0;d=d|0;if(!((b|0)==0&(c|0)==0))do{d=d+-1|0;a[d>>0]=b&7|48;b=Xa(b|0,c|0,3)|0;c=v()|0}while(!((b|0)==0&(c|0)==0));return d|0}function Ga(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295){do{e=b;b=Wa(b|0,c|0,10,0)|0;f=c;c=v()|0;g=Ra(b|0,c|0,10,0)|0;g=Ta(e|0,f|0,g|0,v()|0)|0;v()|0;d=d+-1|0;a[d>>0]=g&255|48}while(f>>>0>9|(f|0)==9&e>>>0>4294967295);c=b}else c=b;if(c)do{g=c;c=(c>>>0)/10|0;d=d+-1|0;a[d>>0]=g-(c*10|0)|48}while(g>>>0>=10);return d|0}function Ha(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=N;N=N+256|0;if((c|0)>(d|0)&(e&73728|0)==0){$a(f|0,b<<24>>24|0,((c-d|0)>>>0<256?c-d|0:256)|0)|0;if((c-d|0)>>>0>255){b=c-d|0;do{Ba(a,f,256);b=b+-256|0}while(b>>>0>255);b=c-d&255}else b=c-d|0;Ba(a,f,b)}N=f;return}function Ia(a,b){a=a|0;b=b|0;if(!a)a=0;else a=Ja(a,b,0)|0;return a|0}function Ja(b,d,e){b=b|0;d=d|0;e=e|0;do if(b){if(d>>>0<128){a[b>>0]=d;b=1;break}if(!(c[c[(Ka()|0)+188>>2]>>2]|0))if((d&-128|0)==57216){a[b>>0]=d;b=1;break}else{c[(ka()|0)>>2]=84;b=-1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;b=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;b=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;b=4;break}else{c[(ka()|0)>>2]=84;b=-1;break}}else b=1;while(0);return b|0}function Ka(){return na()|0}function La(a){a=+a;var b=0;g[h>>3]=a;b=c[h>>2]|0;u(c[h+4>>2]|0);return b|0}function Ma(a,b){a=+a;b=b|0;var d=0,e=0,f=0;g[h>>3]=a;d=c[h>>2]|0;e=c[h+4>>2]|0;f=Xa(d|0,e|0,52)|0;v()|0;switch(f&2047){case 0:{if(a!=0.0){a=+Ma(a*18446744073709551616.0,b);d=(c[b>>2]|0)+-64|0}else d=0;c[b>>2]=d;break}case 2047:break;default:{c[b>>2]=(f&2047)+-1022;c[h>>2]=d;c[h+4>>2]=e&-2146435073|1071644672;a=+g[h>>3]}}return +a}function Na(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;if((c[d+76>>2]|0)>=0?(qa(d)|0)!=0:0){if((b&255|0)!=(a[d+75>>0]|0)?(f=c[d+20>>2]|0,f>>>0<(c[d+16>>2]|0)>>>0):0){c[d+20>>2]=f+1;a[f>>0]=b;b=b&255}else b=ra(d,b)|0;pa(d)}else g=3;do if((g|0)==3){if((b&255|0)!=(a[d+75>>0]|0)?(e=c[d+20>>2]|0,e>>>0<(c[d+16>>2]|0)>>>0):0){c[d+20>>2]=e+1;a[e>>0]=b;b=b&255;break}b=ra(d,b)|0}while(0);return b|0}function Oa(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=N;N=N+16|0;do if(a>>>0<245){m=a>>>0<11?16:a+11&-8;k=c[736]|0;if(k>>>(m>>>3)&3|0){a=2984+((k>>>(m>>>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>>>(b>>>5&8)>>>2&4);j=c[3248+((b>>>5&8|((g&0-g)+-1|0)>>>12&16|b>>>(b>>>5&8)>>>2&4|j>>>1&2|j>>>(j>>>1&2)>>>1&1)+(j>>>(j>>>1&2)>>>(j>>>(j>>>1&2)>>>1&1))<<2)>>2]|0;b=j;i=j;j=(c[j+4>>2]&-8)-m|0;while(1){a=c[b+16>>2]|0;if(!a){a=c[b+20>>2]|0;if(!a)break}h=(c[a+4>>2]&-8)-m|0;f=h>>>0<j>>>0;b=a;i=f?a:i;j=f?h:j}h=i+m|0;if(h>>>0>i>>>0){f=c[i+24>>2]|0;a=c[i+12>>2]|0;do if((a|0)==(i|0)){b=i+20|0;a=c[b>>2]|0;if(!a){b=i+16|0;a=c[b>>2]|0;if(!a){b=0;break}}while(1){e=a+20|0;d=c[e>>2]|0;if(!d){e=a+16|0;d=c[e>>2]|0;if(!d)break;else{a=d;b=e}}else{a=d;b=e}}c[b>>2]=0;b=a}else{b=c[i+8>>2]|0;c[b+12>>2]=a;c[a+8>>2]=b;b=a}while(0);do if(f|0){a=c[i+28>>2]|0;if((i|0)==(c[3248+(a<<2)>>2]|0)){c[3248+(a<<2)>>2]=b;if(!b){c[737]=g&~(1<<a);break}}else{c[((c[f+16>>2]|0)==(i|0)?f+16|0:f+20|0)>>2]=b;if(!b)break}c[b+24>>2]=f;a=c[i+16>>2]|0;if(a|0){c[b+16>>2]=a;c[a+24>>2]=b}a=c[i+20>>2]|0;if(a|0){c[b+20>>2]=a;c[a+24>>2]=b}}while(0);if(j>>>0<16){u=j+m|0;c[i+4>>2]=u|3;u=i+u+4|0;c[u>>2]=c[u>>2]|1}else{c[i+4>>2]=m|3;c[h+4>>2]=j|1;c[h+j>>2]=j;if(l|0){d=c[741]|0;if(!(1<<(l>>>3)&k)){c[736]=1<<(l>>>3)|k;a=2984+(l>>>3<<1<<2)|0;b=2984+(l>>>3<<1<<2)+8|0}else{a=c[2984+(l>>>3<<1<<2)+8>>2]|0;b=2984+(l>>>3<<1<<2)+8|0}c[b>>2]=d;c[a+12>>2]=d;c[d+8>>2]=a;c[d+12>>2]=2984+(l>>>3<<1<<2)}c[738]=j;c[741]=h}u=i+8|0;N=v;return u|0}}}}else if(a>>>0<=4294967231){m=a+11&-8;e=c[737]|0;if(e){if((a+11|0)>>>8)if(m>>>0>16777215)i=31;else{i=(a+11|0)>>>8<<((((a+11|0)>>>8)+1048320|0)>>>16&8);i=14-((i+520192|0)>>>16&4|(((a+11|0)>>>8)+1048320|0)>>>16&8|((i<<((i+520192|0)>>>16&4))+245760|0)>>>16&2)+(i<<((i+520192|0)>>>16&4)<<(((i<<((i+520192|0)>>>16&4))+245760|0)>>>16&2)>>>15)|0;i=m>>>(i+7|0)&1|i<<1}else i=0;a=c[3248+(i<<2)>>2]|0;a:do if(!a){d=0;a=0;b=0-m|0;p=61}else{g=0;b=0-m|0;h=m<<((i|0)==31?0:25-(i>>>1)|0);d=0;while(1){f=(c[a+4>>2]&-8)-m|0;if(f>>>0<b>>>0)if(!f){f=a;b=0;d=a;p=65;break a}else{g=a;b=f}p=c[a+20>>2]|0;a=c[a+16+(h>>>31<<2)>>2]|0;d=(p|0)==0|(p|0)==(a|0)?d:p;if(!a){a=g;p=61;break}else h=h<<1}}while(0);if((p|0)==61){if((d|0)==0&(a|0)==0){a=2<<i;if(!((a|0-a)&e))break;k=((a|0-a)&e&0-((a|0-a)&e))+-1|0;l=k>>>(k>>>12&16)>>>(k>>>(k>>>12&16)>>>5&8);d=l>>>(l>>>2&4)>>>(l>>>(l>>>2&4)>>>1&2);a=0;d=c[3248+((k>>>(k>>>12&16)>>>5&8|k>>>12&16|l>>>2&4|l>>>(l>>>2&4)>>>1&2|d>>>1&1)+(d>>>(d>>>1&1))<<2)>>2]|0}if(!d){i=a;h=b}else{f=a;p=65}}if((p|0)==65)while(1){l=(c[d+4>>2]&-8)-m|0;a=l>>>0<b>>>0;b=a?l:b;f=a?d:f;a=c[d+16>>2]|0;if(!a)a=c[d+20>>2]|0;if(!a){i=f;h=b;break}else d=a}if(((i|0)!=0?h>>>0<((c[738]|0)-m|0)>>>0:0)?(j=i+m|0,j>>>0>i>>>0):0){g=c[i+24>>2]|0;a=c[i+12>>2]|0;do if((a|0)==(i|0)){b=i+20|0;a=c[b>>2]|0;if(!a){b=i+16|0;a=c[b>>2]|0;if(!a){a=0;break}}while(1){f=a+20|0;d=c[f>>2]|0;if(!d){f=a+16|0;d=c[f>>2]|0;if(!d)break;else{a=d;b=f}}else{a=d;b=f}}c[b>>2]=0}else{u=c[i+8>>2]|0;c[u+12>>2]=a;c[a+8>>2]=u}while(0);do if(g){b=c[i+28>>2]|0;if((i|0)==(c[3248+(b<<2)>>2]|0)){c[3248+(b<<2)>>2]=a;if(!a){c[737]=e&~(1<<b);e=e&~(1<<b);break}}else{c[((c[g+16>>2]|0)==(i|0)?g+16|0:g+20|0)>>2]=a;if(!a)break}c[a+24>>2]=g;b=c[i+16>>2]|0;if(b|0){c[a+16>>2]=b;c[b+24>>2]=a}b=c[i+20>>2]|0;if(b){c[a+20>>2]=b;c[b+24>>2]=a}}while(0);b:do if(h>>>0<16){u=h+m|0;c[i+4>>2]=u|3;u=i+u+4|0;c[u>>2]=c[u>>2]|1}else{c[i+4>>2]=m|3;c[j+4>>2]=h|1;c[j+h>>2]=h;d=h>>>3;if(h>>>0<256){a=c[736]|0;if(!(a&1<<d)){c[736]=a|1<<d;a=2984+(d<<1<<2)|0;b=2984+(d<<1<<2)+8|0}else{a=c[2984+(d<<1<<2)+8>>2]|0;b=2984+(d<<1<<2)+8|0}c[b>>2]=j;c[a+12>>2]=j;c[j+8>>2]=a;c[j+12>>2]=2984+(d<<1<<2);break}a=h>>>8;if(a)if(h>>>0>16777215)d=31;else{d=a<<((a+1048320|0)>>>16&8)<<(((a<<((a+1048320|0)>>>16&8))+520192|0)>>>16&4);d=14-(((a<<((a+1048320|0)>>>16&8))+520192|0)>>>16&4|(a+1048320|0)>>>16&8|(d+245760|0)>>>16&2)+(d<<((d+245760|0)>>>16&2)>>>15)|0;d=h>>>(d+7|0)&1|d<<1}else d=0;a=3248+(d<<2)|0;c[j+28>>2]=d;c[j+16+4>>2]=0;c[j+16>>2]=0;b=1<<d;if(!(e&b)){c[737]=e|b;c[a>>2]=j;c[j+24>>2]=a;c[j+12>>2]=j;c[j+8>>2]=j;break}a=c[a>>2]|0;c:do if((c[a+4>>2]&-8|0)!=(h|0)){e=h<<((d|0)==31?0:25-(d>>>1)|0);while(1){d=a+16+(e>>>31<<2)|0;b=c[d>>2]|0;if(!b)break;if((c[b+4>>2]&-8|0)==(h|0)){a=b;break c}else{e=e<<1;a=b}}c[d>>2]=j;c[j+24>>2]=a;c[j+12>>2]=j;c[j+8>>2]=j;break b}while(0);t=a+8|0;u=c[t>>2]|0;c[u+12>>2]=j;c[t>>2]=j;c[j+8>>2]=u;c[j+12>>2]=a;c[j+24>>2]=0}while(0);u=i+8|0;N=v;return u|0}}}else m=-1;while(0);d=c[738]|0;if(d>>>0>=m>>>0){a=d-m|0;b=c[741]|0;if(a>>>0>15){u=b+m|0;c[741]=u;c[738]=a;c[u+4>>2]=a|1;c[b+d>>2]=a;c[b+4>>2]=m|3}else{c[738]=0;c[741]=0;c[b+4>>2]=d|3;c[b+d+4>>2]=c[b+d+4>>2]|1}u=b+8|0;N=v;return u|0}f=c[739]|0;if(f>>>0>m>>>0){s=f-m|0;c[739]=s;u=c[742]|0;t=u+m|0;c[742]=t;c[t+4>>2]=s|1;c[u+4>>2]=m|3;u=u+8|0;N=v;return u|0}if(!(c[854]|0)){c[856]=4096;c[855]=4096;c[857]=-1;c[858]=-1;c[859]=0;c[847]=0;c[854]=v&-16^1431655768;a=4096}else a=c[856]|0;g=m+48|0;h=m+47|0;j=a+h|0;i=0-a|0;if((j&i)>>>0<=m>>>0){u=0;N=v;return u|0}a=c[846]|0;if(a|0?(l=c[844]|0,(l+(j&i)|0)>>>0<=l>>>0?1:(l+(j&i)|0)>>>0>a>>>0):0){u=0;N=v;return u|0}d:do if(!(c[847]&4)){d=c[742]|0;e:do if(d){b=3392;while(1){l=c[b>>2]|0;if(l>>>0<=d>>>0?(l+(c[b+4>>2]|0)|0)>>>0>d>>>0:0)break;a=c[b+8>>2]|0;if(!a){p=128;break e}else b=a}if((j-f&i)>>>0<2147483647){a=ab(j-f&i|0)|0;if((a|0)==((c[b>>2]|0)+(c[b+4>>2]|0)|0))if((a|0)==(-1|0))a=j-f&i;else{h=j-f&i;f=a;p=145;break d}else{e=a;d=j-f&i;p=136}}else a=0}else p=128;while(0);do if((p|0)==128){b=ab(0)|0;if((b|0)!=(-1|0)?(o=c[855]|0,o=((o+-1&b|0)==0?0:(o+-1+b&0-o)-b|0)+(j&i)|0,n=c[844]|0,o>>>0>m>>>0&o>>>0<2147483647):0){l=c[846]|0;if(l|0?(o+n|0)>>>0<=n>>>0|(o+n|0)>>>0>l>>>0:0){a=0;break}a=ab(o|0)|0;if((a|0)==(b|0)){h=o;f=b;p=145;break d}else{e=a;d=o;p=136}}else a=0}while(0);do if((p|0)==136){b=0-d|0;if(!(g>>>0>d>>>0&(d>>>0<2147483647&(e|0)!=(-1|0))))if((e|0)==(-1|0)){a=0;break}else{h=d;f=e;p=145;break d}a=c[856]|0;a=h-d+a&0-a;if(a>>>0>=2147483647){h=d;f=e;p=145;break d}if((ab(a|0)|0)==(-1|0)){ab(b|0)|0;a=0;break}else{h=a+d|0;f=e;p=145;break d}}while(0);c[847]=c[847]|4;p=143}else{a=0;p=143}while(0);if(((p|0)==143?(j&i)>>>0<2147483647:0)?(s=ab(j&i|0)|0,q=ab(0)|0,r=(q-s|0)>>>0>(m+40|0)>>>0,!((s|0)==(-1|0)|r^1|s>>>0<q>>>0&((s|0)!=(-1|0)&(q|0)!=(-1|0))^1)):0){h=r?q-s|0:a;f=s;p=145}if((p|0)==145){a=(c[844]|0)+h|0;c[844]=a;if(a>>>0>(c[845]|0)>>>0)c[845]=a;j=c[742]|0;f:do if(j){a=3392;while(1){b=c[a>>2]|0;d=c[a+4>>2]|0;if((f|0)==(b+d|0)){p=154;break}e=c[a+8>>2]|0;if(!e)break;else a=e}if(((p|0)==154?(t=a+4|0,(c[a+12>>2]&8|0)==0):0)?f>>>0>j>>>0&b>>>0<=j>>>0:0){c[t>>2]=d+h;u=(c[739]|0)+h|0;t=(j+8&7|0)==0?0:0-(j+8)&7;c[742]=j+t;c[739]=u-t;c[j+t+4>>2]=u-t|1;c[j+u+4>>2]=40;c[743]=c[858];break}if(f>>>0<(c[740]|0)>>>0)c[740]=f;d=f+h|0;a=3392;while(1){if((c[a>>2]|0)==(d|0)){p=162;break}b=c[a+8>>2]|0;if(!b)break;else a=b}if((p|0)==162?(c[a+12>>2]&8|0)==0:0){c[a>>2]=f;l=a+4|0;c[l>>2]=(c[l>>2]|0)+h;l=f+8|0;l=f+((l&7|0)==0?0:0-l&7)|0;a=d+((d+8&7|0)==0?0:0-(d+8)&7)|0;k=l+m|0;i=a-l-m|0;c[l+4>>2]=m|3;g:do if((j|0)==(a|0)){u=(c[739]|0)+i|0;c[739]=u;c[742]=k;c[k+4>>2]=u|1}else{if((c[741]|0)==(a|0)){u=(c[738]|0)+i|0;c[738]=u;c[741]=k;c[k+4>>2]=u|1;c[k+u>>2]=u;break}h=c[a+4>>2]|0;if((h&3|0)==1){h:do if(h>>>0<256){b=c[a+8>>2]|0;d=c[a+12>>2]|0;if((d|0)==(b|0)){c[736]=c[736]&~(1<<(h>>>3));break}else{c[b+12>>2]=d;c[d+8>>2]=b;break}}else{g=c[a+24>>2]|0;b=c[a+12>>2]|0;do if((b|0)==(a|0)){b=c[a+16+4>>2]|0;if(!b){b=c[a+16>>2]|0;if(!b){b=0;break}else d=a+16|0}else d=a+16+4|0;while(1){f=b+20|0;e=c[f>>2]|0;if(!e){f=b+16|0;e=c[f>>2]|0;if(!e)break;else{b=e;d=f}}else{b=e;d=f}}c[d>>2]=0}else{u=c[a+8>>2]|0;c[u+12>>2]=b;c[b+8>>2]=u}while(0);if(!g)break;d=c[a+28>>2]|0;do if((c[3248+(d<<2)>>2]|0)!=(a|0)){c[((c[g+16>>2]|0)==(a|0)?g+16|0:g+20|0)>>2]=b;if(!b)break h}else{c[3248+(d<<2)>>2]=b;if(b|0)break;c[737]=c[737]&~(1<<d);break h}while(0);c[b+24>>2]=g;d=c[a+16>>2]|0;if(d|0){c[b+16>>2]=d;c[d+24>>2]=b}d=c[a+16+4>>2]|0;if(!d)break;c[b+20>>2]=d;c[d+24>>2]=b}while(0);a=a+(h&-8)|0;f=(h&-8)+i|0}else f=i;d=a+4|0;c[d>>2]=c[d>>2]&-2;c[k+4>>2]=f|1;c[k+f>>2]=f;d=f>>>3;if(f>>>0<256){a=c[736]|0;if(!(a&1<<d)){c[736]=a|1<<d;a=2984+(d<<1<<2)|0;b=2984+(d<<1<<2)+8|0}else{a=c[2984+(d<<1<<2)+8>>2]|0;b=2984+(d<<1<<2)+8|0}c[b>>2]=k;c[a+12>>2]=k;c[k+8>>2]=a;c[k+12>>2]=2984+(d<<1<<2);break}a=f>>>8;do if(!a)e=0;else{if(f>>>0>16777215){e=31;break}e=a<<((a+1048320|0)>>>16&8)<<(((a<<((a+1048320|0)>>>16&8))+520192|0)>>>16&4);e=14-(((a<<((a+1048320|0)>>>16&8))+520192|0)>>>16&4|(a+1048320|0)>>>16&8|(e+245760|0)>>>16&2)+(e<<((e+245760|0)>>>16&2)>>>15)|0;e=f>>>(e+7|0)&1|e<<1}while(0);a=3248+(e<<2)|0;c[k+28>>2]=e;c[k+16+4>>2]=0;c[k+16>>2]=0;b=c[737]|0;d=1<<e;if(!(b&d)){c[737]=b|d;c[a>>2]=k;c[k+24>>2]=a;c[k+12>>2]=k;c[k+8>>2]=k;break}a=c[a>>2]|0;i:do if((c[a+4>>2]&-8|0)!=(f|0)){e=f<<((e|0)==31?0:25-(e>>>1)|0);while(1){d=a+16+(e>>>31<<2)|0;b=c[d>>2]|0;if(!b)break;if((c[b+4>>2]&-8|0)==(f|0)){a=b;break i}else{e=e<<1;a=b}}c[d>>2]=k;c[k+24>>2]=a;c[k+12>>2]=k;c[k+8>>2]=k;break g}while(0);t=a+8|0;u=c[t>>2]|0;c[u+12>>2]=k;c[t>>2]=k;c[k+8>>2]=u;c[k+12>>2]=a;c[k+24>>2]=0}while(0);u=l+8|0;N=v;return u|0}a=3392;while(1){b=c[a>>2]|0;if(b>>>0<=j>>>0?(u=b+(c[a+4>>2]|0)|0,u>>>0>j>>>0):0)break;a=c[a+8>>2]|0}g=u+-47+((u+-47+8&7|0)==0?0:0-(u+-47+8)&7)|0;g=g>>>0<(j+16|0)>>>0?j:g;a=h+-40|0;s=f+8|0;s=(s&7|0)==0?0:0-s&7;t=f+s|0;c[742]=t;c[739]=a-s;c[t+4>>2]=a-s|1;c[f+a+4>>2]=40;c[743]=c[858];c[g+4>>2]=27;c[g+8>>2]=c[848];c[g+8+4>>2]=c[849];c[g+8+8>>2]=c[850];c[g+8+12>>2]=c[851];c[848]=f;c[849]=h;c[851]=0;c[850]=g+8;a=g+24|0;do{t=a;a=a+4|0;c[a>>2]=7}while((t+8|0)>>>0<u>>>0);if((g|0)!=(j|0)){c[g+4>>2]=c[g+4>>2]&-2;c[j+4>>2]=g-j|1;c[g>>2]=g-j;if((g-j|0)>>>0<256){d=2984+((g-j|0)>>>3<<1<<2)|0;a=c[736]|0;if(!(a&1<<((g-j|0)>>>3))){c[736]=a|1<<((g-j|0)>>>3);a=d;b=d+8|0}else{a=c[d+8>>2]|0;b=d+8|0}c[b>>2]=j;c[a+12>>2]=j;c[j+8>>2]=a;c[j+12>>2]=d;break}if((g-j|0)>>>8)if((g-j|0)>>>0>16777215)e=31;else{e=(g-j|0)>>>8<<((((g-j|0)>>>8)+1048320|0)>>>16&8);e=14-((e+520192|0)>>>16&4|(((g-j|0)>>>8)+1048320|0)>>>16&8|((e<<((e+520192|0)>>>16&4))+245760|0)>>>16&2)+(e<<((e+520192|0)>>>16&4)<<(((e<<((e+520192|0)>>>16&4))+245760|0)>>>16&2)>>>15)|0;e=(g-j|0)>>>(e+7|0)&1|e<<1}else e=0;a=3248+(e<<2)|0;c[j+28>>2]=e;c[j+20>>2]=0;c[j+16>>2]=0;b=c[737]|0;d=1<<e;if(!(b&d)){c[737]=b|d;c[a>>2]=j;c[j+24>>2]=a;c[j+12>>2]=j;c[j+8>>2]=j;break}a=c[a>>2]|0;j:do if((c[a+4>>2]&-8|0)!=(g-j|0)){e=g-j<<((e|0)==31?0:25-(e>>>1)|0);while(1){d=a+16+(e>>>31<<2)|0;b=c[d>>2]|0;if(!b)break;if((c[b+4>>2]&-8|0)==(g-j|0)){a=b;break j}else{e=e<<1;a=b}}c[d>>2]=j;c[j+24>>2]=a;c[j+12>>2]=j;c[j+8>>2]=j;break f}while(0);t=a+8|0;u=c[t>>2]|0;c[u+12>>2]=j;c[t>>2]=j;c[j+8>>2]=u;c[j+12>>2]=a;c[j+24>>2]=0}}else{u=c[740]|0;if((u|0)==0|f>>>0<u>>>0)c[740]=f;c[848]=f;c[849]=h;c[851]=0;c[745]=c[854];c[744]=-1;c[749]=2984;c[748]=2984;c[751]=2992;c[750]=2992;c[753]=3e3;c[752]=3e3;c[755]=3008;c[754]=3008;c[757]=3016;c[756]=3016;c[759]=3024;c[758]=3024;c[761]=3032;c[760]=3032;c[763]=3040;c[762]=3040;c[765]=3048;c[764]=3048;c[767]=3056;c[766]=3056;c[769]=3064;c[768]=3064;c[771]=3072;c[770]=3072;c[773]=3080;c[772]=3080;c[775]=3088;c[774]=3088;c[777]=3096;c[776]=3096;c[779]=3104;c[778]=3104;c[781]=3112;c[780]=3112;c[783]=3120;c[782]=3120;c[785]=3128;c[784]=3128;c[787]=3136;c[786]=3136;c[789]=3144;c[788]=3144;c[791]=3152;c[790]=3152;c[793]=3160;c[792]=3160;c[795]=3168;c[794]=3168;c[797]=3176;c[796]=3176;c[799]=3184;c[798]=3184;c[801]=3192;c[800]=3192;c[803]=3200;c[802]=3200;c[805]=3208;c[804]=3208;c[807]=3216;c[806]=3216;c[809]=3224;c[808]=3224;c[811]=3232;c[810]=3232;u=h+-40|0;s=f+8|0;s=(s&7|0)==0?0:0-s&7;t=f+s|0;c[742]=t;c[739]=u-s;c[t+4>>2]=u-s|1;c[f+u+4>>2]=40;c[743]=c[858]}while(0);a=c[739]|0;if(a>>>0>m>>>0){s=a-m|0;c[739]=s;u=c[742]|0;t=u+m|0;c[742]=t;c[t+4>>2]=s|1;c[u+4>>2]=m|3;u=u+8|0;N=v;return u|0}}c[(ka()|0)>>2]=12;u=0;N=v;return u|0}function Pa(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(!a)return;b=c[740]|0;d=c[a+-4>>2]|0;j=a+-8+(d&-8)|0;do if(!(d&1)){e=c[a+-8>>2]|0;if(!(d&3))return;h=a+-8+(0-e)|0;g=e+(d&-8)|0;if(h>>>0<b>>>0)return;if((c[741]|0)==(h|0)){b=c[j+4>>2]|0;if((b&3|0)!=3){i=h;b=g;break}c[738]=g;c[j+4>>2]=b&-2;c[h+4>>2]=g|1;c[h+g>>2]=g;return}if(e>>>0<256){b=c[h+8>>2]|0;a=c[h+12>>2]|0;if((a|0)==(b|0)){c[736]=c[736]&~(1<<(e>>>3));i=h;b=g;break}else{c[b+12>>2]=a;c[a+8>>2]=b;i=h;b=g;break}}f=c[h+24>>2]|0;b=c[h+12>>2]|0;do if((b|0)==(h|0)){b=c[h+16+4>>2]|0;if(!b){b=c[h+16>>2]|0;if(!b){b=0;break}else a=h+16|0}else a=h+16+4|0;while(1){e=b+20|0;d=c[e>>2]|0;if(!d){e=b+16|0;d=c[e>>2]|0;if(!d)break;else{b=d;a=e}}else{b=d;a=e}}c[a>>2]=0}else{i=c[h+8>>2]|0;c[i+12>>2]=b;c[b+8>>2]=i}while(0);if(f){a=c[h+28>>2]|0;if((c[3248+(a<<2)>>2]|0)==(h|0)){c[3248+(a<<2)>>2]=b;if(!b){c[737]=c[737]&~(1<<a);i=h;b=g;break}}else{c[((c[f+16>>2]|0)==(h|0)?f+16|0:f+20|0)>>2]=b;if(!b){i=h;b=g;break}}c[b+24>>2]=f;a=c[h+16>>2]|0;if(a|0){c[b+16>>2]=a;c[a+24>>2]=b}a=c[h+16+4>>2]|0;if(a){c[b+20>>2]=a;c[a+24>>2]=b;i=h;b=g}else{i=h;b=g}}else{i=h;b=g}}else{i=a+-8|0;b=d&-8;h=a+-8|0}while(0);if(h>>>0>=j>>>0)return;d=c[j+4>>2]|0;if(!(d&1))return;if(!(d&2)){if((c[742]|0)==(j|0)){j=(c[739]|0)+b|0;c[739]=j;c[742]=i;c[i+4>>2]=j|1;if((i|0)!=(c[741]|0))return;c[741]=0;c[738]=0;return}if((c[741]|0)==(j|0)){j=(c[738]|0)+b|0;c[738]=j;c[741]=h;c[i+4>>2]=j|1;c[h+j>>2]=j;return}f=(d&-8)+b|0;do if(d>>>0<256){a=c[j+8>>2]|0;b=c[j+12>>2]|0;if((b|0)==(a|0)){c[736]=c[736]&~(1<<(d>>>3));break}else{c[a+12>>2]=b;c[b+8>>2]=a;break}}else{g=c[j+24>>2]|0;b=c[j+12>>2]|0;do if((b|0)==(j|0)){b=c[j+16+4>>2]|0;if(!b){b=c[j+16>>2]|0;if(!b){a=0;break}else a=j+16|0}else a=j+16+4|0;while(1){e=b+20|0;d=c[e>>2]|0;if(!d){e=b+16|0;d=c[e>>2]|0;if(!d)break;else{b=d;a=e}}else{b=d;a=e}}c[a>>2]=0;a=b}else{a=c[j+8>>2]|0;c[a+12>>2]=b;c[b+8>>2]=a;a=b}while(0);if(g|0){b=c[j+28>>2]|0;if((c[3248+(b<<2)>>2]|0)==(j|0)){c[3248+(b<<2)>>2]=a;if(!a){c[737]=c[737]&~(1<<b);break}}else{c[((c[g+16>>2]|0)==(j|0)?g+16|0:g+20|0)>>2]=a;if(!a)break}c[a+24>>2]=g;b=c[j+16>>2]|0;if(b|0){c[a+16>>2]=b;c[b+24>>2]=a}b=c[j+16+4>>2]|0;if(b|0){c[a+20>>2]=b;c[b+24>>2]=a}}}while(0);c[i+4>>2]=f|1;c[h+f>>2]=f;if((i|0)==(c[741]|0)){c[738]=f;return}}else{c[j+4>>2]=d&-2;c[i+4>>2]=b|1;c[h+b>>2]=b;f=b}d=f>>>3;if(f>>>0<256){b=c[736]|0;if(!(b&1<<d)){c[736]=b|1<<d;b=2984+(d<<1<<2)|0;a=2984+(d<<1<<2)+8|0}else{b=c[2984+(d<<1<<2)+8>>2]|0;a=2984+(d<<1<<2)+8|0}c[a>>2]=i;c[b+12>>2]=i;c[i+8>>2]=b;c[i+12>>2]=2984+(d<<1<<2);return}b=f>>>8;if(b)if(f>>>0>16777215)e=31;else{e=b<<((b+1048320|0)>>>16&8)<<(((b<<((b+1048320|0)>>>16&8))+520192|0)>>>16&4);e=14-(((b<<((b+1048320|0)>>>16&8))+520192|0)>>>16&4|(b+1048320|0)>>>16&8|(e+245760|0)>>>16&2)+(e<<((e+245760|0)>>>16&2)>>>15)|0;e=f>>>(e+7|0)&1|e<<1}else e=0;b=3248+(e<<2)|0;c[i+28>>2]=e;c[i+20>>2]=0;c[i+16>>2]=0;a=c[737]|0;d=1<<e;a:do if(!(a&d)){c[737]=a|d;c[b>>2]=i;c[i+24>>2]=b;c[i+12>>2]=i;c[i+8>>2]=i}else{b=c[b>>2]|0;b:do if((c[b+4>>2]&-8|0)!=(f|0)){e=f<<((e|0)==31?0:25-(e>>>1)|0);while(1){d=b+16+(e>>>31<<2)|0;a=c[d>>2]|0;if(!a)break;if((c[a+4>>2]&-8|0)==(f|0)){b=a;break b}else{e=e<<1;b=a}}c[d>>2]=i;c[i+24>>2]=b;c[i+12>>2]=i;c[i+8>>2]=i;break a}while(0);h=b+8|0;j=c[h>>2]|0;c[j+12>>2]=i;c[h>>2]=i;c[i+8>>2]=j;c[i+12>>2]=b;c[i+24>>2]=0}while(0);j=(c[744]|0)+-1|0;c[744]=j;if(j|0)return;b=3400;while(1){b=c[b>>2]|0;if(!b)break;else b=b+8|0}c[744]=-1;return}function Qa(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=r(b&65535,a&65535)|0;e=(c>>>16)+(r(b&65535,a>>>16)|0)|0;d=r(b>>>16,a&65535)|0;return (u((e>>>16)+(r(b>>>16,a>>>16)|0)+(((e&65535)+d|0)>>>16)|0),e+d<<16|c&65535|0)|0}function Ra(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=Qa(a,c)|0;f=v()|0;return (u((r(b,c)|0)+(r(d,a)|0)+f|f&0|0),e|0|0)|0}function Sa(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return (u(b+d+(a+c>>>0>>>0<a>>>0|0)>>>0|0),a+c>>>0|0)|0}function Ta(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (u(d|0),a-c>>>0|0)|0}function Ua(a){a=a|0;return (a?31-(s(a^a-1)|0)|0:32)|0}function Va(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(!b)if(!e){if(f|0){c[f>>2]=(a>>>0)%(d>>>0);c[f+4>>2]=0}e=0;f=(a>>>0)/(d>>>0)>>>0;return (u(e|0),f)|0}else{if(!f){e=0;f=0;return (u(e|0),f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;e=0;f=0;return (u(e|0),f)|0}do if(d){if(e|0){h=(s(e|0)|0)-(s(b|0)|0)|0;if(h>>>0<=31){n=h+1|0;i=a>>>((h+1|0)>>>0)&h-31>>31|b<<31-h;m=b>>>((h+1|0)>>>0)&h-31>>31;g=0;h=a<<31-h;break}if(!f){e=0;f=0;return (u(e|0),f)|0}c[f>>2]=a|0;c[f+4>>2]=b|b&0;e=0;f=0;return (u(e|0),f)|0}if(d-1&d|0){h=(s(d|0)|0)+33-(s(b|0)|0)|0;n=h;i=32-h-1>>31&b>>>((h-32|0)>>>0)|(b<<32-h|a>>>(h>>>0))&h-32>>31;m=h-32>>31&b>>>(h>>>0);g=a<<64-h&32-h>>31;h=(b<<64-h|a>>>((h-32|0)>>>0))&32-h>>31|a<<32-h&h-33>>31;break}if(f|0){c[f>>2]=d-1&a;c[f+4>>2]=0}if((d|0)==1){e=b|b&0;f=a|0|0;return (u(e|0),f)|0}else{f=Ua(d|0)|0;e=b>>>(f>>>0)|0;f=b<<32-f|a>>>(f>>>0)|0;return (u(e|0),f)|0}}else{if(!e){if(f|0){c[f>>2]=(b>>>0)%(d>>>0);c[f+4>>2]=0}e=0;f=(b>>>0)/(d>>>0)>>>0;return (u(e|0),f)|0}if(!a){if(f|0){c[f>>2]=0;c[f+4>>2]=(b>>>0)%(e>>>0)}d=0;f=(b>>>0)/(e>>>0)>>>0;return (u(d|0),f)|0}if(!(e-1&e)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=e-1&b|b&0}d=0;f=b>>>((Ua(e|0)|0)>>>0);return (u(d|0),f)|0}h=(s(e|0)|0)-(s(b|0)|0)|0;if(h>>>0<=30){n=h+1|0;i=b<<31-h|a>>>((h+1|0)>>>0);m=b>>>((h+1|0)>>>0);g=0;h=a<<31-h;break}if(!f){e=0;f=0;return (u(e|0),f)|0}c[f>>2]=a|0;c[f+4>>2]=b|b&0;e=0;f=0;return (u(e|0),f)|0}while(0);if(!n){j=h;b=m;a=0;h=0}else{k=Sa(d|0|0,e|e&0|0,-1,-1)|0;l=v()|0;j=h;b=m;a=n;h=0;do{p=j;j=g>>>31|j<<1;g=h|g<<1;p=i<<1|p>>>31|0;o=i>>>31|b<<1|0;Ta(k|0,l|0,p|0,o|0)|0;n=v()|0;m=n>>31|((n|0)<0?-1:0)<<1;h=m&1;i=Ta(p|0,o|0,m&(d|0)|0,(((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1)&(e|e&0)|0)|0;b=v()|0;a=a-1|0}while((a|0)!=0);a=0}if(f|0){c[f>>2]=i;c[f+4>>2]=b}o=(g|0)>>>31|j<<1|(0<<1|g>>>31)&0|a;p=(g<<1|0>>>31)&-2|h;return (u(o|0),p)|0}function Wa(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Va(a,b,c,d,0)|0}function Xa(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){u(b>>>c|0);return a>>>c|(b&(1<<c)-1)<<32-c}u(0);return b>>>c-32|0}function Ya(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){u(b<<c|(a&(1<<c)-1<<32-c)>>>32-c|0);return a<<c}u(a<<c-32|0);return 0}function Za(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function _a(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((e|0)>=8192){D(b|0,d|0,e|0)|0;return b|0}h=b|0;g=b+e|0;if((b&3)==(d&3)){while(b&3){if(!e)return h|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}e=g&-4|0;f=e-64|0;while((b|0)<=(f|0)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];c[b+12>>2]=c[d+12>>2];c[b+16>>2]=c[d+16>>2];c[b+20>>2]=c[d+20>>2];c[b+24>>2]=c[d+24>>2];c[b+28>>2]=c[d+28>>2];c[b+32>>2]=c[d+32>>2];c[b+36>>2]=c[d+36>>2];c[b+40>>2]=c[d+40>>2];c[b+44>>2]=c[d+44>>2];c[b+48>>2]=c[d+48>>2];c[b+52>>2]=c[d+52>>2];c[b+56>>2]=c[d+56>>2];c[b+60>>2]=c[d+60>>2];b=b+64|0;d=d+64|0}while((b|0)<(e|0)){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0}}else{e=g-4|0;while((b|0)<(e|0)){a[b>>0]=a[d>>0]|0;a[b+1>>0]=a[d+1>>0]|0;a[b+2>>0]=a[d+2>>0]|0;a[b+3>>0]=a[d+3>>0]|0;b=b+4|0;d=d+4|0}}while((b|0)<(g|0)){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}return h|0}function $a(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=b+e|0;d=d&255;if((e|0)>=67){while(b&3){a[b>>0]=d;b=b+1|0}g=d|d<<8|d<<16|d<<24;while((b|0)<=((f&-4)-64|0)){c[b>>2]=g;c[b+4>>2]=g;c[b+8>>2]=g;c[b+12>>2]=g;c[b+16>>2]=g;c[b+20>>2]=g;c[b+24>>2]=g;c[b+28>>2]=g;c[b+32>>2]=g;c[b+36>>2]=g;c[b+40>>2]=g;c[b+44>>2]=g;c[b+48>>2]=g;c[b+52>>2]=g;c[b+56>>2]=g;c[b+60>>2]=g;b=b+64|0}while((b|0)<(f&-4|0)){c[b>>2]=g;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return f-e|0}function ab(a){a=a|0;var b=0,d=0;d=C()|0;b=c[i>>2]|0;if((a|0)>0&(b+a|0)<(b|0)|(b+a|0)<0){H(b+a|0)|0;w(12);return -1}if((b+a|0)>(d|0))if(!(E(b+a|0)|0)){w(12);return -1}c[i>>2]=b+a;return b|0}function bb(a,b){a=a|0;b=b|0;return Q[a&1](b|0)|0}function cb(a,b,c,d,e,f,g){a=a|0;b=b|0;c=+c;d=d|0;e=e|0;f=f|0;g=g|0;return R[a&1](b|0,+c,d|0,e|0,f|0,g|0)|0}function db(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return S[a&1](b|0,c|0,d|0)|0}function eb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return T[a&1](b|0,c|0,d|0,e|0)|0}function fb(a,b,c){a=a|0;b=b|0;c=c|0;U[a&1](b|0,c|0)}function gb(a){a=a|0;t(0);return 0}function hb(a,b,c,d,e,f){a=a|0;b=+b;c=c|0;d=d|0;e=e|0;f=f|0;t(1);return 0}function ib(a,b,c){a=a|0;b=b|0;c=c|0;t(2);return 0}function jb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;t(3);return 0}function kb(a,b){a=a|0;b=b|0;t(4)}\n\n// EMSCRIPTEN_END_FUNCS\nvar Q=[gb,ga];var R=[hb,xa];var S=[ib,ha];var T=[jb,ia];var U=[kb,ya];return{___errno_location:ka,___muldi3:Ra,___udivdi3:Wa,_abort_run:aa,_bitshift64Lshr:Xa,_bitshift64Shl:Ya,_enable_debug:ba,_free:Pa,_i64Add:Sa,_i64Subtract:Ta,_llvm_bswap_i32:Za,_malloc:Oa,_memcpy:_a,_memset:$a,_ping:_,_read_register:ca,_reset:ea,_run:$,_sbrk:ab,_set_stop_address:Z,_write_register:da,dynCall_ii:bb,dynCall_iidiiii:cb,dynCall_iiii:db,dynCall_iiiii:eb,dynCall_vii:fb,establishStackSpace:Y,stackAlloc:V,stackRestore:X,stackSave:W}})\n\n\n// EMSCRIPTEN_END_ASM\n(asmGlobalArg,asmLibraryArg,buffer);var ___errno_location=Module[\"___errno_location\"]=asm[\"___errno_location\"];var ___muldi3=Module[\"___muldi3\"]=asm[\"___muldi3\"];var ___udivdi3=Module[\"___udivdi3\"]=asm[\"___udivdi3\"];var _abort_run=Module[\"_abort_run\"]=asm[\"_abort_run\"];var _bitshift64Lshr=Module[\"_bitshift64Lshr\"]=asm[\"_bitshift64Lshr\"];var _bitshift64Shl=Module[\"_bitshift64Shl\"]=asm[\"_bitshift64Shl\"];var _enable_debug=Module[\"_enable_debug\"]=asm[\"_enable_debug\"];var _free=Module[\"_free\"]=asm[\"_free\"];var _i64Add=Module[\"_i64Add\"]=asm[\"_i64Add\"];var _i64Subtract=Module[\"_i64Subtract\"]=asm[\"_i64Subtract\"];var _llvm_bswap_i32=Module[\"_llvm_bswap_i32\"]=asm[\"_llvm_bswap_i32\"];var _malloc=Module[\"_malloc\"]=asm[\"_malloc\"];var _memcpy=Module[\"_memcpy\"]=asm[\"_memcpy\"];var _memset=Module[\"_memset\"]=asm[\"_memset\"];var _ping=Module[\"_ping\"]=asm[\"_ping\"];var _read_register=Module[\"_read_register\"]=asm[\"_read_register\"];var _reset=Module[\"_reset\"]=asm[\"_reset\"];var _run=Module[\"_run\"]=asm[\"_run\"];var _sbrk=Module[\"_sbrk\"]=asm[\"_sbrk\"];var _set_stop_address=Module[\"_set_stop_address\"]=asm[\"_set_stop_address\"];var _write_register=Module[\"_write_register\"]=asm[\"_write_register\"];var establishStackSpace=Module[\"establishStackSpace\"]=asm[\"establishStackSpace\"];var stackAlloc=Module[\"stackAlloc\"]=asm[\"stackAlloc\"];var stackRestore=Module[\"stackRestore\"]=asm[\"stackRestore\"];var stackSave=Module[\"stackSave\"]=asm[\"stackSave\"];var dynCall_ii=Module[\"dynCall_ii\"]=asm[\"dynCall_ii\"];var dynCall_iidiiii=Module[\"dynCall_iidiiii\"]=asm[\"dynCall_iidiiii\"];var dynCall_iiii=Module[\"dynCall_iiii\"]=asm[\"dynCall_iiii\"];var dynCall_iiiii=Module[\"dynCall_iiiii\"]=asm[\"dynCall_iiiii\"];var dynCall_vii=Module[\"dynCall_vii\"]=asm[\"dynCall_vii\"];Module[\"asm\"]=asm;Module[\"ccall\"]=ccall;if(memoryInitializer){if(!isDataURI(memoryInitializer)){memoryInitializer=locateFile(memoryInitializer)}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=readBinary(memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency(\"memory initializer\");var applyMemoryInitializer=function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module[\"memoryInitializerRequest\"])delete Module[\"memoryInitializerRequest\"].response;removeRunDependency(\"memory initializer\")};var doBrowserLoad=function(){readAsync(memoryInitializer,applyMemoryInitializer,function(){throw\"could not load memory initializer \"+memoryInitializer})};var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module[\"memoryInitializerRequest\"]){var useRequest=function(){var request=Module[\"memoryInitializerRequest\"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module[\"memoryInitializerRequestURL\"]);if(data){response=data.buffer}else{console.warn(\"a problem seems to have happened with Module.memoryInitializerRequest, status: \"+request.status+\", retrying \"+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)};if(Module[\"memoryInitializerRequest\"].response){setTimeout(useRequest,0)}else{Module[\"memoryInitializerRequest\"].addEventListener(\"load\",useRequest)}}else{doBrowserLoad()}}}var calledRun;Module[\"then\"]=function(func){if(calledRun){func(Module)}else{var old=Module[\"onRuntimeInitialized\"];Module[\"onRuntimeInitialized\"]=function(){if(old)old();func(Module)}}return Module};function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;if(ABORT)return;initRuntime();preMain();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}Module[\"run\"]=run;function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(noExitRuntime){}else{ABORT=true;EXITSTATUS=status;exitRuntime();if(Module[\"onExit\"])Module[\"onExit\"](status)}quit_(status,new ExitStatus(status))}function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}what+=\"\";out(what);err(what);ABORT=true;EXITSTATUS=1;throw\"abort(\"+what+\"). Build with -s ASSERTIONS=1 for more info.\"}Module[\"abort\"]=abort;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}noExitRuntime=true;run();\n\n\n\n return Module\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = Module;\n else if (typeof define === 'function' && define['amd'])\n define([], function() { return Module; });\n else if (typeof exports === 'object')\n exports[\"Module\"] = Module;\n module.exports = Module;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\nvar nativeThumbulator = require(\"./native/thumbulator\");\nvar Thumbulator = (function () {\n function Thumbulator(bus, options) {\n if (options === void 0) { options = {}; }\n this._module = null;\n this._options = null;\n this._options = tslib_1.__assign({ stopAddress: 0 }, options);\n this._module = nativeThumbulator(this._getApi(bus, this._options));\n this.enableDebug(false);\n }\n Thumbulator.prototype.init = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n this._module._set_stop_address(this._options.stopAddress);\n return [2];\n });\n });\n };\n Thumbulator.prototype.ping = function () {\n return this._module.ccall('ping', 'string', [], []);\n };\n Thumbulator.prototype.run = function (cycles) {\n return this._module._run(cycles);\n };\n Thumbulator.prototype.abort = function () {\n this._module._abort_run();\n };\n Thumbulator.prototype.enableDebug = function (enable) {\n this._module._enable_debug(enable ? 1 : 0);\n };\n Thumbulator.prototype.reset = function () {\n this._module._reset();\n };\n Thumbulator.prototype.readRegister = function (register) {\n if (register < 0 || register > 15) {\n throw new Error(\"illegal thumb register \" + register);\n }\n return this._module._read_register(register);\n };\n Thumbulator.prototype.writeRegister = function (register, value) {\n if (register < 0 || register > 15) {\n throw new Error(\"illegal thumb register \" + register);\n }\n this._module._write_register(register, value);\n };\n Thumbulator.prototype._getApi = function (bus, options) {\n var printer = options.printer || (function (data) { return console.log('thumbulator: ' + data); });\n return {\n print: printer,\n printErr: printer,\n trapOnInstructionFetch: options.trapOnInstructionFetch || (function () { return 0; }),\n trapOnBx32: options.trapOnBx32 || (function () { return 3; }),\n busRead16: bus.read16,\n busRead32: bus.read32 || (function (address) { return (bus.read16(address) & 0xffff) | (bus.read16(address + 2) << 16); }),\n busWrite16: bus.write16,\n busWrite32: bus.write32 ||\n (function (address, value) { return (bus.write16(address, value & 0xffff), bus.write16(address + 2, value >>> 16)); })\n };\n };\n return Thumbulator;\n}());\nexports.default = Thumbulator;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nfunction encodeWithPrefix(value: number, width?: number, signed = true, prefix = ''): string {\n if (!signed && value < 0) {\n return (\n encodeWithPrefix(value >>> 16, width && width > 8 ? width - 4 : 4, false, prefix) +\n encodeWithPrefix(value & 0xffff, 4)\n );\n }\n\n let result = Math.abs(value)\n .toString(16)\n .toUpperCase();\n\n if (typeof width !== 'undefined') {\n while (result.length < width) {\n result = '0' + result;\n }\n }\n\n return (value < 0 ? '-' : '') + prefix + result;\n}\n\nexport function encode(value: number, width?: number, signed = true): string {\n return encodeWithPrefix(value, width, signed, '$');\n}\n\nexport function decode(value: string): number {\n const sign = value.match(/^-/) ? -1 : 1;\n\n let stripped = value.replace(/^-/, '').toUpperCase();\n\n if (stripped.match(/^0X[0-9A-F]+$/)) {\n stripped = stripped.replace(/^0x/, '');\n } else if (stripped.match(/^\\$[0-9A-F]+$/)) {\n stripped = stripped.replace(/^\\$/, '');\n } else {\n throw new TypeError('invalid hex number ' + value);\n }\n\n return sign * parseInt(stripped, 16);\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Thumbulator from 'thumbulator.ts';\nimport { Event } from 'microevent.ts';\n\nimport { encode as hex } from '../../../../tools/hex';\n\nconst enum CONST {\n returnAddress = 0x8004\n}\n\nfunction hostIsLittleEndian(): boolean {\n const buffer8 = new Uint8Array([1, 2, 3, 4]),\n buffer32 = new Uint32Array(buffer8.buffer);\n\n return buffer32[0] === 0x04030201;\n}\n\nclass Soc {\n constructor(blx32Handler: Soc.Blx32Handler = () => Thumbulator.TrapReason.bxLeaveThumb) {\n if (hostIsLittleEndian()) {\n // If we are on a little endian host, we use typed arrays to take advantage of\n // hardware word access\n this.getRom16 = address => this._rom16[address >>> 1];\n this.getRom32 = address => this._rom32[address >>> 2];\n this.getRam16 = address => this._ram16[address >>> 1];\n this.getRam32 = address => this._ram32[address >>> 2];\n this.setRam16 = (address, value) => (this._ram16[address >>> 1] = value);\n this.setRam32 = (address, value) => (this._ram32[address >>> 2] = value);\n } else {\n // On big endian, we dance the endianness shuffle ourselves (DataView is dead slow)\n this.getRom16 = address => this._rom8[address] | (this._rom8[address + 1] << 8);\n this.getRom32 = address =>\n this._rom8[address] |\n (this._rom8[address + 1] << 8) |\n (this._rom8[address + 2] << 16) |\n (this._rom8[address + 3] << 24);\n this.getRam16 = address => this._ram8[address] | (this._ram8[address + 1] << 8);\n this.getRam32 = address =>\n this._ram8[address] |\n (this._ram8[address + 1] << 8) |\n (this._ram8[address + 2] << 16) |\n (this._ram8[address + 3] << 24);\n this.setRam16 = (address, value) => {\n this._ram8[address] = value & 0xff;\n this._ram8[address + 1] = (value >>> 8) & 0xff;\n };\n this.setRam32 = (address, value) => {\n this._ram8[address] = value & 0xff;\n this._ram8[address + 1] = (value >>> 8) & 0xff;\n this._ram8[address + 2] = (value >>> 16) & 0xff;\n this._ram8[address + 3] = (value >>> 24) & 0xff;\n };\n }\n\n // ARM ROM: the whole ROM image, suitable for 16bit and 32bit access\n this._rom8 = new Uint8Array(this._romBuffer);\n this._rom16 = new Uint16Array(this._romBuffer);\n this._rom32 = new Uint32Array(this._romBuffer);\n\n // ARM RAM\n this._ram8 = new Uint8Array(this._ramBuffer);\n this._ram16 = new Uint16Array(this._ramBuffer);\n this._ram32 = new Uint32Array(this._ramBuffer);\n\n this._thumbulator = new Thumbulator(this._thumbulatorBus, {\n stopAddress: CONST.returnAddress,\n trapOnBx32: blx32Handler\n });\n\n this.reset();\n }\n\n init(): Promise<void> {\n return this._thumbulator.init();\n }\n\n reset(): void {}\n\n getRom(): Uint8Array {\n return this._rom8;\n }\n\n getRam(): Uint8Array {\n return this._ram8;\n }\n\n run(entry: number): void {\n this._thumbulator.reset();\n this._thumbulator.enableDebug(false);\n\n for (let i = 0; i <= 12; i++) {\n this._thumbulator.writeRegister(i, 0);\n }\n\n this._thumbulator.writeRegister(13, 0x40001fb4);\n this._thumbulator.writeRegister(14, CONST.returnAddress + 1);\n this._thumbulator.writeRegister(15, entry);\n\n this._armMamcr = 0;\n\n const trap = this._thumbulator.run(500000);\n\n if (trap !== Thumbulator.TrapReason.stop && trap !== Thumbulator.TrapReason.abort) {\n this._triggerTrap(`ARM execution trapped: ${trap}`);\n }\n }\n\n getThumbulator(): Thumbulator {\n return this._thumbulator;\n }\n\n private _triggerTrap(message: string): void {\n this._thumbulator.abort();\n this.trap.dispatch(message);\n }\n\n getRom16: (address: number) => number;\n getRom32: (address: number) => number;\n getRam16: (address: number) => number;\n getRam32: (address: number) => number;\n setRam16: (address: number, value: number) => void;\n setRam32: (address: number, value: number) => void;\n\n trap = new Event<string>();\n\n private _thumbulatorBus: Thumbulator.Bus = {\n read16: (address: number): number => {\n if (address & 0x01) {\n this._triggerTrap(`unaligned 16 bit ARM read from ${hex(address, 8, false)}`);\n return 0;\n }\n\n const region = address >>> 28,\n addr = address & 0x0fffffff;\n\n switch (region) {\n case 0x0:\n if (addr < 0x8000) {\n return this.getRom16(addr);\n }\n break;\n\n case 0x4:\n if (addr < 0x2000) {\n return this.getRam16(addr);\n }\n break;\n\n case 0xe:\n switch (addr) {\n case 0x001fc000:\n return this._armMamcr;\n }\n\n break;\n\n default:\n }\n\n this._triggerTrap(`invalid 16 bit ARM read from ${hex(address, 8, false)}`);\n },\n\n read32: (address: number): number => {\n if (address & 0x03) {\n this._triggerTrap(`unaligned 32 bit ARM read from ${hex(address, 8, false)}`);\n return 0;\n }\n\n const region = address >>> 28,\n addr = address & 0x0fffffff;\n\n switch (region) {\n case 0x0:\n if (addr < 0x8000) {\n return this.getRom32(addr);\n }\n break;\n\n case 0x4:\n if (addr < 0x2000) {\n return this.getRam32(addr);\n }\n break;\n\n case 0xe:\n switch (addr) {\n case 0x8004:\n case 0x8008:\n return 0;\n }\n\n break;\n\n default:\n }\n\n this._triggerTrap(`invalid 32 bit ARM read from ${hex(address, 8, false)}`);\n },\n\n write16: (address: number, value: number): void => {\n if (address & 0x01) {\n this._triggerTrap(`unaligned 16 bit ARM write: ${hex(value, 4)} -> ${hex(address, 8, false)}`);\n return;\n }\n\n const region = address >>> 28,\n addr = address & 0x0fffffff;\n\n switch (region) {\n case 0x04:\n if (addr < 0x2000) {\n this.setRam16(addr, value & 0xffff);\n return;\n }\n break;\n\n case 0xe:\n switch (addr) {\n case 0x001fc000:\n this._armMamcr = value;\n return;\n }\n\n break;\n }\n\n this._triggerTrap(`invalid 16 bit ARM write: ${hex(value, 4)} -> ${hex(address, 8, false)}`);\n },\n\n write32: (address: number, value: number): void => {\n if (address & 0x03) {\n this._triggerTrap(`unaligned 32 bit ARM write: ${hex(value, 8, false)} -> ${hex(address, 8, false)}`);\n return;\n }\n\n const region = address >>> 28,\n addr = address & 0x0fffffff;\n\n switch (region) {\n case 0x4:\n if (addr < 0x2000) {\n this.setRam32(addr, value);\n return;\n }\n\n case 0xe:\n switch (addr) {\n case 0x8004:\n case 0x8008:\n return;\n }\n\n break;\n }\n\n this._triggerTrap(`invalid 32 bit ARM write: ${hex(value, 8, false)} -> ${hex(address, 8, false)}`);\n }\n };\n\n private _romBuffer = new ArrayBuffer(0x8000);\n\n private _rom8: Uint8Array;\n private _rom16: Uint16Array;\n private _rom32: Uint32Array;\n\n private _ramBuffer = new ArrayBuffer(0x2000);\n\n private _ram8: Uint8Array;\n private _ram16: Uint16Array;\n private _ram32: Uint32Array;\n\n private _armMamcr = 0;\n\n private _thumbulator: Thumbulator = null;\n}\n\nnamespace Soc {\n export interface Blx32Handler {\n (address: number, targetAddress: number): number;\n }\n}\n\nexport { Soc as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport HarmonySoc from './harmony/Soc';\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport CartridgeInterface from './CartridgeInterface';\nimport * as cartridgeUtil from './util';\n\nclass CartridgeDPCPlus extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length < 28 * 0x0400 || buffer.length > 0x8000) {\n throw new Error(`not a DPC+ image: invalid lenght ${buffer.length}`);\n }\n\n /* ROM layout:\n *\n * 3k ARM driver\n * 6 * 4k banks (either 6502 or ARM)\n * 4k image ROM\n * 1k frequency ROM\n */\n\n this._rom = this._soc.getRom();\n\n for (let i = 0; i < 6; i++) {\n this._banks[i] = new Uint8Array(this._rom.buffer, 0x0c00 + i * 0x1000, 0x1000);\n }\n\n // ARM RAM\n this._ram = this._soc.getRam();\n\n this._imageRam = new Uint8Array(this._ram.buffer, 0x0c00, 0x1000);\n\n /* RAM layout\n *\n * * 3k driver (copied to RAM)\n * * 4k display RAM\n * * 1k frequency RAM\n */\n\n const offset = 0x8000 - buffer.length;\n\n for (let i = 0; i < buffer.length; i++) {\n this._rom[offset + i] = buffer[i];\n }\n\n for (let i = 0; i < 8; i++) {\n this._fetchers[i] = new Fetcher();\n this._fractionalFetchers[i] = new FractionalFetcher();\n }\n\n for (let i = 0; i < 3; i++) {\n this._musicFetchers[i] = new MusicFetcher();\n }\n\n this._soc.trap.addHandler(message => this.triggerTrap(CartridgeInterface.TrapReason.other, message));\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, ['DPC+'.split('').map(x => x.charCodeAt(0))]);\n\n return signatureCounts[0] === 2;\n }\n\n init(): Promise<void> {\n return this._soc.init();\n }\n\n reset() {\n this._soc.reset();\n\n this._currentBank = this._banks[5];\n\n for (let i = 0; i < 0x0300; i++) {\n this._soc.setRam32(i << 2, this._soc.getRom32(i << 2));\n }\n\n for (let i = 0x1b00; i < 0x2000; i++) {\n this._soc.setRam32((0x0300 + i - 0x1b00) << 2, this._soc.getRom32(i << 2));\n }\n\n this._currentBank = this._banks[5];\n\n for (let i = 0; i < 8; i++) {\n this._parameters[i] = 0;\n }\n\n for (let i = 0; i < 8; i++) {\n this._fetchers[i].reset();\n this._fractionalFetchers[i].reset();\n }\n\n for (let i = 0; i < 3; i++) {\n this._musicFetchers[i].reset();\n }\n\n this._parameterIndex = 0;\n\n this._fastFetch = this._ldaPending = false;\n\n this._rng = 0x2b435044;\n\n this._lastCpuTime = 0;\n this._clockAccumulator = 0;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_dpc_plus;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n setCpuTimeProvider(provider: () => number): this {\n this._cpuTimeProvider = provider;\n\n return this;\n }\n\n read(address: number): number {\n return this._access(address, this._bus.getLastDataBusValue());\n }\n\n peek(address: number): number {\n return this._currentBank[address & 0x0fff];\n }\n\n write(address: number, value: number): void {\n this._access(address, value);\n }\n\n protected triggerTrap(reason: CartridgeInterface.TrapReason, message: string) {\n super.triggerTrap(reason, message);\n }\n\n private _access(address: number, value: number): number {\n address &= 0x0fff;\n\n const readResult = this._currentBank[address];\n\n if (this._fastFetch && this._ldaPending && address > 0x7f && address < 0x0ff6 && readResult < 0x28) {\n address = readResult;\n }\n\n this._ldaPending = false;\n\n if (address < 0x28) {\n const idx = address & 0x07,\n fetcher = this._fetchers[idx],\n fractionalFetcher = this._fractionalFetchers[idx];\n let result = 0;\n\n switch ((address >>> 3) & 0x07) {\n case 0x00:\n switch (idx) {\n case 0x00:\n this._advanceRng();\n return this._rng & 0xff;\n\n case 0x01:\n this._rewindRng();\n return this._rng & 0xff;\n\n case 0x02:\n return (this._rng >>> 8) & 0xff;\n\n case 0x03:\n return (this._rng >>> 16) & 0xff;\n\n case 0x04:\n return (this._rng >>> 24) & 0xff;\n\n case 0x05: {\n this._clockMusicFetchers();\n\n let acc = 0;\n for (let i = 0; i < 3; i++) {\n acc += this._imageRam[\n (this._musicFetchers[i].waveform << 5) + this._musicFetchers[i].waveformSample()\n ];\n }\n\n return acc & 0xff;\n }\n }\n\n return 0;\n\n case 0x01:\n result = this._imageRam[fetcher.pointer];\n fetcher.increment();\n return result;\n\n case 0x02:\n result = this._imageRam[fetcher.pointer] & fetcher.mask();\n fetcher.increment();\n return result;\n\n case 0x03:\n result = this._imageRam[fractionalFetcher.pointer >>> 8];\n fractionalFetcher.increment();\n return result;\n\n case 0x04:\n return idx < 4 ? fetcher.mask() : 0;\n\n default:\n return 0;\n }\n } else if (address < 0x80) {\n const idx = address & 0x07,\n fetcher = this._fetchers[idx],\n fractionalFetcher = this._fractionalFetchers[idx];\n\n switch (((address - 0x28) >>> 3) & 0x0f) {\n case 0x00:\n fractionalFetcher.setPointerLo(value);\n break;\n\n case 0x01:\n fractionalFetcher.setPointerHi(value);\n break;\n\n case 0x02:\n fractionalFetcher.setFraction(value);\n break;\n\n case 0x03:\n fetcher.top = value;\n break;\n\n case 0x04:\n fetcher.bottom = value;\n break;\n\n case 0x05:\n fetcher.setPointerLo(value);\n break;\n\n case 0x06:\n switch (idx) {\n case 0x00:\n this._fastFetch = value === 0;\n break;\n\n case 0x01:\n if (this._parameterIndex < 8) {\n this._parameters[this._parameterIndex++] = value;\n }\n\n break;\n\n case 0x02:\n this._dispatchFunction(value);\n break;\n\n case 0x05:\n case 0x06:\n case 0x07:\n this._musicFetchers[idx - 0x05].waveform = value & 0x7f;\n break;\n }\n\n break;\n\n case 0x07:\n fetcher.decrement();\n this._imageRam[fetcher.pointer] = value;\n break;\n\n case 0x08:\n fetcher.setPointerHi(value);\n break;\n\n case 0x09:\n switch (idx) {\n case 0x00:\n this._rng = 0x2b435044;\n break;\n\n case 0x01:\n this._rng = (this._rng & 0xffffff00) | value;\n break;\n\n case 0x02:\n this._rng = (this._rng & 0xffff00ff) | (value << 8);\n break;\n\n case 0x03:\n this._rng = (this._rng & 0xff00ffff) | (value << 16);\n break;\n\n case 0x04:\n this._rng = (this._rng & 0x00ffffff) | (value << 24);\n break;\n\n case 0x05:\n case 0x06:\n case 0x07:\n this._musicFetchers[idx - 0x05].frequency = this._soc.getRam32(\n 0x2000 - 0x400 + (value << 2)\n );\n break;\n }\n\n break;\n\n case 0x0a:\n this._imageRam[fetcher.pointer] = value;\n fetcher.increment();\n break;\n\n default:\n break;\n }\n } else if (address > 0x0ff5 && address < 0x0ffc) {\n this._currentBank = this._banks[address - 0x0ff6];\n }\n\n if (this._fastFetch && address > 0x7f && address < 0x0ff6) {\n this._ldaPending = readResult === 0xa9;\n }\n\n return readResult;\n }\n\n private _clockMusicFetchers(): void {\n const cpuTime = this._cpuTimeProvider();\n\n this._clockAccumulator += (cpuTime - this._lastCpuTime) * 20000;\n this._lastCpuTime = cpuTime;\n\n const clocks = Math.floor(this._clockAccumulator);\n this._clockAccumulator -= clocks;\n\n if (clocks === 0) {\n return;\n }\n\n for (let i = 0; i < 3; i++) {\n this._musicFetchers[i].increment(clocks);\n }\n }\n\n private _dispatchFunction(index: number) {\n const romBase = this._parameters[0] + (this._parameters[1] << 8);\n\n switch (index) {\n case 0:\n this._parameterIndex = 0;\n break;\n\n case 1:\n for (let i = 0; i < this._parameters[3]; i++) {\n this._ram[0x0c00 + ((this._fetchers[this._parameters[2] & 0x07].pointer + i) & 0x0fff)] = this._rom[\n 0x0c00 + (romBase + i) % 0x7400\n ];\n }\n\n this._parameterIndex = 0;\n break;\n\n case 2:\n for (let i = 0; i < this._parameters[3]; i++) {\n this._ram[\n 0x0c00 + ((this._fetchers[this._parameters[2] & 0x07].pointer + i) & 0x0fff)\n ] = this._parameters[0];\n }\n\n this._parameterIndex = 0;\n break;\n\n case 254:\n case 255:\n this._soc.run(0x0c0b);\n break;\n }\n }\n\n private _advanceRng(): void {\n this._rng = (this._rng & (1 << 10) ? 0x10adab1e : 0x00) ^ ((this._rng >>> 11) | (this._rng << 21));\n }\n\n private _rewindRng(): void {\n this._rng =\n this._rng & (1 << 31)\n ? ((0x10adab1e ^ this._rng) << 11) | ((0x10adab1e ^ this._rng) >>> 21)\n : (this._rng << 11) | (this._rng >>> 21);\n }\n\n private _rom: Uint8Array;\n private _banks = new Array<Uint8Array>(6);\n private _currentBank: Uint8Array;\n\n private _ram: Uint8Array;\n private _imageRam: Uint8Array;\n\n private _fetchers = new Array<Fetcher>(8);\n private _fractionalFetchers = new Array<FractionalFetcher>(8);\n private _musicFetchers = new Array<MusicFetcher>(3);\n\n private _parameters = new Uint8Array(8);\n private _parameterIndex = 0;\n\n private _rng = 0;\n\n private _clockAccumulator = 0;\n private _lastCpuTime = 0;\n\n private _fastFetch = false;\n private _ldaPending = false;\n\n private _bus: Bus;\n private _cpuTimeProvider: () => number = null;\n\n private _soc = new HarmonySoc();\n}\n\nclass Fetcher {\n contructor() {\n this.reset();\n }\n\n reset() {\n this.pointer = this.top = this.bottom = 0;\n }\n\n setPointerHi(value: number): void {\n this.pointer = (this.pointer & 0xff) | ((value & 0x0f) << 8);\n }\n\n setPointerLo(value: number): void {\n this.pointer = (this.pointer & 0x0f00) | (value & 0xff);\n }\n\n increment(): void {\n this.pointer = (this.pointer + 1) & 0xfff;\n }\n\n decrement(): void {\n this.pointer = (this.pointer + 0xfff) & 0xfff;\n }\n\n mask(): number {\n return ((this.top - (this.pointer & 0xff)) & 0xff) > ((this.top - this.bottom) & 0xff) ? 0xff : 0;\n }\n\n pointer = 0;\n top = 0;\n bottom = 0;\n}\n\nclass FractionalFetcher {\n contructor() {\n this.reset();\n }\n\n reset() {\n this.pointer = this.fraction = 0;\n }\n\n setPointerHi(value: number): void {\n this.pointer = (this.pointer & 0x00ffff) | ((value & 0x0f) << 16);\n }\n\n setPointerLo(value: number): void {\n this.pointer = (this.pointer & 0x0f00ff) | ((value & 0xff) << 8);\n }\n\n setFraction(value: number): void {\n this.fraction = value;\n this.pointer &= 0x0fff00;\n }\n\n increment(): void {\n this.pointer = (this.pointer + this.fraction) & 0x0fffff;\n }\n\n pointer = 0;\n fraction = 0;\n}\n\nclass MusicFetcher {\n constructor() {\n this.reset();\n }\n\n reset(): void {\n this.frequency = 0;\n this.waveform = 0;\n this.counter = 0;\n }\n\n increment(clocks: number): void {\n this.counter = (this.counter + clocks * this.frequency) | 0;\n }\n\n waveformSample(): number {\n return this.counter >>> 27;\n }\n\n frequency = ~0;\n counter = ~0;\n waveform = 0;\n}\n\nexport { CartridgeDPCPlus as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Thumbulator from 'thumbulator.ts';\n\nimport HarmonySoc from './harmony/Soc';\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport CartridgeInterface from './CartridgeInterface';\nimport * as cartridgeUtil from './util';\n\nconst enum ReservedStream {\n amplitudeCDF = 0x22,\n amplitudeCDFJ = 0x23,\n jump = 0x21,\n comm = 0x20\n}\n\nconst enum CdfVersion {\n cdf0,\n cdf1,\n cdfj,\n invalid\n}\n\nclass CartridgeCDF extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n const version = CartridgeCDF.getVersion(buffer);\n\n switch (version) {\n case CdfVersion.cdf0:\n this._jumpstreamMask = 0xff;\n this._amplitudeStream = ReservedStream.amplitudeCDF;\n this._datastreamBase = 0x06e0;\n this._datastreamIncrementBase = 0x0768;\n this._waveformBase = 0x7f0;\n break;\n\n case CdfVersion.cdf1:\n this._jumpstreamMask = 0xff;\n this._amplitudeStream = ReservedStream.amplitudeCDF;\n this._datastreamBase = 0x00a0;\n this._datastreamIncrementBase = 0x0128;\n this._waveformBase = 0x01b0;\n break;\n\n case CdfVersion.cdfj:\n this._jumpstreamMask = 0xfe;\n this._amplitudeStream = ReservedStream.amplitudeCDFJ;\n this._datastreamBase = 0x0098;\n this._datastreamIncrementBase = 0x0124;\n this._waveformBase = 0x01b0;\n break;\n\n default:\n throw new Error('not a CDF image: missing signature');\n }\n\n if (buffer.length !== 0x8000) {\n throw new Error(`not a CDF image: invalid lenght ${buffer.length}`);\n }\n\n this._soc = new HarmonySoc(version === CdfVersion.cdf0 ? this._handleBxCDF0 : this._handleBxCDF1);\n this._soc.trap.addHandler(message => this.triggerTrap(CartridgeInterface.TrapReason.other, message));\n\n /* ROM layout:\n *\n * 2k ARM driver\n * 2k user ARM code\n * 28k 6502 ROM\n */\n\n this._rom = this._soc.getRom();\n\n for (let i = 0; i < 0x8000; i++) {\n this._rom[i] = buffer[i];\n }\n\n for (let i = 0; i < 7; i++) {\n this._banks[i] = new Uint8Array(this._rom.buffer, 0x1000 * (i + 1), 0x1000);\n }\n\n /* RAM layout\n *\n * * 2k driver (copied to RAM)\n * * 4k display RAM\n * * 2k aux RAM\n */\n\n this._ram = this._soc.getRam();\n this._displayRam = new Uint8Array(this._soc.getRam().buffer, 0x0800, 0x1000);\n\n for (let i = 0; i < 3; i++) {\n this._musicStreams[i] = new MusicStream();\n }\n\n this.reset();\n }\n\n static getVersion(buffer: cartridgeUtil.BufferInterface): CdfVersion {\n const sig = 'CDF'.split('').map(x => x.charCodeAt(0)),\n startAddress = cartridgeUtil.searchForSignature(buffer, [...sig, -1, ...sig, -1, ...sig]);\n\n if (startAddress < 0) {\n return CdfVersion.invalid;\n }\n\n switch (buffer[startAddress + 3]) {\n case 0:\n return CdfVersion.cdf0;\n\n case 1:\n return CdfVersion.cdf1;\n\n case 'J'.charCodeAt(0):\n return CdfVersion.cdfj;\n\n default:\n return CdfVersion.invalid;\n }\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n return CartridgeCDF.getVersion(buffer) !== CdfVersion.invalid;\n }\n\n init(): Promise<void> {\n return this._soc.init();\n }\n\n reset() {\n for (let i = 0; i < 0x0200; i++) {\n this._soc.setRam32(i << 2, this._soc.getRom32(i << 2));\n }\n\n this._fastFetch = false;\n this._digitalAudio = false;\n\n this._fastJumpCountdown = 0;\n this._fastFetchPending = false;\n\n this._jmpOperandAddress = 0;\n this._ldaOperandAddress = 0;\n\n this._currentBank = this._banks[6];\n\n for (let i = 0; i < 3; i++) {\n this._musicStreams[i].reset();\n }\n\n this._lastCpuTime = 0;\n this._clockAccumulator = 0;\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_cdf;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n return this;\n }\n\n setCpuTimeProvider(provider: () => number): this {\n this._cpuTimeProvider = provider;\n\n return this;\n }\n\n read(address: number): number {\n return this._access(address, this._bus.getLastDataBusValue());\n }\n\n peek(address: number): number {\n return this._currentBank[address & 0x0fff];\n }\n\n write(address: number, value: number): void {\n this._access(address, value);\n }\n\n private _access(address: number, value: number): number {\n address &= 0x0fff;\n\n const romValue = this._currentBank[address];\n\n if (this._fastJumpCountdown-- > 0 && address === this._jmpOperandAddress) {\n this._jmpOperandAddress++;\n\n return this._datastreamReadWithIncrement(this._jumpstream, 0x0100);\n }\n\n if (\n this._fastFetch &&\n romValue === 0x4c &&\n (this._currentBank[(address + 1) & 0x0fff] & this._jumpstreamMask) === 0 &&\n this._currentBank[(address + 2) & 0x0fff] === 0\n ) {\n this._fastJumpCountdown = 2;\n this._jmpOperandAddress = (address + 1) & 0x0fff;\n this._jumpstream = ReservedStream.jump + this._currentBank[(address + 1) & 0x0fff];\n\n return romValue;\n }\n\n this._fastJumpCountdown = 0;\n\n if (\n this._fastFetch &&\n this._fastFetchPending &&\n this._ldaOperandAddress === address &&\n romValue <= this._amplitudeStream\n ) {\n this._fastFetchPending = false;\n\n if (romValue === this._amplitudeStream) {\n this._clockMusicStreams();\n\n if (this._digitalAudio) {\n const counter = this._musicStreams[0].counter,\n sampleAddress = this._soc.getRam32(this._waveformBase) + (counter >>> 21);\n\n let sample = 0;\n\n if (sampleAddress < 0x8000) {\n sample = this._rom[sampleAddress];\n }\n\n if (sampleAddress > 0x40000000 && sampleAddress < 0x40002000) {\n sample = this._ram[sampleAddress - 0x40000000];\n }\n\n if ((counter & 0x100000) === 0) {\n sample >>>= 4;\n }\n\n return sample & 0x0f;\n } else {\n let acc = 0;\n for (let i = 0; i < 3; i++) {\n acc += this._displayRam[\n (this._getWaveform(i) +\n (this._musicStreams[i].counter >>> this._musicStreams[i].waveformSize)) &\n 0x0fff\n ];\n }\n\n return acc;\n }\n }\n\n return this._datastreamRead(romValue);\n }\n\n this._fastFetchPending = false;\n\n if (address >= 0x0ff0) {\n switch (address) {\n case 0x0ff0:\n this._datastreamWriteWithIncrement(ReservedStream.comm, value, 0x0100);\n break;\n\n case 0x0ff1: {\n let pointer = this._getDatastreamPointer(ReservedStream.comm);\n pointer <<= 8;\n pointer &= 0xf0000000;\n pointer |= value << 20;\n this._setDatastreamPointer(ReservedStream.comm, pointer);\n\n break;\n }\n\n case 0x0ff2:\n this._fastFetch = (value & 0x0f) === 0;\n this._digitalAudio = (value & 0xf0) === 0;\n break;\n\n case 0x0ff3:\n switch (value) {\n case 254:\n case 255:\n this._soc.run(0x080b);\n break;\n }\n break;\n }\n\n if (address > 0x0ff4 && address < 0x0ffc) {\n this._currentBank = this._banks[address - 0x0ff5];\n }\n }\n\n if (this._fastFetch && romValue === 0xa9) {\n this._fastFetchPending = true;\n this._ldaOperandAddress = (address + 1) & 0x0fff;\n }\n\n return romValue;\n }\n\n private _clockMusicStreams(): void {\n const cpuTime = this._cpuTimeProvider();\n\n this._clockAccumulator += (cpuTime - this._lastCpuTime) * 20000;\n this._lastCpuTime = cpuTime;\n\n const clocks = Math.floor(this._clockAccumulator);\n this._clockAccumulator -= clocks;\n\n if (clocks === 0) {\n return;\n }\n\n for (let i = 0; i < 3; i++) {\n this._musicStreams[i].increment(clocks);\n }\n }\n\n private _getDatastreamPointer(stream: number): number {\n return this._soc.getRam32(this._datastreamBase + 4 * stream);\n }\n\n private _setDatastreamPointer(stream: number, value: number): void {\n this._soc.setRam32(this._datastreamBase + 4 * stream, value);\n }\n\n private _getDatastreamIncrement(stream: number): number {\n return this._soc.getRam32(this._datastreamIncrementBase + 4 * stream);\n }\n\n private _datastreamRead(stream: number): number {\n const pointer = this._getDatastreamPointer(stream),\n value = this._displayRam[pointer >>> 20];\n\n this._setDatastreamPointer(stream, (pointer + (this._getDatastreamIncrement(stream) << 12)) | 0);\n\n return value;\n }\n\n private _datastreamReadWithIncrement(stream: number, increment: number): number {\n const pointer = this._getDatastreamPointer(stream),\n value = this._displayRam[pointer >>> 20];\n\n this._setDatastreamPointer(stream, (pointer + (increment << 12)) | 0);\n\n return value;\n }\n\n private _datastreamWriteWithIncrement(stream: number, value: number, increment: number) {\n const pointer = this._getDatastreamPointer(stream);\n\n this._displayRam[pointer >>> 20] = value;\n\n this._setDatastreamPointer(stream, (pointer + (increment << 12)) | 0);\n }\n\n private _getWaveform(index: number): number {\n const value = this._soc.getRam32(this._waveformBase + 4 * index);\n\n return (value - 0x40000000 - 0x0800) & 0x0fff;\n }\n\n private _handleBxCDF0 = (address: number): number => {\n const thumbulator = this._soc.getThumbulator(),\n r2 = thumbulator.readRegister(2),\n r3 = thumbulator.readRegister(3);\n\n switch (address) {\n case 0x000006e2:\n this._musicStreams[r2 % 3].frequency = r3;\n return 0;\n\n case 0x000006e6:\n this._musicStreams[r2 % 3].counter = 0;\n return 0;\n\n case 0x000006ea:\n thumbulator.writeRegister(2, this._musicStreams[r2 % 3].counter);\n return 0;\n\n case 0x000006ee:\n this._musicStreams[r2 % 3].waveformSize = r3;\n return 0;\n }\n\n return Thumbulator.TrapReason.bxLeaveThumb;\n };\n\n private _handleBxCDF1 = (address: number): number => {\n const thumbulator = this._soc.getThumbulator(),\n r2 = thumbulator.readRegister(2),\n r3 = thumbulator.readRegister(3);\n\n switch (address) {\n case 0x00000752:\n this._musicStreams[r2 % 3].frequency = r3;\n return 0;\n\n case 0x00000756:\n this._musicStreams[r2 % 3].counter = 0;\n return 0;\n\n case 0x0000075a:\n thumbulator.writeRegister(2, this._musicStreams[r2 % 3].counter);\n return 0;\n\n case 0x0000075e:\n this._musicStreams[r2 % 3].waveformSize = r3;\n return 0;\n }\n\n return Thumbulator.TrapReason.bxLeaveThumb;\n };\n\n private _banks = new Array<Uint8Array>(7);\n private _currentBank: Uint8Array = null;\n\n private _rom: Uint8Array = null;\n private _ram: Uint8Array = null;\n private _displayRam: Uint8Array = null;\n\n private _musicStreams = new Array<MusicStream>(3);\n private _clockAccumulator = 0;\n private _lastCpuTime = 0;\n\n private _soc: HarmonySoc = null;\n\n private _fastFetch = false;\n private _digitalAudio = false;\n\n private _fastJumpCountdown = 0;\n private _fastFetchPending = false;\n\n private _jmpOperandAddress = 0;\n private _ldaOperandAddress = 0;\n\n private _datastreamBase = 0;\n private _datastreamIncrementBase = 0;\n private _waveformBase = 0;\n\n private _jumpstream = 0;\n private _jumpstreamMask = 0;\n private _amplitudeStream = 0;\n\n private _bus: Bus = null;\n private _cpuTimeProvider: () => number = null;\n}\n\nclass MusicStream {\n reset() {\n this.counter = this.frequency = 0;\n this.waveformSize = 27;\n }\n\n increment(clocks: number): void {\n this.counter = (this.counter + clocks * this.frequency) | 0;\n }\n\n counter = 0;\n frequency = 0;\n waveformSize = 27;\n}\n\nexport { CartridgeCDF as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport Bus from '../Bus';\nimport * as cartridgeUtil from './util';\n\nclass Cartridge8040 extends AbstractCartridge {\n constructor(buffer: cartridgeUtil.BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000) {\n throw new Error(`buffer is not an 8k cartridge image: wrong length ${buffer.length}`);\n }\n\n for (let i = 0; i < 0x1000; i++) {\n this._bank0[i] = buffer[i];\n this._bank1[i] = buffer[0x1000 + i];\n }\n\n this.reset();\n }\n\n static matchesBuffer(buffer: cartridgeUtil.BufferInterface): boolean {\n // Signatures shamelessly stolen from stella\n const signatureCounts = cartridgeUtil.searchForSignatures(buffer, [\n [0xad, 0x00, 0x08], // LDA $0800\n [0xad, 0x40, 0x08], // LDA $0840\n [0x2c, 0x00, 0x08], // BIT $0800\n [0x0c, 0x00, 0x08, 0x4c], // NOP $0800; JMP ...\n [0x0c, 0xff, 0x0f, 0x4c] // NOP $0FFF; JMP ...\n ]);\n\n for (const count of signatureCounts) {\n if (count >= 2) {\n return true;\n }\n }\n\n return false;\n }\n\n reset(): void {\n this._bank = this._bank0;\n }\n\n read(address: number): number {\n return this.peek(address);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n return this._bank[address];\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_econobanking;\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n this._bus.event.read.addHandler(this._onBusAccess, this);\n this._bus.event.write.addHandler(this._onBusAccess, this);\n\n return this;\n }\n\n private _onBusAccess(accessType: Bus.AccessType, self: Cartridge8040): void {\n const address = self._bus.getLastAddresBusValue() & 0x1840;\n\n switch (address) {\n case 0x0800:\n self._bank = self._bank0;\n break;\n\n case 0x0840:\n self._bank = self._bank1;\n break;\n }\n }\n\n private _bank: Uint8Array = null;\n private _bank0 = new Uint8Array(0x1000);\n private _bank1 = new Uint8Array(0x1000);\n\n private _bus: Bus = null;\n}\n\nexport { Cartridge8040 as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport AbstractCartridge from './AbstractCartridge';\nimport CartridgeInfo from './CartridgeInfo';\nimport RngInterface from '../../../tools/rng/GeneratorInterface';\nimport Bus from '../Bus';\nimport { BufferInterface } from './util';\n\nclass CartridgePP extends AbstractCartridge {\n constructor(buffer: BufferInterface) {\n super();\n\n if (buffer.length !== 0x2000 && buffer.length !== 0x2003) {\n throw new Error(`buffer is not a PP cartridge image; wrong length ${buffer.length} bytes`);\n }\n\n for (let i = 0; i < 8; i++) {\n this._banks[i] = new Uint8Array(0x0400);\n\n for (let j = 0; j < 0x0400; j++) {\n this._banks[i][j] = buffer[i * 0x0400 + j];\n }\n }\n\n this.reset();\n }\n\n getType(): CartridgeInfo.CartridgeType {\n return CartridgeInfo.CartridgeType.bankswitch_8k_pp;\n }\n\n reset(): void {\n this._switchLayout(0);\n\n this._bankSwitchPending = false;\n }\n\n randomize(rng: RngInterface): void {\n for (let i = 0; i < 0x40; i++) {\n this._ram[i] = rng.int(0xff);\n }\n }\n\n setBus(bus: Bus): this {\n this._bus = bus;\n\n bus.event.read.addHandler(CartridgePP._onBusAccess, this);\n bus.event.write.addHandler(CartridgePP._onBusAccess, this);\n\n return this;\n }\n\n read(address: number): number {\n address &= 0x0fff;\n this._access(address, this._bus.getLastDataBusValue());\n\n if (address < 0x40) {\n return this._ram[address];\n }\n\n if (address < 0x80) {\n return this._bus.getLastDataBusValue();\n }\n\n return this._segments[address >>> 10][address & 0x03ff];\n }\n\n write(address: number, value: number) {\n this._access(address & 0x0fff, value);\n }\n\n peek(address: number): number {\n address &= 0x0fff;\n\n if (address < 0x40) {\n return this._ram[address];\n }\n\n if (address < 0x80) {\n return this._bus.getLastDataBusValue();\n }\n\n return this._segments[address >>> 10][address & 0x03ff];\n }\n\n private static _onBusAccess(accessType: Bus.AccessType, self: CartridgePP): void {\n let address = self._bus.getLastAddresBusValue();\n\n if (self._bankSwitchPending && address !== self._previousAddressBusValue && --self._accessCounter === 0) {\n self._switchLayout(self._pendingBank);\n self._bankSwitchPending = false;\n }\n\n if (address & 0x1000) {\n return;\n }\n\n address &= 0xff;\n\n if (address >= 0x30 && address <= 0x3f) {\n self._pendingBank = address & 0x0f;\n self._accessCounter = 3;\n self._bankSwitchPending = true;\n }\n }\n\n private _access(address: number, value: number): void {\n if (address >= 0x40 && address < 0x80) {\n this._ram[address - 0x40] = value;\n }\n }\n\n private _switchLayout(index: number): void {\n switch (index) {\n case 0:\n case 8:\n return this._configureSegments(0, 0, 1, 2);\n\n case 1:\n case 9:\n return this._configureSegments(0, 1, 3, 2);\n\n case 2:\n case 10:\n return this._configureSegments(4, 5, 6, 7);\n\n case 3:\n case 11:\n return this._configureSegments(7, 4, 3, 2);\n\n case 4:\n case 12:\n return this._configureSegments(0, 0, 6, 7);\n\n case 5:\n case 13:\n return this._configureSegments(0, 1, 7, 6);\n\n case 6:\n case 14:\n return this._configureSegments(3, 2, 4, 5);\n\n case 7:\n case 15:\n return this._configureSegments(6, 0, 5, 1);\n\n default:\n throw new Error('illegal layout index');\n }\n }\n\n private _configureSegments(zero: number, one: number, two: number, three: number): void {\n this._segments[0] = this._banks[zero];\n this._segments[1] = this._banks[one];\n this._segments[2] = this._banks[two];\n this._segments[3] = this._banks[three];\n }\n\n private _banks: Array<Uint8Array> = new Array(8);\n private _segments: Array<Uint8Array> = new Array(4);\n private _ram = new Uint8Array(0x40);\n\n private _bus: Bus;\n\n private _bankSwitchPending = false;\n private _pendingBank = 0;\n private _accessCounter = 0;\n private _previousAddressBusValue = 0;\n}\n\nexport default CartridgePP;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport CartridgeInfo from './CartridgeInfo';\nimport CartridgeF8 from './CartridgeF8';\nimport CartridgeE0 from './CartridgeE0';\nimport Cartridge3F from './Cartridge3F';\nimport Cartridge3E from './Cartridge3E';\nimport CartridgeFE from './CartridgeFE';\nimport CartridgeUA from './CartridgeUA';\nimport CartridgeE7 from './CartridgeE7';\nimport CartridgeFA2 from './CartridgeFA2';\nimport CartridgeEF from './CartridgeEF';\nimport CartridgeDPCPlus from './CartridgeDPCPlus';\nimport CartridgeCDF from './CartridgeCDF';\nimport Cartridge8040 from './Cartridge0840';\nimport * as cartridgeUtil from './util';\nimport CartridgeCV from './CartridgeCV';\n\nclass CartridgeDetector {\n detectCartridgeType(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (buffer.length % 8448 === 0) {\n return CartridgeInfo.CartridgeType.bankswitch_supercharger;\n }\n\n if (buffer.length < 0x0800) {\n return CartridgeInfo.CartridgeType.vanilla_2k;\n }\n\n if (buffer.length >= 10240 && buffer.length <= 10496) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_DPC;\n }\n\n switch (buffer.length) {\n case 0x0800:\n return this._detect2k(buffer);\n\n case 0x1000:\n return CartridgeInfo.CartridgeType.vanilla_4k;\n\n case 0x2000:\n return this._detect8k(buffer);\n\n case 0x2003:\n return CartridgeInfo.CartridgeType.bankswitch_8k_pp;\n\n case 0x3000:\n return CartridgeInfo.CartridgeType.bankswitch_12k_FA;\n\n case 0x4000:\n return this._detect16k(buffer);\n\n case 0x7000:\n return CartridgeInfo.CartridgeType.bankswitch_FA2;\n\n case 0x7400:\n return this._detect29k(buffer);\n\n case 0x8000:\n return this._detect32k(buffer);\n\n case 0x10000:\n return this._detect64k(buffer);\n\n default:\n return CartridgeInfo.CartridgeType.unknown;\n }\n }\n\n private _detect2k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (CartridgeCV.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_2k_cv;\n }\n\n return CartridgeInfo.CartridgeType.vanilla_2k;\n }\n\n private _detect8k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n const f8Matches = CartridgeF8.matchesBuffer(buffer);\n\n if (CartridgeE0.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_E0;\n }\n\n if (Cartridge3F.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_3F;\n }\n\n if (CartridgeUA.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_UA;\n }\n\n if (!f8Matches && CartridgeFE.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_FE;\n }\n\n if (Cartridge8040.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_8k_econobanking;\n }\n\n return CartridgeInfo.CartridgeType.bankswitch_8k_F8;\n }\n\n private _detect16k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (CartridgeE7.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_16k_E7;\n }\n\n return CartridgeInfo.CartridgeType.bankswitch_16k_F6;\n }\n\n private _detect29k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (CartridgeFA2.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_FA2;\n }\n\n return CartridgeInfo.CartridgeType.bankswitch_dpc_plus;\n }\n\n private _detect32k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (Cartridge3E.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_3E;\n }\n\n if (CartridgeDPCPlus.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_dpc_plus;\n }\n\n if (CartridgeCDF.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_cdf;\n }\n\n return CartridgeInfo.CartridgeType.bankswitch_32k_F4;\n }\n\n private _detect64k(buffer: cartridgeUtil.BufferInterface): CartridgeInfo.CartridgeType {\n if (CartridgeEF.matchesBuffer(buffer)) {\n return CartridgeInfo.CartridgeType.bankswitch_64k_EF;\n }\n\n return CartridgeInfo.CartridgeType.bankswitch_64k_F0;\n }\n}\n\nexport { CartridgeDetector as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport Cartridge2k from './Cartridge2k';\nimport Cartridge4k from './Cartridge4k';\nimport CartridgeCV from './CartridgeCV';\nimport CartridgeF8 from './CartridgeF8';\nimport CartridgeF6 from './CartridgeF6';\nimport CartridgeE0 from './CartridgeE0';\nimport CartridgeFE from './CartridgeFE';\nimport Cartridge3F from './Cartridge3F';\nimport Cartridge3E from './Cartridge3E';\nimport CartridgeUA from './CartridgeUA';\nimport CartridgeFA from './CartridgeFA';\nimport CartridgeE7 from './CartridgeE7';\nimport CartridgeF0 from './CartridgeF0';\nimport CartridgeEF from './CartridgeEF';\nimport CartridgeF4 from './CartridgeF4';\nimport CartridgeFA2 from './CartridgeFA2';\nimport CartridgeSupercharger from './CartridgeSupercharger';\nimport CartridgeDPC from './CartridgeDPC';\nimport CartridgeDPCPlus from './CartridgeDPCPlus';\nimport CartdridgeCDF from './CartridgeCDF';\nimport Cartidge8040 from './Cartridge0840';\nimport CartridgePP from './CartridgePP';\n\nimport CartridgeInfo from './CartridgeInfo';\nimport CartridgeDetector from './CartridgeDetector';\nimport CartridgeInterface from './CartridgeInterface';\n\nexport default class CartridgeFactory {\n async createCartridge(\n buffer: { [i: number]: number; length: number },\n cartridgeType?: CartridgeInfo.CartridgeType\n ): Promise<CartridgeInterface> {\n const cartridge = this._createCartridge(buffer, cartridgeType);\n\n await cartridge.init();\n\n return cartridge;\n }\n\n private _createCartridge(\n buffer: { [i: number]: number; length: number },\n cartridgeType?: CartridgeInfo.CartridgeType\n ): CartridgeInterface {\n if (typeof cartridgeType === 'undefined') {\n const detector = new CartridgeDetector();\n\n cartridgeType = detector.detectCartridgeType(buffer);\n }\n\n switch (cartridgeType) {\n case CartridgeInfo.CartridgeType.vanilla_2k:\n return new Cartridge2k(buffer);\n\n case CartridgeInfo.CartridgeType.vanilla_4k:\n return new Cartridge4k(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_2k_cv:\n return new CartridgeCV(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_F8:\n return new CartridgeF8(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_E0:\n return new CartridgeE0(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_3F:\n return new Cartridge3F(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_FE:\n return new CartridgeFE(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_UA:\n return new CartridgeUA(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_DPC:\n return new CartridgeDPC(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_econobanking:\n return new Cartidge8040(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_8k_pp:\n return new CartridgePP(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_12k_FA:\n return new CartridgeFA(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_16k_F6:\n return new CartridgeF6(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_16k_E7:\n return new CartridgeE7(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_FA2:\n return new CartridgeFA2(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_32k_F4:\n return new CartridgeF4(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_64k_F0:\n return new CartridgeF0(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_64k_EF:\n return new CartridgeEF(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_3E:\n return new Cartridge3E(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_supercharger:\n return new CartridgeSupercharger(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_dpc_plus:\n return new CartridgeDPCPlus(buffer);\n\n case CartridgeInfo.CartridgeType.bankswitch_cdf:\n return new CartdridgeCDF(buffer);\n\n default:\n throw new Error(`invalid or unsupported cartridge image`);\n }\n }\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\n\nimport Bus from './Bus';\nimport Board from './Board';\nimport AsyncIOInterface from '../io/AsyncIOInterface';\n\nclass AsyncIO implements AsyncIOInterface {\n constructor(private _board: Board) {\n this._bus = this._board.getBus();\n\n this._board.systemReset.addHandler(AsyncIO._onReset, this);\n this._bus.event.write.addHandler(AsyncIO._onWrite, this);\n this._bus.event.read.addHandler(AsyncIO._onRead, this);\n\n this.reset();\n }\n\n reset(): this {\n for (let i = 0; i < this._bufferOut.length; i++) {\n this._bufferOut[i] = 0;\n }\n\n this._indexBufferOut = 0;\n\n return this;\n }\n\n send(message: ArrayLike<number>): void {\n this._indexBufferIn = message.length > 256 ? 255 : message.length - 1;\n\n for (let i = 0; i <= this._indexBufferIn; i++) {\n this._bufferIn[i] = message[i];\n }\n }\n\n private static _onWrite(accessType: Bus.AccessType, self: AsyncIO): void {\n if (accessType !== Bus.AccessType.tia) {\n return;\n }\n\n switch (self._bus.getLastAddresBusValue()) {\n case 0x30:\n self._bufferOut[self._indexBufferOut] = self._bus.getLastDataBusValue();\n self._indexBufferOut = (self._indexBufferOut + 1) % self._bufferOut.length;\n\n break;\n\n case 0x31: {\n const count = self._bus.getLastDataBusValue();\n const data = new Uint8Array(count);\n\n for (let i = 0; i < count; i++) {\n const j = (self._indexBufferOut - 1 + self._bufferOut.length) % self._bufferOut.length;\n\n data[count - i - 1] = self._bufferOut[j];\n self._indexBufferOut = j;\n }\n\n self.message.dispatch(data);\n\n break;\n }\n }\n }\n\n private static _onRead(accessType: Bus.AccessType, self: AsyncIO): void {\n if (accessType !== Bus.AccessType.tia) {\n return;\n }\n\n switch (self._bus.getLastAddresBusValue()) {\n case 0x30:\n self._bus.setDataBusValue(self._indexBufferIn >= 0 ? self._bufferIn[self._indexBufferIn--] : 0);\n\n break;\n\n case 0x31: {\n self._bus.setDataBusValue(self._indexBufferIn >= 0 ? self._indexBufferIn + 1 : 0);\n\n break;\n }\n }\n }\n\n private static _onReset(payload: void, self: AsyncIO): void {\n self.reset();\n }\n\n message = new Event<Uint8Array>();\n\n private readonly _bufferOut = new Uint8Array(256);\n private readonly _bufferIn = new Uint8Array(256);\n private _indexBufferOut = 0;\n private _indexBufferIn = -1;\n\n private _bus: Bus = null;\n}\n\nexport default AsyncIO;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SchedulerInterface from './SchedulerInterface';\nimport TaskInterface from './TaskInterface';\n\nclass PeriodicScheduler implements SchedulerInterface {\n constructor(private _period: number) {}\n\n setPeriod(period: number): PeriodicScheduler {\n this._period = period;\n\n return this;\n }\n\n getPeriod(): number {\n return this._period;\n }\n\n start<T>(worker: SchedulerInterface.WorkerInterface<T>, context?: T): TaskInterface {\n let terminate = false;\n\n const handler = () => {\n if (terminate) {\n return;\n }\n\n worker(context);\n\n setTimeout(handler, this._period);\n };\n\n setTimeout(handler, this._period);\n\n return {\n stop: () => (terminate = true)\n };\n }\n}\n\nexport { PeriodicScheduler as default };\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.immediate = factory());\n}(this, (function () { 'use strict';\n\nvar context = (function () {\n /* eslint no-eval: 0 */\n return this || (1, eval)('this');\n})();\n\n// @see http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/\nvar useNative = (function () {\n return !(context.navigator && /Trident|Edge/.test(context.navigator.userAgent));\n})();\n\nvar nextId = 1;\nvar lock = false;\nvar TASKS = {};\n\nfunction wrap(handler) {\n var args = Array.prototype.slice.call(arguments, 1);\n var len = args.length;\n\n return !len ? function () {\n return handler.call(undefined);\n } : len === 1 ? function () {\n return handler.call(undefined, args[0]);\n } : len === 2 ? function () {\n return handler.call(undefined, args[0], args[1]);\n } : len === 3 ? function () {\n return handler.call(undefined, args[0], args[1], args[2]);\n } : function () {\n return handler.apply(undefined, args);\n };\n}\n\nfunction create(args) {\n TASKS[nextId] = wrap.apply(undefined, args);\n return nextId++;\n}\n\nfunction clear(handleId) {\n delete TASKS[handleId];\n}\n\nfunction run(handleId) {\n if (lock) {\n context.setTimeout(wrap(run, handleId), 0);\n } else {\n var task = TASKS[handleId];\n\n if (task) {\n lock = true;\n\n try {\n task();\n } finally {\n clear(handleId);\n lock = false;\n }\n }\n }\n}\n\nfunction init() {\n var polifill = function polifill() {\n var handleId = create(arguments);\n context.setTimeout(wrap(run, handleId), 0);\n return handleId;\n };\n\n polifill.usePolifill = 'setTimeout';\n\n return polifill;\n}\n\nfunction canUse() {\n return 'setTimeout' in context;\n}\n\nvar setTimeoutPolifill = Object.freeze({\n\tinit: init,\n\tcanUse: canUse\n});\n\nfunction init$1() {\n var polifill = function polifill() {\n var handleId = create(arguments);\n context.process.nextTick(wrap(run, handleId));\n return handleId;\n };\n\n polifill.usePolifill = 'nextTick';\n\n return polifill;\n}\n\n// Don't get fooled by e.g. browserify environments.\n// For Node.js before 0.9\nfunction canUse$1() {\n return Object.prototype.toString.call(context.process) === '[object process]';\n}\n\nvar nextTickPolifill = Object.freeze({\n\tinit: init$1,\n\tcanUse: canUse$1\n});\n\nfunction init$2() {\n var messagePrefix = 'setImmediate$' + Math.random() + '$';\n\n var onGlobalMessage = function onGlobalMessage(event) {\n if (event.source === context && typeof event.data === 'string' && event.data.indexOf(messagePrefix) === 0) {\n\n run(Number(event.data.slice(messagePrefix.length)));\n }\n };\n\n if (context.addEventListener) {\n context.addEventListener('message', onGlobalMessage, false);\n } else {\n context.attachEvent('onmessage', onGlobalMessage);\n }\n\n var polifill = function polifill() {\n var handleId = create(arguments);\n context.postMessage(messagePrefix + handleId, '*');\n return handleId;\n };\n\n polifill.usePolifill = 'postMessage';\n\n return polifill;\n}\n\n// For non-IE10 modern browsers\nfunction canUse$2() {\n if (context.importScripts || !context.postMessage) {\n return false;\n }\n\n if (context.navigator && /Chrome/.test(context.navigator.userAgent)) {\n //skip this method due to heavy minor GC on heavy use.\n return false;\n }\n\n var asynch = true;\n var oldOnMessage = context.onmessage;\n context.onmessage = function () {\n asynch = false;\n };\n\n context.postMessage('', '*');\n context.onmessage = oldOnMessage;\n return asynch;\n}\n\nvar postMessagePolifill = Object.freeze({\n\tinit: init$2,\n\tcanUse: canUse$2\n});\n\nfunction init$3() {\n var channel = new context.MessageChannel();\n\n channel.port1.onmessage = function (event) {\n run(Number(event.data));\n };\n\n var polifill = function polifill() {\n var handleId = create(arguments);\n channel.port2.postMessage(handleId);\n return handleId;\n };\n\n polifill.usePolifill = 'messageChannel';\n\n return polifill;\n}\n\n// For web workers, where supported\nfunction canUse$3() {\n return Boolean(context.MessageChannel);\n}\n\nvar messageChannelPolifill = Object.freeze({\n\tinit: init$3,\n\tcanUse: canUse$3\n});\n\nfunction init$4() {\n var html = context.document.documentElement;\n\n var polifill = function polifill() {\n var handleId = create(arguments);\n var script = context.document.createElement('script');\n\n script.onreadystatechange = function () {\n run(handleId);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n\n html.appendChild(script);\n return handleId;\n };\n\n polifill.usePolifill = 'readyStateChange';\n\n return polifill;\n}\n\n// For IE 68\nfunction canUse$4() {\n return context.document && 'onreadystatechange' in context.document.createElement('script');\n}\n\nvar readyStateChangePolifill = Object.freeze({\n\tinit: init$4,\n\tcanUse: canUse$4\n});\n\nvar POLIFILLS = [nextTickPolifill, postMessagePolifill, messageChannelPolifill, readyStateChangePolifill];\n\nvar setImmediate = useNative ? context.setImmediate || context.msSetImmediate || usePolifill(POLIFILLS, setTimeoutPolifill) : init();\n\nvar clearImmediate = useNative ? context.clearImmediate || context.msClearImmediate || clear : clear;\n\nfunction polifill() {\n if (context.setImmediate !== setImmediate) {\n context.setImmediate = setImmediate;\n context.msSetImmediate = setImmediate;\n context.clearImmediate = clearImmediate;\n context.msClearImmediate = clearImmediate;\n }\n}\n\nfunction usePolifill(list, def) {\n for (var i = 0; i < list.length; i++) {\n var _polifill = list[i];\n if (_polifill.canUse()) {\n return _polifill.init();\n }\n }\n\n return def.init();\n}\n\nvar index = {\n setImmediate: setImmediate,\n clearImmediate: clearImmediate,\n polifill: polifill\n};\n\nreturn index;\n\n})));\n//# sourceMappingURL=setImmediate.js.map\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as polyfill from 'setimmediate2';\n\n// Make sure that setTimeout is called every now and then in order to work around\n// scheduling issues in chrome.\n\nconst enum CONST {\n setTimeoutRecurrence = 10\n}\n\nlet index = 0;\n\nexport function setImmediate(callback: () => void) {\n if (index === 0) {\n setTimeout(callback, 0);\n } else {\n polyfill.setImmediate(callback);\n }\n\n index = (index + 1) % CONST.setTimeoutRecurrence;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { setImmediate } from './setImmediate';\n\nimport SchedulerInterface from './SchedulerInterface';\nimport TaskInterface from './TaskInterface';\n\nclass ImmediateScheduler implements SchedulerInterface {\n start<T>(worker: SchedulerInterface.WorkerInterface<T>, context?: T): TaskInterface {\n let terminate = false;\n\n function handler() {\n if (terminate) {\n return;\n }\n\n worker(context);\n setImmediate(handler);\n }\n\n setImmediate(handler);\n\n return {\n stop: () => (terminate = true)\n };\n }\n}\n\nexport { ImmediateScheduler as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst getTimestamp =\n (self as any).performance && (self as any).performance.now\n ? () => (self as any).performance.now()\n : () => Date.now();\n\nexport { getTimestamp as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SchedulerInterface from '../SchedulerInterface';\nimport TaskInterface from '../TaskInterface';\nimport getTimestamp from '../getTimestamp';\nimport { setImmediate } from '../setImmediate';\n\nconst THRESHOLD = 1;\n\nclass ConstantTimesliceScheduler implements SchedulerInterface {\n start<T>(worker: SchedulerInterface.WorkerInterface<T>, context?: T, _timeSlice?: number): TaskInterface {\n const timeSlice = _timeSlice || 50;\n\n let running = true;\n\n function handler() {\n if (!running) {\n return;\n }\n\n const timestampStart = getTimestamp();\n let emulationTime = 0,\n delta = 0;\n\n while (getTimestamp() - timestampStart < timeSlice) {\n do {\n delta = getTimestamp() - timestampStart - emulationTime;\n } while (delta < THRESHOLD);\n\n emulationTime += worker(context, delta) as number;\n }\n\n delta = getTimestamp() - timestampStart - emulationTime;\n if (delta > 0) {\n emulationTime += worker(context, delta) as number;\n }\n\n if (running) {\n setImmediate(handler);\n }\n }\n\n setImmediate(handler);\n\n return { stop: () => (running = false) };\n }\n}\n\nexport { ConstantTimesliceScheduler as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SchedulerInterface from '../SchedulerInterface';\nimport TaskInterface from '../TaskInterface';\nimport getTimestamp from '../getTimestamp';\nimport { setImmediate } from '../setImmediate';\n\nconst CORRECTION_THESHOLD = 3,\n MAX_ACCUMULATED_DELTA = 100;\n\nclass ConstantCyclesScheduler implements SchedulerInterface {\n start<T>(worker: SchedulerInterface.WorkerInterface<T>, context?: T): TaskInterface {\n let terminate = false,\n targetSleepInterval = -1,\n lastYieldTimestamp = 0,\n accumulatedDelta = 0;\n\n function handler() {\n if (terminate) {\n return;\n }\n\n const timestamp0 = getTimestamp(),\n targetDuration = worker(context) || 0,\n timestamp1 = getTimestamp();\n\n let delay = targetDuration - timestamp1 + timestamp0;\n\n if (targetSleepInterval >= 0) {\n accumulatedDelta += targetSleepInterval - timestamp0 + lastYieldTimestamp;\n }\n\n if (accumulatedDelta > MAX_ACCUMULATED_DELTA) {\n accumulatedDelta = MAX_ACCUMULATED_DELTA;\n } else if (accumulatedDelta < -MAX_ACCUMULATED_DELTA) {\n accumulatedDelta = -MAX_ACCUMULATED_DELTA;\n }\n\n if (Math.abs(accumulatedDelta) > CORRECTION_THESHOLD) {\n delay += accumulatedDelta;\n accumulatedDelta = 0;\n }\n\n if (delay < 0) {\n delay = 0;\n accumulatedDelta = delay;\n }\n\n if (delay > 0) {\n setTimeout(handler, Math.round(delay));\n } else {\n setImmediate(handler);\n }\n\n targetSleepInterval = delay;\n lastYieldTimestamp = getTimestamp();\n }\n\n setImmediate(handler);\n\n return {\n stop: () => (terminate = true)\n };\n }\n}\n\nexport { ConstantCyclesScheduler as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SchedulerInterface from '../SchedulerInterface';\nimport TaskInterface from '../TaskInterface';\nimport getTimestamp from '../getTimestamp';\nimport { setImmediate } from '../setImmediate';\n\nconst SAFETY_FACTOR = 3;\n\nclass ConstantTimesliceScheduler implements SchedulerInterface {\n start<T>(worker: SchedulerInterface.WorkerInterface<T>, context?: T, _timeSlice?: number): TaskInterface {\n const timeSlice = _timeSlice || 100;\n\n let timestamp0 = getTimestamp(),\n emulationTime = 0,\n running = true;\n\n function handler() {\n if (!running) {\n return;\n }\n\n const timestamp = getTimestamp();\n let delta = timestamp - timestamp0 - emulationTime;\n\n if (delta > SAFETY_FACTOR * timeSlice) {\n delta = SAFETY_FACTOR * timeSlice;\n timestamp0 = timestamp - delta;\n emulationTime = 0;\n }\n\n emulationTime += worker(context, delta) as number;\n\n const timeToSleep = timeSlice - getTimestamp() + timestamp;\n\n if (timeToSleep > 0) {\n setTimeout(handler, timeToSleep);\n } else {\n setImmediate(handler);\n }\n }\n\n setImmediate(handler);\n\n return { stop: () => (running = false) };\n }\n}\n\nexport { ConstantTimesliceScheduler as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport SchedulerInterface from './SchedulerInterface';\nimport PeriodicScheduler from './PeriodicScheduler';\nimport ImmediateScheduler from './ImmedateScheduler';\n\nimport BusyWaitScheduler from './limiting/BusyWait';\nimport ConstantCyclesScheduler from './limiting/ConstantCycles';\nimport ConstantTimesliceScheduler from './limiting/ConstantTimeslice';\n\nclass Factory {\n createPeriodicScheduler(period: number): PeriodicScheduler {\n return new PeriodicScheduler(period);\n }\n\n createImmediateScheduler(): SchedulerInterface {\n return new ImmediateScheduler();\n }\n\n createLimitingScheduler(strategy = Factory.LimitingSchedulingStrategy.constantCycles) {\n switch (strategy) {\n case Factory.LimitingSchedulingStrategy.busyWait:\n return new BusyWaitScheduler();\n\n case Factory.LimitingSchedulingStrategy.constantCycles:\n return new ConstantCyclesScheduler();\n\n case Factory.LimitingSchedulingStrategy.constantTimeslice:\n return new ConstantTimesliceScheduler();\n\n default:\n throw new Error('invalud limiting scheduling strategy');\n }\n }\n\n getLimitingSchedulingStrategies(): Array<Factory.LimitingSchedulingStrategy> {\n return [\n Factory.LimitingSchedulingStrategy.busyWait,\n Factory.LimitingSchedulingStrategy.constantCycles,\n Factory.LimitingSchedulingStrategy.constantTimeslice\n ];\n }\n\n describeLimitingSchedulingStrategy(strategy: Factory.LimitingSchedulingStrategy): string {\n switch (strategy) {\n case Factory.LimitingSchedulingStrategy.busyWait:\n return 'Busy wait, constant timeslice length';\n\n case Factory.LimitingSchedulingStrategy.constantCycles:\n return 'Constant cycle count';\n\n case Factory.LimitingSchedulingStrategy.constantTimeslice:\n return 'Constant timeslice length';\n\n default:\n throw new Error('invalid limiting scheduling strategy');\n }\n }\n}\n\nnamespace Factory {\n export const enum LimitingSchedulingStrategy {\n busyWait,\n constantCycles,\n constantTimeslice\n }\n}\n\nexport { Factory as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event, EventInterface } from 'microevent.ts';\n\nimport SchedulerInterface from './scheduler/SchedulerInterface';\nimport TaskInterface from './scheduler/TaskInterface';\n\nclass ClockProbe {\n constructor(private _scheduler: SchedulerInterface) {}\n\n attach(clock: EventInterface<any>): ClockProbe {\n if (this._clock) {\n this.detach();\n }\n\n this._clock = clock;\n clock.addHandler(this._clockHandler, this);\n\n return this;\n }\n\n start(): ClockProbe {\n if (this._measurementTask) {\n return this;\n }\n\n this._timestamp = Date.now();\n this._counter = 0;\n this._measurementTask = this._scheduler.start(this._updateMeasurement, this);\n\n return this;\n }\n\n detach(): ClockProbe {\n if (!this._clock) {\n return this;\n }\n\n this._clock.removeHandler(this._clockHandler, this);\n this._clock = undefined;\n\n return this;\n }\n\n stop(): ClockProbe {\n if (!this._measurementTask) {\n return this;\n }\n\n this._measurementTask.stop();\n this._measurementTask = undefined;\n\n return this;\n }\n\n getFrequency(): number {\n return this._frequency;\n }\n\n private _updateMeasurement(probe: ClockProbe) {\n const timestamp = Date.now();\n\n probe._frequency = probe._counter / (timestamp - probe._timestamp) * 1000;\n\n probe._counter = 0;\n probe._timestamp = timestamp;\n\n probe.frequencyUpdate.dispatch(probe._frequency);\n }\n\n private _clockHandler(clocks: number, ctx: ClockProbe) {\n ctx._counter += clocks;\n }\n\n frequencyUpdate = new Event<number>();\n\n private _counter = 0;\n private _timestamp: number;\n private _frequency = 0;\n\n private _clock: EventInterface<any>;\n\n private _measurementTask: TaskInterface;\n}\n\nexport { ClockProbe as default };\n","import { __awaiter, __generator } from \"tslib\";\nvar Semaphore = /** @class */ (function () {\n function Semaphore(_maxConcurrency) {\n this._maxConcurrency = _maxConcurrency;\n this._queue = [];\n if (_maxConcurrency <= 0) {\n throw new Error('semaphore must be initialized to a positive value');\n }\n this._value = _maxConcurrency;\n }\n Semaphore.prototype.acquire = function () {\n var _this = this;\n var locked = this.isLocked();\n var ticket = new Promise(function (r) { return _this._queue.push(r); });\n if (!locked)\n this._dispatch();\n return ticket;\n };\n Semaphore.prototype.runExclusive = function (callback) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, value, release;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, this.acquire()];\n case 1:\n _a = _b.sent(), value = _a[0], release = _a[1];\n _b.label = 2;\n case 2:\n _b.trys.push([2, , 4, 5]);\n return [4 /*yield*/, callback(value)];\n case 3: return [2 /*return*/, _b.sent()];\n case 4:\n release();\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n Semaphore.prototype.isLocked = function () {\n return this._value <= 0;\n };\n Semaphore.prototype.release = function () {\n if (this._maxConcurrency > 1) {\n throw new Error('this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead');\n }\n if (this._currentReleaser) {\n this._currentReleaser();\n this._currentReleaser = undefined;\n }\n };\n Semaphore.prototype._dispatch = function () {\n var _this = this;\n var nextConsumer = this._queue.shift();\n if (!nextConsumer)\n return;\n var released = false;\n this._currentReleaser = function () {\n if (released)\n return;\n released = true;\n _this._value++;\n _this._dispatch();\n };\n nextConsumer([this._value--, this._currentReleaser]);\n };\n return Semaphore;\n}());\nexport default Semaphore;\n","import { __awaiter, __generator } from \"tslib\";\nimport Semaphore from './Semaphore';\nvar Mutex = /** @class */ (function () {\n function Mutex() {\n this._semaphore = new Semaphore(1);\n }\n Mutex.prototype.acquire = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, releaser;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, this._semaphore.acquire()];\n case 1:\n _a = _b.sent(), releaser = _a[1];\n return [2 /*return*/, releaser];\n }\n });\n });\n };\n Mutex.prototype.runExclusive = function (callback) {\n return this._semaphore.runExclusive(function () { return callback(); });\n };\n Mutex.prototype.isLocked = function () {\n return this._semaphore.isLocked();\n };\n Mutex.prototype.release = function () {\n this._semaphore.release();\n };\n return Mutex;\n}());\nexport default Mutex;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event, EventInterface } from 'microevent.ts';\n\nimport EmulationServiceInterface from '../EmulationServiceInterface';\nimport EmulationContext from './EmulationContext';\nimport Board from '../../../../machine/stella/Board';\nimport BoardInterface from '../../../../machine/board/BoardInterface';\nimport CartridgeFactory from '../../../../machine/stella/cartridge/CartridgeFactory';\nimport CartridgeInfo from '../../../../machine/stella/cartridge/CartridgeInfo';\nimport SchedulerInterface from '../../../../tools/scheduler/SchedulerInterface';\nimport AsyncIO from '../../../../machine/stella/AsyncIO';\nimport SchedulerFactory from '../../../../tools/scheduler/Factory';\nimport ClockProbe from '../../../../tools/ClockProbe';\nimport PeriodicScheduler from '../../../../tools/scheduler/PeriodicScheduler';\nimport { Mutex } from 'async-mutex';\n\nconst CLOCK_UPDATE_INTERVAL = 2000;\n\nexport default class EmulationService implements EmulationServiceInterface {\n constructor() {\n this.frequencyUpdate = this._clockProbe.frequencyUpdate;\n this._updateScheduler();\n }\n\n init(): Promise<void> {\n return Promise.resolve();\n }\n\n start(\n buffer: { [i: number]: number; length: number },\n config: EmulationServiceInterface.Config,\n cartridgeType?: CartridgeInfo.CartridgeType\n ): Promise<EmulationServiceInterface.State> {\n const factory = new CartridgeFactory();\n\n return this._mutex.runExclusive(async () => {\n try {\n this._stop();\n\n this._limitingStrategy = config.pcmAudio\n ? SchedulerFactory.LimitingSchedulingStrategy.constantTimeslice\n : SchedulerFactory.LimitingSchedulingStrategy.constantCycles;\n this._updateScheduler();\n\n if (this._state === EmulationServiceInterface.State.error) {\n return this._state;\n }\n\n const cartridge = await factory.createCartridge(buffer, cartridgeType),\n board = new Board(config, cartridge);\n\n this._board = board;\n this._board.trap.addHandler(EmulationService._trapHandler, this);\n\n if (config.asyncIO) {\n this._asyncIO = new AsyncIO(board);\n }\n\n this._context = new EmulationContext(board, this._asyncIO);\n\n this._clockProbe.attach(this._board.clock);\n\n this._setState(EmulationServiceInterface.State.paused);\n } catch (e) {\n this._setError(e);\n }\n\n return this._state;\n });\n }\n\n stop(): Promise<EmulationServiceInterface.State> {\n return this._mutex.runExclusive(() => this._stop());\n }\n\n pause(): Promise<EmulationServiceInterface.State> {\n return this._mutex.runExclusive(() => {\n try {\n if (this._state === EmulationServiceInterface.State.running) {\n this._board.getTimer().stop();\n this._board.suspend();\n this._setState(EmulationServiceInterface.State.paused);\n\n this._clockProbe.stop();\n }\n } catch (e) {\n this._setError(e);\n }\n\n return this._state;\n });\n }\n\n resume(): Promise<EmulationServiceInterface.State> {\n return this._mutex.runExclusive(() => {\n if (this._state === EmulationServiceInterface.State.paused) {\n try {\n this._tryToResume();\n } catch (e) {\n this._setError(e);\n }\n }\n\n return this._state;\n });\n }\n\n reset(): Promise<EmulationServiceInterface.State> {\n return this._mutex.runExclusive(() => {\n try {\n switch (this._state) {\n case EmulationServiceInterface.State.running:\n case EmulationServiceInterface.State.paused:\n this._board.reset();\n\n break;\n\n case EmulationServiceInterface.State.error:\n this._board.reset();\n this._tryToResume();\n\n break;\n }\n } catch (e) {\n this._setError(e);\n }\n\n return this._state;\n });\n }\n\n getState(): EmulationServiceInterface.State {\n return this._state;\n }\n\n getEmulationContext(): EmulationContext {\n switch (this._state) {\n case EmulationServiceInterface.State.running:\n case EmulationServiceInterface.State.paused:\n return this._context;\n\n default:\n return null;\n }\n }\n\n getLastError(): Error {\n return this._lastError;\n }\n\n getFrequency(): number {\n return this._clockProbe.getFrequency();\n }\n\n getRateLimit(): boolean {\n return this._enforceRateLimit;\n }\n\n setRateLimit(enforce: boolean): Promise<void> {\n if (this._enforceRateLimit === enforce) {\n return Promise.resolve(undefined);\n }\n\n return this._mutex.runExclusive(() => {\n if (this._state === EmulationServiceInterface.State.running) {\n this._board.getTimer().stop();\n }\n\n this._enforceRateLimit = enforce;\n this._updateScheduler();\n\n if (this._state === EmulationServiceInterface.State.running) {\n this._board.getTimer().start(this._scheduler);\n }\n });\n }\n\n private static _trapHandler(trap: BoardInterface.TrapPayload, self: EmulationService) {\n self._setError(new Error(`TRAP: ${trap.message}`));\n self.emulationError.dispatch(self._lastError);\n }\n\n private _stop(): EmulationServiceInterface.State {\n try {\n if (this._state === EmulationServiceInterface.State.running) {\n this._board.getTimer().stop();\n this._board.suspend();\n this._board.trap.removeHandler(EmulationService._trapHandler, this);\n\n this._clockProbe.stop().detach();\n }\n\n this._board = null;\n this._context = null;\n this._asyncIO = undefined;\n\n this._setState(EmulationServiceInterface.State.stopped);\n } catch (e) {\n this._setError(e);\n }\n\n return this._state;\n }\n\n private _tryToResume(): void {\n if (this._state === EmulationServiceInterface.State.running) {\n return;\n }\n\n this._board.getTimer().start(this._scheduler);\n this._board.resume();\n this._setState(EmulationServiceInterface.State.running);\n\n this._clockProbe.start();\n }\n\n private _setError(e: Error): void {\n this._lastError = e;\n this._setState(EmulationServiceInterface.State.error);\n }\n\n private _setState(state: EmulationServiceInterface.State): EmulationServiceInterface.State {\n if (state !== this._state) {\n this._state = state;\n this.stateChanged.dispatch(state);\n }\n\n return this._state;\n }\n\n private _updateScheduler(): void {\n this._scheduler = this._enforceRateLimit\n ? this._schedulerFactory.createLimitingScheduler(this._limitingStrategy)\n : this._schedulerFactory.createImmediateScheduler();\n }\n\n stateChanged = new Event<EmulationServiceInterface.State>();\n emulationError = new Event<Error>();\n frequencyUpdate: EventInterface<number>;\n\n private _enforceRateLimit = true;\n private _state = EmulationServiceInterface.State.stopped;\n private _lastError: Error = null;\n private _board: Board;\n private _context: EmulationContext;\n private _asyncIO: AsyncIO;\n private _scheduler: SchedulerInterface = null;\n private _clockProbe = new ClockProbe(new PeriodicScheduler(CLOCK_UPDATE_INTERVAL));\n private _mutex = new Mutex();\n private _schedulerFactory = new SchedulerFactory();\n private _limitingStrategy = SchedulerFactory.LimitingSchedulingStrategy.constantCycles;\n}\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport EmulationServiceInterface from './EmulationServiceInterface';\nimport EmulationContextInterface from './EmulationContextInterface';\n\nclass DriverManager {\n bind(emulationService: EmulationServiceInterface): this {\n if (this._driversBound) {\n return this;\n }\n\n this._emulationService = emulationService;\n\n if (this._shouldBindDrivers()) {\n this._bindDrivers();\n }\n\n this._emulationService.stateChanged.addHandler(DriverManager._onEmuStateChange, this);\n\n return this;\n }\n\n unbind(): this {\n if (!this._emulationService) {\n return this;\n }\n\n this._unbindDrivers();\n\n this._emulationService.stateChanged.removeHandler(DriverManager._onEmuStateChange, this);\n\n this._emulationService = null;\n\n return this;\n }\n\n addDriver(driver: DriverManager.Driver, binder: DriverManager.Binder): this {\n this._drivers.set(driver, new DriverManager.DriverContext(driver, binder));\n\n if (this._driversBound) {\n binder(this._emulationService.getEmulationContext(), driver);\n }\n\n return this;\n }\n\n removeDriver(driver: DriverManager.Driver): this {\n if (!this._drivers.get(driver)) {\n return this;\n }\n\n driver.unbind();\n\n this._drivers.delete(driver);\n\n return this;\n }\n\n private static _onEmuStateChange(newState: EmulationServiceInterface.State, self: DriverManager): void {\n if (self._shouldBindDrivers(newState)) {\n self._bindDrivers();\n } else {\n self._unbindDrivers();\n }\n }\n\n private _shouldBindDrivers(\n state = this._emulationService ? this._emulationService.getState() : undefined\n ): boolean {\n return (\n this._emulationService &&\n (state === EmulationServiceInterface.State.running || state === EmulationServiceInterface.State.paused)\n );\n }\n\n private _bindDrivers(): void {\n if (this._driversBound) {\n return;\n }\n\n this._drivers.forEach(driverContext =>\n driverContext.binder(this._emulationService.getEmulationContext(), driverContext.driver)\n );\n\n this._driversBound = true;\n }\n\n private _unbindDrivers(): void {\n if (!this._driversBound) {\n return;\n }\n\n this._drivers.forEach(driverContext => driverContext.driver.unbind());\n\n this._driversBound = false;\n }\n\n private _emulationService: EmulationServiceInterface;\n private _drivers = new Map<DriverManager.Driver, DriverManager.DriverContext>();\n private _driversBound = false;\n}\n\nnamespace DriverManager {\n export interface Driver {\n unbind(): void;\n }\n\n export interface Binder {\n (context: EmulationContextInterface, driver: Driver): void;\n }\n\n export class DriverContext {\n constructor(public driver: Driver, public binder: Binder) {}\n }\n}\n\nexport { DriverManager as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport EventServiceInterface from '../EmulationServiceInterface';\nimport CartridgeInfo from '../../../../machine/stella/cartridge/CartridgeInfo';\n\nexport const RPC_TYPE = {\n emulationPause: 'emulation/pause',\n emulationReset: 'emulation/reset',\n emulationResume: 'emulation/resume',\n emulationSetRateLimit: 'emulation/setRateLimit',\n emulationStart: 'emulation/start',\n emulationStop: 'emulation/stop',\n emulationFetchLastError: 'emulation/fetchLastError',\n getVideoParameters: 'video/getParameters',\n getWaveformAudioParameters: (index: number) => `audio/waveform/getParameters/${index}`,\n getPCMAudioParameters: (index: number) => `audio/pcm/getParameters/${index}`,\n setup: '/setup'\n};\nObject.freeze(RPC_TYPE);\n\nexport const SIGNAL_TYPE = {\n emulationError: 'emulation/error',\n emulationFrequencyUpdate: 'emulation/frequencyUpdate',\n videoNewFrame: 'video/newFrame',\n videoReturnSurface: 'video/returnSurface',\n controlStateUpdate: 'control/stateUpdate',\n waveformAudioVolumeChange: 'audio/waveform/volumeChange',\n waveformAudioBufferChange: 'audio/waveform/bufferChange',\n pcmAudioNewFrame: (index: number) => `audio/pcm/newFrame/${index}`,\n pcmAudioTogglePause: (index: number) => `audio/pcm/togglePause/${index}`,\n pcmAudioReturnFrame: (index: number) => `audio/pcm/returnFrame/${index}`,\n audioStop: 'audio/stop',\n messageFromAsyncIO: 'asyncIO/messageFrom',\n messageToAsyncIO: 'asyncIO/messageTo'\n};\nObject.freeze(SIGNAL_TYPE);\n\nexport interface SetupMessage {}\n\nexport interface EmulationStartMessage {\n buffer: { [i: number]: number; length: number };\n config: EventServiceInterface.Config;\n cartridgeType?: CartridgeInfo.CartridgeType;\n}\n\nexport interface VideoParametersResponse {\n width: number;\n height: number;\n}\n\nexport interface WaveformAudioParametersResponse {\n volume: number;\n}\n\nexport interface VideoNewFrameMessage {\n id: number;\n width: number;\n height: number;\n buffer: ArrayBuffer;\n}\n\nexport interface VideoReturnSurfaceMessage {\n id: number;\n buffer: ArrayBuffer;\n}\n\nexport interface WaveformAudioVolumeChangeMessage {\n index: number;\n value: number;\n}\n\nexport interface WaveformAudioBufferChangeMessage {\n index: number;\n key: number;\n}\n\nexport interface PCMAudioParametersResponse {\n sampleRate: number;\n frameSize: number;\n paused: boolean;\n}\n\nexport interface PCMAudioNewFrameMessage {\n buffer: ArrayBuffer;\n id: number;\n}\n\nexport interface PCMAudioTogglePauseMessage {\n paused: boolean;\n}\n\nexport interface PCMAudioReturnFrameMessage {\n id: number;\n buffer: ArrayBuffer;\n}\n\nexport type MessageFromAsyncIOMessage = ArrayLike<number>;\n\nexport type MessageToAsyncIOMessage = Array<number>;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Mutex } from 'async-mutex';\nimport { RpcProviderInterface } from 'worker-rpc';\n\nimport VideoOutputInterface from '../../../../machine/io/VideoOutputInterface';\nimport ObjectPool from '../../../../tools/pool/Pool';\nimport ObjectPoolMember from '../../../../tools/pool/PoolMember';\nimport ArrayBufferSurface from '../../../../video/surface/ArrayBufferSurface';\n\nimport {\n SIGNAL_TYPE,\n RPC_TYPE,\n VideoNewFrameMessage,\n VideoReturnSurfaceMessage,\n VideoParametersResponse\n} from './messages';\n\nclass VideoDriver {\n constructor(private _rpc: RpcProviderInterface) {}\n\n init(): void {\n this._rpc\n .registerSignalHandler(SIGNAL_TYPE.videoReturnSurface, this._onReturnSurfaceFromHost.bind(this))\n .registerRpcHandler(RPC_TYPE.getVideoParameters, this._onGetVideoParameters.bind(this));\n }\n\n bind(video: VideoOutputInterface): void {\n this._mutex.runExclusive(() => this._bind(video));\n }\n\n unbind(): void {\n this._mutex.runExclusive(() => this._unbind());\n }\n\n private static _onNewFrame(surface: ArrayBufferSurface, self: VideoDriver): void {\n if (!self._active) {\n console.warn('new frame passed to inactive driver');\n return;\n }\n\n if (!self._managedSurfaces.has(surface)) {\n console.warn(`surface not registered`);\n return;\n }\n\n const buffer = surface.getUnderlyingBuffer(),\n id = self._ids.get(self._managedSurfaces.get(surface));\n\n self._rpc.signal<VideoNewFrameMessage>(\n SIGNAL_TYPE.videoNewFrame,\n {\n id,\n width: self._width,\n height: self._height,\n buffer\n },\n [buffer]\n );\n }\n\n private async _bind(video: VideoOutputInterface): Promise<void> {\n if (this._active) {\n return;\n }\n\n this._width = video.getWidth();\n this._height = video.getHeight();\n this._video = video;\n\n this._surfacePool = new ObjectPool<ArrayBufferSurface>(() =>\n ArrayBufferSurface.createFromArrayBuffer(\n this._width,\n this._height,\n new ArrayBuffer(4 * this._width * this._height)\n )\n );\n this._managedSurfacesById = new Map<number, ObjectPoolMember<ArrayBufferSurface>>();\n this._managedSurfaces = new WeakMap<ArrayBufferSurface, ObjectPoolMember<ArrayBufferSurface>>();\n this._ids = new WeakMap<ObjectPoolMember<ArrayBufferSurface>, number>();\n\n this._video.setSurfaceFactory(\n (): ArrayBufferSurface => {\n const managedSurface = this._surfacePool.get(),\n surface = managedSurface.get();\n\n const isNewSurface = !this._ids.has(managedSurface);\n\n if (isNewSurface) {\n const id = this._nextId++;\n\n this._ids.set(managedSurface, id);\n this._managedSurfacesById.set(id, managedSurface);\n this._managedSurfaces.set(surface, managedSurface);\n\n surface.fill(0xff000000);\n }\n\n return managedSurface.get();\n }\n );\n\n this._video.newFrame.addHandler(VideoDriver._onNewFrame, this);\n\n this._active = true;\n }\n\n private async _unbind(): Promise<void> {\n if (!this._active) {\n return;\n }\n this._active = false;\n\n this._video.setSurfaceFactory(null);\n this._video.newFrame.removeHandler(VideoDriver._onNewFrame, this);\n\n this._video = null;\n this._surfacePool = null;\n this._managedSurfacesById = null;\n this._ids = null;\n }\n\n private _onReturnSurfaceFromHost(message: VideoReturnSurfaceMessage): void {\n if (!this._active) {\n console.warn('surface returned from host to inactive driver');\n return;\n }\n\n const surface = this._managedSurfacesById.get(message.id);\n\n if (!surface) {\n console.warn(`invalid member ID ${message.id}`);\n return;\n }\n\n surface.get().replaceUnderlyingBuffer(this._width, this._height, message.buffer);\n surface.release();\n }\n\n private _onGetVideoParameters(): VideoParametersResponse {\n return {\n width: this._width,\n height: this._height\n };\n }\n\n private _active = false;\n\n private _video: VideoOutputInterface = null;\n\n private _mutex = new Mutex();\n\n private _surfacePool: ObjectPool<ArrayBufferSurface> = null;\n private _managedSurfacesById: Map<number, ObjectPoolMember<ArrayBufferSurface>> = null;\n private _managedSurfaces: WeakMap<ArrayBufferSurface, ObjectPoolMember<ArrayBufferSurface>>;\n private _ids: WeakMap<ObjectPoolMember<ArrayBufferSurface>, number> = null;\n private _width = 0;\n private _height = 0;\n\n private _nextId = 0;\n}\n\nexport { VideoDriver as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport EmulationContextInterface from '../EmulationContextInterface';\nimport ControlState from './ControlState';\nimport { RpcProviderInterface } from 'worker-rpc';\nimport JoystickInterface from '../../../../machine/io/DigitalJoystickInterface';\nimport PaddleInterface from '../../../../machine/io/PaddleInterface';\nimport ControlPanelInterface from '../../../../machine/stella/ControlPanelInterface';\n\nimport { SIGNAL_TYPE } from './messages';\n\nclass ControlDriver {\n constructor(private _rpc: RpcProviderInterface) {}\n\n init(): void {\n this._rpc.registerSignalHandler(SIGNAL_TYPE.controlStateUpdate, this._onControlStateUpdate.bind(this));\n }\n\n bind(emulationContext: EmulationContextInterface): void {\n if (this._active) {\n return;\n }\n\n this._active = true;\n this._emulationContext = emulationContext;\n }\n\n unbind(): void {\n if (!this._active) {\n return;\n }\n\n this._active = false;\n this._emulationContext = null;\n }\n\n private _onControlStateUpdate(controlState: ControlState): void {\n if (!this._active) {\n return;\n }\n\n for (let i = 0; i < 2; i++) {\n this._applyJoystickState(controlState.joystickState[i], this._emulationContext.getJoystick(i));\n }\n\n for (let i = 0; i < 4; i++) {\n this._applyPaddleState(controlState.paddleState[i], this._emulationContext.getPaddle(i));\n }\n\n this._applyControlPanelState(controlState.controlPanelState, this._emulationContext.getControlPanel());\n }\n\n private _applyJoystickState(state: ControlState.JoystickState, joystick: JoystickInterface): void {\n joystick.getUp().toggle(state.up);\n joystick.getDown().toggle(state.down);\n joystick.getLeft().toggle(state.left);\n joystick.getRight().toggle(state.right);\n joystick.getFire().toggle(state.fire);\n }\n\n private _applyPaddleState(state: ControlState.PaddleState, paddle: PaddleInterface): void {\n paddle.setValue(state.value);\n paddle.getFire().toggle(state.fire);\n }\n\n private _applyControlPanelState(state: ControlState.ControlPanelState, panel: ControlPanelInterface): void {\n panel.getDifficultySwitchP0().toggle(state.difficulty0);\n panel.getDifficultySwitchP1().toggle(state.difficulty1);\n panel.getResetButton().toggle(state.reset);\n panel.getColorSwitch().toggle(state.color);\n panel.getSelectSwitch().toggle(state.select);\n }\n\n private _active = false;\n private _emulationContext: EmulationContextInterface = null;\n}\n\nexport { ControlDriver as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { RpcProviderInterface } from 'worker-rpc';\nimport WaveformAudioOutputInterface from '../../../../machine/io/WaveformAudioOutputInterface';\n\nimport {\n SIGNAL_TYPE,\n RPC_TYPE,\n WaveformAudioBufferChangeMessage,\n WaveformAudioVolumeChangeMessage,\n WaveformAudioParametersResponse\n} from './messages';\n\nclass WaveformAudioDriver {\n constructor(private _index: number, private _rpc: RpcProviderInterface) {\n this._rpc.registerRpcHandler(\n RPC_TYPE.getWaveformAudioParameters(this._index),\n this._onGetWaveformAudioParameters.bind(this)\n );\n }\n\n bind(audio: WaveformAudioOutputInterface): void {\n if (this._audio) {\n return;\n }\n\n this._audio = audio;\n\n this._audio.bufferChanged.addHandler(WaveformAudioDriver._onBufferChanged, this);\n this._audio.volumeChanged.addHandler(WaveformAudioDriver._onVolumeChanged, this);\n this._audio.stop.addHandler(WaveformAudioDriver._onStop, this);\n }\n\n unbind(): void {\n if (!this._audio) {\n return;\n }\n\n this._audio.bufferChanged.removeHandler(WaveformAudioDriver._onBufferChanged, this);\n this._audio.volumeChanged.removeHandler(WaveformAudioDriver._onVolumeChanged, this);\n this._audio.stop.removeHandler(WaveformAudioDriver._onStop, this);\n\n this._audio = null;\n }\n\n private static _onBufferChanged(key: number, self: WaveformAudioDriver) {\n self._rpc.signal<WaveformAudioBufferChangeMessage>(SIGNAL_TYPE.waveformAudioBufferChange, {\n index: self._index,\n key\n });\n }\n\n private static _onVolumeChanged(value: number, self: WaveformAudioDriver) {\n self._rpc.signal<WaveformAudioVolumeChangeMessage>(SIGNAL_TYPE.waveformAudioVolumeChange, {\n index: self._index,\n value\n });\n }\n\n private static _onStop(value: void, self: WaveformAudioDriver) {\n self._rpc.signal<number>(SIGNAL_TYPE.audioStop, self._index);\n }\n\n private _onGetWaveformAudioParameters(): WaveformAudioParametersResponse {\n return { volume: this._audio.getVolume() };\n }\n\n private _audio: WaveformAudioOutputInterface = null;\n}\n\nexport { WaveformAudioDriver as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { RpcProviderInterface } from 'worker-rpc';\n\nimport PoolMemberInterface from '../../../../tools/pool/PoolMemberInterface';\nimport PCMAudioEndpointInterface from '../../../driver/PCMAudioEndpointInterface';\nimport {\n RPC_TYPE,\n SIGNAL_TYPE,\n PCMAudioParametersResponse,\n PCMAudioNewFrameMessage,\n PCMAudioReturnFrameMessage,\n PCMAudioTogglePauseMessage\n} from './messages';\n\nclass PCMAudioDriver {\n constructor(index: number, private _rpc: RpcProviderInterface) {\n this._rpc\n .registerRpcHandler(RPC_TYPE.getPCMAudioParameters(index), this._onGetPCMAudioParameters.bind(this))\n .registerSignalHandler(SIGNAL_TYPE.pcmAudioReturnFrame(index), this._onReturnFrame.bind(this));\n\n this._signalNewFrame = SIGNAL_TYPE.pcmAudioNewFrame(index);\n this._signalTogglePause = SIGNAL_TYPE.pcmAudioTogglePause(index);\n }\n\n bind(endpoint: PCMAudioEndpointInterface): void {\n if (this._enabled) {\n this.unbind();\n }\n\n this._endpoint = endpoint;\n\n this._endpoint.newFrame.addHandler(PCMAudioDriver._onNewFrame, this);\n this._endpoint.togglePause.addHandler(PCMAudioDriver._onTogglePause, this);\n\n this._sampleRate = this._endpoint.getSampleRate();\n this._frameSize = this._endpoint.getFrameSize();\n\n this._enabled = true;\n }\n\n unbind(): void {\n if (!this._enabled) {\n return;\n }\n\n this._endpoint.newFrame.removeHandler(PCMAudioDriver._onNewFrame, this);\n this._endpoint.togglePause.removeHandler(PCMAudioDriver._onTogglePause, this);\n this._endpoint = null;\n\n this._pendingFrames.clear();\n\n this._sampleRate = this._frameSize = 0;\n\n this._enabled = false;\n }\n\n private static _onNewFrame(frame: PoolMemberInterface<Float32Array>, self: PCMAudioDriver) {\n if (!self._enabled) {\n frame.dispose();\n return;\n }\n\n const id = self._nextId++,\n data = frame.get();\n self._pendingFrames.set(id, frame);\n\n self._rpc.signal<PCMAudioNewFrameMessage>(\n self._signalNewFrame,\n {\n id,\n buffer: data.buffer\n },\n [data.buffer]\n );\n }\n\n private static _onTogglePause(paused: boolean, self: PCMAudioDriver) {\n self._paused = paused;\n\n self._rpc.signal<PCMAudioTogglePauseMessage>(self._signalTogglePause, {\n paused\n });\n }\n\n private _onGetPCMAudioParameters(): PCMAudioParametersResponse {\n return {\n sampleRate: this._sampleRate,\n frameSize: this._frameSize,\n paused: this._paused\n };\n }\n\n private _onReturnFrame(msg: PCMAudioReturnFrameMessage): void {\n if (!this._enabled || !this._pendingFrames.has(msg.id)) {\n return;\n }\n\n const frame = this._pendingFrames.get(msg.id);\n this._pendingFrames.delete(msg.id);\n\n frame.adopt(new Float32Array(msg.buffer));\n frame.release();\n }\n\n private _enabled = false;\n\n private _endpoint: PCMAudioEndpointInterface;\n private _sampleRate = 0;\n private _frameSize = 0;\n\n private _pendingFrames = new Map<number, PoolMemberInterface<Float32Array>>();\n private _nextId = 0;\n\n private _paused = false;\n\n private _signalNewFrame = '';\n private _signalTogglePause = '';\n}\n\nexport { PCMAudioDriver as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Event } from 'microevent.ts';\nimport AsyncIOInterface from '../../machine/io/AsyncIOInterface';\n\nclass AsyncIO {\n bind(io: AsyncIOInterface | null): void {\n if (this._io) {\n return;\n }\n\n if (io) {\n io.message.addHandler(AsyncIO._onAsyncIOMessage, this);\n }\n\n this._io = io;\n }\n\n unbind(): void {\n if (!this._io) {\n return;\n }\n\n this._io.message.removeHandler(AsyncIO._onAsyncIOMessage, this);\n\n this._io = null;\n }\n\n send(message: ArrayLike<number>): void {\n if (this._io) {\n this._io.send(message);\n }\n }\n\n private static _onAsyncIOMessage(message: ArrayLike<number>, self: AsyncIO): void {\n self.message.dispatch(message);\n }\n\n message = new Event<ArrayLike<number>>();\n\n private _io: AsyncIOInterface = null;\n}\n\nexport default AsyncIO;\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport EmulationService from '../vanilla/EmulationService';\nimport EmulationServiceInterface from '../EmulationServiceInterface';\nimport { RpcProviderInterface } from 'worker-rpc';\nimport DriverManager from '../DriverManager';\nimport VideoDriver from './VideoDriver';\nimport ControlDriver from './ControlDriver';\nimport WaveformAudioDriver from './WaveformAudioDriver';\nimport PCMAudioDriver from './PCMAudioDriver';\nimport EmulationContext from '../vanilla/EmulationContext';\nimport AsyncIODriver from '../../../driver/AsyncIO';\n\nimport { RPC_TYPE, SIGNAL_TYPE, EmulationStartMessage, SetupMessage, MessageToAsyncIOMessage } from './messages';\n\nclass EmulationBackend {\n constructor(private _rpc: RpcProviderInterface) {\n this._service = new EmulationService();\n }\n\n startup(): void {\n const driverManager = new DriverManager(),\n videoDriver = new VideoDriver(this._rpc),\n controlDriver = new ControlDriver(this._rpc),\n waveformAduioDrivers = [0, 1].map(i => new WaveformAudioDriver(i, this._rpc)),\n pcmAudioDriver = new PCMAudioDriver(0, this._rpc),\n asyncIODriver = new AsyncIODriver();\n\n this._rpc\n .registerRpcHandler(RPC_TYPE.setup, this._onSetup.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationFetchLastError, this._onFetchLastError.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationPause, this._onEmulationPause.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationReset, this._onEmulationReset.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationResume, this._onEmulationResume.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationSetRateLimit, this._onEmulationSetRateLimit.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationStart, this._onEmulationStart.bind(this))\n .registerRpcHandler(RPC_TYPE.emulationStop, this._onEmulationStop.bind(this))\n .registerSignalHandler<MessageToAsyncIOMessage>(SIGNAL_TYPE.messageToAsyncIO, data =>\n asyncIODriver.send(data)\n );\n\n asyncIODriver.message.addHandler(message => this._rpc.signal(SIGNAL_TYPE.messageFromAsyncIO, message));\n\n this._service.frequencyUpdate.addHandler(EmulationBackend._onFrequencyUpdate, this);\n this._service.emulationError.addHandler(EmulationBackend._onEmulationError, this);\n\n this._videoDriver = videoDriver;\n videoDriver.init();\n controlDriver.init();\n\n driverManager\n .addDriver(videoDriver, (context: EmulationContext, driver: VideoDriver) =>\n driver.bind(context.getRawVideo())\n )\n .addDriver(controlDriver, (context: EmulationContext, driver: ControlDriver) => driver.bind(context))\n .addDriver(pcmAudioDriver, (context: EmulationContext, driver: PCMAudioDriver) =>\n driver.bind(context.getPCMChannel())\n )\n .addDriver(asyncIODriver, (context: EmulationContext, driver: AsyncIODriver) =>\n driver.bind(context.getAsyncIO())\n )\n .bind(this._service);\n\n for (let i = 0; i < 2; i++) {\n driverManager.addDriver(waveformAduioDrivers[i], (context: EmulationContext, driver: WaveformAudioDriver) =>\n driver.bind(context.getWaveformChannels()[i])\n );\n }\n }\n\n private static _onFrequencyUpdate(frequency: number, self: EmulationBackend): void {\n self._rpc.signal<number>(SIGNAL_TYPE.emulationFrequencyUpdate, frequency);\n }\n\n private static _onEmulationError(error: Error, self: EmulationBackend): void {\n self._rpc.signal<string>(SIGNAL_TYPE.emulationError, error ? error.message : null);\n }\n\n private _onSetup(msg: SetupMessage): void {\n this._videoDriver.init();\n }\n\n private _onFetchLastError(): string {\n const lastError = this._service.getLastError();\n\n return lastError ? lastError.message : null;\n }\n\n private _onEmulationPause(): Promise<EmulationServiceInterface.State> {\n return this._service.pause();\n }\n\n private _onEmulationReset(): Promise<EmulationServiceInterface.State> {\n return this._service.reset();\n }\n\n private _onEmulationResume(): Promise<EmulationServiceInterface.State> {\n return this._service.resume();\n }\n\n private _onEmulationStart(message: EmulationStartMessage): Promise<EmulationServiceInterface.State> {\n return this._service.start(message.buffer, message.config, message.cartridgeType);\n }\n\n private _onEmulationStop(): Promise<EmulationServiceInterface.State> {\n return this._service.stop();\n }\n\n private _onEmulationSetRateLimit(message: boolean): Promise<void> {\n return this._service.setRateLimit(message);\n }\n\n private _service: EmulationService;\n private _videoDriver: VideoDriver = null;\n}\n\nexport { EmulationBackend as default };\n","/*\n * This file is part of 6502.ts, an emulator for 6502 based systems built\n * in Typescript\n *\n * Copyright (c) 2014 -- 2020 Christian Speckner and contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { getRpc } from '../rpc';\nimport EmulationBackend from '../../../src/web/stella/service/worker/EmulationBackend';\n\nconst emulationBackend = new EmulationBackend(getRpc());\nemulationBackend.startup();\n"],"names":["Object","defineProperty","exports","value","factories","getFactory","handlerCount","src","argsHandlers","argsContexts","i","push","Function","bind","apply","concat","compileFactory","callback","context","payload","Event","this","hasHandlers","_handlers","_contexts","_createDispatcher","prototype","addHandler","handler","isHandlerAttached","_updateHasHandlers","removeHandler","idx","_getHandlerIndex","splice","length","undefined","dispatch","Event_1","default","MSG_RESOLVE_TRANSACTION","MSG_REJECT_TRANSACTION","MSG_ERROR","RpcProvider","_dispatch","_rpcTimeout","error","microevent_ts_1","_rpcHandlers","_signalHandlers","_pendingTransactions","_nextTransactionId","message","type","MessageType","signal","_handleSignal","rpc","_handeRpc","internal","_handleInternal","_raiseError","id","transfer","_this","transactionId","Promise","resolve","reject","transaction","timeoutHandle","setTimeout","_transactionTimeout","registerRpcHandler","Error","registerSignalHandler","deregisterRpcHandler","deregisterSignalHandler","filter","h","forEach","then","result","reason","_clearTransaction","clearTimeout","RpcProvider_1","rpcProvider","port","portPending","__decorate","decorators","target","key","desc","d","c","arguments","r","getOwnPropertyDescriptor","Reflect","decorate","__metadata","metadataKey","metadataValue","metadata","__awaiter","thisArg","_arguments","P","generator","fulfilled","step","next","e","rejected","done","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","pop","EmulationServiceInterface","BoardInterface","CpuInterface","postMessage","onmessage","data","console","log","newPort","State","PoolMember","[object Object]","_value","_releaseCB","_disposeCB","Pool","_factory","release","dispose","member","_poolSize","newItem","victim","_releaseMember","_disposeMember","_pool","_isAvailable","_isDisposed","position","_poolPosition","event","get","ArrayBufferSurface","width","height","buffer","replaceUnderlyingBuffer","byteLength","_width","_height","_underlyingBuffer","_buffer","Uint32Array","VideoEndpoint","_video","WeakMap","ObjectPool","ImageData","getWidth","getHeight","setSurfaceFactory","poolMember","imageData","_surfaces","has","newSurface","createFromArrayBuffer","set","fill","surface","_poolMembers","newFrame","InducedMember","_mapper","_adopter","InducedPool","original","_map","AudioOutputBuffer","_content","_sampleRate","PCMAudioEndpoint","_output","Float32Array","getFrameSize","getSampleRate","getContent","_pcmDataPool","_audioBufferMap","togglePause","paused","setFrameBufferFactory","wrappedBuffer","_audioBufferPool","isPaused","EmulationContext","_board","_asyncIO","getConfig","_videoEndpoint","getVideoOutput","getJoystick0","getJoystick1","getControlPanel","getPaddle","getWaveformChannels","_audioEndpoint","getPCMChannel","board","Bus","trap","read","write","tia","triggerTrap","_tia","pia","_pia","cartridge","_cartridge","address","_lastAddressBusValue","_lastDataBusValue","peek","TrapPayload","bus","Pia","_controlPanel","_joystick0","_joystick1","_rng","Uint8Array","reset","ram","int","_interruptFlag","_flagSetDuringThisCycle","_timerDivide","_subTimer","_timerValue","_timerWrapped","_readTimer","_readIo","_peekTimer","_writeTimer","_writeIo","_cycleTimer","_bus","_setTimer","divide","getUp","getDown","getLeft","getRight","getResetButton","getSelectSwitch","getColorSwitch","getDifficultySwitchP0","getDifficultySwitchP1","getLastDataBusValue","ResultImpl","nextStep","cycleType","poll","pollInterrupts","immutables","freezeImmutables","immutableProperties","prop","writable","configurable","Immutable","enumerable","Boot","state","_result","_pre1Step","_pre2Step","_stack1Step","_stack2Step","_state","s","_stack3Step","_readTargetLoStep","operand","_targetAddress","_readTargetHiStep","p","Interrupt","defaultVector","isBrk","_dummyRead","_isBrk","_pushPch","_pushPcl","_vector","nmi","_defaultVector","_pushFlags","flags","_fetchPcl","_fetchPch","irq","Instruction","operation","addressingMode","effectiveAddressingMode","OperationMap","Array","__init","opcodes","opcode","j","_opcode","_operation","_addressingMode","_effectiveAdressingMode","Absolute","_fetchLo","_operand","_fetchHi","_next","AbsoluteIndexed","indexExtractor","writeOp","index","_indexExtractor","_carry","_writeOp","_dereferenceAndCarry","x","Dereference","_dereference","Immediate","_fetchOperand","IndexedIndirectX","_fetchAddress","_address","_addIndex","IndexedIndirectY","ZeroPage","ZeroPageIndexed","Branch","predicate","_fetchTarget","_predicate","_firstDummyRead","_target","_secondDummyRead","branch","Jsr","_addressLo","_dummyStackRead","ReadModifyWrite","_read","_dummyWrite","_write","readModifyWrite","Rts","_dummyOperandRead","_popPcl","_popPch","_incrementP","NullaryOneCycle","_executeOperation","nullaryOneCycle","Pull","_incrementS","_pull","pull","Push","_push","Rti","_popP","Write","setFlagsNZ","genRmw","genNullary","genUnary","adc","d0","a","d1","sum","aslImmediate","old","aslRmw","bit","cmp","getRegister","diff","sbc","lsrImmediate","lsrRmw","rolImmediate","rolRmw","rorImmediate","rorRmw","alr","dcp","axs","rra","rla","slo","aax","isc","aac","Indirect","_fetchAddressLo","_fetchAddressHi","Compiler","instruction","_createAddressing","ops.adc","deref","o","ops.genUnary","ops.aslImmediate","ops.aslRmw","ops.bit","ops.cmp","ops.genRmw","ops.genNullary","jsr","ops.lsrImmediate","ops.lsrRmw","ops.rolImmediate","ops.rolRmw","ops.rorImmediate","ops.rorRmw","rti","rts","ops.sbc","ops.aac","ops.aax","ops.alr","ops.arr","ops.axs","ops.dcp","ops.isc","ops.rla","ops.rra","ops.slo","dereference","immediate","zeroPage","absolute","zeroPageX","zeroPageY","absoluteX","absoluteY","indexedIndirectX","indirectIndexedY","indirect","StateMachineCpu","_opBoot","_opIrq","_opNmi","compiler","_operations","compile","executionState","_interruptPending","_nmiPending","_halt","_lastResult","_lastInstructionPointer","_invalidInstructionCallback","_fetch","_pollInterrupts","_pollInterruptsAfterLastInstruction","restoreFlagsFromStack","opAdc","opAnd","opAslAcc","opAslMem","opBit","opBrk","nextOpAddr","vector","readWord","opClc","opCld","opCli","opClv","opCmp","opCpx","opCpy","opDec","opDex","opEor","opDey","opInc","opInx","opIny","opJmp","opJsr","returnPtr","addrLo","opLda","opLdx","opLdy","opLsrAcc","opLsrMem","opNop","opOra","opPhp","opPlp","opPha","opPla","opRolAcc","opRolMem","opRorAcc","opRorMem","opRti","opRts","opSbc","opSec","opSed","opSei","opSta","opStx","opSty","opTax","opTay","opTsx","opTxa","opTxs","opTya","opAlr","opAxs","opDcp","opLax","opArr","opSlo","opAax","opLar","opIsc","opAac","opAtx","opRra","opRla","opBoot","dispatchInterrupt","opIrq","opNmi","BatchedAccessCpu","_halted","_opCycles","_instructionCallback","_interuptCheck","_checkForInterrupts","_currentAddressingMode","base","slowIndexedAccess","ops.opAdc","ops.opAnd","ops.opAslAcc","ops.opAslMem","ops.opNop","ops.opJmp","ops.opBit","ops.opBrk","ops.opClc","ops.opCld","ops.opCli","ops.opClv","ops.opCmp","ops.opCpx","ops.opCpy","ops.opDec","ops.opDex","ops.opDey","ops.opEor","ops.opInc","ops.opInx","ops.opIny","ops.opJsr","ops.opLda","ops.opLdx","ops.opLdy","ops.opLsrAcc","ops.opLsrMem","ops.opOra","ops.opPhp","ops.opPha","ops.opPla","ops.opPlp","ops.opRolAcc","ops.opRolMem","ops.opRorAcc","ops.opRorMem","ops.opRti","ops.opRts","ops.opSbc","ops.opSec","ops.opSed","ops.opSei","ops.opSta","ops.opStx","ops.opSty","ops.opTax","ops.opTay","ops.opTsx","ops.opTxa","ops.opTxs","ops.opTya","ops.opArr","ops.opAlr","ops.opAxs","ops.opDcp","ops.opLax","ops.opSlo","ops.opAax","ops.opLar","ops.opIsc","ops.opAac","ops.opAtx","ops.opRra","ops.opRla","Factory","_type","rng","Type","stateMachine","batchedAccess","Config","config","tvMode","enableAudio","randomSeed","emulatePaddles","frameStart","pcmAudio","cpuType","CpuFactory","encodings","decodeChar","charCodeAt","decodeNibble","decode","nibbles","decodedSize","padding","getPadding","decoded","nibble","FREQUENCY_DIVISIORS","decodeBase64","POLY0","Int8Array","POLY1","POLY2","POLY4","POLY5","POLY9","POLY68","POLYS","ToneGenerator","_config","tone","frequency","poly","content","sampleRate","getClockHz","count","offset","WaveformAudio","_toneGenerator","_volume","_tone","_frequency","_dispatchBufferChanged","volumeChanged","active","_active","stop","getBuffer","getKey","bufferChanged","_getKey","PCMChannel","_audc","_audf","_audv","_clkEnable","_noiseFeedback","_noiseCounterBit4","_pulseCounterHold","_divCounter","_noiseCounter","_pulseCounter","pulseFeedback","mixingTable","VOL_MAX","vol","PCMAudio","_frameSize","audv","_channel0","audc","audf","setActive","_channel1","_bufferIndex","_counter","phase0","_currentOutputBuffer","phase1","getLength","_dispatchBuffer","_isActive","isActive","factory","_bufferFactory","decodes0","decodes1","decodes2","decodes3","decodes4","decodes6","decodesMissile","decodesPlayer","decodes","Missile","_collisionMask","_flushLineCache","color","_enabled","_rendering","_renderCounter","_moving","_hmmClocks","_decodes","_resmp","_enam","_effectiveWidth","_lastMovementTick","enam","enabled","counter","hblank","player","resmp","getRespClock","_widths","clock","tick","isReceivingHclock","collision","starfieldEffect","starfieldDelta","colorIn","Playfield","_pattern","_reflected","_refp","_pf0","_pf1","_pf2","_color","_colorP0","_colorP1","_colorMode","_applyColors","reflected","colorMode","_x","currentPixel","_colorLeft","_colorRight","Player","_patternNew","_patternOld","_delaying","_sampleCounter","_dividerPending","_dividerChangeCounter","_setDivider","pattern","_updatePattern","masked","oldDecodes","_divider","delta","oldReflected","oldDelaying","_renderCounterTripPoint","oldPatternOld","divider","Ball","_enabledOld","_enabledNew","enabledNewOldValue","_updateEnabled","oldEnabledOld","LatchedInput","_switch","_modeLatched","_latchedValue","C","RPOT","PaddleReader","clockFreq","_paddle","_uThresh","Math","exp","valueChanged","_updateValue","provider","_cpuTimeProvider","_timestamp","_u","getValue","_dumped","oldValue","timestamp","FrameManager","_vblankLines","_kernelLines","_overscanLines","_frameStart","vblank","surfaceBuffer","_linesWithoutVsync","_vsync","_lineInState","_surface","_surfaceFactory","_setState","_startFrame","_finalizeFrame","vsync","_getReadableState","newState","DelayQueue","_length","size","_queue","QueueEntry","nextIndex","delay","currentIndex","_indices","remove","_nextIndex","scope","entry","addresses","values","NTSC","PAL","SECAM","Tia","joystick0","joystick1","paddles","_frameManager","_onNewFrame","_palette","_getPalette","_input0","getFire","_input1","_pcmAudio","pcmChannels","getChannels","_waveformAudio","_audio","_getClockFreq","_paddles","_hctr","_movementInProgress","_extendedHblank","_movementClock","_priority","_hstate","_colorBk","_linesSinceChange","_collisionUpdateRequired","_maxLinesTotal","_xDelta","_delayQueue","_missile0","_missile1","_player0","_player1","_playfield","_ball","_cpu","resume","cpu","setCpuTimeProvider","lastDataBusValue","inpt","halt","_rsync","setVsync","resm","_resxCounter","nusiz","setColor","setColorP0","setColorP1","_setPriority","ctrlpf","resp","vdelp","resbl","vdelbl","getCurrentLine","getDebugState","execute","_delayedWrite","_tickMovement","_tickHblank","_tickHframe","_updateCollision","_nextLine","self","setVblank","_clearHmoveComb","startMovement","pf0","pf1","pf2","grp","shufflePatterns","hmp","hmm","hmbl","refp","shuffleStatus","enabl","linesTotal","boundary","m","movementCounter","movementTick","_tickSprites","isRendering","_renderPixel","_cloneLastLine","nextLine","prevDelta","palette.NTSC","palette.PAL","palette.SECAM","getPixel","priority","wasCaching","rewindCycles","Switch","beforeRead","stateChanged","ControlPanel","_selectSwitch","_resetButton","_colorSwitch","_difficutlyP0","_difficutlyP1","DigitalJoystick","_left","_right","_up","_down","_fire","Paddle","_fireSwitch","global","module","define","Alea","seed","me","mash","String","s0","s1","s2","copy","impl","opts","xg","prng","int32","double","quick","amd","alea","XorGen","strseed","z","w","k","xor128","xorwow","X","init","slice","Date","xorshift7","limit","max","xor4096","b","floor","tychei","pool","math","nodecrypto","startdenom","pow","significance","overflow","mask","seedrandom","options","shortseed","mixkey","flatten","entropy","tostring","out","randomBytes","crypto","msCrypto","getRandomValues","browser","navigator","plugins","screen","autoseed","arc4","ARC4","S","pass","is_math_call","keylen","obj","depth","typ","smear","stringseed","fromCharCode","random","require$$0","ex","CartridgeInterface","CartridgeInfo","sr","SeedrandomGenerator","Board","cpuFactory","clocks","start","scheduler","_start","_stop","isRunning","_runTask","seedrandom.alea","randomize","create","controlPanel","setInvalidInstructionCallback","_onInvalidInstruction","setCpu","setBus","getCpuTime","setRng","setTia","setPia","setCartridge","_clockHz","_sliceSize","map","getWaveformChannel","_timer","toggle","_subClock","_cpuCycles","systemReset","cycles","cpuCycles","_cycle","cpuClock","_suspended","_updateAudioState","_audioEnabled","_trap","sep","clockMode","_clockMode","requestedCycles","lastExecutionState","notifyCpuCycleComplete","_timeSlice","round","setAudioEnabled","cycle","_executeSlice","CartridgeType","vanilla_2k","vanilla_4k","bankswitch_2k_cv","bankswitch_8k_F8","bankswitch_8k_E0","bankswitch_8k_3F","bankswitch_8k_FE","bankswitch_8k_UA","bankswitch_8k_econobanking","bankswitch_8k_pp","bankswitch_12k_FA","bankswitch_8k_DPC","bankswitch_16k_F6","bankswitch_16k_E7","bankswitch_FA2","bankswitch_32k_F4","bankswitch_3E","bankswitch_64k_F0","bankswitch_64k_EF","bankswitch_supercharger","bankswitch_dpc_plus","bankswitch_cdf","unknown","cartridgeType","AbstractCartridge","Cartridge2k","super","paddedBuffer","paddedLength","nextPowerOfTwo","padBuffer","_rom","Cartridge4k","warn","len","min","searchForSignatures","signatures","candidates","counts","signature","iCandidate","candidate","iSignature","CartridgeCV","signatureCounts","_ram","CartridgeF8","_supportSC","_bank0","_bank1","cartridgeUtil.searchForSignatures","_bank","_hasSC","_access","_saraRAM","CartridgeF6","_bank2","_bank3","CartridgeE0","_banks","_activeBanks","_handleBankswitch","addressMasked","CartridgeFE","_lastAccessWasFE","_onBusAccess","accessType","previousAddressBusValue","getLastAddresBusValue","dataBusHiBits","Cartridge3F","Cartridge3E","bankCount","_ramBanks","_ramBank","_ramSelect","CartridgeUA","CartridgeFA","CartrdigeE7","_ram1Banks","_ram1","_ram0Enabled","_ram0","CartridgeF0","_bankIdx","_currentBank","CartridgeEF","matchMagic","magicString","magic","split","CartridgeF4","CartridgeFA2","_accessCounter","_accessCounterLimit","_handleIo","_savedRam","Header","startAddressLow","startAddressHigh","controlWord","blockCount","checksum","multiloadId","progressBarSpeedLow","progressBarSpeedHigh","blockLocation","blockChecksum","bios","CartridgeSupercharger","_loadCount","_loads","_headers","verify","_setupRom","_setBankswitchMode","_transitionCount","_pendingWrite","_pendingWriteData","_writeRamEnabled","_loadInProgress","_loadTimestamp","readValue","_bank1Type","_loadIntoRam","mode","_configureBanks","bank0","bank1Type","bank1","loadId","loadIndex","header","load","blockIdx","location","bank","mixerTable","CartridgeDPC","_fetchers","Fetcher","_fetcherData","fetcher","_lastCpuTime","_clockAccumulator","_clockMusicFetchers","_randomNext","fetchedData","pointer","setStart","setEnd","setLow","setHigh","setMusicMode","oldRng","cpuTime","forwardClock","end","musicMode","_updateMask","period","newPointerLow","distanceStart","distanceEnd","extendStatics","setPrototypeOf","__proto__","hasOwnProperty","__assign","assign","__values","__read","ar","__await","__","constructor","indexOf","getOwnPropertySymbols","propertyIsEnumerable","paramIndex","decorator","k2","il","jl","asyncIterator","q","fulfill","settle","shift","cooked","raw","mod","__esModule","receiver","privateMap","window","defaultSetTimout","defaultClearTimeout","cachedSetTimeout","cachedClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","array","noop","on","addListener","once","off","removeListener","removeAllListeners","emit","performance","performanceNow","now","mozNow","msNow","oNow","webkitNow","getTime","startTime","nextTick","args","title","env","argv","version","versions","binding","name","cwd","chdir","dir","umask","hrtime","previousTimestamp","clocktime","seconds","nanoseconds","platform","uptime","lookup","revLookup","Arr","inited","code","encodeChunk","uint8","tmp","num","output","join","fromByteArray","extraBytes","parts","maxChunkLength","len2","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","Infinity","rt","abs","isNaN","LN2","toString","isArray","arr","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","arg","encodingOrOffset","allocUnsafe","from","ArrayBuffer","byteOffset","fromArrayLike","fromArrayBuffer","string","encoding","isEncoding","actual","fromString","internalIsBuffer","checked","val","fromObject","assertSize","_isBuffer","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","arrayIndexOf","lastIndexOf","indexSize","arrLength","valLength","buf","readUInt16BE","foundIndex","found","hexWrite","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","asciiToBytes","latin1Write","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","base64.fromByteArray","res","secondByte","thirdByte","fourthByte","tempCodePoint","firstByte","codePoint","bytesPerSequence","codePoints","MAX_ARGUMENTS_LENGTH","decodeCodePointsArray","poolSize","_augment","alloc","allocUnsafeSlow","isBuffer","isFastBuffer","readFloatLE","isSlowBuffer","compare","list","pos","swap16","swap32","swap64","equals","inspect","match","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","toHex","bytes","checkOffset","ext","checkInt","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754.write","writeDouble","newBuf","subarray","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","ieee754.read","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","INVALID_BASE64_RE","leadSurrogate","b64","l","placeHolders","L","base64.toByteArray","trim","replace","stringtrim","base64clean","dst","normalizeArray","allowAboveRoot","up","last","unshift","splitPathRe","splitPath","filename","exec","resolvedPath","resolvedAbsolute","path","charAt","normalize","isPathAbsolute","isAbsolute","trailingSlash","extname","basename","dirname","root","delimiter","relative","to","fromParts","toParts","samePartsLength","outputParts","paths","xs","_scriptDir","Module","document","currentScript","moduleOverrides","quit_","status","toThrow","ENVIRONMENT_IS_WEB","ENVIRONMENT_IS_WORKER","ENVIRONMENT_IS_NODE","ENVIRONMENT_HAS_NODE","ENVIRONMENT_IS_SHELL","importScripts","process","node","read_","readAsync","readBinary","nodeFS","nodePath","scriptDirectory","locateFile","__dirname","binary","tryParseAsDataURI","require$$1","assert","abort","intArrayToString","readbuffer","scriptArgs","quit","print","printErr","href","url","xhr","XMLHttpRequest","open","send","responseText","err","responseType","response","onload","onerror","noExitRuntime","tempRet0","setTempRet0","getTempRet0","GLOBAL_BASE","ABORT","condition","text","getCFunc","ident","func","ccall","returnType","argTypes","toC","stringToUTF8","stackAlloc","writeArrayToMemory","cArgs","stack","converter","stackSave","UTF8ToString","Boolean","convertReturnValue","stackRestore","HEAP8","HEAPU8","HEAP32","UTF8Decoder","TextDecoder","UTF8ArrayToString","u8Array","maxBytesToRead","endIdx","endPtr","u0","u1","u2","ch","ptr","stringToUTF8Array","outU8Array","outIdx","maxBytesToWrite","startIdx","u","outPtr","updateGlobalBufferAndViews","Int16Array","Int32Array","Uint16Array","Float64Array","DYNAMIC_BASE","DYNAMICTOP_PTR","INITIAL_TOTAL_MEMORY","callRuntimeCallbacks","callbacks","__ATPRERUN__","__ATINIT__","__ATMAIN__","__ATPOSTRUN__","preRun","addOnPreRun","initRuntime","preMain","postRun","addOnPostRun","cb","runDependencies","dependenciesFulfilled","addRunDependency","removeRunDependency","memoryInitializer","dataURIPrefix","isDataURI","startsWith","ASM_CONSTS","$0","trapOnInstructionFetch","busRead32","$1","busWrite32","busRead16","trapOnBx32","busWrite16","_emscripten_asm_const_iii","a0","a1","_emscripten_asm_const_ii","tempDoublePtr","demangle","demangleAll","jsStackTrace","stackTrace","js","SYSCALLS","buffers","printChar","stream","curr","varargs","getStr","get64","low","getZero","___syscall140","which","getStreamFromFD","FS","ErrnoError","errno","___syscall6","flush_NO_FILESYSTEM","fflush","_fd_write","iov","iovcnt","pnum","___wasi_fd_write","_emscripten_get_heap_size","_exit","exit","_emscripten_memcpy_big","dest","___setErrNo","abortOnCannotGrowMemory","requestedSize","_emscripten_resize_heap","chr","atob","input","chr1","chr2","chr3","enc2","enc3","enc4","keyStr","intArrayFromBase64","calledRun","asmGlobalArg","asmLibraryArg","asm","imul","clz32","A","B","D","E","F","G","H","I","J","K","M","N","O","V","W","Y","Z","$","fa","aa","ba","ca","va","da","ea","Na","oa","Za","ga","la","ja","ha","ia","ka","ma","na","qa","ta","pa","ra","sa","_a","ua","wa","za","xa","La","Ha","Ba","Ma","Ga","Ya","Sa","Wa","Ra","Ta","$a","ya","Aa","Ca","Da","Fa","R","Ea","Ia","U","Xa","Ja","Ka","Oa","ab","Pa","Qa","Ua","Va","bb","Q","db","eb","T","fb","gb","hb","ib","jb","kb","___errno_location","___muldi3","___udivdi3","_abort_run","_bitshift64Lshr","_bitshift64Shl","_enable_debug","_free","_i64Add","_i64Subtract","_llvm_bswap_i32","_malloc","_memcpy","_memset","_ping","_read_register","_reset","_run","_sbrk","_set_stop_address","_write_register","dynCall_ii","dynCall_iidiiii","dynCall_iiii","dynCall_iiiii","dynCall_vii","establishStackSpace","applyMemoryInitializer","doBrowserLoad","memoryInitializerBytes","useRequest","request","addEventListener","ExitStatus","doRun","implicit","what","runCaller","Thumbulator","_module","_options","tslib_1","stopAddress","nativeThumbulator","_getApi","enableDebug","ping","enable","readRegister","register","writeRegister","printer","read16","read32","write16","write32","encodeWithPrefix","signed","prefix","toUpperCase","encode","Soc","blx32Handler","_triggerTrap","hex","addr","getRom16","getRam16","_armMamcr","getRom32","getRam32","setRam16","setRam32","buffer8","hostIsLittleEndian","_rom8","_ram8","_rom16","_rom32","_ram16","_ram32","_romBuffer","_ramBuffer","_thumbulator","_thumbulatorBus","CartridgeDPCPlus","HarmonySoc","_soc","getRom","getRam","_imageRam","_fractionalFetchers","FractionalFetcher","_musicFetchers","MusicFetcher","_parameters","_parameterIndex","_fastFetch","_ldaPending","readResult","fractionalFetcher","_advanceRng","_rewindRng","acc","waveform","waveformSample","increment","setPointerLo","setPointerHi","setFraction","top","bottom","_dispatchFunction","decrement","romBase","fraction","CartridgeCDF","thumbulator","getThumbulator","r2","r3","_musicStreams","waveformSize","getVersion","_jumpstreamMask","_amplitudeStream","_datastreamBase","_datastreamIncrementBase","_waveformBase","_handleBxCDF0","_handleBxCDF1","_displayRam","MusicStream","sig","startAddress","cartridgeUtil.searchForSignature","_digitalAudio","_fastJumpCountdown","_fastFetchPending","_jmpOperandAddress","_ldaOperandAddress","romValue","_datastreamReadWithIncrement","_jumpstream","_clockMusicStreams","sampleAddress","sample","_getWaveform","_datastreamRead","_datastreamWriteWithIncrement","_getDatastreamPointer","_setDatastreamPointer","_getDatastreamIncrement","Cartridge8040","CartridgePP","_switchLayout","_bankSwitchPending","_segments","_previousAddressBusValue","_pendingBank","_configureSegments","zero","one","two","three","CartridgeDetector","_detect2k","_detect8k","_detect16k","_detect29k","_detect32k","_detect64k","matchesBuffer","f8Matches","CartridgeE7","CartridgeFactory","_createCartridge","detectCartridgeType","Cartidge8040","CartdridgeCDF","AsyncIO","getBus","_onReset","_onWrite","_onRead","_bufferOut","_indexBufferOut","_indexBufferIn","_bufferIn","setDataBusValue","PeriodicScheduler","_period","worker","terminate","eval","useNative","test","userAgent","nextId","lock","TASKS","wrap","clear","handleId","task","polifill","usePolifill","canUse","setTimeoutPolifill","freeze","init$1","canUse$1","nextTickPolifill","init$2","messagePrefix","onGlobalMessage","source","attachEvent","canUse$2","asynch","oldOnMessage","postMessagePolifill","init$3","channel","MessageChannel","port1","port2","canUse$3","messageChannelPolifill","init$4","html","documentElement","script","createElement","onreadystatechange","removeChild","appendChild","canUse$4","readyStateChangePolifill","POLIFILLS","setImmediate","msSetImmediate","clearImmediate","msClearImmediate","def","_polifill","polyfill.setImmediate","ImmediateScheduler","getTimestamp","ConstantTimesliceScheduler","timeSlice","running","timestampStart","emulationTime","MAX_ACCUMULATED_DELTA","ConstantCyclesScheduler","targetSleepInterval","lastYieldTimestamp","accumulatedDelta","timestamp0","timeToSleep","strategy","BusyWaitScheduler","ClockProbe","_scheduler","_clock","detach","_clockHandler","_measurementTask","_updateMeasurement","probe","frequencyUpdate","ctx","Semaphore","_maxConcurrency","acquire","locked","isLocked","ticket","runExclusive","_b","_currentReleaser","nextConsumer","released","Mutex","_semaphore","EmulationService","stopped","SchedulerFactory","_clockProbe","_updateScheduler","_mutex","_limitingStrategy","createCartridge","_trapHandler","asyncIO","_context","attach","_setError","getTimer","suspend","_tryToResume","_lastError","getFrequency","_enforceRateLimit","enforce","emulationError","_schedulerFactory","createLimitingScheduler","createImmediateScheduler","DriverManager","Map","emulationService","_driversBound","_emulationService","_shouldBindDrivers","_bindDrivers","_onEmuStateChange","_unbindDrivers","driver","binder","_drivers","DriverContext","getEmulationContext","unbind","delete","getState","driverContext","RPC_TYPE","emulationPause","emulationReset","emulationResume","emulationSetRateLimit","emulationStart","emulationStop","emulationFetchLastError","getVideoParameters","getWaveformAudioParameters","getPCMAudioParameters","setup","SIGNAL_TYPE","emulationFrequencyUpdate","videoNewFrame","videoReturnSurface","controlStateUpdate","waveformAudioVolumeChange","waveformAudioBufferChange","pcmAudioNewFrame","pcmAudioTogglePause","pcmAudioReturnFrame","audioStop","messageFromAsyncIO","messageToAsyncIO","VideoDriver","_rpc","_onReturnSurfaceFromHost","_onGetVideoParameters","video","_bind","_unbind","_managedSurfaces","getUnderlyingBuffer","_ids","_surfacePool","_managedSurfacesById","managedSurface","_nextId","ControlDriver","_onControlStateUpdate","emulationContext","_emulationContext","controlState","_applyJoystickState","joystickState","getJoystick","_applyPaddleState","paddleState","_applyControlPanelState","controlPanelState","joystick","down","left","right","fire","paddle","setValue","panel","difficulty0","difficulty1","select","WaveformAudioDriver","_index","_onGetWaveformAudioParameters","audio","_onBufferChanged","_onVolumeChanged","_onStop","volume","getVolume","PCMAudioDriver","_onGetPCMAudioParameters","_onReturnFrame","_signalNewFrame","_signalTogglePause","endpoint","_endpoint","_onTogglePause","_pendingFrames","frame","_paused","frameSize","msg","adopt","io","_io","_onAsyncIOMessage","EmulationBackend","_service","driverManager","videoDriver","controlDriver","waveformAduioDrivers","pcmAudioDriver","asyncIODriver","AsyncIODriver","_onSetup","_onFetchLastError","_onEmulationPause","_onEmulationReset","_onEmulationResume","_onEmulationSetRateLimit","_onEmulationStart","_onEmulationStop","_onFrequencyUpdate","_onEmulationError","_videoDriver","addDriver","getRawVideo","getAsyncIO","lastError","getLastError","pause","setRateLimit","startup"],"mappings":"qgBACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtD,IAAIC,EAAY,GAWhB,SAASC,EAAWC,GAGhB,OAFKF,EAAUE,KACXF,EAAUE,GAGlB,SAAwBA,GAGpB,IAFA,IAAIC,EAAM,6BAA+BD,EAAe,gBACpDE,EAAe,GAAIC,EAAe,GAC7BC,EAAI,EAAGA,EAAIJ,EAAcI,IAC9BF,EAAaG,KAAK,KAAOD,GACzBD,EAAaE,KAAK,MAAQD,GAC1BH,GAAO,SAAWG,EAAI,gBAAkBA,EAAI,OAGhD,OADAH,GAAO,KACA,IAAKK,SAASC,KAAKC,MAAMF,SAAU,MAAC,GAAQG,OAAOP,EAAaO,OAAON,GAAe,CAACF,MAZhES,CAAeV,IACtCF,EAAUE,GAbrBF,EAAU,GAAK,WACX,OAAO,cAEXA,EAAU,GAAK,SAAUa,EAAUC,GAC/B,YAAyB,MACdD,EACJ,SAAqBE,GACxBF,EAASE,EAASD,KAmB1B,IAAIE,EAAuB,WACvB,SAASA,IACLC,KAAKC,aAAc,EACnBD,KAAKE,UAAY,GACjBF,KAAKG,UAAY,GACjBH,KAAKI,oBAuCT,OArCAL,EAAMM,UAAUC,WAAa,SAAUC,EAASV,GAO5C,OANKG,KAAKQ,kBAAkBD,EAASV,KACjCG,KA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,KACvB,MAAM,IAAI1xB,MAAM,wBAGpBrD,KAAK01B,UAAU11B,KAAKk1B,WAAa9mB,EACjCpO,KAAK21B,OAAO31B,KAAKk1B,WAAap2B,EAE9BkB,KAAKk1B,YAGTjtB,OAAOmG,GACH,IAAI/O,EAEJ,IAAKA,EAAI,EAAGA,EAAIW,KAAKk1B,WACbl1B,KAAK01B,UAAUr2B,KAAO+O,EADE/O,KAM5BA,EAAIW,KAAKk1B,YACTl1B,KAAK01B,UAAUr2B,GAAKW,KAAK01B,UAAU11B,KAAKk1B,UAAY,GACpDl1B,KAAK21B,OAAOt2B,GAAKW,KAAK21B,OAAO31B,KAAKk1B,UAAY,GAC9Cl1B,KAAKk1B,cChFV,MAAMU,GAAO,IAAI5rB,YAAY,CAChC,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,aAGS6rB,GAAM,IAAI7rB,YAAY,CAC/B,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,aAGS8rB,GAAQ,IAAI9rB,YAAY,CACjC,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,aC1TJ,MAAM+rB,GACF9tB,YACY0hB,EACRqM,EACAC,EACAC,GAHQl2B,aAAA2pB,EA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