import{DasQ,dasl,easw,lasy}from"./chunk-2T5IQXGX.js";import{casE}from"./chunk-JM5NHRL4.js";import{I,Pasn,Sasu,Uasr,Wasb,XasB,Zasa,_asg,gaso,kasC,lasf,qasc}from"./chunk-VOKPYVET.js";import"./chunk-5XVCUSSZ.js";varp=[{id:"hello.xasm",name:"Hello World (ASM)"},{id:"hello.c",name:"Hello World (CMOC)"},{id:"joystick.c",name:"Joystick Test (CMOC)"},{id:"threed.c",name:"3D Transformations (CMOC)"}],d=B([[r.LEFT,0,1],[r.RIGHT,0,2],[r.DOWN,0,4],[r.UP,0,8],[r.GP_B,2,1],[r.GP_A,2,2],[r.GP_D,2,4],[r.GP_C,2,8],[r.P2_LEFT,1,1],[r.P2_RIGHT,1,2],[r.P2_DOWN,1,4],[r.P2_UP,1,8],[r.P2_GP_B,2,16],[r.P2_GP_A,2,32],[r.P2_GP_D,2,64],[r.P2_GP_C,2,128]]),D=class{constructor(t){this.ora=0;this.orb=0;this.ddra=0;this.ddrb=0;this.t1on=0;this.t1int=0;this.t1c=0;this.t1ll=0;this.t1lh=0;this.t1pb7=0;this.t2on=0;this.t2int=0;this.t2c=0;this.t2ll=0;this.sr=0;this.srb=0;this.src=0;this.srclk=0;this.acr=0;this.pcr=0;this.ifr=0;this.ier=0;this.ca2=0;this.cb2h=0;this.cb2s=0;this.vectrex=t}reset(){this.ora=0,this.orb=0,this.ddra=0,this.ddrb=0,this.t1on=0,this.t1int=0,this.t1c=0,this.t1ll=0,this.t1lh=0,this.t1pb7=128,this.t2on=0,this.t2int=0,this.t2c=0,this.t2ll=0,this.sr=0,this.srb=8,this.src=0,this.srclk=0,this.acr=0,this.pcr=0,this.ifr=0,this.ier=0,this.ca2=1,this.cb2h=1,this.cb2s=0}int_update(){this.ifr&127&(this.ier&127)?this.ifr|=128:this.ifr&=127}step0(){vart=0;if(this.t1on&&(this.t1c=this.t1c>0?this.t1c-1:65535,(this.t1c&65535)==65535&&(this.acr&64?(this.ifr|=64,this.int_update(),this.t1pb7^=128,this.t1c=this.t1lh<<8|this.t1ll):this.t1int&&(this.ifr|=64,this.int_update(),this.t1pb7=128,this.t1int=0))),this.t2on&&(this.acr&32)==0&&(this.t2c=this.t2c>0?this.t2c-1:65535,(this.t2c&65535)==65535&&this.t2int&&(this.ifr|=32,this.int_update(),this.t2int=0)),this.src=this.src>0?this.src-1:255,(this.src&255)==255?(this.src=this.t2ll,this.srclk?(t=1,this.srclk=0):(t=0,this.srclk=1)):t=0,this.srb<8){switch(this.acr&28){case0:break;case4:t&&(this.sr<<=1,this.srb++);break;case8:this.sr<<=1,this.srb++;break;case12:break;case16:t&&(this.cb2s=this.sr>>7&1,this.sr<<=1,this.sr|=this.cb2s);break;case20:t&&(this.cb2s=this.sr>>7&1,this.sr<<=1,this.sr|=this.cb2s,this.srb++);break;case24:this.cb2s=this.sr>>7&1,this.sr<<=1,this.sr|=this.cb2s,this.srb++;break;case28:break}this.srb==8&&(this.ifr|=4,this.int_update())}}step1(){(this.pcr&14)==10&&(this.ca2=1),(this.pcr&224)==160&&(this.cb2h=1)}read(t){vars;switch(t&15){case0:returnthis.acr&128?s=this.orb&95|this.t1pb7|this.vectrex.alg.compare:s=this.orb&223|this.vectrex.alg.compare,s&255;case1:(this.pcr&14)==8&&(this.ca2=0);case15:return(this.orb&24)==8?s=this.vectrex.psg.readData():s=this.ora,s&255;case2:returnthis.ddrb&255;case3:returnthis.ddra&255;case4:returns=this.t1c,this.ifr&=191,this.t1on=0,this.t1int=0,this.t1pb7=128,this.int_update(),s&255;case5:returnthis.t1c>>8&255;case6:returnthis.t1ll&255;case7:returnthis.t1lh&255;case8:returns=this.t2c,this.ifr&=223,this.t2on=0,this.t2int=0,this.int_update(),s&255;case9:returnthis.t2c>>8;case10:returns=this.sr,this.ifr&=251,this.srb=0,this.srclk=1,this.int_update(),s&255;case11:returnthis.acr&255;case12:returnthis.pcr&255;case13:returnthis.ifr&255;case14:return(this.ier|128)&255}}write(t,s){switch(t&15){case0:this.orb=s,this.vectrex.snd_update(),this.vectrex.alg.update(),(this.pcr&224)==128&&(this.cb2h=0);break;case1:(this.pcr&14)==8&&(this.ca2=0);case15:this.ora=s,this.vectrex.snd_update(),this.vectrex.alg.xsh=s^128,this.vectrex.alg.update();break;case2:this.ddrb=s;break;case3:this.ddra=s;break;case4:this.t1ll=s;break;case5:this.t1lh=s,this.t1c=this.t1lh<<8|this.t1ll,this.ifr&=191,this.t1on=1,this.t1int=1,this.t1pb7=0,this.int_update();break;case6:this.t1ll=s;break;case7:this.t1lh=s;break;case8:this.t2ll=s;break;case9:this.t2c=s<<8|this.t2ll,this.ifr&=223,this.t2on=1,this.t2int=1,this.int_update();break;case10:this.sr=s,this.ifr&=251,this.srb=0,this.srclk=1,this.int_update();break;case11:this.acr=s;break;case12:this.pcr=s,(this.pcr&14)==12?this.ca2=0:this.ca2=1,(this.pcr&224)==192?this.cb2h=0:thi