1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-18 03:05:35 +00:00
8bitworkshop/gen/apple2-VEFTRPFL.js.map

8 lines
83 KiB
Plaintext

{
"version": 3,
"sources": ["../src/machine/apple2.ts", "../src/platform/apple2.ts"],
"sourcesContent": ["\nimport { MOS6502, MOS6502State } from \"../common/cpu/MOS6502\";\nimport { Bus, BasicScanlineMachine, SavesState, AcceptsBIOS } from \"../common/devices\";\nimport { KeyFlags } from \"../common/emu\"; // TODO\nimport { hex, lzgmini, stringToByteArray, RGBA, printFlags } from \"../common/util\";\n\n// TODO: read prodos/ca65 header?\nconst VM_BASE = 0x803; // where to JMP after pr#6\nconst LOAD_BASE = VM_BASE;\nconst PGM_BASE = VM_BASE;\nconst HDR_SIZE = PGM_BASE - LOAD_BASE;\n\ninterface AppleIIStateBase {\n ram : Uint8Array;\n soundstate : number;\n auxRAMselected,writeinhibit : boolean;\n auxRAMbank : number;\n}\n\ninterface AppleIIControlsState {\n inputs : Uint8Array; // unused?\n kbdlatch : number;\n}\n\ninterface AppleIIState extends AppleIIStateBase, AppleIIControlsState {\n c : MOS6502State;\n grswitch : number;\n slots: SlotDevice[];\n}\n\ninterface SlotDevice extends Bus {\n readROM(address: number) : number;\n readConst(address: number) : number;\n}\n\nexport class AppleII extends BasicScanlineMachine implements AcceptsBIOS {\n\n // approx: http://www.cs.columbia.edu/~sedwards/apple2fpga/\n cpuFrequency = 1022727;\n sampleRate = this.cpuFrequency;\n cpuCyclesPerLine = 65;\n cpuCyclesPerFrame = this.cpuCyclesPerLine * 262;\n canvasWidth = 280;\n numVisibleScanlines = 192;\n numTotalScanlines = 262;\n defaultROMSize = 0xbf00-0x803; // TODO\n\n ram = new Uint8Array(0x13000); // 64K + 16K LC RAM - 4K hardware + 12K ROM\n bios : Uint8Array;\n cpu = new MOS6502();\n grdirty = new Array(0xc000 >> 7);\n grparams = {dirty:this.grdirty, grswitch:GR_TXMODE, mem:this.ram};\n ap2disp;\n kbdlatch = 0;\n soundstate = 0;\n // language card switches\n auxRAMselected = false;\n auxRAMbank = 1;\n writeinhibit = true;\n // value to add when reading & writing each of these banks\n // bank 1 is E000-FFFF, bank 2 is D000-DFFF\n bank2rdoffset=0;\n bank2wroffset=0;\n // disk II\n slots : SlotDevice[] = new Array(8);\n // fake disk drive that loads program into RAM\n fakeDrive : SlotDevice = {\n readROM: (a) => {\n var pc = this.cpu.getPC();\n if (pc >= 0xC600 && pc < 0xC700) {\n // We're reading code to EXECUTE.\n // Load the built program directly into memory, and \"read\"\n // a JMP directly to it.\n //console.log(`fakeDrive (EXEC): ${a.toString(16)}`);\n switch (a) {\n // JMP VM_BASE\n case 0:\n // SHOULD load program into RAM here, but have to do it\n // below instead.\n return 0;\n case 1: return VM_BASE&0xff;\n case 2: return (VM_BASE>>8)&0xff;\n default: return 0;\n }\n }\n else {\n // We're reading code, but not executing it.\n // This is probably the Monitor routine to identify whether\n // this slot is a Disk ][ drive, so... give it what it wants.\n //console.log(`fakeDrive (NOEX): ${a.toString(16)}`);\n switch (a) {\n case 0:\n // Actually, if we get here, we probably ARE being\n // executed. For some reason, the instruction at $C600\n // gets read for execution, BEFORE the PC gets set to\n // the correct location. So we handle loading the program\n // into RAM and returning the JMP here, instead of above\n // where it would otherwise belong.\n if (this.rom) {\n console.log(`Loading program into Apple ][ RAM at \\$${PGM_BASE.toString(16)}`);\n this.ram.set(this.rom.slice(HDR_SIZE), PGM_BASE);\n }\n return 0x4c; // JMP\n case 1: return 0x20;\n case 3: return 0x00;\n case 5: return 0x03;\n case 7: return 0x3c;\n default: return 0;\n }\n }\n },\n readConst: (a) => {\n return 0;\n },\n read: (a) => { return this.floatbus(); },\n write: (a,v) => { }\n };\n\n constructor() {\n super();\n this.loadBIOS(new lzgmini().decode(stringToByteArray(atob(APPLEIIGO_LZG))));\n this.connectCPUMemoryBus(this);\n // This line is inappropriate for real ROMs, but was there for\n // the APPLE][GO ROM, so keeping it only in the constructor, for\n // that special case (in case it really is important for this\n // address to be an RTS).\n this.bios[0xD39A - (0x10000 - this.bios.length)] = 0x60; // $d39a = RTS\n }\n saveState() : AppleIIState {\n // TODO: automagic\n return {\n c: this.cpu.saveState(),\n ram: this.ram.slice(),\n kbdlatch: this.kbdlatch,\n soundstate: this.soundstate,\n grswitch: this.grparams.grswitch,\n auxRAMselected: this.auxRAMselected,\n auxRAMbank: this.auxRAMbank,\n writeinhibit: this.writeinhibit,\n slots: this.slots.map((slot) => { return slot && slot['saveState'] && slot['saveState']() }),\n inputs: null\n };\n }\n loadState(s:AppleIIState) {\n this.cpu.loadState(s.c);\n this.ram.set(s.ram);\n this.kbdlatch = s.kbdlatch;\n this.soundstate = s.soundstate;\n this.grparams.grswitch = s.grswitch;\n this.auxRAMselected = s.auxRAMselected;\n this.auxRAMbank = s.auxRAMbank;\n this.writeinhibit = s.writeinhibit;\n this.setupLanguageCardConstants();\n for (var i=0; i<this.slots.length; i++)\n if (this.slots[i] && this.slots[i]['loadState'])\n this.slots[i]['loadState'](s.slots[i]);\n this.ap2disp.invalidate(); // repaint entire screen\n }\n saveControlsState() : AppleIIControlsState {\n return {inputs:null,kbdlatch:this.kbdlatch};\n }\n loadControlsState(s:AppleIIControlsState) {\n this.kbdlatch = s.kbdlatch;\n }\n loadBIOS(data, title?) {\n if (data.length != 0x3000) {\n console.log(`apple2 loadBIOS !!!WARNING!!!: BIOS wants length 0x3000, but BIOS '${title}' has length 0x${data.length.toString(16)}`);\n console.log(\"will load BIOS to end of memory anyway...\");\n }\n this.bios = Uint8Array.from(data);\n this.ram.set(this.bios, 0x10000 - this.bios.length);\n this.ram[0xbf00] = 0x4c; // fake DOS detect for C\n this.ram[0xbf6f] = 0x01; // fake DOS detect for C\n }\n loadROM(data) {\n if (data.length == 35*16*256) { // is it a disk image?\n var diskii = new DiskII(this, data);\n this.slots[6] = diskii;\n } else { // it's a binary, use a fake drive\n super.loadROM(data);\n this.slots[6] = this.fakeDrive;\n }\n }\n reset() {\n super.reset();\n this.auxRAMselected = false;\n this.auxRAMbank = 1;\n this.writeinhibit = true;\n this.ram.fill(0, 0x300, 0x400); // Clear soft-reset vector\n // (force hard reset)\n this.skipboot();\n }\n skipboot() {\n // execute until $c600 boot\n for (var i=0; i<2000000; i++) {\n this.cpu.advanceClock();\n if ((this.cpu.getPC()>>8) == 0xc6) break;\n }\n // get out of $c600 boot\n for (var i=0; i<2000000; i++) {\n this.cpu.advanceClock();\n if ((this.cpu.getPC()>>8) < 0xc6) break;\n }\n }\n readConst(address: number): number {\n if (address < 0xc000) {\n return this.ram[address];\n } else if (address >= 0xd000) {\n if (!this.auxRAMselected)\n return this.bios[address - (0x10000 - this.bios.length)];\n else if (address >= 0xe000)\n return this.ram[address];\n else\n return this.ram[address + this.bank2rdoffset];\n } else if (address >= 0xc100 && address < 0xc800) {\n var slot = (address >> 8) & 7;\n return (this.slots[slot] && this.slots[slot].readConst(address & 0xff)) | 0;\n } else {\n return 0;\n }\n }\n read(address:number) : number {\n address &= 0xffff;\n if (address < 0xc000 || address >= 0xd000) {\n return this.readConst(address);\n } else if (address < 0xc100) {\n var slot = (address >> 4) & 0x0f;\n switch (slot)\n {\n case 0:\n return this.kbdlatch;\n case 1:\n this.kbdlatch &= 0x7f;\n break;\n case 3:\n this.soundstate = this.soundstate ^ 1;\n break;\n case 5:\n if ((address & 0x0f) < 8) {\n // graphics\n if ((address & 1) != 0)\n this.grparams.grswitch |= 1 << ((address >> 1) & 0x07);\n else\n this.grparams.grswitch &= ~(1 << ((address >> 1) & 0x07));\n }\n break;\n case 6:\n // tapein, joystick, buttons\n switch (address & 7) {\n // buttons (off)\n case 1:\n case 2:\n case 3:\n return this.floatbus() & 0x7f;\n // joystick\n case 4:\n case 5:\n return this.floatbus() | 0x80;\n default:\n return this.floatbus();\n }\n case 7:\n // joy reset\n if (address == 0xc070)\n return this.floatbus() | 0x80;\n case 8:\n return this.doLanguageCardIO(address);\n case 9: case 10: case 11: case 12: case 13: case 14: case 15:\n return (this.slots[slot-8] && this.slots[slot-8].read(address & 0xf)) | 0;\n }\n } else if (address >= 0xc100 && address < 0xc800) {\n var slot = (address >> 8) & 7;\n return (this.slots[slot] && this.slots[slot].readROM(address & 0xff)) | 0;\n }\n return this.floatbus();\n }\n write(address:number, val:number) : void {\n address &= 0xffff;\n val &= 0xff;\n if (address < 0xc000) {\n this.ram[address] = val;\n this.grdirty[address>>7] = 1;\n } else if (address < 0xc080) {\n this.read(address); // strobe address, discard result\n } else if (address < 0xc100) {\n var slot = (address >> 4) & 0x0f;\n this.slots[slot-8] && this.slots[slot-8].write(address & 0xf, val);\n } else if (address >= 0xd000 && !this.writeinhibit) {\n if (address >= 0xe000)\n this.ram[address] = val;\n else\n this.ram[address + this.bank2wroffset] = val;\n }\n }\n // http://www.deater.net/weave/vmwprod/megademo/vapor_lock.html\n // https://retrocomputing.stackexchange.com/questions/14012/what-is-dram-refresh-and-why-is-the-weird-apple-ii-video-memory-layout-affected\n // http://www.apple-iigs.info/doc/fichiers/TheappleIIcircuitdescription1.pdf\n // http://rich12345.tripod.com/aiivideo/softalk.html\n // https://github.com/MiSTer-devel/Apple-II_MiSTer/blob/master/rtl/timing_generator.vhd\n floatbus() : number {\n var fcyc = this.frameCycles;\n var yline = Math.floor(fcyc / 65);\n var xcyc = Math.floor(fcyc % 65);\n var addr = this.ap2disp.getAddressForScanline(yline);\n return this.readConst(addr + xcyc);\n }\n\n connectVideo(pixels:Uint32Array) {\n super.connectVideo(pixels);\n this.ap2disp = this.pixels && new Apple2Display(this.pixels, this.grparams);\n }\n startScanline() {\n }\n drawScanline() {\n // TODO: draw scanline via ap2disp\n }\n advanceFrame(trap) : number {\n var clocks = super.advanceFrame(trap);\n this.ap2disp && this.ap2disp.updateScreen();\n return clocks;\n }\n advanceCPU() {\n this.audio.feedSample(this.soundstate, 1);\n return super.advanceCPU();\n }\n\n setKeyInput(key:number, code:number, flags:number) : void {\n if (flags & KeyFlags.KeyDown) {\n code = 0;\n switch (key) {\n case 16: case 17: case 18:\n break; // ignore shift/ctrl/etc\n case 8:\n code=8; // left\n if (flags & KeyFlags.Shift) {\n // (possibly) soft reset\n this.cpu.reset();\n return;\n }\n break;\n case 13: code=13; break; // return\n case 27: code=27; break; // escape\n case 37: code=8; break; // left\n case 39: code=21; break; // right\n case 38: code=11; break; // up\n case 40: code=10; break; // down\n default:\n code = key;\n // convert to uppercase for Apple ][\n if (code >= 0x61 && code <= 0x7a) code -= 32;\n if (code >= 32) {\n if (code >= 65 && code < 65+26) {\n if (flags & KeyFlags.Ctrl)\n code -= 64; // ctrl\n }\n }\n }\n if (code) {\n this.kbdlatch = (code | 0x80) & 0xff;\n }\n }\n }\n \n doLanguageCardIO(address:number) {\n switch (address & 0x0f) {\n // Select aux RAM bank 2, write protected.\n case 0x0:\n case 0x4:\n this.auxRAMselected = true;\n this.auxRAMbank = 2;\n this.writeinhibit = true;\n break;\n // Select ROM, write enable aux RAM bank 2.\n case 0x1:\n case 0x5:\n this.auxRAMselected = false;\n this.auxRAMbank = 2;\n this.writeinhibit = false;\n break;\n // Select ROM, write protect aux RAM (either bank).\n case 0x2:\n case 0x6:\n case 0xA:\n case 0xE:\n this.auxRAMselected = false;\n this.writeinhibit = true;\n break;\n // Select aux RAM bank 2, write enabled.\n case 0x3:\n case 0x7:\n this.auxRAMselected = true;\n this.auxRAMbank = 2;\n this.writeinhibit = false;\n break;\n // Select aux RAM bank 1, write protected.\n case 0x8:\n case 0xC:\n this.auxRAMselected = true;\n this.auxRAMbank = 1;\n this.writeinhibit = true;\n break;\n // Select ROM, write enable aux RAM bank 1.\n case 0x9:\n case 0xD:\n this.auxRAMselected = false;\n this.auxRAMbank = 1;\n this.writeinhibit = false;\n break;\n // Select aux RAM bank 1, write enabled.\n case 0xB:\n case 0xF:\n this.auxRAMselected = true;\n this.auxRAMbank = 1;\n this.writeinhibit = false;\n break;\n }\n this.setupLanguageCardConstants();\n return this.floatbus();\n }\n\n setupLanguageCardConstants() {\n // reset language card constants\n if (this.auxRAMbank == 2)\n this.bank2rdoffset = -0x1000; // map 0xd000-0xdfff -> 0xc000-0xcfff\n else\n this.bank2rdoffset = 0x3000; // map 0xd000-0xdfff -> 0x10000-0x10fff\n if (this.auxRAMbank == 2)\n this.bank2wroffset = -0x1000; // map 0xd000-0xdfff -> 0xc000-0xcfff\n else\n this.bank2wroffset = 0x3000; // map 0xd000-0xdfff -> 0x10000-0x10fff\n }\n\n getDebugCategories() {\n return ['CPU','Stack','I/O','Disk'];\n }\n getDebugInfo(category:string, state:AppleIIState) {\n switch (category) {\n case 'I/O': return \"AUX RAM Bank: \" + state.auxRAMbank + \n \"\\nAUX RAM Select: \" + state.auxRAMselected +\n \"\\nAUX RAM Write: \" + !state.writeinhibit +\n \"\\n\\nGR Switches: \" + printFlags(state.grswitch, [\"Graphics\",\"Mixed\",\"Page2\",\"Hires\"], false) +\n \"\\n\";\n case 'Disk': return (this.slots[6] && this.slots[6]['toLongString'] && this.slots[6]['toLongString']()) || \"\\n\";\n }\n }\n}\n\nconst GR_TXMODE = 1;\nconst GR_MIXMODE = 2;\nconst GR_PAGE1 = 4;\nconst GR_HIRES = 8;\n\ntype AppleGRParams = {dirty:boolean[], grswitch:number, mem:Uint8Array};\n\nvar Apple2Display = function(pixels : Uint32Array, apple : AppleGRParams) {\n var XSIZE = 280;\n var YSIZE = 192;\n var PIXELON = 0xffffffff;\n var PIXELOFF = 0xff000000;\n\n var oldgrmode = -1;\n var textbuf = new Array(40*24);\n\n const flashInterval = 500;\n\n // https://mrob.com/pub/xapple2/colors.html\n const loresColor = [\n RGBA(0, 0, 0),\n RGBA(227, 30, 96),\n RGBA(96, 78, 189),\n RGBA(255, 68, 253),\n RGBA(0, 163, 96),\n RGBA(156, 156, 156),\n RGBA(20, 207, 253),\n RGBA(208, 195, 255),\n RGBA(96, 114, 3),\n RGBA(255, 106, 60),\n RGBA(156, 156, 156),\n RGBA(255, 160, 208),\n RGBA(20, 245, 60),\n RGBA(208, 221, 141),\n RGBA(114, 255, 208),\n RGBA(255, 255, 255)\n ];\n\n const text_lut = [\n 0x000, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380,\n 0x028, 0x0a8, 0x128, 0x1a8, 0x228, 0x2a8, 0x328, 0x3a8,\n 0x050, 0x0d0, 0x150, 0x1d0, 0x250, 0x2d0, 0x350, 0x3d0\n ];\n\n const hires_lut = [\n 0x0000, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00,\n 0x0080, 0x0480, 0x0880, 0x0c80, 0x1080, 0x1480, 0x1880, 0x1c80,\n 0x0100, 0x0500, 0x0900, 0x0d00, 0x1100, 0x1500, 0x1900, 0x1d00,\n 0x0180, 0x0580, 0x0980, 0x0d80, 0x1180, 0x1580, 0x1980, 0x1d80,\n 0x0200, 0x0600, 0x0a00, 0x0e00, 0x1200, 0x1600, 0x1a00, 0x1e00,\n 0x0280, 0x0680, 0x0a80, 0x0e80, 0x1280, 0x1680, 0x1a80, 0x1e80,\n 0x0300, 0x0700, 0x0b00, 0x0f00, 0x1300, 0x1700, 0x1b00, 0x1f00,\n 0x0380, 0x0780, 0x0b80, 0x0f80, 0x1380, 0x1780, 0x1b80, 0x1f80,\n 0x0028, 0x0428, 0x0828, 0x0c28, 0x1028, 0x1428, 0x1828, 0x1c28,\n 0x00a8, 0x04a8, 0x08a8, 0x0ca8, 0x10a8, 0x14a8, 0x18a8, 0x1ca8,\n 0x0128, 0x0528, 0x0928, 0x0d28, 0x1128, 0x1528, 0x1928, 0x1d28,\n 0x01a8, 0x05a8, 0x09a8, 0x0da8, 0x11a8, 0x15a8, 0x19a8, 0x1da8,\n 0x0228, 0x0628, 0x0a28, 0x0e28, 0x1228, 0x1628, 0x1a28, 0x1e28,\n 0x02a8, 0x06a8, 0x0aa8, 0x0ea8, 0x12a8, 0x16a8, 0x1aa8, 0x1ea8,\n 0x0328, 0x0728, 0x0b28, 0x0f28, 0x1328, 0x1728, 0x1b28, 0x1f28,\n 0x03a8, 0x07a8, 0x0ba8, 0x0fa8, 0x13a8, 0x17a8, 0x1ba8, 0x1fa8,\n 0x0050, 0x0450, 0x0850, 0x0c50, 0x1050, 0x1450, 0x1850, 0x1c50,\n 0x00d0, 0x04d0, 0x08d0, 0x0cd0, 0x10d0, 0x14d0, 0x18d0, 0x1cd0,\n 0x0150, 0x0550, 0x0950, 0x0d50, 0x1150, 0x1550, 0x1950, 0x1d50,\n 0x01d0, 0x05d0, 0x09d0, 0x0dd0, 0x11d0, 0x15d0, 0x19d0, 0x1dd0,\n 0x0250, 0x0650, 0x0a50, 0x0e50, 0x1250, 0x1650, 0x1a50, 0x1e50,\n 0x02d0, 0x06d0, 0x0ad0, 0x0ed0, 0x12d0, 0x16d0, 0x1ad0, 0x1ed0,\n 0x0350, 0x0750, 0x0b50, 0x0f50, 0x1350, 0x1750, 0x1b50, 0x1f50,\n 0x03d0, 0x07d0, 0x0bd0, 0x0fd0, 0x13d0, 0x17d0, 0x1bd0, 0x1fd0,\n // just for floating bus, y >= 192\n 0x0078, 0x0478, 0x0878, 0x0c78, 0x1078, 0x1478, 0x1878, 0x1c78,\n 0x00f8, 0x04f8, 0x08f8, 0x0cf8, 0x10f8, 0x14f8, 0x18f8, 0x1cf8,\n 0x0178, 0x0578, 0x0978, 0x0d78, 0x1178, 0x1578, 0x1978, 0x1d78, \n 0x01f8, 0x05f8, 0x09f8, 0x0df8, 0x11f8, 0x15f8, 0x19f8, 0x1df8, \n 0x0278, 0x0678, 0x0a78, 0x0e78, 0x1278, 0x1678, 0x1a78, 0x1e78, \n 0x02f8, 0x06f8, 0x0af8, 0x0ef8, 0x12f8, 0x16f8, 0x1af8, 0x1ef8, \n 0x0378, 0x0778, 0x0b78, 0x0f78, 0x1378, 0x1778, 0x1b78, 0x1f78, \n 0x03f8, 0x07f8, 0x0bf8, 0x0ff8, 0x13f8, 0x17f8, 0x1bf8, 0x1ff8, \n 0x0000, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400,\n ];\n\n var colors_lut;\n\n /**\n * This function makes the color lookup table for hires mode.\n * We make a table of 1024 * 2 * 7 entries.\n * Why? Because we assume each color byte has 10 bits\n * (8 real bits + 1 on each side) and we need different colors\n * for odd and even addresses (2) and each byte displays 7 pixels.\n */\n {\n colors_lut = new Array(256*4*2*7);\n var i,j;\n var c1,c2,c3 = 15;\n var base = 0;\n\n // go thru odd and even\n for (j=0; j<2; j++)\n {\n // go thru 1024 values\n for (var b1=0; b1<1024; b1++)\n {\n // see if the hi bit is set\n if ((b1 & 0x80) == 0)\n {\n c1 = 3; c2 = 12; // purple & green\n } else\n {\n c1 = 6; c2 = 9; // blue & orange\n }\n // make a value consisting of:\n // the 8th bit, then bits 0-7, then the 9th bit\n var b = ((b1 & 0x100) >> 8) | ((b1 & 0x7f) << 1) |\n ((b1 & 0x200) >> 1);\n // go through each pixel\n for (i=0; i<7; i++)\n {\n var c;\n // is this pixel lit?\n if (((2<<i)&b) != 0)\n {\n // are there pixels lit on both sides of this one?\n if (((7<<i)&b) == (7<<i))\n // yes, make it white\n c = 15;\n else\n // no, choose color based on odd/even byte\n // and odd/even pixel column\n c = ((((j ^ i) & 1) == 0) ? c1 : c2);\n } else\n {\n // are there pixels lit in the previous & next\n // column but none in this?\n if (((5<<i)&b) == (5<<i))\n // color this pixel\n c = ((((j ^ i) & 1) != 0) ? c1 : c2);\n else\n c = 0;\n }\n colors_lut[base] = loresColor[c];\n base++;\n }\n }\n }\n }\n\n function drawLoresChar(x, y, b)\n {\n var i,base,adr,c;\n base = (y<<3)*XSIZE + x*7; //(x<<2) + (x<<1) + x\n c = loresColor[b & 0x0f];\n for (i=0; i<4; i++)\n {\n pixels[base] =\n pixels[base+1] =\n pixels[base+2] =\n pixels[base+3] =\n pixels[base+4] =\n pixels[base+5] =\n pixels[base+6] = c;\n base += XSIZE;\n }\n c = loresColor[b >> 4];\n for (i=0; i<4; i++)\n {\n pixels[base] =\n pixels[base+1] =\n pixels[base+2] =\n pixels[base+3] =\n pixels[base+4] =\n pixels[base+5] =\n pixels[base+6] = c;\n base += XSIZE;\n }\n }\n\n function drawTextChar(x, y, b, invert)\n {\n var base = (y<<3)*XSIZE + x*7; // (x<<2) + (x<<1) + x\n var on,off;\n if (invert)\n {\n on = PIXELOFF;\n off = PIXELON;\n } else\n {\n on = PIXELON;\n off = PIXELOFF;\n }\n\n for (var yy=0; yy<8; yy++)\n {\n var chr = apple2_charset[(b<<3)+yy];\n pixels[base] = ((chr & 64) > 0)?on:off;\n pixels[base+1] = ((chr & 32) > 0)?on:off;\n pixels[base+2] = ((chr & 16) > 0)?on:off;\n pixels[base+3] = ((chr & 8) > 0)?on:off;\n pixels[base+4] = ((chr & 4) > 0)?on:off;\n pixels[base+5] = ((chr & 2) > 0)?on:off;\n pixels[base+6] = ((chr & 1) > 0)?on:off;\n base += XSIZE;\n }\n }\n\n this.getAddressForScanline = function(y:number) : number {\n var base = hires_lut[y];\n if ((apple.grswitch & GR_HIRES) && (y < 160 || !(apple.grswitch & GR_MIXMODE)))\n base = base | ((apple.grswitch & GR_PAGE1) ? 0x4000 : 0x2000);\n else\n base = (base & 0x3ff) | ((apple.grswitch & GR_PAGE1) ? 0x800 : 0x400);\n return base;\n }\n\n function drawHiresLines(y, maxy)\n {\n var yb = y*XSIZE;\n for (; y < maxy; y++)\n {\n var base = hires_lut[y] + (((apple.grswitch & GR_PAGE1) != 0) ? 0x4000 : 0x2000);\n if (!apple.dirty[base >> 7])\n {\n yb += XSIZE;\n continue;\n }\n var c1, c2;\n var b = 0;\n var b1 = apple.mem[base] & 0xff;\n for (var x1=0; x1<20; x1++)\n {\n var b2 = apple.mem[base+1] & 0xff;\n var b3 = apple.mem[base+2] & 0xff;\n var d1 = (((b&0x40)<<2) | b1 | b2<<9) & 0x3ff;\n for (var i=0; i<7; i++)\n pixels[yb+i] = colors_lut[d1*7+i];\n var d2 = (((b1&0x40)<<2) | b2 | b3<<9) & 0x3ff;\n for (var i=0; i<7; i++)\n pixels[yb+7+i] = colors_lut[d2*7+7168+i];\n yb += 14;\n base += 2;\n b = b2;\n b1 = b3;\n }\n }\n }\n\n function drawLoresLine(y)\n {\n // get the base address of this line\n var base = text_lut[y] +\n (((apple.grswitch & GR_PAGE1) != 0) ? 0x800 : 0x400);\n //\t\tif (!dirty[base >> 7])\n //\t\t return;\n for (var x=0; x<40; x++)\n {\n var b = apple.mem[base+x] & 0xff;\n // if the char. changed, draw it\n if (b != textbuf[y*40+x])\n {\n drawLoresChar(x, y, b);\n textbuf[y*40+x] = b;\n }\n }\n }\n\n function drawTextLine(y, flash)\n {\n // get the base address of this line\n var base = text_lut[y] +\n (((apple.grswitch & GR_PAGE1) != 0) ? 0x800 : 0x400);\n //\t\tif (!dirty[base >> 7])\n //\t\t return;\n for (var x=0; x<40; x++)\n {\n var b = apple.mem[base+x] & 0xff;\n var invert;\n // invert flash characters 1/2 of the time\n if (b >= 0x80)\n {\n invert = false;\n } else if (b >= 0x40)\n {\n invert = flash;\n if (flash)\n b -= 0x40;\n else\n b += 0x40;\n } else\n invert = true;\n // if the char. changed, draw it\n if (b != textbuf[y*40+x])\n {\n drawTextChar(x, y, b & 0x7f, invert);\n textbuf[y*40+x] = b;\n }\n }\n }\n\n this.updateScreen = function(totalrepaint)\n {\n var y;\n var flash = (new Date().getTime() % (flashInterval<<1)) > flashInterval;\n\n // if graphics mode changed, repaint whole screen\n if (apple.grswitch != oldgrmode)\n {\n oldgrmode = apple.grswitch;\n totalrepaint = true;\n }\n if (totalrepaint)\n {\n // clear textbuf if in text mode\n if ((apple.grswitch & GR_TXMODE) != 0 || (apple.grswitch & GR_MIXMODE) != 0)\n {\n for (y=0; y<24; y++)\n for (var x=0; x<40; x++)\n textbuf[y*40+x] = -1;\n }\n for (var i=0; i<apple.dirty.length; i++)\n apple.dirty[i] = true;\n }\n\n // first, draw top part of window\n if ((apple.grswitch & GR_TXMODE) != 0)\n {\n for (y=0; y<20; y++)\n drawTextLine(y, flash);\n } else\n {\n if ((apple.grswitch & GR_HIRES) != 0)\n drawHiresLines(0, 160);\n else\n for (y=0; y<20; y++)\n drawLoresLine(y);\n }\n\n // now do mixed part of window\n if ((apple.grswitch & GR_TXMODE) != 0 || (apple.grswitch & GR_MIXMODE) != 0)\n {\n for (y=20; y<24; y++)\n drawTextLine(y, flash);\n } else\n {\n if ((apple.grswitch & GR_HIRES) != 0)\n drawHiresLines(160, 192);\n else\n for (y=20; y<24; y++)\n drawLoresLine(y);\n }\n for (var i=0; i<apple.dirty.length; i++)\n apple.dirty[i] = false;\n }\n \n this.invalidate = function() {\n oldgrmode = -1;\n }\n}\n\n/*exported apple2_charset */\n\nconst apple2_charset = [\n 0x00,0x1c,0x22,0x2a,0x2e,0x2c,0x20,0x1e,\n 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22,\n 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c,\n 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c,\n 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c,\n 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e,\n 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20,\n 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e,\n 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22,\n 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,\n 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c,\n 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22,\n 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e,\n 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,\n 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22,\n 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,\n 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20,\n 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a,\n 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22,\n 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c,\n 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,\n 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c,\n 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08,\n 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22,\n 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22,\n 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08,\n 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e,\n 0x00,0x3e,0x30,0x30,0x30,0x30,0x30,0x3e,\n 0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x00,\n 0x00,0x3e,0x06,0x06,0x06,0x06,0x06,0x3e,\n 0x00,0x00,0x00,0x08,0x14,0x22,0x00,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\n 0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,\n 0x00,0x14,0x14,0x14,0x00,0x00,0x00,0x00,\n 0x00,0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,\n 0x00,0x08,0x1e,0x28,0x1c,0x0a,0x3c,0x08,\n 0x00,0x30,0x32,0x04,0x08,0x10,0x26,0x06,\n 0x00,0x10,0x28,0x28,0x10,0x2a,0x24,0x1a,\n 0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,\n 0x00,0x08,0x10,0x20,0x20,0x20,0x10,0x08,\n 0x00,0x08,0x04,0x02,0x02,0x02,0x04,0x08,\n 0x00,0x08,0x2a,0x1c,0x08,0x1c,0x2a,0x08,\n 0x00,0x00,0x08,0x08,0x3e,0x08,0x08,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10,\n 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\n 0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x00,\n 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c,\n 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c,\n 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e,\n 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c,\n 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04,\n 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c,\n 0x00,0x0e,0x10,0x20,0x3c,0x22,0x22,0x1c,\n 0x00,0x3e,0x02,0x04,0x08,0x10,0x10,0x10,\n 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,\n 0x00,0x1c,0x22,0x22,0x1e,0x02,0x04,0x38,\n 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00,\n 0x00,0x00,0x00,0x08,0x00,0x08,0x08,0x10,\n 0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,\n 0x00,0x00,0x00,0x3e,0x00,0x3e,0x00,0x00,\n 0x00,0x10,0x08,0x04,0x02,0x04,0x08,0x10,\n 0x00,0x1c,0x22,0x04,0x08,0x08,0x00,0x08,\n 0x80,0x9c,0xa2,0xaa,0xae,0xac,0xa0,0x9e,\n 0x80,0x88,0x94,0xa2,0xa2,0xbe,0xa2,0xa2,\n 0x80,0xbc,0xa2,0xa2,0xbc,0xa2,0xa2,0xbc,\n 0x80,0x9c,0xa2,0xa0,0xa0,0xa0,0xa2,0x9c,\n 0x80,0xbc,0xa2,0xa2,0xa2,0xa2,0xa2,0xbc,\n 0x80,0xbe,0xa0,0xa0,0xbc,0xa0,0xa0,0xbe,\n 0x80,0xbe,0xa0,0xa0,0xbc,0xa0,0xa0,0xa0,\n 0x80,0x9e,0xa0,0xa0,0xa0,0xa6,0xa2,0x9e,\n 0x80,0xa2,0xa2,0xa2,0xbe,0xa2,0xa2,0xa2,\n 0x80,0x9c,0x88,0x88,0x88,0x88,0x88,0x9c,\n 0x80,0x82,0x82,0x82,0x82,0x82,0xa2,0x9c,\n 0x80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0,0xb2,0x84,0x88,0x90,0xa6,0x86,\n 0x80,0x90,0xa8,0xa8,0x90,0xaa,0xa4,0x9a,\n 0x80,0x88,0x88,0x88,0x80,0x80,0x80,0x80,\n 0x80,0x88,0x90,0xa0,0xa0,0xa0,0x90,0x88,\n 0x80,0x88,0x84,0x82,0x82,0x82,0x84,0x88,\n 0x80,0x88,0xaa,0x9c,0x88,0x9c,0xaa,0x88,\n 0x80,0x80,0x88,0x88,0xbe,0x88,0x88,0x80,\n 0x80,0x80,0x80,0x80,0x80,0x88,0x88,0x90,\n 0x80,0x80,0x80,0x80,0xbe,0x80,0x80,0x80,\n 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88,\n 0x80,0x80,0x82,0x84,0x88,0x90,0xa0,0x80,\n 0x80,0x9c,0xa2,0xa6,0xaa,0xb2,0xa2,0x9c,\n 0x80,0x88,0x98,0x88,0x88,0x88,0x88,0x9c,\n 0x80,0x9c,0xa2,0x82,0x8c,0x90,0xa0,0xbe,\n 0x80,0xbe,0x82,0x84,0x8c,0x82,0xa2,0x9c,\n 0x80,0x84,0x8c,0x94,0xa4,0xbe,0x84,0x84,\n 0x80,0xbe,0xa0,0xbc,0x82,0x82,0xa2,0x9c,\n 0x80,0x8e,0x90,0xa0,0xbc,0xa2,0xa2,0x9c,\n 0x80,0xbe,0x82,0x84,0x88,0x90,0x90,0x90,\n 0x80,0x9c,0xa2,0xa2,0x9c,0xa2,0xa2,0x9c,\n 0x80,0x9c,0xa2,0xa2,0x9e,0x82,0x84,0xb8,\n 0x80,0x80,0x80,0x88,0x80,0x88,0x80,0x80,\n 0x80,0x80,0x80,0x88,0x80,0x88,0x88,0x90,\n 0x80,0x84,0x88,0x90,0xa0,0x90,0x88,0x84,\n 0x80,0x80,0x80,0xbe,0x80,0xbe,0x80,0x80,\n 0x80,0x90,0x88,0x84,0x82,0x84,0x88,0x90,\n 0x80,0x9c,0xa2,0x84,0x88,0x88,0x80,0x88,\n 0x00,0x1c,0x22,0x2a,0x2e,0x2c,0x20,0x1e,\n 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22,\n 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c,\n 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c,\n 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c,\n 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e,\n 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20,\n 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e,\n 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22,\n 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,\n 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c,\n 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22,\n 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e,\n 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,\n 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22,\n 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,\n 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20,\n 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a,\n 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22,\n 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c,\n 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08,\n 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c,\n 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08,\n 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22,\n 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22,\n 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08,\n 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e,\n 0x00,0x3e,0x30,0x30,0x30,0x30,0x30,0x3e,\n 0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x00,\n 0x00,0x3e,0x06,0x06,0x06,0x06,0x06,0x3e,\n 0x00,0x00,0x00,0x08,0x14,0x22,0x00,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\n 0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,\n 0x00,0x14,0x14,0x14,0x00,0x00,0x00,0x00,\n 0x00,0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,\n 0x00,0x08,0x1e,0x28,0x1c,0x0a,0x3c,0x08,\n 0x00,0x30,0x32,0x04,0x08,0x10,0x26,0x06,\n 0x00,0x10,0x28,0x28,0x10,0x2a,0x24,0x1a,\n 0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,\n 0x00,0x08,0x10,0x20,0x20,0x20,0x10,0x08,\n 0x00,0x08,0x04,0x02,0x02,0x02,0x04,0x08,\n 0x00,0x08,0x2a,0x1c,0x08,0x1c,0x2a,0x08,\n 0x00,0x00,0x08,0x08,0x3e,0x08,0x08,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10,\n 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,\n 0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x00,\n 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c,\n 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c,\n 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e,\n 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c,\n 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04,\n 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c,\n 0x00,0x0e,0x10,0x20,0x3c,0x22,0x22,0x1c,\n 0x00,0x3e,0x02,0x04,0x08,0x10,0x10,0x10,\n 0x00,0x1c,0x22,0x22,0x1c,0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2,0xbc,0xa8,0xa4,0xa2,\n 0x80,0x9c,0xa2,0xa0,0x9c,0x82,0xa2,0x9c,\n 0x80,0xbe,0x88,0x88,0x88,0x88,0x88,0x88,\n 0x80,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0x9c,\n 0x80,0xa2,0xa2,0xa2,0xa2,0xa2,0x94,0x88,\n 0x80,0xa2,0xa2,0xa2,0xaa,0xaa,0xb6,0xa2,\n 0x80,0xa2,0xa2,0x94,0x88,0x94,0xa2,0xa2,\n 0x80,0xa2,0xa2,0x94,0x88,0x88,0x88,0x88,\n 0x80,0xbe,0x82,0x84,0x88,0x90,0xa0,0xbe,\n 0x80,0xbe,0xb0,0xb0,0xb0,0xb0,0xb0,0xbe,\n 0x80,0x80,0xa0,0x90,0x88,0x84,0x82,0x80,\n 0x80,0xbe,0x86,0x86,0x86,0x86,0x86,0xbe,\n 0x80,0x80,0x80,0x88,0x94,0xa2,0x80,0x80,\n 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xbe,\n 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,\n 0x80,0x88,0x88,0x88,0x88,0x88,0x80,0x88,\n 0x80,0x94,0x94,0x94,0x80,0x80,0x80,0x80,\n 0x80,0x94,0x94,0xbe,0x94,0xbe,0x94,0x94,\n 0x80,0x88,0x9e,0xa8,0x9c,0x8a,0xbc,0x88,\n 0x80,0xb0,0xb2,0x84,0x88,0x90,0xa6,0x86,\n 0x80,0x90,0xa8,0xa8,0x90,0xaa,0xa4,0x9a,\n 0x80,0x88,0x88,0x88,0x80,0x80,0x80,0x80,\n 0x80,0x88,0x90,0xa0,0xa0,0xa0,0x90,0x88,\n 0x80,0x88,0x84,0x82,0x82,0x82,0x84,0x88,\n 0x80,0x88,0xaa,0x9c,0x88,0x9c,0xaa,0x88,\n 0x80,0x80,0x88,0x88,0xbe,0x88,0x88,0x80,\n 0x80,0x80,0x80,0x80,0x80,0x88,0x88,0x90,\n 0x80,0x80,0x80,0x80,0xbe,0x80,0x80,0x80,\n 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x88,\n 0x80,0x80,0x82,0x84,0x88,0x90,0xa0,0x80,\n 0x80,0x9c,0xa2,0xa6,0xaa,0xb2,0xa2,0x9c,\n 0x80,0x88,0x98,0x88,0x88,0x88,0x88,0x9c,\n 0x80,0x9c,0xa2,0x82,0x8c,0x90,0xa0,0xbe,\n 0x80,0xbe,0x82,0x84,0x8c,0x82,0xa2,0x9c,\n 0x80,0x84,0x8c,0x94,0xa4,0xbe,0x84,0x84,\n 0x80,0xbe,0xa0,0xbc,0x82,0x82,0xa2,0x9c,\n 0x80,0x8e,0x90,0xa0,0xbc,0xa2,0xa2,0x9c,\n 0x80,0xbe,0x82,0x84,0x88,0x90,0x90,0x90,\n 0x80,0x9c,0xa2,0xa2,0x9c,0xa2,0xa2,0x9c,\n 0x80,0x9c,0xa2,0xa2,0x9e,0x82,0x84,0xb8,\n 0x80,0x80,0x80,0x88,0x80,0x88,0x80,0x80,\n 0x80,0x80,0x80,0x88,0x80,0x88,0x88,0x90,\n 0x80,0x84,0x88,0x90,0xa0,0x90,0x88,0x84,\n 0x80,0x80,0x80,0xbe,0x80,0xbe,0x80,0x80,\n 0x80,0x90,0x88,0x84,0x82,0x84,0x88,0x90,\n 0x80,0x9c,0xa2,0x84,0x88,0x88,0x80,0x88\n];\n\n// public domain ROM (http://a2go.applearchives.com/roms/)\nconst APPLEIIGO_LZG = `TFpHAAAwAAAABYxwdy2NARUZHjRBUFBMRUlJR08gUk9NMS4wADQfNB80HzQfNB80HzQfNB80HDQGIADgGR97GR+uNB80Hxk/azQfNB8ZP2UZH4s0HzQfNB80HzQfNB80HzQfNB80HzQfNB80HTQPoCA0HCAgoBkOKAEQEAwFEw8GFCAODxQgARYBCQwBAgwFGRAoxs/SoM3P0sWgyc4eA83B1MnPzqDQzMXB08Wgw8zJw8ugHgigGQgo1MjFoMHQHhnJycfPoMzPNIHCxczP1x4cNAoZHvhMA+AgWPyiJ70A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xea,0x88\n ,0x10,0xEB,0x85,0x26,0x85,0x3D,0x85,0x41,0xA9,0x08,0x85,0x27,0x18,0x08,0xBD,0x8C\n ,0xC0,0x10,0xFB,0x49,0xD5,0xD0,0xF7,0xBD,0x8C,0xC0,0x10,0xFB,0xC9,0xAA,0xD0,0xF3\n ,0xEA,0xBD,0x8C,0xC0,0x10,0xFB,0xC9,0x96,0xF0,0x09,0x28,0x90,0xDF,0x49,0xAD,0xF0\n ,0x25,0xD0,0xD9,0xA0,0x03,0x85,0x40,0xBD,0x8C,0xC0,0x10,0xFB,0x2A,0x85,0x3C,0xBD\n ,0x8C,0xC0,0x10,0xFB,0x25,0x3C,0x88,0xD0,0xEC,0x28,0xC5,0x3D,0xD0,0xBE,0xA5,0x40\n ,0xC5,0x41,0xD0,0xB8,0xB0,0xB7,0xA0,0x56,0x84,0x3C,0xBC,0x8C,0xC0,0x10,0xFB,0x59\n ,0xD6,0x02,0xA4,0x3C,0x88,0x99,0x00,0x03,0xD0,0xEE,0x84,0x3C,0xBC,0x8C,0xC0,0x10\n ,0xFB,0x59,0xD6,0x02,0xA4,0x3C,0x91,0x26,0xC8,0xD0,0xEF,0xBC,0x8C,0xC0,0x10,0xFB\n ,0x59,0xD6,0x02,0xD0,0x87,0xA0,0x00,0xA2,0x56,0xCA,0x30,0xFB,0xB1,0x26,0x5E,0x00\n ,0x03,0x2A,0x5E,0x00,0x03,0x2A,0x91,0x26,0xC8,0xD0,0xEE,0xE6,0x27,0xE6,0x3D,0xA5\n ,0x3D,0xCD,0x00,0x08,0xA6,0x2B,0x90,0xDB,0x4C,0x01,0x08,0x00,0x00,0x00,0x00,0x00\n ];\n\nclass DiskIIState {\n data : Uint8Array[];\n track : number = 0;\n read_mode : boolean = true;\n write_protect : boolean = false;\n motor : boolean = false;\n track_index : number = 0;\n}\n\nclass DiskII extends DiskIIState implements SlotDevice, SavesState<DiskIIState> {\n emu : AppleII;\n track_data : Uint8Array;\n \n constructor(emu : AppleII, image : Uint8Array) {\n super();\n this.emu = emu;\n this.data = new Array(NUM_TRACKS);\n for (var i=0; i<NUM_TRACKS; i++) {\n var ofs = i*16*256;\n this.data[i] = nibblizeTrack(254, i, image.slice(ofs, ofs+16*256));\n }\n }\n \n saveState() : DiskIIState {\n var s = {\n data: new Array(NUM_TRACKS),\n track: this.track,\n read_mode: this.read_mode,\n write_protect: this.write_protect,\n motor: this.motor,\n track_index: this.track_index\n };\n for (var i=0; i<NUM_TRACKS; i++)\n s.data[i] = this.data[i].slice(0);\n return s;\n }\n \n loadState(s: DiskIIState) {\n for (var i=0; i<NUM_TRACKS; i++)\n this.data[i].set(s.data[i]);\n this.track = s.track;\n this.read_mode = s.read_mode;\n this.write_protect = s.write_protect;\n this.motor = s.motor;\n this.track_index = s.track_index;\n if ((this.track & 1) == 0)\n this.track_data = this.data[this.track>>1];\n else\n this.track_data = null;\n }\n \n toLongString() {\n return \"Track: \" + (this.track / 2) +\n \"\\nOffset: \" + (this.track_index) +\n \"\\nMode: \" + (this.read_mode ? \"READ\" : \"WRITE\") +\n \"\\nMotor: \" + this.motor +\n \"\\nData: \" + (this.track_data ? hex(this.track_data[this.track_index]) : '-') +\n \"\\n\";\n }\n \n read_latch() : number {\n this.track_index = (this.track_index + 1) % TRACK_SIZE;\n if (this.track_data) {\n return (this.track_data[this.track_index] & 0xff);\n } else\n return this.emu.floatbus() | 0x80;\n }\n\n write_latch(value: number) {\n this.track_index = (this.track_index + 1) % TRACK_SIZE;\n if (this.track_data != null)\n this.track_data[this.track_index] = value;\n }\n \n readROM(address) { return DISKII_PROM[address]; }\n readConst(address) { return DISKII_PROM[address]; }\n read(address) { return this.doIO(address, 0); }\n write(address, value) { this.doIO(address, value); }\n\n doIO(address, value) : number \n {\n switch (address & 0x0f)\n {\n /*\n * Turn motor phases 0 to 3 on. Turning on the previous phase + 1\n * increments the track position, turning on the previous phase - 1\n * decrements the track position. In this scheme phase 0 and 3 are\n * considered to be adjacent. The previous phase number can be\n * computed as the track number % 4.\n */\n case 0x1:\n case 0x3:\n case 0x5:\n case 0x7:\n var phase, lastphase, new_track;\n new_track = this.track;\n phase = (address >> 1) & 3;\n\n // if new phase is even and current phase is odd\n if (phase == ((new_track - 1) & 3))\n {\n if (new_track > 0)\n new_track--;\n } else\n if (phase == ((new_track + 1) & 3))\n {\n if (new_track < NUM_TRACKS*2-1)\n new_track++;\n }\n if ((new_track & 1) == 0)\n {\n this.track_data = this.data[new_track>>1];\n console.log('track', new_track/2);\n } else\n this.track_data = null;\n this.track = new_track;\n break;\n /*\n * Turn drive motor off.\n */\n case 0x8:\n this.motor = false;\n break;\n /*\n * Turn drive motor on.\n */\n case 0x9:\n this.motor = true;\n break; \n /*\n * Select drive 1.\n */\n case 0xa:\n //drive = 0;\n break;\n /*\n * Select drive 2.\n */\n case 0xb:\n //drive = 1;\n break;\n /*\n * Select write mode.\n */\n case 0xf:\n this.read_mode = false;\n /*\n * Read a disk byte if read mode is active.\n */\n case 0xC:\n if (this.read_mode)\n return this.read_latch();\n break;\n /*\n * Select read mode and read the write protect status.\n */\n case 0xE:\n this.read_mode = true;\n /*\n * Write a disk byte if write mode is active and the disk is not\n * write protected.\n */\n case 0xD:\n if (value >= 0 && !this.read_mode && !this.write_protect)\n this.write_latch(value);\n /*\n * Read the write protect status only.\n */\n return this.write_protect ? 0x80 : 0x00;\n }\n return this.emu.floatbus();\n }\n\n}\n\n/* --------------- TRACK CONVERSION ROUTINES ---------------------- */\n\n /*\n * Normal byte (lower six bits only) -> disk byte translation table.\n */\n const byte_translation = [\n 0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,\n 0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,\n 0xb4, 0xb5, 0xb6, 0xb7, 0xb9, 0xba, 0xbb, 0xbc,\n 0xbd, 0xbe, 0xbf, 0xcb, 0xcd, 0xce, 0xcf, 0xd3,\n 0xd6, 0xd7, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,\n 0xdf, 0xe5, 0xe6, 0xe7, 0xe9, 0xea, 0xeb, 0xec,\n 0xed, 0xee, 0xef, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,\n 0xf7, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff\n ];\n\n /*\n * Sector skewing table.\n */\n\n const skewing_table = [\n 0,7,14,6,13,5,12,4,11,3,10,2,9,1,8,15\n ];\n\n/*\n * Encode a 256-byte sector as SECTOR_SIZE disk bytes as follows:\n *\n * 14 sync bytes\n * 3 address header bytes\n * 8 address block bytes\n * 3 address trailer bytes\n * 6 sync bytes\n * 3 data header bytes\n * 343 data block bytes\n * 3 data trailer bytes\n */\n function nibblizeSector(vol, trk, sector, inn, in_ofs, out, i)\n {\n var loop, checksum, prev_value, value;\n var sector_buffer = new Uint8Array(258);\n value = 0;\n\n /*\n * Step 1: write 6 sync bytes (0xff's). Normally these would be\n * written as 10-bit bytes with two extra zero bits, but for the\n * purpose of emulation normal 8-bit bytes will do, since the\n * emulated drive will always be in sync.\n */\n for (loop = 0; loop < 14; loop++)\n out[i++] = 0xff;\n\n /*\n * Step 2: write the 3-byte address header (0xd5 0xaa 0x96).\n */\n out[i++] = 0xd5;\n out[i++] = 0xaa;\n out[i++] = 0x96;\n\n /*\n * Step 3: write the address block. Use 4-and-4 encoding to convert\n * the volume, track and sector and checksum into 2 disk bytes each.\n * The checksum is a simple exclusive OR of the first three values.\n */\n out[i++] = ((vol >> 1) | 0xaa);\n out[i++] = (vol | 0xaa);\n checksum = vol;\n out[i++] = ((trk >> 1) | 0xaa);\n out[i++] = (trk | 0xaa);\n checksum ^= trk;\n out[i++] = ((sector >> 1) | 0xaa);\n out[i++] = (sector | 0xaa);\n checksum ^= sector;\n out[i++] = ((checksum >> 1) | 0xaa);\n out[i++] = (checksum | 0xaa);\n\n /*\n * Step 4: write the 3-byte address trailer (0xde 0xaa 0xeb).\n */\n out[i++] = (0xde);\n out[i++] = (0xaa);\n out[i++] = (0xeb);\n\n /*\n * Step 5: write another 6 sync bytes.\n */\n for (loop = 0; loop < 6; loop++)\n out[i++] = (0xff);\n\n /*\n * Step 6: write the 3-byte data header.\n */\n out[i++] = (0xd5);\n out[i++] = (0xaa);\n out[i++] = (0xad);\n\n /*\n * Step 7: read the next 256-byte sector from the old disk image file,\n * and add two zero bytes to bring the number of bytes up to a multiple\n * of 3.\n */\n for (loop = 0; loop < 256; loop++)\n sector_buffer[loop] = inn[loop + in_ofs] & 0xff;\n sector_buffer[256] = 0;\n sector_buffer[257] = 0; \n\n /*\n * Step 8: write the first 86 disk bytes of the data block, which\n * encodes the bottom two bits of each sector byte into six-bit\n * values as follows:\n *\n * disk byte n, bit 0 = sector byte n, bit 1\n * disk byte n, bit 1 = sector byte n, bit 0\n * disk byte n, bit 2 = sector byte n + 86, bit 1\n * disk byte n, bit 3 = sector byte n + 86, bit 0\n * disk byte n, bit 4 = sector byte n + 172, bit 1\n * disk byte n, bit 5 = sector byte n + 172, bit 0\n *\n * The scheme allows each pair of bits to be shifted to the right out\n * of the disk byte, then shifted to the left into the sector byte.\n *\n * Before the 6-bit value is translated to a disk byte, it is exclusive\n * ORed with the previous 6-bit value, hence the values written are\n * really a running checksum.\n */\n prev_value = 0;\n for (loop = 0; loop < 86; loop++)\n {\n value = (sector_buffer[loop] & 0x01) << 1;\n value |= (sector_buffer[loop] & 0x02) >> 1;\n value |= (sector_buffer[loop + 86] & 0x01) << 3;\n value |= (sector_buffer[loop + 86] & 0x02) << 1;\n value |= (sector_buffer[loop + 172] & 0x01) << 5;\n value |= (sector_buffer[loop + 172] & 0x02) << 3;\n out[i++] = (byte_translation[value ^ prev_value]);\n prev_value = value;\n } \n\n /*\n * Step 9: write the last 256 disk bytes of the data block, which\n * encodes the top six bits of each sector byte. Again, each value\n * is exclusive ORed with the previous value to create a running\n * checksum (the first value is exclusive ORed with the last value of\n * the previous step).\n */\n\n for (loop = 0; loop < 256; loop++)\n {\n value = (sector_buffer[loop] >> 2);\n out[i++] = (byte_translation[value ^ prev_value]);\n prev_value = value;\n }\n\n /*\n * Step 10: write the last value as the checksum.\n */\n out[i++] = (byte_translation[value]);\n\n /*\n * Step 11: write the 3-byte data trailer.\n */\n out[i++] = (0xde);\n out[i++] = (0xaa);\n out[i++] = (0xeb);\n\n }\n\n function nibblizeTrack(vol, trk, inn)\n {\n var out = new Uint8Array(TRACK_SIZE);\n var out_pos = 0;\n for (var sector = 0; sector < 16; sector++) {\n nibblizeSector(vol, trk, sector,\n inn, skewing_table[sector] << 8,\n out, out_pos);\n out_pos += SECTOR_SIZE;\n }\n while (out_pos < TRACK_SIZE)\n out[out_pos++] = (0xff);\n return out;\n }\n\n\n", "\nimport { Platform, getOpcodeMetadata_6502, getToolForFilename_6502 } from \"../common/baseplatform\";\nimport { PLATFORMS } from \"../common/emu\";\nimport { AppleII } from \"../machine/apple2\";\nimport { Base6502MachinePlatform } from \"../common/baseplatform\";\nimport { CodeAnalyzer_apple2 } from \"../common/analysis\";\nimport { BaseMAME6502Platform } from \"../common/mameplatform\";\n\nconst APPLE2_PRESETS = [\n {id:'sieve.c', name:'Sieve'},\n {id:'keyboardtest.c', name:'Keyboard Test'},\n {id:'mandel.c', name:'Mandelbrot'},\n {id:'tgidemo.c', name:'TGI Graphics Demo'},\n {id:'Eliza.c', name:'Eliza'},\n {id:'siegegame.c', name:'Siege Game'},\n {id:'cosmic.c', name:'Cosmic Impalas'},\n {id:'farmhouse.c', name:\"Farmhouse Adventure\"},\n {id:'yum.c', name:\"Yum Dice Game\"},\n {id:'lzgtest.c', name:\"LZG Decompressor (C)\"},\n {id:'hgrtest.a', name:\"HGR Test (ASM)\"},\n {id:'conway.a', name:\"Conway's Game of Life (ASM)\"},\n {id:'lz4fh.a', name:\"LZ4FH Decompressor (ASM)\"},\n {id:'deltamod.dasm', name:\"Delta Modulation (ASM)\"},\n// {id:'zap.dasm', name:\"ZAP! (ASM)\"},\n// {id:'tb_6502.s', name:'Tom Bombem (assembler game)'},\n];\n\n/// MAME support\n\nclass Apple2MAMEPlatform extends BaseMAME6502Platform implements Platform {\n\n start () {\n this.startModule(this.mainElement, {\n jsfile:'mame8bitpc.js',\n biosfile:['apple2e.zip'],\n //cfgfile:'nes.cfg',\n driver:'apple2e',\n width:280*2,\n height:192*2,\n //romfn:'/emulator/cart.nes',\n //romsize:romSize,\n //romdata:new lzgmini().decode(lzgRom).slice(0, romSize),\n preInit:function(_self) {\n },\n });\n }\n\n getOpcodeMetadata = getOpcodeMetadata_6502;\n getDefaultExtension () { return \".c\"; };\n getToolForFilename = getToolForFilename_6502;\n\n getPresets () { return APPLE2_PRESETS; }\n\n loadROM (title, data) {\n this.loadROMFile(data);\n // TODO\n }\n}\n\n///\n\nclass NewApple2Platform extends Base6502MachinePlatform<AppleII> implements Platform {\n\n newMachine() { return new AppleII(); }\n getPresets() { return APPLE2_PRESETS; }\n getDefaultExtension() { return \".c\"; };\n readAddress(a) { return this.machine.readConst(a); }\n // TODO loadBIOS(bios)\t{ this.machine.loadBIOS(a); }\n getMemoryMap = function() { return { main:[\n {name:'Zero Page RAM',start:0x0,size:0x100,type:'ram'},\n {name:'Line Input RAM',start:0x200,size:0x100,type:'ram'},\n {name:'RAM',start:0x300,size:0xc0,type:'ram'},\n {name:'DOS Vectors',start:0x3c0,size:0x40,type:'ram'},\n {name:'Text/Lores Page 1',start:0x400,size:0x400,type:'ram'},\n {name:'RAM',start:0x800,size:0x1800,type:'ram'},\n {name:'Hires Page 1',start:0x2000,size:0x2000,type:'ram'},\n {name:'Hires Page 2',start:0x4000,size:0x2000,type:'ram'},\n {name:'RAM',start:0x6000,size:0x6000,type:'ram'},\n {name:'I/O',start:0xc000,size:0x1000,type:'io'},\n {name:'ROM',start:0xd000,size:0x3000-6,type:'rom'},\n ] } };\n getROMExtension(rom:Uint8Array) {\n if (rom && rom.length == 35*16*256) return \".dsk\"; // DSK image\n return \".bin\";\n };\n getToolForFilename = (fn:string) : string => {\n if (fn.endsWith(\".lnk\")) return \"merlin32\";\n else return getToolForFilename_6502(fn);\n }\n /*\n newCodeAnalyzer() {\n return new CodeAnalyzer_apple2(this);\n }\n getOriginPC() {\n return 0x803; // TODO?\n }\n */\n}\n\nPLATFORMS['apple2.mame'] = Apple2MAMEPlatform;\nPLATFORMS['apple2'] = NewApple2Platform;\n"],
"mappings": "+NAOA,GAAM,GAAU,KACV,GAAY,EACZ,EAAW,EACX,GAAW,EAAW,GAyBrB,eAAsB,GAA4C,CAmFvE,aAAc,CACZ,QAjFF,kBAAe,QACf,gBAAa,KAAK,aAClB,sBAAmB,GACnB,uBAAoB,KAAK,iBAAmB,IAC5C,iBAAc,IACd,yBAAsB,IACtB,uBAAoB,IACpB,oBAAiB,MAAO,KAExB,SAAM,GAAI,YAAW,OAErB,SAAM,GAAI,IACV,aAAU,GAAI,OAAM,OAAU,GAC9B,cAAW,CAAC,MAAM,KAAK,QAAS,SAAS,EAAW,IAAI,KAAK,KAE7D,cAAW,EACX,gBAAa,EAEb,oBAAiB,GACjB,gBAAa,EACb,kBAAe,GAGf,mBAAc,EACd,mBAAc,EAEd,WAAuB,GAAI,OAAM,GAEjC,eAAyB,CACvB,QAAS,AAAC,GAAM,CACd,GAAI,GAAK,KAAK,IAAI,QAClB,GAAI,GAAM,OAAU,EAAK,MAKrB,OAAQ,OAED,GAGH,MAAO,OACJ,GAAG,MAAO,GAAQ,QAClB,GAAG,MAAQ,IAAS,EAAG,YACnB,MAAO,OAQlB,QAAQ,OACD,GAOH,MAAI,MAAK,KACL,SAAQ,IAAI,yCAA0C,EAAS,SAAS,OACxE,KAAK,IAAI,IAAI,KAAK,IAAI,MAAM,IAAW,IAEpC,OACJ,GAAG,MAAO,QACV,GAAG,MAAO,OACV,GAAG,MAAO,OACV,GAAG,MAAO,YACN,MAAO,KAIxB,UAAW,AAAC,GACF,EAEV,KAAM,AAAC,GAAe,KAAK,WAC3B,MAAO,CAAC,EAAE,IAAM,IAKhB,KAAK,SAAS,GAAI,KAAU,OAAO,EAAkB,KAAK,OAC1D,KA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