mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-18 03:05:35 +00:00
8 lines
318 KiB
Plaintext
8 lines
318 KiB
Plaintext
|
{
|
||
|
"version": 3,
|
||
|
"sources": ["../jsnes/src/controller.js", "../jsnes/src/utils.js", "../jsnes/src/cpu.js", "../jsnes/src/tile.js", "../jsnes/src/ppu.js", "../jsnes/src/papu.js", "../jsnes/src/mappers.js", "../jsnes/src/rom.js", "../jsnes/src/nes.js", "../jsnes/src/index.js", "../src/platform/nes.ts"],
|
||
|
"sourcesContent": ["var Controller = function() {\n this.state = new Array(8);\n for (var i = 0; i < this.state.length; i++) {\n this.state[i] = 0x40;\n }\n};\n\nController.BUTTON_A = 0;\nController.BUTTON_B = 1;\nController.BUTTON_SELECT = 2;\nController.BUTTON_START = 3;\nController.BUTTON_UP = 4;\nController.BUTTON_DOWN = 5;\nController.BUTTON_LEFT = 6;\nController.BUTTON_RIGHT = 7;\n\nController.prototype = {\n buttonDown: function(key) {\n this.state[key] = 0x41;\n },\n\n buttonUp: function(key) {\n this.state[key] = 0x40;\n }\n};\n\nmodule.exports = Controller;\n", "module.exports = {\n copyArrayElements: function(src, srcPos, dest, destPos, length) {\n for (var i = 0; i < length; ++i) {\n dest[destPos + i] = src[srcPos + i];\n }\n },\n\n copyArray: function(src) {\n return src.slice(0);\n },\n\n fromJSON: function(obj, state) {\n for (var i = 0; i < obj.JSON_PROPERTIES.length; i++) {\n var key = obj.JSON_PROPERTIES[i];\n if (obj[key] !== null && obj[key].buffer && obj[key].set)\n obj[key].set(state[key]); // set array elements\n else\n obj[key] = state[key]; // replace\n }\n },\n\n toJSON: function(obj) {\n var state = {};\n for (var i = 0; i < obj.JSON_PROPERTIES.length; i++) {\n var key = obj.JSON_PROPERTIES[i];\n state[key] = obj[key];\n }\n return state;\n }\n};\n", "var utils = require(\"./utils\");\n\nvar CPU = function(nes) {\n this.nes = nes;\n\n // Keep Chrome happy\n this.mem = null;\n this.REG_ACC = null;\n this.REG_X = null;\n this.REG_Y = null;\n this.REG_SP = null;\n this.REG_PC = null;\n this.REG_PC_NEW = null;\n this.REG_STATUS = null;\n this.F_CARRY = null;\n this.F_DECIMAL = null;\n this.F_INTERRUPT = null;\n this.F_INTERRUPT_NEW = null;\n this.F_OVERFLOW = null;\n this.F_SIGN = null;\n this.F_ZERO = null;\n this.F_NOTUSED = null;\n this.F_NOTUSED_NEW = null;\n this.F_BRK = null;\n this.F_BRK_NEW = null;\n this.opdata = null;\n this.cyclesToHalt = null;\n this.crash = null;\n this.irqRequested = null;\n this.irqType = null;\n\n this.reset();\n};\n\nCPU.prototype = {\n // IRQ Types\n IRQ_NORMAL: 0,\n IRQ_NMI: 1,\n IRQ_RESET: 2,\n\n reset: function() {\n // Main memory\n this.mem = new Uint8Array(0x10000);\n\n for (var i = 0; i < 0x2000; i++) {\n this.mem[i] = 0xff;\n }\n for (var p = 0; p < 4; p++) {\n var j = p * 0x800;\n this.mem[j + 0x008] = 0xf7;\n this.mem[j + 0x009] = 0xef;\n this.mem[j + 0x00a] = 0xdf;\n this.mem[j + 0x00f] = 0xbf;\n }\n for (var k = 0x2001; k < this.mem.length; k++) {\n this.mem[k] = 0;\n }\n\n // CPU Registers:\n this.REG_ACC = 0;\n this.REG_X = 0;\n this.REG_Y = 0;\n // Reset Stack pointer:\n this.REG_SP = 0x01ff;\n // Reset Program counter:\n this.REG_PC = 0x8000 - 1;\n this.REG_PC_NEW = 0x8000 - 1;\n // Reset Status register:\n this.REG_STATUS = 0x28;\n\n this.setStatus(0x28);\n\n // Set flags:\n this.F_CARRY = 0;\n this.F_DECIMAL = 0;\n this.F_INTERRUPT = 1;\n this.F_INTERRUPT_NEW = 1;\n this.F_OVERFLOW = 0;\n this.F_SIGN = 0;\n this.F_ZERO = 1;\n\n this.F_NOTUSED = 1;\n this.F_NOTUSED_NEW = 1;\n this.F_BRK = 1;\n this.F_BRK_NEW = 1;\n\n this.opdata = new OpData().opdata;\n this.cyclesToHalt = 0;\n\n // Reset crash flag:\n this.crash = false;\n\n // Interrupt notification:\n this.irqRequested = false;\n this.irqType = null;\n },\n\n // Emulates a single CPU instruction, returns the number of cycles\n emulate: function() {\n var temp;\n var add;\n\n // Check interrupts:\n if (this.irqRequested) {\n temp =\n this.F_CARRY |\n ((this.F_ZERO === 0 ? 1 : 0) << 1) |\n (this.F_INTERRUPT << 2) |\n (this.F_DECIMAL << 3) |\n (this.F_BRK << 4) |\n (this.F_NOTUSED << 5) |\n (this.F_OVERFLOW << 6) |\n (this.F_SIGN << 7);\n\n this.REG_PC_NEW = this.REG_PC;\n this.F_INTERRUPT_NEW = this.F_INTERRUPT;\n switch (this.irq
|
||
|
"mappings": "oXAAA,oBAAI,GAAa,UAAW,CAC1B,KAAK,MAAQ,GAAI,OAAM,GACvB,OAAS,GAAI,EAAG,EAAI,KAAK,MAAM,OAAQ,IACrC,KAAK,MAAM,GAAK,IAIpB,EAAW,SAAW,EACtB,EAAW,SAAW,EACtB,EAAW,cAAgB,EAC3B,EAAW,aAAe,EAC1B,EAAW,UAAY,EACvB,EAAW,YAAc,EACzB,EAAW,YAAc,EACzB,EAAW,aAAe,EAE1B,EAAW,UAAY,CACrB,WAAY,SAAS,EAAK,CACxB,KAAK,MAAM,GAAO,IAGpB,SAAU,SAAS,EAAK,CACtB,KAAK,MAAM,GAAO,KAItB,EAAO,QAAU,IC1BjB,mBAAO,QAAU,CACf,kBAAmB,SAAS,EAAK,EAAQ,EAAM,EAAS,EAAQ,CAC9D,OAAS,GAAI,EAAG,EAAI,EAAQ,EAAE,EAC5B,EAAK,EAAU,GAAK,EAAI,EAAS,IAIrC,UAAW,SAAS,EAAK,CACvB,MAAO,GAAI,MAAM,IAGnB,SAAU,SAAS,EAAK,EAAO,CAC7B,OAAS,GAAI,EAAG,EAAI,EAAI,gBAAgB,OAAQ,IAAK,CACnD,GAAI,GAAM,EAAI,gBAAgB,GAC9B,AAAI,EAAI,KAAS,MAAQ,EAAI,GAAK,QAAU,EAAI,GAAK,IACnD,EAAI,G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