1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-15 14:07:16 +00:00
8bitworkshop/gen/apple2-JWHRVLUW.js

14 lines
24 KiB
JavaScript

import{a as r0}from"./chunk-SAEVCPQX.js";import{B as e0,I as t0,q as x0,t as a0,y as z}from"./chunk-ORITJQOD.js";import{J as G,O as b,g as W,k as V,l as X,r as $,t as A}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var E=2051,l0=E,O=E,u0=O-l0,N=class extends x0{constructor(){super();this.cpuFrequency=1022727;this.sampleRate=this.cpuFrequency;this.cpuCyclesPerLine=65;this.cpuCyclesPerFrame=this.cpuCyclesPerLine*262;this.canvasWidth=280;this.numVisibleScanlines=192;this.numTotalScanlines=262;this.defaultROMSize=48896-2051;this.ram=new Uint8Array(77824);this.cpu=new a0;this.grdirty=new Array(49152>>7);this.grparams={dirty:this.grdirty,grswitch:P,mem:this.ram};this.kbdlatch=0;this.soundstate=0;this.auxRAMselected=!1;this.auxRAMbank=1;this.writeinhibit=!0;this.bank2rdoffset=0;this.bank2wroffset=0;this.slots=new Array(8);this.fakeDrive={readROM:x=>{var a=this.cpu.getPC();if(a>=50688&&a<50944)switch(x){case 0:return 0;case 1:return E&255;case 2:return E>>8&255;default:return 0}else switch(x){case 0:return this.rom&&(console.log(`Loading program into Apple ][ RAM at $${O.toString(16)}`),this.ram.set(this.rom.slice(u0),O)),76;case 1:return 32;case 3:return 0;case 5:return 3;case 7:return 60;default:return 0}},readConst:x=>0,read:x=>this.floatbus(),write:(x,a)=>{}};this.loadBIOS(new V().decode(X(atob(g0)))),this.connectCPUMemoryBus(this),this.bios[54170-(65536-this.bios.length)]=96}saveState(){return{c:this.cpu.saveState(),ram:this.ram.slice(),kbdlatch:this.kbdlatch,soundstate:this.soundstate,grswitch:this.grparams.grswitch,auxRAMselected:this.auxRAMselected,auxRAMbank:this.auxRAMbank,writeinhibit:this.writeinhibit,slots:this.slots.map(x=>x&&x.saveState&&x.saveState()),inputs:null}}loadState(x){this.cpu.loadState(x.c),this.ram.set(x.ram),this.kbdlatch=x.kbdlatch,this.soundstate=x.soundstate,this.grparams.grswitch=x.grswitch,this.auxRAMselected=x.auxRAMselected,this.auxRAMbank=x.auxRAMbank,this.writeinhibit=x.writeinhibit,this.setupLanguageCardConstants();for(var a=0;a<this.slots.length;a++)this.slots[a]&&this.slots[a].loadState&&this.slots[a].loadState(x.slots[a]);this.ap2disp.invalidate()}saveControlsState(){return{inputs:null,kbdlatch:this.kbdlatch}}loadControlsState(x){this.kbdlatch=x.kbdlatch}loadBIOS(x,a){x.length!=12288&&(console.log(`apple2 loadBIOS !!!WARNING!!!: BIOS wants length 0x3000, but BIOS '${a}' has length 0x${x.length.toString(16)}`),console.log("will load BIOS to end of memory anyway...")),this.bios=Uint8Array.from(x),this.ram.set(this.bios,65536-this.bios.length),this.ram[48896]=76,this.ram[49007]=1}loadROM(x){if(x.length==35*16*256){var a=new c0(this,x);this.slots[6]=a}else super.loadROM(x),this.slots[6]=this.fakeDrive}reset(){super.reset(),this.auxRAMselected=!1,this.auxRAMbank=1,this.writeinhibit=!0,this.ram.fill(0,768,1024),this.skipboot()}skipboot(){for(var x=0;x<2e6&&(this.cpu.advanceClock(),this.cpu.getPC()>>8!=198);x++);for(var x=0;x<2e6&&(this.cpu.advanceClock(),!(this.cpu.getPC()>>8<198));x++);}readConst(x){if(x<49152)return this.ram[x];if(x>=53248)return this.auxRAMselected?x>=57344?this.ram[x]:this.ram[x+this.bank2rdoffset]:this.bios[x-(65536-this.bios.length)];if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readConst(x&255))|0}else return 0}read(x){if(x&=65535,x<49152||x>=53248)return this.readConst(x);if(x<49408){var a=x>>4&15;switch(a){case 0:return this.kbdlatch;case 1:this.kbdlatch&=127;break;case 3:this.soundstate=this.soundstate^1;break;case 5:(x&15)<8&&((x&1)!=0?this.grparams.grswitch|=1<<(x>>1&7):this.grparams.grswitch&=~(1<<(x>>1&7)));break;case 6:switch(x&7){case 1:case 2:case 3:return this.floatbus()&127;case 4:case 5:return this.floatbus()|128;default:return this.floatbus()}case 7:if(x==49264)return this.floatbus()|128;case 8:return this.doLanguageCardIO(x);case 9:case 10:case 11:case 12:case 13:case 14:case 15:return(this.slots[a-8]&&this.slots[a-8].read(x&15))|0}}else if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readROM(x&255))|0}return this.floatbus()}write(x,a){if(x&=65535,a&=255,x<49152)this.ram[x]=a,this.grdirty[x>>7]=1;else if(x<49280)this.read(x);else if(x<49408){var r=x>>4&15;this.slots[r-8]&&this.slots[r-8].write(x&15,a)}else x>=53248&&!this.writeinhibit&&(x>=57344?this.ram[x]=a:this.ram[x+this.bank2wroffset]=a)}floatbus(){var x=this.frameCycles,a=Math.floor(x/65),r=Math.floor(x%65),d=this.ap2disp.getAddressForScanline(a);return this.readConst(d+r)}connectVideo(x){super.connectVideo(x),this.ap2disp=this.pixels&&new d0(this.pixels,this.grparams)}startScanline(){}drawScanline(){}advanceFrame(x){var a=super.advanceFrame(x);return this.ap2disp&&this.ap2disp.updateScreen(),a}advanceCPU(){return this.audio.feedSample(this.soundstate,1),super.advanceCPU()}setKeyInput(x,a,r){if(r&b.KeyDown){switch(a=0,x){case 16:case 17:case 18:break;case 8:if(a=8,r&b.Shift){this.cpu.reset();return}break;case 13:a=13;break;case 27:a=27;break;case 37:a=8;break;case 39:a=21;break;case 38:a=11;break;case 40:a=10;break;case 48:r&b.Shift&&(a=41);break;case 49:r&b.Shift&&(a=33);break;case 50:r&b.Shift&&(a=64);break;case 51:r&b.Shift&&(a=35);break;case 52:r&b.Shift&&(a=36);break;case 53:r&b.Shift&&(a=37);break;case 54:r&b.Shift&&(a=94);break;case 55:r&b.Shift&&(a=38);break;case 56:r&b.Shift&&(a=42);break;case 57:r&b.Shift&&(a=40);break;case 61:a=r&b.Shift?43:61;break;case 173:a=r&b.Shift?95:45;break;case 59:a=r&b.Shift?58:59;break;case 188:a=r&b.Shift?60:44;break;case 190:a=r&b.Shift?62:46;break;case 191:a=r&b.Shift?63:47;break;case 222:a=r&b.Shift?34:39;break;default:a=x,a>=97&&a<=122&&(a-=32),a>=65&&a<65+26&&r&b.Ctrl&&(a-=64)}a&&(this.kbdlatch=(a|128)&255)}}doLanguageCardIO(x){switch(x&15){case 0:case 4:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!0;break;case 1:case 5:this.auxRAMselected=!1,this.auxRAMbank=2,this.writeinhibit=!1;break;case 2:case 6:case 10:case 14:this.auxRAMselected=!1,this.writeinhibit=!0;break;case 3:case 7:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!1;break;case 8:case 12:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!0;break;case 9:case 13:this.auxRAMselected=!1,this.auxRAMbank=1,this.writeinhibit=!1;break;case 11:case 15:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!1;break}return this.setupLanguageCardConstants(),this.floatbus()}setupLanguageCardConstants(){this.auxRAMbank==2?this.bank2rdoffset=-4096:this.bank2rdoffset=12288,this.auxRAMbank==2?this.bank2wroffset=-4096:this.bank2wroffset=12288}getDebugCategories(){return["CPU","Stack","I/O","Disk"]}getDebugInfo(x,a){switch(x){case"I/O":return"AUX RAM Bank: "+a.auxRAMbank+`
AUX RAM Select: `+a.auxRAMselected+`
AUX RAM Write: `+!a.writeinhibit+`
GR Switches: `+$(a.grswitch,["Graphics","Mixed","Page2","Hires"],!1)+`
`;case"Disk":return this.slots[6]&&this.slots[6].toLongString&&this.slots[6].toLongString()||`
`}}},P=1,K=2,R=4,L=8,d0=function(i,x){var a=280,r=192,d=4294967295,e=4278190080,n=-1,c=new Array(40*24);let p=500,S=[A(0,0,0),A(227,30,96),A(96,78,189),A(255,68,253),A(0,163,96),A(156,156,156),A(20,207,253),A(208,195,255),A(96,114,3),A(255,106,60),A(156,156,156),A(255,160,208),A(20,245,60),A(208,221,141),A(114,255,208),A(255,255,255)],l=[0,128,256,384,512,640,768,896,40,168,296,424,552,680,808,936,80,208,336,464,592,720,848,976],k=[0,1024,2048,3072,4096,5120,6144,7168,128,1152,2176,3200,4224,5248,6272,7296,256,1280,2304,3328,4352,5376,6400,7424,384,1408,2432,3456,4480,5504,6528,7552,512,1536,2560,3584,4608,5632,6656,7680,640,1664,2688,3712,4736,5760,6784,7808,768,1792,2816,3840,4864,5888,6912,7936,896,1920,2944,3968,4992,6016,7040,8064,40,1064,2088,3112,4136,5160,6184,7208,168,1192,2216,3240,4264,5288,6312,7336,296,1320,2344,3368,4392,5416,6440,7464,424,1448,2472,3496,4520,5544,6568,7592,552,1576,2600,3624,4648,5672,6696,7720,680,1704,2728,3752,4776,5800,6824,7848,808,1832,2856,3880,4904,5928,6952,7976,936,1960,2984,4008,5032,6056,7080,8104,80,1104,2128,3152,4176,5200,6224,7248,208,1232,2256,3280,4304,5328,6352,7376,336,1360,2384,3408,4432,5456,6480,7504,464,1488,2512,3536,4560,5584,6608,7632,592,1616,2640,3664,4688,5712,6736,7760,720,1744,2768,3792,4816,5840,6864,7888,848,1872,2896,3920,4944,5968,6992,8016,976,2e3,3024,4048,5072,6096,7120,8144,120,1144,2168,3192,4216,5240,6264,7288,248,1272,2296,3320,4344,5368,6392,7416,376,1400,2424,3448,4472,5496,6520,7544,504,1528,2552,3576,4600,5624,6648,7672,632,1656,2680,3704,4728,5752,6776,7800,760,1784,2808,3832,4856,5880,6904,7928,888,1912,2936,3960,4984,6008,7032,8056,1016,2040,3064,4088,5112,6136,7160,8184,0,1024,2048,3072,4096,5120];var Q;{Q=new Array(256*4*2*7);var g,I,y,F,w0=15,Z=0;for(I=0;I<2;I++)for(var D=0;D<1024;D++){(D&128)==0?(y=3,F=12):(y=6,F=9);var U=(D&256)>>8|(D&127)<<1|(D&512)>>1;for(g=0;g<7;g++){var v;(2<<g&U)!=0?(7<<g&U)==7<<g?v=15:v=((I^g)&1)==0?y:F:(5<<g&U)==5<<g?v=((I^g)&1)!=0?y:F:v=0,Q[Z]=S[v],Z++}}}function h0(o,s,h){var f,t,u,m;for(t=(s<<3)*a+o*7,m=S[h&15],f=0;f<4;f++)i[t]=i[t+1]=i[t+2]=i[t+3]=i[t+4]=i[t+5]=i[t+6]=m,t+=a;for(m=S[h>>4],f=0;f<4;f++)i[t]=i[t+1]=i[t+2]=i[t+3]=i[t+4]=i[t+5]=i[t+6]=m,t+=a}function b0(o,s,h,f){var t=(s<<3)*a+o*7,u,m;f?(u=e,m=d):(u=d,m=e);for(var w=0;w<8;w++){var C=k0[(h<<3)+w];i[t]=(C&64)>0?u:m,i[t+1]=(C&32)>0?u:m,i[t+2]=(C&16)>0?u:m,i[t+3]=(C&8)>0?u:m,i[t+4]=(C&4)>0?u:m,i[t+5]=(C&2)>0?u:m,i[t+6]=(C&1)>0?u:m,t+=a}}this.getAddressForScanline=function(o){var s=k[o];return x.grswitch&L&&(o<160||!(x.grswitch&K))?s=s|(x.grswitch&R?16384:8192):s=s&1023|(x.grswitch&R?2048:1024),s};function J(o,s){for(var h=o*a;o<s;o++){var f=k[o]+((x.grswitch&R)!=0?16384:8192);if(!x.dirty[f>>7]){h+=a;continue}for(var t,u,m=0,w=x.mem[f]&255,C=0;C<20;C++){for(var _=x.mem[f+1]&255,j=x.mem[f+2]&255,m0=((m&64)<<2|w|_<<9)&1023,B=0;B<7;B++)i[h+B]=Q[m0*7+B];for(var A0=((w&64)<<2|_|j<<9)&1023,B=0;B<7;B++)i[h+7+B]=Q[A0*7+7168+B];h+=14,f+=2,m=_,w=j}}}function Y(o){for(var s=l[o]+((x.grswitch&R)!=0?2048:1024),h=0;h<40;h++){var f=x.mem[s+h]&255;f!=c[o*40+h]&&(h0(h,o,f),c[o*40+h]=f)}}function q(o,s){for(var h=l[o]+((x.grswitch&R)!=0?2048:1024),f=0;f<40;f++){var t=x.mem[h+f]&255,u;t>=128?u=!1:t>=64?(u=s,s?t-=64:t+=64):u=!0,t!=c[o*40+f]&&(b0(f,o,t&127,u),c[o*40+f]=t)}}this.updateScreen=function(o){var s,h=new Date().getTime()%(p<<1)>p;if(x.grswitch!=n&&(n=x.grswitch,o=!0),o){if((x.grswitch&P)!=0||(x.grswitch&K)!=0)for(s=0;s<24;s++)for(var f=0;f<40;f++)c[s*40+f]=-1;for(var t=0;t<x.dirty.length;t++)x.dirty[t]=!0}if((x.grswitch&P)!=0)for(s=0;s<20;s++)q(s,h);else if((x.grswitch&L)!=0)J(0,160);else for(s=0;s<20;s++)Y(s);if((x.grswitch&P)!=0||(x.grswitch&K)!=0)for(s=20;s<24;s++)q(s,h);else if((x.grswitch&L)!=0)J(160,192);else for(s=20;s<24;s++)Y(s);for(var t=0;t<x.dirty.length;t++)x.dirty[t]=!1},this.invalidate=function(){n=-1}},k0=[0,28,34,42,46,44,32,30,0,8,20,34,34,62,34,34,0,60,34,34,60,34,34,60,0,28,34,32,32,32,34,28,0,60,34,34,34,34,34,60,0,62,32,32,60,32,32,62,0,62,32,32,60,32,32,32,0,30,32,32,32,38,34,30,0,34,34,34,62,34,34,34,0,28,8,8,8,8,8,28,0,2,2,2,2,2,34,28,0,34,36,40,48,40,36,34,0,32,32,32,32,32,32,62,0,34,54,42,42,34,34,34,0,34,34,50,42,38,34,34,0,28,34,34,34,34,34,28,0,60,34,34,60,32,32,32,0,28,34,34,34,42,36,26,0,60,34,34,60,40,36,34,0,28,34,32,28,2,34,28,0,62,8,8,8,8,8,8,0,34,34,34,34,34,34,28,0,34,34,34,34,34,20,8,0,34,34,34,42,42,54,34,0,34,34,20,8,20,34,34,0,34,34,20,8,8,8,8,0,62,2,4,8,16,32,62,0,62,48,48,48,48,48,62,0,0,32,16,8,4,2,0,0,62,6,6,6,6,6,62,0,0,0,8,20,34,0,0,0,0,0,0,0,0,0,62,0,0,0,0,0,0,0,0,0,8,8,8,8,8,0,8,0,20,20,20,0,0,0,0,0,20,20,62,20,62,20,20,0,8,30,40,28,10,60,8,0,48,50,4,8,16,38,6,0,16,40,40,16,42,36,26,0,8,8,8,0,0,0,0,0,8,16,32,32,32,16,8,0,8,4,2,2,2,4,8,0,8,42,28,8,28,42,8,0,0,8,8,62,8,8,0,0,0,0,0,0,8,8,16,0,0,0,0,62,0,0,0,0,0,0,0,0,0,0,8,0,0,2,4,8,16,32,0,0,28,34,38,42,50,34,28,0,8,24,8,8,8,8,28,0,28,34,2,12,16,32,62,0,62,2,4,12,2,34,28,0,4,12,20,36,62,4,4,0,62,32,60,2,2,34,28,0,14,16,32,60,34,34,28,0,62,2,4,8,16,16,16,0,28,34,34,28,34,34,28,0,28,34,34,30,2,4,56,0,0,0,8,0,8,0,0,0,0,0,8,0,8,8,16,0,4,8,16,32,16,8,4,0,0,0,62,0,62,0,0,0,16,8,4,2,4,8,16,0,28,34,4,8,8,0,8,128,156,162,170,174,172,160,158,128,136,148,162,162,190,162,162,128,188,162,162,188,162,162,188,128,156,162,160,160,160,162,156,128,188,162,162,162,162,162,188,128,190,160,160,188,160,160,190,128,190,160,160,188,160,160,160,128,158,160,160,160,166,162,158,128,162,162,162,190,162,162,162,128,156,136,136,136,136,136,156,128,130,130,130,130,130,162,156,128,162,164,168,176,168,164,162,128,160,160,160,160,160,160,190,128,162,182,170,170,162,162,162,128,162,162,178,170,166,162,162,128,156,162,162,162,162,162,156,128,188,162,162,188,160,160,160,128,156,162,162,162,170,164,154,128,188,162,162,188,168,164,162,128,156,162,160,156,130,162,156,128,190,136,136,136,136,136,136,128,162,162,162,162,162,162,156,128,162,162,162,162,162,148,136,128,162,162,162,170,170,182,162,128,162,162,148,136,148,162,162,128,162,162,148,136,136,136,136,128,190,130,132,136,144,160,190,128,190,176,176,176,176,176,190,128,128,160,144,136,132,130,128,128,190,134,134,134,134,134,190,128,128,128,136,148,162,128,128,128,128,128,128,128,128,128,190,128,128,128,128,128,128,128,128,128,136,136,136,136,136,128,136,128,148,148,148,128,128,128,128,128,148,148,190,148,190,148,148,128,136,158,168,156,138,188,136,128,176,178,132,136,144,166,134,128,144,168,168,144,170,164,154,128,136,136,136,128,128,128,128,128,136,144,160,160,160,144,136,128,136,132,130,130,130,132,136,128,136,170,156,136,156,170,136,128,128,136,136,190,136,136,128,128,128,128,128,128,136,136,144,128,128,128,128,190,128,128,128,128,128,128,128,128,128,128,136,128,128,130,132,136,144,160,128,128,156,162,166,170,178,162,156,128,136,152,136,136,136,136,156,128,156,162,130,140,144,160,190,128,190,130,132,140,130,162,156,128,132,140,148,164,190,132,132,128,190,160,188,130,130,162,156,128,142,144,160,188,162,162,156,128,190,130,132,136,144,144,144,128,156,162,162,156,162,162,156,128,156,162,162,158,130,132,184,128,128,128,136,128,136,128,128,128,128,128,136,128,136,136,144,128,132,136,144,160,144,136,132,128,128,128,190,128,190,128,128,128,144,136,132,130,132,136,144,128,156,162,132,136,136,128,136,0,28,34,42,46,44,32,30,0,8,20,34,34,62,34,34,0,60,34,34,60,34,34,60,0,28,34,32,32,32,34,28,0,60,34,34,34,34,34,60,0,62,32,32,60,32,32,62,0,62,32,32,60,32,32,32,0,30,32,32,32,38,34,30,0,34,34,34,62,34,34,34,0,28,8,8,8,8,8,28,0,2,2,2,2,2,34,28,0,34,36,40,48,40,36,34,0,32,32,32,32,32,32,62,0,34,54,42,42,34,34,34,0,34,34,50,42,38,34,34,0,28,34,34,34,34,34,28,0,60,34,34,60,32,32,32,0,28,34,34,34,42,36,26,0,60,34,34,60,40,36,34,0,28,34,32,28,2,34,28,0,62,8,8,8,8,8,8,0,34,34,34,34,34,34,28,0,34,34,34,34,34,20,8,0,34,34,34,42,42,54,34,0,34,34,20,8,20,34,34,0,34,34,20,8,8,8,8,0,62,2,4,8,16,32,62,0,62,48,48,48,48,48,62,0,0,32,16,8,4,2,0,0,62,6,6,6,6,6,62,0,0,0,8,20,34,0,0,0,0,0,0,0,0,0,62,0,0,0,0,0,0,0,0,0,8,8,8,8,8,0,8,0,20,20,20,0,0,0,0,0,20,20,62,20,62,20,20,0,8,30,40,28,10,60,8,0,48,50,4,8,16,38,6,0,16,40,40,16,42,36,26,0,8,8,8,0,0,0,0,0,8,16,32,32,32,16,8,0,8,4,2,2,2,4,8,0,8,42,28,8,28,42,8,0,0,8,8,62,8,8,0,0,0,0,0,0,8,8,16,0,0,0,0,62,0,0,0,0,0,0,0,0,0,0,8,0,0,2,4,8,16,32,0,0,28,34,38,42,50,34,28,0,8,24,8,8,8,8,28,0,28,34,2,12,16,32,62,0,62,2,4,12,2,34,28,0,4,12,20,36,62,4,4,0,62,32,60,2,2,34,28,0,14,16,32,60,34,34,28,0,62,2,4,8,16,16,16,0,28,34,34,28,34,34,28,0,28,34,34,30,2,4,56,0,0,0,8,0,8,0,0,0,0,0,8,0,8,8,16,0,4,8,16,32,16,8,4,0,0,0,62,0,62,0,0,0,16,8,4,2,4,8,16,0,28,34,4,8,8,0,8,128,156,162,170,174,172,160,158,128,136,148,162,162,190,162,162,128,188,162,162,188,162,162,188,128,156,162,160,160,160,162,156,128,188,162,162,162,162,162,188,128,190,160,160,188,160,160,190,128,190,160,160,188,160,160,160,128,158,160,160,160,166,162,158,128,162,162,162,190,162,162,162,128,156,136,136,136,136,136,156,128,130,130,130,130,130,162,156,128,162,164,168,176,168,164,162,128,160,160,160,160,160,160,190,128,162,182,170,170,162,162,162,128,162,162,178,170,166,162,162,128,156,162,162,162,162,162,156,128,188,162,162,188,160,160,160,128,156,162,162,162,170,164,154,128,188,162,162,188,168,164,162,128,156,162,160,156,130,162,156,128,190,136,136,136,136,136,136,128,162,162,162,162,162,162,156,128,162,162,162,162,162,148,136,128,162,162,162,170,170,182,162,128,162,162,148,136,148,162,162,128,162,162,148,136,136,136,136,128,190,130,132,136,144,160,190,128,190,176,176,176,176,176,190,128,128,160,144,136,132,130,128,128,190,134,134,134,134,134,190,128,128,128,136,148,162,128,128,128,128,128,128,128,128,128,190,128,128,128,128,128,128,128,128,128,136,136,136,136,136,128,136,128,148,148,148,128,128,128,128,128,148,148,190,148,190,148,148,128,136,158,168,156,138,188,136,128,176,178,132,136,144,166,134,128,144,168,168,144,170,164,154,128,136,136,136,128,128,128,128,128,136,144,160,160,160,144,136,128,136,132,130,130,130,132,136,128,136,170,156,136,156,170,136,128,128,136,136,190,136,136,128,128,128,128,128,128,136,136,144,128,128,128,128,190,128,128,128,128,128,128,128,128,128,128,136,128,128,130,132,136,144,160,128,128,156,162,166,170,178,162,156,128,136,152,136,136,136,136,156,128,156,162,130,140,144,160,190,128,190,130,132,140,130,162,156,128,132,140,148,164,190,132,132,128,190,160,188,130,130,162,156,128,142,144,160,188,162,162,156,128,190,130,132,136,144,144,144,128,156,162,162,156,162,162,156,128,156,162,162,158,130,132,184,128,128,128,136,128,136,128,128,128,128,128,136,128,136,136,144,128,132,136,144,160,144,136,132,128,128,128,190,128,190,128,128,128,144,136,132,130,132,136,144,128,156,162,132,136,136,128,136],g0="TFpHAAAwAAAABYxwdy2NARUZHjRBUFBMRUlJR08gUk9NMS4wADQfNB80HzQfNB80HzQfNB80HDQGIADgGR97GR+uNB80Hxk/azQfNB8ZP2UZH4s0HzQfNB80HzQfNB80HzQfNB80HzQfNB80HTQPoCA0HCAgoBkOKAEQEAwFEw8GFCAODxQgARYBCQwBAgwFGRAoxs/SoM3P0sWgyc4eA83B1MnPzqDQzMXB08Wgw8zJw8ugHgigGQgo1MjFoMHQHhnJycfPoMzPNIHCxczP1x4cNAoZHvhMA+AgWPyiJ70A352ABMoQ9x4DMN+dAAUewx5OGQUDYB4DBh7DkB4ZBx4DTEDgNEEZP7s0HzQfNB80HzQfNB80HzQfNB80HzQfNB80HzQfNB80HzQfNB80HzQfNB80HjQYyc6w7snJkOrJzPDm0OjqNAtISikDCQSFKWgpGJACaX+FKAoKBSiFKGAZHnQApSUgwftlIBkdSzQVpSJIICT8pSiFKqUphSukIYhoaQHFI7ANHk6xKJEqiBD5MOGgACCe/LCGpCSpoJEoyMQhkPkZHsc0G6QksShIKT8JQJEoaGw4GRMbIAz9IKX7NKHJm/DzGRyNNAYgjv2lMyDt/aIBivDzyiA1/cmV0AKxKMngkAIp350AAsmN0LIgnPypjdBbpD2mPB4nIED5oACprUzt/RlfdjQfNB80HzQfNB80HzQfNB80HzQfNB80HjQFqQCFHKXmhRugAIQapRyRGiB+9MjQ9uYbpRspH9DuYIXihuCE4UgpwIUmSkoFJoUmaIUnCgoKJic0QmYmpScpHwXmhSeKwADwBaAjaQTI6Qew+4Tlqr259IUwmEql5IUcsBUcACM0BArJwBAGpRxJf4UcGf7aNB80HzQfNB80HzQfNBw0CkoIIEf4KKkPkAJp4IUusSZFMCUuUSaRJmAgAPjELLARyCAO+JD2aQFIHghoxS2Q9WCgL9ACoCeELaAnqQCFMCAo+IgQ9mAVBQR+JxUGBH4mCgoZgjRgpTAYaQMpD4UwCjQBBTCFMBln35AESjQBKQ8Za/CoSpAJarAQyaLwDCmHSqq9YvkgefjQBKCAqQCqvab5hS4pA4UvmCmPqpigA+CK8AtKkAhKSgkgiND6yIjQ8hmfOzQfNB80FNgghP4gL/sgk/4gif6tWMCtWsCtXcCtX8Ct/88sEMDYIDr/IGD7qQCFAKnGhQFsGR5vNB0VAxNs3dvHzxkKDa1wwKAA6uq9ZMAQBMjQ+IhgqQCFSK1WwK1UwK1RwKkA8AutUMCtU8AgNvipFIUiHhYgqSiFIakYhSOpF4UlTCL8IFj8oAm5CPuZDgSI0PdgrfMDSaWN9ANgyY3QGKwAwBATwJPQDywQwB5E+8CD8AMeBEz9+xUdB/gVEAf4yYfQEqlAIKj8oMCpDDTBrTDAiND1YKQkkSjmJKUkxSGwZmDJoLDvqBDsyY3wWsmKNGGI0MnGJBDopSGFJMYkpSLFJbALxiUVHAf4AEggJPwgnvygAGhpAMUjkPCwyqUihSWgAIQk8OSpAIUk5h4+HhC2xiUVHQf4FQYH+DhI6QHQ/Gg0gfZg5kLQAuZDpTzFPqU95T/mPB4GPRl99BUcB/jmTtAC5k8sAMAQ9ZEorQDALBDAYBUKB/j+YKUySKn/hTK9AAIg7f1oHoHJiPAdyZjwCuD4kAMgOv/o0BOp3B4VFQoH+P4VHgf4NBsASBmiWCDl/WgpDwmwybqQAmkGbDYAyaCQAiUyhDVIIHj7aKQ1GTEvQBkKBRkLGLE8kUIgtPyQ9xm+YTQBoD/QAqD/hDIZYlI+ojigG9AIHoI2oPClPikP8AYJwKAA8AKp/ZQAlQFg6upMFR8eQzQHqYdM7f2lSEilRaZGpEcZbhYZ34Q0GzQB9QP7A2L6Yvo=";var M=35,H=6272,C0=383,s0=[162,32,160,0,162,3,134,60,138,10,36,60,240,16,5,60,73,255,41,126,176,8,74,208,251,152,157,86,3,200,232,16,229,32,88,255,186,189,0,1,10,10,10,10,133,43,170,189,142,192,189,140,192,189,138,192,189,137,192,160,80,189,128,192,152,41,3,10,5,43,170,189,129,192,169,86,169,0,234,136,16,235,133,38,133,61,133,65,169,8,133,39,24,8,189,140,192,16,251,73,213,208,247,189,140,192,16,251,201,170,208,243,234,189,140,192,16,251,201,150,240,9,40,144,223,73,173,240,37,208,217,160,3,133,64,189,140,192,16,251,42,133,60,189,140,192,16,251,37,60,136,208,236,40,197,61,208,190,165,64,197,65,208,184,176,183,160,86,132,60,188,140,192,16,251,89,214,2,164,60,136,153,0,3,208,238,132,60,188,140,192,16,251,89,214,2,164,60,145,38,200,208,239,188,140,192,16,251,89,214,2,208,135,160,0,162,86,202,48,251,177,38,94,0,3,42,94,0,3,42,145,38,200,208,238,230,39,230,61,165,61,205,0,8,166,43,144,219,76,1,8,0,0,0,0,0],i0=class{constructor(){this.track=0;this.read_mode=!0;this.write_protect=!1;this.motor=!1;this.track_index=0}},c0=class extends i0{constructor(x,a){super();this.emu=x,this.data=new Array(M);for(var r=0;r<M;r++){var d=r*16*256;this.data[r]=p0(254,r,a.slice(d,d+16*256))}}saveState(){for(var x={data:new Array(M),track:this.track,read_mode:this.read_mode,write_protect:this.write_protect,motor:this.motor,track_index:this.track_index},a=0;a<M;a++)x.data[a]=this.data[a].slice(0);return x}loadState(x){for(var a=0;a<M;a++)this.data[a].set(x.data[a]);this.track=x.track,this.read_mode=x.read_mode,this.write_protect=x.write_protect,this.motor=x.motor,this.track_index=x.track_index,(this.track&1)==0?this.track_data=this.data[this.track>>1]:this.track_data=null}toLongString(){return"Track: "+this.track/2+`
Offset: `+this.track_index+`
Mode: `+(this.read_mode?"READ":"WRITE")+`
Motor: `+this.motor+`
Data: `+(this.track_data?W(this.track_data[this.track_index]):"-")+`
`}read_latch(){return this.track_index=(this.track_index+1)%H,this.track_data?this.track_data[this.track_index]&255:this.emu.floatbus()|128}write_latch(x){this.track_index=(this.track_index+1)%H,this.track_data!=null&&(this.track_data[this.track_index]=x)}readROM(x){return s0[x]}readConst(x){return s0[x]}read(x){return this.doIO(x,0)}write(x,a){this.doIO(x,a)}doIO(x,a){switch(x&15){case 1:case 3:case 5:case 7:var r,d,e;e=this.track,r=x>>1&3,r==(e-1&3)?e>0&&e--:r==(e+1&3)&&e<M*2-1&&e++,(e&1)==0?(this.track_data=this.data[e>>1],console.log("track",e/2)):this.track_data=null,this.track=e;break;case 8:this.motor=!1;break;case 9:this.motor=!0;break;case 10:break;case 11:break;case 15:this.read_mode=!1;case 12:if(this.read_mode)return this.read_latch();break;case 14:this.read_mode=!0;case 13:return a>=0&&!this.read_mode&&!this.write_protect&&this.write_latch(a),this.write_protect?128:0}return this.emu.floatbus()}},T=[150,151,154,155,157,158,159,166,167,171,172,173,174,175,178,179,180,181,182,183,185,186,187,188,189,190,191,203,205,206,207,211,214,215,217,218,219,220,221,222,223,229,230,231,233,234,235,236,237,238,239,242,243,244,245,246,247,249,250,251,252,253,254,255],S0=[0,7,14,6,13,5,12,4,11,3,10,2,9,1,8,15];function B0(i,x,a,r,d,e,n){var c,p,S,l,k=new Uint8Array(258);for(l=0,c=0;c<14;c++)e[n++]=255;for(e[n++]=213,e[n++]=170,e[n++]=150,e[n++]=i>>1|170,e[n++]=i|170,p=i,e[n++]=x>>1|170,e[n++]=x|170,p^=x,e[n++]=a>>1|170,e[n++]=a|170,p^=a,e[n++]=p>>1|170,e[n++]=p|170,e[n++]=222,e[n++]=170,e[n++]=235,c=0;c<6;c++)e[n++]=255;for(e[n++]=213,e[n++]=170,e[n++]=173,c=0;c<256;c++)k[c]=r[c+d]&255;for(k[256]=0,k[257]=0,S=0,c=0;c<86;c++)l=(k[c]&1)<<1,l|=(k[c]&2)>>1,l|=(k[c+86]&1)<<3,l|=(k[c+86]&2)<<1,l|=(k[c+172]&1)<<5,l|=(k[c+172]&2)<<3,e[n++]=T[l^S],S=l;for(c=0;c<256;c++)l=k[c]>>2,e[n++]=T[l^S],S=l;e[n++]=T[l],e[n++]=222,e[n++]=170,e[n++]=235}function p0(i,x,a){for(var r=new Uint8Array(H),d=0,e=0;e<16;e++)B0(i,x,e,a,S0[e]<<8,r,d),d+=C0;for(;d<H;)r[d++]=255;return r}var n0=[{id:"sieve.c",name:"Sieve"},{id:"keyboardtest.c",name:"Keyboard Test"},{id:"mandel.c",name:"Mandelbrot"},{id:"tgidemo.c",name:"TGI Graphics Demo"},{id:"Eliza.c",name:"Eliza"},{id:"siegegame.c",name:"Siege Game"},{id:"cosmic.c",name:"Cosmic Impalas"},{id:"farmhouse.c",name:"Farmhouse Adventure"},{id:"yum.c",name:"Yum Dice Game"},{id:"lzgtest.c",name:"LZG Decompressor (C)"},{id:"hgrtest.a",name:"HGR Test (ASM)"},{id:"conway.a",name:"Conway's Game of Life (ASM)"},{id:"lz4fh.a",name:"LZ4FH Decompressor (ASM)"},{id:"deltamod.dasm",name:"Delta Modulation (ASM)"}],f0=class extends r0{constructor(){super(...arguments);this.getOpcodeMetadata=e0;this.getToolForFilename=z}start(){this.startModule(this.mainElement,{jsfile:"mame8bitpc.js",biosfile:["apple2e.zip"],driver:"apple2e",width:280*2,height:192*2,preInit:function(x){}})}getDefaultExtension(){return".c"}getPresets(){return n0}loadROM(x,a){this.loadROMFile(a)}},o0=class extends t0{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"Zero Page RAM",start:0,size:256,type:"ram"},{name:"Line Input RAM",start:512,size:256,type:"ram"},{name:"RAM",start:768,size:192,type:"ram"},{name:"DOS Vectors",start:960,size:64,type:"ram"},{name:"Text/Lores Page 1",start:1024,size:1024,type:"ram"},{name:"RAM",start:2048,size:6144,type:"ram"},{name:"Hires Page 1",start:8192,size:8192,type:"ram"},{name:"Hires Page 2",start:16384,size:8192,type:"ram"},{name:"RAM",start:24576,size:24576,type:"ram"},{name:"I/O",start:49152,size:4096,type:"io"},{name:"ROM",start:53248,size:12288-6,type:"rom"}]}};this.getToolForFilename=x=>x.endsWith(".lnk")?"merlin32":z(x)}newMachine(){return new N}getPresets(){return n0}getDefaultExtension(){return".c"}readAddress(x){return this.machine.readConst(x)}getROMExtension(x){return x&&x.length==35*16*256?".dsk":".bin"}};G["apple2.mame"]=f0;G.apple2=o0;
//# sourceMappingURL=apple2-JWHRVLUW.js.map