import{aasg}from"./chunk-NIPSYUTW.js";import{Gasp,qash,wasd,zasc}from"./chunk-5KW3VA4L.js";import"./chunk-5B4VPQ4V.js";import{Iaso,Nasr,Uasm,Xasl}from"./chunk-ZDSSTLWD.js";import"./chunk-5XVCUSSZ.js";varn=classextendsh{constructor(){super(...arguments);this.numTotalScanlines=312;this.cpuCyclesPerLine=63;this.joymask0=0;this.joymask1=0}loadROM(e){super.loadROM(e),this.reloadROM()}reloadROM(){if(this.sys){vare=this.exports.machine_load_rom(this.sys,this.romptr,this.romlen);console.log("machine_load_rom",e)}}loadBIOS(e){super.loadBIOS(e)}reset(){super.reset(),this.reloadROM()}advanceFrame(e){returnthis.exports.machine_start_frame(this.sys),e?this.advanceFrameClock(e,999999):this.exports.machine_advance_frame(this.sys),this.syncVideo(),this.syncAudio(),1}getCPUState(){this.exports.machine_save_cpu_state(this.sys,this.stateptr);vare=this.statearr,t=e[6]+(e[7]<<8);return{PC:t,SP:e[2],A:e[0],X:e[3],Y:e[4],C:e[1]&1,Z:e[1]&2,I:e[1]&4,D:e[1]&8,V:e[1]&64,N:e[1]&128,o:this.readConst(t)}}saveState(){vare=this.getCPUState();returnthis.exports.machine_save_state(this.sys,this.stateptr),{c:e,state:this.statearr.slice(0)}}loadState(e){this.statearr.set(e.state),this.exports.machine_load_state(this.sys,this.stateptr)}getVideoParams(){return{width:384,height:240,overscan:!0,videoFrequency:60}}pollControls(){}setKeyInput(e,t,i){i&r.Shift&&(e|=256),i&r.Ctrl&&(e|=512);vara=0;e==37&&(e=8,a=4),e==38&&(e=11,a=1),e==39&&(e=9,a=8),e==40&&(e=10,a=2),e==32&&(a=256),i&r.KeyDown?(this.exports.machine_key_down(this.sys,e),this.joymask0|=a):i&r.KeyUp&&(this.exports.machine_key_up(this.sys,e),this.joymask0&=~a),this.setJoyInput(0,this.joymask0),this.setJoyInput(1,this.joymask1)}setJoyInput(e,t){this.exports.machine_joy_set(this.sys,e,t)}setPaddleInput(e,t){this.exports.machine_paddle_set(this.sys,e,t)}};varx=[{id:"hello.dasm",name:"Hello World (ASM)"},{id:"hellopm.dasm",name:"Hello Sprites (ASM)"},{id:"helloconio.c",name:"Text Mode (C)"},{id:"siegegame.c",name:"Siege Game (C)"},{id:"hellodlist.c",name:"Display List (C)"}],B=x.concat([{id:"sieve.bas",name:"Benchmark (FastBasic)"},{id:"pmtest.bas",name:"Sprites Test (FastBasic)"},{id:"dli.bas",name:"DLI Test (FastBasic)"},{id:"joyas.bas",name:"Match-3 Game (FastBasic)"}]),Z=l([[m.VK_SPACE,0,0],[m.VK_ENTER,0,0]]),f={main:[{name:"RAM",start:0,size:65536,type:"ram"},{name:"Left Cartridge ROM",start:40960,size:8192,type:"rom"},{name:"GTIA",start:53248,size:32,type:"io"},{name:"POKEY",start:53760,size:16,type:"io"},{name:"PIA",start:54016,size:4,type:"io"},{name:"ANTIC",start:54272,size:16,type:"io"},{name:"Cartridge Control Line",start:54784,size:256,type:"io"},{name:"ROM",start:55296,size:2048,type:"rom"},{name:"ATARI Character Set",start:57344,size:1024,type:"rom"},{name:"ROM",start:58368,size:7168,type:"rom"}]};functionu(s){returns.endsWith(".bas")||s.endsWith(".fb")||s.endsWith(".fbi")?"fastbasic":d(s)}varA=classextendsg{constructor(){super(...arguments);this.getToolForFilename=u;this.getOpcodeMetadata=c}getPresets(){returnx}getDefaultExtension(){return".asm"}showHelp(e,t){e=="fastbasic"?window.open("https://github.com/dmsc/fastbasic/blob/master/manual.md","_help"):window.open("https://atariwiki.org/wiki/Wiki.jsp?page=Assembler","_help")}};varM=classextendsA{constructor(){super(...arguments);this.getMemoryMap=function(){returnf}}getPresets(){returnB}loadROM(e,t){this.started?(this.loadROMFile(t),this.loadRegion(":cartleft:cart:rom",t)):this.startModule(this.mainElement,{jsfile:"mame8bitws.js",biosfile:"a800xl.zip",cfgfile:"a800xl.cfg",driver:"a800xl",width:336*2,height:225*2,romfn:"/emulator/cart.rom",romdata:newUint8Array(t),romsize:8192,preInit:function(i){}})}start(){}},y=classextendsA{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"Cartridge ROM",start:16384,size:32768,type:"rom"},{name:"GTIA",start:49152,size:32,type:"io"},{name:"ANTIC",start:54272,size:16,type:"io"},{name:"POKEY",start:59392,size:16,type:"io"},{name:"ATARI Character Set",start:63488,size:1024,type:"rom"},{name:"ROM