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

3 lines
4.7 KiB
JavaScript

import{I as c,o as x,t as F}from"./chunk-TV4YGKI4.js";import{$ as m,J as l,O as A,V as e,_ as p,g as _,k as I,l as h}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";var y=[e.VK_DELETE,e.VK_ENTER,e.VK_RIGHT,e.VK_F7,e.VK_F1,e.VK_F3,e.VK_F5,e.VK_DOWN,e.VK_3,e.VK_W,e.VK_A,e.VK_4,e.VK_Z,e.VK_S,e.VK_E,e.VK_SHIFT,e.VK_5,e.VK_R,e.VK_D,e.VK_6,e.VK_C,e.VK_F,e.VK_T,e.VK_X,e.VK_7,e.VK_Y,e.VK_G,e.VK_8,e.VK_B,e.VK_H,e.VK_U,e.VK_V,e.VK_9,e.VK_I,e.VK_J,e.VK_0,e.VK_M,e.VK_K,e.VK_O,e.VK_N,null,e.VK_P,e.VK_L,e.VK_MINUS,e.VK_PERIOD,null,null,e.VK_COMMA,null,null,e.VK_SEMICOLON,e.VK_HOME,e.VK_SHIFT,e.VK_EQUALS,e.VK_TILDE,e.VK_SLASH,e.VK_1,e.VK_LEFT,e.VK_CONTROL,e.VK_2,e.VK_SPACE,e.VK_ALT,e.VK_Q,null],a=0,u=class{constructor(){this.regs=new Uint8Array(16);this.ina=0;this.inb=0}read(r){return this.regs[r]}write(r,t){this.regs[r]=t}input_a(){return this.ina&~this.regs[1]}input_b(){return this.inb&~this.regs[1]}output_a(){return this.regs[0]^255|this.regs[1]}output_b(){return this.regs[2]^255|this.regs[3]}},f=class extends x{constructor(){super();this.cpuFrequency=1e6;this.defaultROMSize=4096;this.cpu=new F;this.ram=new Uint8Array(6144);this.rriot1=new u;this.rriot2=new u;this.digits=[];this.read=m([[5888,5951,15,r=>this.readIO_1(r)],[5952,6015,15,r=>this.readIO_2(r)],[0,6143,8191,r=>this.ram[r]],[6144,8191,2047,r=>this.bios[r]]],{gmask:8191});this.write=m([[5888,5951,15,(r,t)=>this.writeIO_1(r,t)],[5952,6015,15,(r,t)=>this.writeIO_2(r,t)],[0,6143,8191,(r,t)=>{this.ram[r]=t}]],{gmask:8191});this.bios=new I().decode(h(atob(B))),this.connectCPUMemoryBus(this)}readConst(r){return this.read(r)}readIO_1(r){return this.rriot1.read(r)}writeIO_1(r,t){this.rriot1.write(r,t)}readIO_2(r){switch(r&15){case 0:let t=0;for(let i=0;i<8;i++)(this.rriot2.regs[0]&1<<i)==0&&(t|=this.inputs[a+i]);this.rriot2.ina=t^255}return this.rriot2.read(r)}writeIO_2(r,t){this.rriot2.write(r,t);let i=this.rriot2.output_a(),s=this.rriot2.output_b();console.log(i,s)}loadROM(r){super.loadROM(r),this.ram.set(this.rom,1024),this.reset()}loadBIOS(r){this.bios=p(r,2048),this.reset()}setKeyInput(r,t,i){for(var s=y,o=0;o<s.length;o++)if(s[o]&&s[o].c==r){let n=o>>3,K=o&7;i&A.KeyDown?this.inputs[a+n]|=1<<K:i&A.KeyUp&&(this.inputs[a+n]&=~(1<<K)),console.log(r,n,K,_(this.inputs[a+n]));break}}advanceFrame(r){for(var t=0;t<this.cpuFrequency/60&&!(r&&r());)t+=this.advanceCPU();return t}},B="TFpHAAAIAAAABY3ivWkoAQsOJSiprY3sFyAyGaknjUIXqb+NQxeiZKkWIHoZytD4qSoo4a35FyBhGa31FyBeGa32KKPtF833F63uF+34F5AkqS8lXeclnegooqICqQQOBTgAhfqF+0xPHCDsJXAg6hlMMxgPGamNDgVrTI3vF61xGI3wF61yGI3xF6kHDgJ8/43pFyBBGk7pFw3pFyUErekXyRbQ7aIKICQaJQHfytD2JUIq8AYlBtHw8yDzGc35F/ANrfkXyQAlDf/wF9CcJQ0gTBmN7RcOBQHuF0z4GCXEKKSiAiV9L/AUIAAa0CPK0PElDEzsFw4CnCWhzecX0Awo4ugX0ASpAPACqf8OBcWt9ReN7Ret9heN7hepYI3vF6kAjecXjegXYKgY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jkEXoj+OQxeiB45CF9h4YKkghf6G/SUkrUIXKf4OInLUHqIIJYVG/mkAJcnK0O4lCgkBJcam/WCt8xeN9Bet8hc46QGwA870F6z0FxDzDggPSk70F5DjCYCw4KADogGp/45CF+joLUAXiND1oAeMQhcJgEn/YA4iXIX5qX+NQReiCaADufgADgPmSB8lAikPKOGI0OslMakAJRlM/h6E/Ki55x+gAIxAFyUOjUAXoH+I0P3o6KT8YOb60ALm+2CiIaABIAIf0AfgJ9D1qRVgoP8KsAPIEPqKKQ9KqpgQAxhpB8rQ+mAYZfeF96X2aQCF9mAgWh4grB8opKX4DqKkG8lHEBcOqaSgBCom+Cb5iA7iZWCl+IX6pfmF+2AAKAMKDU1JSyATUlJFIBO/htvP5u39h//v9/y53vnx////HBwiHB8c";var O=[{id:"hello.dasm",name:"Hello World (ASM)"}],V=class extends c{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:5120,type:"ram"},{name:"6530",start:5888,size:64,type:"io"},{name:"6530",start:5952,size:64,type:"io"},{name:"RAM",start:6016,size:128,type:"ram"},{name:"BIOS",start:6144,size:2048,type:"rom"}]}}}newMachine(){return new f}getPresets(){return O}getDefaultExtension(){return".dasm"}readAddress(r){return this.machine.readConst(r)}};l.kim1=V;
//# sourceMappingURL=kim1-2YBUUP2G.js.map