2023-04-22 18:41:16 +00:00
|
|
|
import{J as d0,c as t0,d as r0,e as i0,k as s0,q as n0}from"./chunk-HB3LWF25.js";import{$ as S,J as y,V as A,W as F0,Y as A0,_ as Z,g as o,k as $,l as x0,s as e0}from"./chunk-ATS7PSQG.js";import"./chunk-5XVCUSSZ.js";var C0=A0([[A.UP,16,1],[A.DOWN,16,2],[A.LEFT,16,4],[A.RIGHT,16,8],[A.A,16,16],[A.P2_UP,17,1],[A.P2_DOWN,17,2],[A.P2_LEFT,17,4],[A.P2_RIGHT,17,8],[A.P2_A,17,16],[A.VK_P,20,1],[A.VK_SLASH,20,2],[A.VK_X,20,4],[A.VK_MINUS,20,8],[A.VK_COMMA,20,16],[A.VK_EQUALS,20,32],[A.VK_O,21,1],[A.VK_L,21,2],[A.VK_9,21,4],[A.VK_6,21,8],[A.VK_3,21,16],[A.VK_PERIOD,21,32],[A.VK_I,22,1],[A.VK_K,22,2],[A.VK_8,22,4],[A.VK_5,22,8],[A.VK_2,22,16],[A.VK_0,22,32],[A.VK_U,23,1],[A.VK_J,23,2],[A.VK_7,23,4],[A.VK_4,23,8],[A.VK_1,23,16],[A.VK_BACK_SLASH,23,32]]),a0=2,m0=function(d){var F,r,B,C,b,O,L,U;let V=d?320:160,N=d?204:102,z=V>>2,h0=256,u0=4293848814,Y0=4278190080;var I=new Uint8Array(32),a=0,m=0,c=!1,l=0,D=0,E=0,Q=0,h=0,u=N,P=new Uint32Array(8),G=new Uint8Array(8),k=0,K=new Uint8Array(d?262:131),b0=!1,g=new Uint8Array(4),X=0,Y=0,j=0;function R(x,e){r[x]=e,j++,K[(x&4095)/z|0]=1}function g0(x,e){for(var s=x*4+3,f=0;f<4;f++){var w=x%z>=(D&63)?0:4;L[s--]=P[w+(e&3)],e>>=2}}function _(x){for(var e=x*V/4,s=0;s<V/4;s++)g0(e+s,r[e+s])}function q(x,e){if(a&8){var s=0;c||(e>>=4);for(var f=0;f<4;f++){var w=e&1?m>>2&3:m&3;s|=w<<f*2,e>>=1}e=s,c=!c}if(a&4){if(X&4){var n=2*(~X&3);e=(g[3]>>n&3)<<6|(g[2]>>n&3)<<4|(g[1]>>n&3)<<2|(g[0]>>n&3)<<0}else g[X&3]=e;X++}else{var n=(a&3)<<1,s=e>>n|l;l=e<<8-n&255,e=s}if(a&64&&(e=(e&3)<<6|(e&12)<<2|(e&48)>>2|(e&192)>>6),a&48){var t=r[x],i=0;t&192&&e&192&&(i|=1),t&48&&e&48&&(i|=2),t&12&&e&12&&(i|=4),t&3&&e&3&&(i|=8),a&16&&(e|=t),a&32&&(e^=t),Y=Y&240|i|i<<4}R(x,e)}function W(x,e){G[x&7]=e&255,P[x&7]=J[e&255],H()}function X0(){var x=D>>6}function H(){k=N}this.drawScanline=x=>{x==Q&&E&8&&(F.retryInterrupts=!(E&4),this.probe&&this.probe.logInterrupt(h),F.interrupt(h)),x<N&&k>0?(K[x]=0,_(x),k--):K[x]&&(K[x]=0,_(x))},this.init=(x,e,s,f,w)=>{F=e,r=s,I=f,U=w,O=Z(new $().decode(x0(atob(l0))),8192),d?B={read:S([[16384,32767,16383,function(t){return r[t]}],[53248,57343,4095,function(t){return r[t+16384]}],[0,45055,65535,function(t){return b?b[t]:0}]]),write:S([[16384,32767,16383,R],[53248,57343,4095,function(t,i){R(t+16384,i)}],[0,16383,16383,q]])}:B={read:S([[0,8191,8191,function(t){return O[t]}],[8192,16383,8191,function(t){return b?b[t]:0}],[16384,20479,4095,function(t){return j++,r[t]}]]),write:S([[16384,20479,4095,R],[0,16383,4095,q]])},C={read:function(t){t&=31;var i;switch(t){case 8:i=Y,Y=0;break;default:i=I[t];break}return i},write:function(t,i){switch(t&=31,i&=255,t){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:W(t,i);break;case 9:D=i,X0(),H();break;case 10:u=d?i:i>>1,H();break;case 11:var p=F.saveState();W((p.BC>>8)-1,B.read(p.HL));break;case 12:a=i,l=0,X=0,c=!1;break;case 13:h=i;break;case 14:E=i;break;case 15:Q=d?i:i>>1;break;case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:U.setACRegister(t,i);break;case 24:var p=F.saveState();U.setACRegister((p.BC>>8)-1,B.read(p.HL));break;case 25:m=i;break;default:console.log("IO write",o(t,4),o(i,2));break}}},x.connectCPUMemoryBus(B),x.connectCPUIOBus(C),this.membus=B,this.iobus=C;for(var n=0;n<8;n++)W(n,n)},this.resetWaitStates=function(x){var e=x<u?j:0;return j=0,e},this.loadState=x=>{F.loadState(x.c),r.set(x.ram),P.set(x.palette),G.set(x.palinds),a=x.magicop,m=x.xpand,c=x.xplower,l=x.shift2,D=x.horcb,E=x.inmod,Q=x.inlin,h=x.infbk,u=x.verbl,X=x.rotcount,g.set(x.rotdata),Y=x.intst,I.set(x.inputs),H()},this.saveState=()=>({c:F.saveState(),ram:r.slice(0),inputs:I.slice(0),palette:P.slice(0),palinds:G.slice(0),magicop:a,xpand:m,xplower:c,shift2:l,horcb:D,inmod:E,inlin:Q,infbk:h,verbl:u,rotcount:X,rotdata:g.slice(0),intst:Y}),this.reset=()=>{a=m=E=Q=h=l=D=0,u=N,c=!1},this.toLongString=x=>{var e="";e+=`
|
2022-02-21 15:35:52 +00:00
|
|
|
INLIN: `+x.inlin,e+=`
|
|
|
|
VERBL: `+x.verbl,e+=`
|
|
|
|
MAGICOP: $`+o(x.magicop),e+=`
|
|
|
|
XPAND: $`+o(x.xpand),e+=`
|
|
|
|
XPLOWER: `+x.xplower,e+=`
|
|
|
|
SHIFT2: $`+o(x.shift2),e+=`
|
|
|
|
HORCB: $`+o(x.horcb),e+=`
|
|
|
|
INMOD: $`+o(x.inmod),e+=`
|
|
|
|
INFBK: $`+o(x.infbk),e+=`
|
|
|
|
INTST: $`+o(x.intst),e+=`
|
|
|
|
Palette: `;for(var s=0;s<8;s++)e+=o(G[s]);return e+=`
|
2022-09-16 04:59:21 +00:00
|
|
|
`,e},this.connectVideo=function(x){L=x},this.loadROM=function(x){b=x},this.loadBIOS=function(x){O=x},this.getVisiblePixelWords=function(){return u*V}},T=class extends n0{constructor(F){super();this.cpuFrequency=1789e3;this.numTotalScanlines=262;this.sampleRate=60*262*a0;this.cpu=new t0,this.psg=new o0(new r0),this.audioadapter=new s0(this.psg.psg,a0,this.sampleRate),this.handler=F0(this.inputs,C0),this.defaultROMSize=F?45056:8192,this.ram=new Uint8Array(F?20480:4096),this.numVisibleScanlines=F?204:102,this.canvasWidth=F?320:160,this.cpuCyclesPerLine=this.cpuFrequency/(60*this.numVisibleScanlines*1.286)|0,this.m=new m0(F),this.m.init(this,this.cpu,this.ram,this.inputs,this.psg)}read(F){return this.m.membus.read(F)}write(F,r){this.m.membus.write(F,r)}connectVideo(F){super.connectVideo(F),this.frontbuffer=F,this.backbuffer=new Uint32Array(F.length),this.m.connectVideo(this.backbuffer)}preFrame(){this.m.resetWaitStates(0)}postFrame(){var F=this.m.getVisiblePixelWords();this.frontbuffer.set(this.backbuffer.slice(0,F),0),this.frontbuffer.fill(0,F)}setPaddleInput(F,r){switch(F){case 0:this.inputs[28]=r&255;break;case 1:this.inputs[29]=r&255;break}}startScanline(){this.audio&&this.audioadapter.generate(this.audio)}drawScanline(){var F=this.scanline;this.m.drawScanline(F)}advanceCPU(){var F=super.advanceCPU(),r=this.m.resetWaitStates(this.scanline);return r&&(F+=r,this.probe.logClocks(r)),F}loadROM(F){super.loadROM(F),this.m.loadROM(this.rom),this.reset()}loadBIOS(F){this.m.loadBIOS(Z(F,8192)),this.reset()}reset(){super.reset(),this.m.reset()}loadState(F){this.m.loadState(F)}saveState(){return this.m.saveState()}getDebugCategories(){return["CPU","Stack","Astro"]}getDebugInfo(F,r){switch(F){case"Astro":return this.m.toLongString(r)}}},o0=class extends i0{setACRegister(F,r){switch(F&=7,r&=255,F){case 0:this.psg.setClock(1789e3*16/(r+1)),this.psg.writeRegisterAY(7,7^255);break;case 1:case 2:case 3:var B=(F-1)*2,C=r*2+1;this.psg.writeRegisterAY(B,C&255),this.psg.writeRegisterAY(B+1,C>>8&255);break;case 5:this.psg.writeRegisterAY(10,r&15);break;case 6:this.psg.writeRegisterAY(8,r&15),this.psg.writeRegisterAY(9,r>>4&15);break}}};var J=[0,2368548,4737096,7171437,9539985,11974326,14342874,16777215,2425019,4784352,7213567,9582079,12016383,14384895,16753663,16762879,4784304,7143637,9568761,11937279,14306047,16740095,16749311,16758783,6946975,9306307,11731175,14096639,16465151,16736767,16745983,16755199,8847495,11206827,13631696,15994612,16724735,16733951,16743423,16752639,10420330,12779662,15138995,16713687,16723195,16732415,16741631,16751103,11534409,13959277,16318610,16713142,16722394,16731647,16741119,16750335,12255269,14680137,16711790,16713362,16722615,16732123,16741375,16750847,12517376,14876708,16711752,16714605,16724113,16733366,16742874,16752127,12255232,14680064,16711715,16716871,16726380,16735632,16745141,16754393,11534336,13959168,16318464,16720164,16729416,16738924,16748177,16757685,10420224,12779520,15141888,16723971,16733479,16742731,16752240,16761492,8847360,11206656,13639168,16007680,16738058,16747310,16756563,16766071,6946816,9309440,11743488,14112256,16480768,16752151,16761659,16770911,4784128,7151872,9585920,11954688,14323200,16757509,16766761,16776270,2429184,4797696,7232e3,9600512,12034816,14403328,16771870,16777027,9472,2377984,4746496,7180800,9549312,11983616,14352155,16777023,14080,23296,2326528,4695040,7129344,9497856,11927326,14286659,18176,27648,36864,2405376,4774144,7142661,9568041,11927374,21760,30976,40192,246272,2614784,4980503,7405371,9764703,24320,33536,43008,52224,716810,3079982,5504851,7864183,25856,35328,44544,53763,63271,1572683,3932016,6291348,26624,35840,45312,54564,63816,393068,2752401,5177269,26112,35584,44835,54343,63596,65424,2031541,4456409,24832,34084,43592,52845,62353,65462,1834970,4194302,22565,31817,41326,50578,60087,65499,2031615,4456447,19273,28781,38034,47542,56794,393215,2752511,5177343,15466,24718,34227,43479,52987,1569535,3932159,6291455,10887,20395,29648,38900,703743,3072255,5505023,7864319,6047,15299,24807,230655,2599167,4967935,7401983,9764863,688,10197,19449,2388223,4756735,712550
|
2023-04-22 18:41:16 +00:00
|
|
|
//# sourceMappingURL=astrocade-KAQ653HU.js.map
|