From 89d6e203bb3dcc8e34be3c30bad06c6676f96668 Mon Sep 17 00:00:00 2001 From: Owen Ryan Date: Wed, 25 Sep 2024 02:22:48 +0100 Subject: [PATCH] Add DOOM --- source/_data/social-media.yml | 2 +- source/doom/bios/seabios.bin | Bin 0 -> 131072 bytes source/doom/build/libv86.js | 837 +++++++++++++++++++++++++++++++++ source/doom/build/v86.wasm | Bin 0 -> 1138733 bytes source/doom/kernel/bzImage | Bin 0 -> 8059936 bytes source/doom/kernel/rootfs.cpio | Bin 0 -> 22300672 bytes 6 files changed, 838 insertions(+), 1 deletion(-) create mode 100644 source/doom/bios/seabios.bin create mode 100644 source/doom/build/libv86.js create mode 100644 source/doom/build/v86.wasm create mode 100644 source/doom/kernel/bzImage create mode 100644 source/doom/kernel/rootfs.cpio diff --git a/source/_data/social-media.yml b/source/_data/social-media.yml index 698e7e2..5390b97 100644 --- a/source/_data/social-media.yml +++ b/source/_data/social-media.yml @@ -19,7 +19,7 @@ links: color-primary: 0077B5 # No clue what to put here to I'm linking to my doom page lmao - name: DOOM - url: https://owenryan.us/doom + url: /doom style: fa-classes: [ fa-solid, fa-spaghetti-monster-flying ] color-primary: A72626 diff --git a/source/doom/bios/seabios.bin b/source/doom/bios/seabios.bin new file mode 100644 index 0000000000000000000000000000000000000000..8c9ab8ffea3b4e4d5fbbbe63a43ceaf2dcb501c7 GIT binary patch literal 131072 zcmeFadwf*Y)i-`-<|LVfA!mRA0|Xg#)S$6uEGm&;hYXh}sDW?^7Xe$EBG8I311N|S zPX=e_cr2~jx3;zwQ6FlprMFy0#awU(uwn?05TR;B3wt=A5iEqD%==yY%y7{@zu)`s z`+lMya`tuYz1LoQ?X}ikdygdb{@06vUJUeNpcezZ80f`7F9v!s(2Idy4D@247X!T* z=*2)U26{2ji-BGY^kSeF1HBmN#Xv6xdNI(8fnE&sVxSiTy%^}lKraS*G0=;FUJUeN zpcezZ80f`7F9v!s(2Idy4D@247X!T*=*2)U26{2ji-BGY^kSeF1HBmN#Xv6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6BtR6!rjQX?u2pTtRdSqA! z?97&UB}58@xfA>X63zpM7e@_1hc)t}jrQZNPhwucrR2qi<;1yfptvR5jg>J$X_y!s zwwy2lTPcl!0C+qEIE)|PFy}enXa60}h3V7Tg91Er&YX|Q<@KX>yB&HYfFO-yN~QFr zOi`WS8|pK0Q4elHYPRB4W>xMx1O0wOP7>-E$zlTc;5?czKqlzvO4oB`mj+68}KbRiXzw2`8mLc?Bf;`YB+yR=f$1*5|{J)94}tOrJNto3qtBm)dxNx z0WOXQ2_C8FBl8^c^N_FOc*KP_j*gJW4aD@&o&o&SWkU0YBRs=Ly>=W2!3&jgsaT)q~o|%33>(1>+&0vGXT;qFrcernJ%K382~@w5@>wPC!!Wg z%m_8U352UsHwe-8f%2rEOZa}Eq`~B|qy5%gsh|^Pgwsi@U>m%r`FuL(J7{->L z-bGsYl}DR^f8j1hBUTGSmk4VzPV(?5yO&9G1$x z4|eaAhSthRzHhN-r}!CnUi%jWycP1r<#KFl1|ra(FYzzr?EgGM#w83Q7?b{B@WXKs zwqAG~?WrH{6tUW^-1-yb{@vQwn!+4Q-)r`&d}fAZ49$=ff@~oO^XFT~rM}-x<`>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE? +$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("globalThis",function(a){return a||$jscomp.global},"es_2020","es3");$jscomp.polyfill("String.prototype.trimRight",function(a){function b(){return this.replace(/[\s\xa0]+$/,"")}return a||b},"es_2019","es3");$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return bG;G++)J=126G?D[G]:G,I[G]=String.fromCharCode(J);g.imageSmoothingEnabled=!1;k.style.position="absolute";k.style.backgroundColor="#ccc";k.style.width="7px";k.style.display="inline-block";f.style.display="block";e.style.display="none";this.bus=b;b.register("screen-set-mode",function(x){this.set_mode(x)},this);b.register("screen-fill-buffer-end",function(x){this.update_buffer(x)}, +this);b.register("screen-put-char",function(x){this.put_char(x[0],x[1],x[2],x[3],x[4])},this);b.register("screen-update-cursor",function(x){this.update_cursor(x[0],x[1])},this);b.register("screen-update-cursor-scanline",function(x){this.update_cursor_scanline(x[0],x[1])},this);b.register("screen-clear",function(){this.clear_screen()},this);b.register("screen-set-size-text",function(x){this.set_size_text(x[0],x[1])},this);b.register("screen-set-size-graphical",function(x){this.set_size_graphical(x[0], +x[1],x[2],x[3])},this);this.init=function(){this.set_size_text(80,25);this.timer()};this.make_screenshot=function(){const x=new Image;if(t)x.src=e.toDataURL("image/png");else{const y=[9,16],B=document.createElement("canvas");B.width=u*y[0];B.height=w*y[1];const A=B.getContext("2d");A.imageSmoothingEnabled=!1;A.font=window.getComputedStyle(f).font;A.textBaseline="top";for(let E=0;EB),v[y]=B,v[y+1]=A,v[y+2]=E,q[x]=1)};this.timer=function(){z||requestAnimationFrame(t?N:O)};var O=function(){for(var x=0;xy;)f.removeChild(f.firstChild);for(;f.childNodes.length=x&&2*x{g.strokeRect(y.buffer_x,y.buffer_y,y.buffer_width,y.buffer_height)}),g.lineWidth=1):x.forEach(y=>{g.putImageData(y.image_data,y.screen_x-y.buffer_x,y.screen_y-y.buffer_y,y.buffer_x,y.buffer_y,y.buffer_width,y.buffer_height)})};this.init()};const VIRTIO_9P_F_MOUNT_TAG=0,VIRTIO_9P_MAX_TAGLEN=254; +var EPERM=1,ENOENT=2,EEXIST=17,EINVAL=22,EOPNOTSUPP=95,ENOTEMPTY=39,EPROTO=71,P9_SETATTR_MODE=1,P9_SETATTR_UID=2,P9_SETATTR_GID=4,P9_SETATTR_SIZE=8,P9_SETATTR_ATIME=16,P9_SETATTR_MTIME=32,P9_SETATTR_CTIME=64,P9_SETATTR_ATIME_SET=128,P9_SETATTR_MTIME_SET=256,P9_STAT_MODE_DIR=2147483648,P9_STAT_MODE_APPEND=1073741824,P9_STAT_MODE_EXCL=536870912,P9_STAT_MODE_MOUNT=268435456,P9_STAT_MODE_AUTH=134217728,P9_STAT_MODE_TMP=67108864,P9_STAT_MODE_SYMLINK=33554432,P9_STAT_MODE_LINK=16777216,P9_STAT_MODE_DEVICE= +8388608,P9_STAT_MODE_NAMED_PIPE=2097152,P9_STAT_MODE_SOCKET=1048576,P9_STAT_MODE_SETUID=524288,P9_STAT_MODE_SETGID=262144,P9_STAT_MODE_SETVTX=65536;const P9_LOCK_TYPE_RDLCK=0,P9_LOCK_TYPE_WRLCK=1,P9_LOCK_TYPE_UNLCK=2,P9_LOCK_TYPES=Object.freeze(["shared","exclusive","unlock"]),P9_LOCK_FLAGS_BLOCK=1,P9_LOCK_FLAGS_RECLAIM=2,P9_LOCK_SUCCESS=0,P9_LOCK_BLOCKED=1,P9_LOCK_ERROR=2,P9_LOCK_GRACE=3;var FID_NONE=-1,FID_INODE=1,FID_XATTR=2; +function Virtio9p(a,b,c){this.fs=a;this.bus=c;this.configspace_tagname=[104,111,115,116,57,112];this.configspace_taglen=this.configspace_tagname.length;this.VERSION="9P2000.L";this.msize=this.BLOCKSIZE=8192;this.replybuffer=new Uint8Array(2*this.msize);this.replybuffersize=0;this.fids=[];this.virtio=new VirtIO(b,{name:"virtio-9p",pci_id:48,device_id:4169,subsystem_device_id:9,common:{initial_port:43008,queues:[{size_supported:32,notify_offset:0}],features:[VIRTIO_9P_F_MOUNT_TAG,VIRTIO_F_VERSION_1, +VIRTIO_F_RING_EVENT_IDX,VIRTIO_F_RING_INDIRECT_DESC],on_driver_ok:()=>{}},notification:{initial_port:43264,single_handler:!1,handlers:[d=>{if(0!==d)dbg_assert(!1,"Virtio9P Notified for non-existent queue: "+d+" (expected queue_id of 0)");else{for(;this.virtqueue.has_request();)d=this.virtqueue.pop_request(),this.ReceiveRequest(d);this.virtqueue.notify_me_after(0)}}]},isr_status:{initial_port:42752},device_specific:{initial_port:42496,struct:[{bytes:2,name:"mount tag length",read:()=>this.configspace_taglen, +write:d=>{}}].concat(v86util.range(VIRTIO_9P_MAX_TAGLEN).map(d=>({bytes:1,name:"mount tag name "+d,read:()=>this.configspace_tagname[d]||0,write:e=>{}})))}});this.virtqueue=this.virtio.queues[0]} +Virtio9p.prototype.get_state=function(){var a=[];a[0]=this.configspace_tagname;a[1]=this.configspace_taglen;a[2]=this.virtio;a[3]=this.VERSION;a[4]=this.BLOCKSIZE;a[5]=this.msize;a[6]=this.replybuffer;a[7]=this.replybuffersize;a[8]=this.fids.map(function(b){return[b.inodeid,b.type,b.uid,b.dbg_name]});a[9]=this.fs;return a}; +Virtio9p.prototype.set_state=function(a){this.configspace_tagname=a[0];this.configspace_taglen=a[1];this.virtio.set_state(a[2]);this.virtqueue=this.virtio.queues[0];this.VERSION=a[3];this.BLOCKSIZE=a[4];this.msize=a[5];this.replybuffer=a[6];this.replybuffersize=a[7];this.fids=a[8].map(function(b){return{inodeid:b[0],type:b[1],uid:b[2],dbg_name:b[3]}});this.fs.set_state(a[9])};Virtio9p.prototype.Createfid=function(a,b,c,d){return{inodeid:a,type:b,uid:c,dbg_name:d}}; +Virtio9p.prototype.update_dbg_name=function(a,b){for(const c of this.fids)c.inodeid===a&&(c.dbg_name=b)};Virtio9p.prototype.Reset=function(){this.fids=[]};Virtio9p.prototype.BuildReply=function(a,b,c){dbg_assert(0<=c,"9P: Negative payload size");marshall.Marshall(["w","b","h"],[c+7,a+1,b],this.replybuffer,0);c+7>=this.replybuffer.length&&message.Debug("Error in 9p: payloadsize exceeds maximum length");this.replybuffersize=c+7}; +Virtio9p.prototype.SendError=function(a,b,c){b=marshall.Marshall(["w"],[c],this.replybuffer,7);this.BuildReply(6,a,b)};Virtio9p.prototype.SendReply=function(a){dbg_assert(0<=this.replybuffersize,"9P: Negative replybuffersize");a.set_next_blob(this.replybuffer.subarray(0,this.replybuffersize));this.virtqueue.push_reply(a);this.virtqueue.flush_replies()}; +Virtio9p.prototype.ReceiveRequest=async function(a){var b=new Uint8Array(a.length_readable);a.get_next_blob(b);var c={offset:0},d=marshall.Unmarshall(["w","b","h"],b,c),e=d[0],g=d[1],f=d[2];switch(g){case 8:e=this.fs.GetTotalSize();b=this.fs.GetSpace();d=[16914839];d[1]=this.BLOCKSIZE;d[2]=Math.floor(b/d[1]);d[3]=d[2]-Math.floor(e/d[1]);d[4]=d[2]-Math.floor(e/d[1]);d[5]=this.fs.CountUsedInodes();d[6]=this.fs.CountFreeInodes();d[7]=0;d[8]=256;e=marshall.Marshall("wwddddddw".split(""),d,this.replybuffer, +7);this.BuildReply(g,f,e);this.SendReply(a);break;case 112:case 12:d=marshall.Unmarshall(["w","w"],b,c);var k=d[0];c=d[1];message.Debug("[open] fid="+k+", mode="+c);b=this.fids[k].inodeid;var m=this.fs.GetInode(b);message.Debug("file open "+this.fids[k].dbg_name);d=this.fs.OpenInode(b,c);this.fs.AddEvent(this.fids[k].inodeid,function(){message.Debug("file opened "+this.fids[k].dbg_name+" tag:"+f);var r=[];r[0]=m.qid;r[1]=this.msize-24;marshall.Marshall(["Q","w"],r,this.replybuffer,7);this.BuildReply(g, +f,17);this.SendReply(a)}.bind(this));break;case 70:d=marshall.Unmarshall(["w","w","s"],b,c);b=d[0];k=d[1];e=d[2];message.Debug("[link] dfid="+b+", name="+e);d=this.fs.Link(this.fids[b].inodeid,this.fids[k].inodeid,e);if(0>d){e="";d===-EPERM?e="Operation not permitted":(e="Unknown error: "+-d,dbg_assert(!1,"[link]: Unexpected error code: "+-d));this.SendError(f,e,-d);this.SendReply(a);break}this.BuildReply(g,f,0);this.SendReply(a);break;case 16:d=marshall.Unmarshall(["w","s","s","w"],b,c);k=d[0];e= +d[1];b=d[2];d=d[3];message.Debug("[symlink] fid="+k+", name="+e+", symgt="+b+", gid="+d);b=this.fs.CreateSymlink(e,this.fids[k].inodeid,b);m=this.fs.GetInode(b);m.uid=this.fids[k].uid;m.gid=d;marshall.Marshall(["Q"],[m.qid],this.replybuffer,7);this.BuildReply(g,f,13);this.SendReply(a);break;case 18:d=marshall.Unmarshall("wswwww".split(""),b,c);k=d[0];e=d[1];c=d[2];b=d[3];var l=d[4];d=d[5];message.Debug("[mknod] fid="+k+", name="+e+", major="+b+", minor="+l);b=this.fs.CreateNode(e,this.fids[k].inodeid, +b,l);m=this.fs.GetInode(b);m.mode=c;m.uid=this.fids[k].uid;m.gid=d;marshall.Marshall(["Q"],[m.qid],this.replybuffer,7);this.BuildReply(g,f,13);this.SendReply(a);break;case 22:d=marshall.Unmarshall(["w"],b,c);k=d[0];m=this.fs.GetInode(this.fids[k].inodeid);message.Debug("[readlink] fid="+k+" name="+this.fids[k].dbg_name+" target="+m.symlink);e=marshall.Marshall(["s"],[m.symlink],this.replybuffer,7);this.BuildReply(g,f,e);this.SendReply(a);break;case 72:d=marshall.Unmarshall(["w","s","w","w"],b,c); +k=d[0];e=d[1];c=d[2];d=d[3];message.Debug("[mkdir] fid="+k+", name="+e+", mode="+c+", gid="+d);b=this.fs.CreateDirectory(e,this.fids[k].inodeid);m=this.fs.GetInode(b);m.mode=c|S_IFDIR;m.uid=this.fids[k].uid;m.gid=d;marshall.Marshall(["Q"],[m.qid],this.replybuffer,7);this.BuildReply(g,f,13);this.SendReply(a);break;case 14:d=marshall.Unmarshall(["w","s","w","w","w"],b,c);k=d[0];e=d[1];b=d[2];c=d[3];d=d[4];this.bus.send("9p-create",[e,this.fids[k].inodeid]);message.Debug("[create] fid="+k+", name="+ +e+", flags="+b+", mode="+c+", gid="+d);b=this.fs.CreateFile(e,this.fids[k].inodeid);this.fids[k].inodeid=b;this.fids[k].type=FID_INODE;this.fids[k].dbg_name=e;m=this.fs.GetInode(b);m.uid=this.fids[k].uid;m.gid=d;m.mode=c;marshall.Marshall(["Q","w"],[m.qid,this.msize-24],this.replybuffer,7);this.BuildReply(g,f,17);this.SendReply(a);break;case 52:d=marshall.Unmarshall("wbwddws".split(""),b,c);k=d[0];b=d[2];e=0===d[4]?Infinity:d[4];e=this.fs.DescribeLock(d[1],d[3],e,d[5],d[6]);message.Debug("[lock] fid="+ +k+", type="+P9_LOCK_TYPES[e.type]+", start="+e.start+", length="+e.length+", proc_id="+e.proc_id);d=this.fs.Lock(this.fids[k].inodeid,e,b);marshall.Marshall(["b"],[d],this.replybuffer,7);this.BuildReply(g,f,1);this.SendReply(a);break;case 54:d=marshall.Unmarshall("wbddws".split(""),b,c);k=d[0];e=0===d[3]?Infinity:d[3];e=this.fs.DescribeLock(d[1],d[2],e,d[4],d[5]);message.Debug("[getlock] fid="+k+", type="+P9_LOCK_TYPES[e.type]+", start="+e.start+", length="+e.length+", proc_id="+e.proc_id);d=this.fs.GetLock(this.fids[k].inodeid, +e);d||(d=e,d.type=P9_LOCK_TYPE_UNLCK);e=marshall.Marshall(["b","d","d","w","s"],[d.type,d.start,Infinity===d.length?0:d.length,d.proc_id,d.client_id],this.replybuffer,7);this.BuildReply(g,f,e);this.SendReply(a);break;case 24:d=marshall.Unmarshall(["w","d"],b,c);k=d[0];m=this.fs.GetInode(this.fids[k].inodeid);message.Debug("[getattr]: fid="+k+" name="+this.fids[k].dbg_name+" request mask="+d[1]);if(!m||m.status===STATUS_UNLINKED){message.Debug("getattr: unlinked");this.SendError(f,"No such file or directory", +ENOENT);this.SendReply(a);break}d[0]|=4096;d[0]=d[1];d[1]=m.qid;d[2]=m.mode;d[3]=m.uid;d[4]=m.gid;d[5]=m.nlinks;d[6]=m.major<<8|m.minor;d[7]=m.size;d[8]=this.BLOCKSIZE;d[9]=Math.floor(m.size/512+1);d[10]=m.atime;d[11]=0;d[12]=m.mtime;d[13]=0;d[14]=m.ctime;d[15]=0;d[16]=0;d[17]=0;d[18]=0;d[19]=0;marshall.Marshall("dQwwwddddddddddddddd".split(""),d,this.replybuffer,7);this.BuildReply(g,f,153);this.SendReply(a);break;case 26:d=marshall.Unmarshall("wwwwwddddd".split(""),b,c);k=d[0];m=this.fs.GetInode(this.fids[k].inodeid); +message.Debug("[setattr]: fid="+k+" request mask="+d[1]+" name="+this.fids[k].dbg_name);d[1]&P9_SETATTR_MODE&&(m.mode=d[2]);d[1]&P9_SETATTR_UID&&(m.uid=d[3]);d[1]&P9_SETATTR_GID&&(m.gid=d[4]);d[1]&P9_SETATTR_ATIME&&(m.atime=Math.floor((new Date).getTime()/1E3));d[1]&P9_SETATTR_MTIME&&(m.mtime=Math.floor((new Date).getTime()/1E3));d[1]&P9_SETATTR_CTIME&&(m.ctime=Math.floor((new Date).getTime()/1E3));d[1]&P9_SETATTR_ATIME_SET&&(m.atime=d[6]);d[1]&P9_SETATTR_MTIME_SET&&(m.mtime=d[8]);d[1]&P9_SETATTR_SIZE&& +await this.fs.ChangeSize(this.fids[k].inodeid,d[5]);this.BuildReply(g,f,0);this.SendReply(a);break;case 50:d=marshall.Unmarshall(["w","d"],b,c);k=d[0];this.BuildReply(g,f,0);this.SendReply(a);break;case 40:case 116:d=marshall.Unmarshall(["w","d","w"],b,c);k=d[0];e=d[1];l=d[2];m=this.fs.GetInode(this.fids[k].inodeid);40==g&&message.Debug("[treaddir]: fid="+k+" offset="+e+" count="+l);116==g&&message.Debug("[read]: fid="+k+" ("+this.fids[k].dbg_name+") offset="+e+" count="+l+" fidtype="+this.fids[k].type); +if(!m||m.status===STATUS_UNLINKED){message.Debug("read/treaddir: unlinked");this.SendError(f,"No such file or directory",ENOENT);this.SendReply(a);break}if(this.fids[k].type==FID_XATTR)for(m.caps.lengthm.size&&(l=0),this.bus.send("9p-read-start", +[this.fids[k].dbg_name]),d=await this.fs.Read(d,e,l),this.bus.send("9p-read-end",[this.fids[k].dbg_name,l]),d&&this.replybuffer.set(d,11);marshall.Marshall(["w"],[l],this.replybuffer,7);this.BuildReply(g,f,4+l);this.SendReply(a);break;case 118:d=marshall.Unmarshall(["w","d","w"],b,c);k=d[0];e=d[1];l=d[2];d=this.fids[k].dbg_name;message.Debug("[write]: fid="+k+" ("+d+") offset="+e+" count="+l+" fidtype="+this.fids[k].type);if(this.fids[k].type===FID_XATTR){this.SendError(f,"Setxattr not supported", +EOPNOTSUPP);this.SendReply(a);break}else await this.fs.Write(this.fids[k].inodeid,e,l,b.subarray(c.offset));this.bus.send("9p-write-end",[d,l]);marshall.Marshall(["w"],[l],this.replybuffer,7);this.BuildReply(g,f,4);this.SendReply(a);break;case 74:d=marshall.Unmarshall(["w","s","w","s"],b,c);c=d[0];l=d[1];e=d[2];b=d[3];message.Debug("[renameat]: oldname="+l+" newname="+b);d=await this.fs.Rename(this.fids[c].inodeid,l,this.fids[e].inodeid,b);if(0>d){e="";d===-ENOENT?e="No such file or directory":d=== +-EPERM?e="Operation not permitted":d===-ENOTEMPTY?e="Directory not empty":(e="Unknown error: "+-d,dbg_assert(!1,"[renameat]: Unexpected error code: "+-d));this.SendError(f,e,-d);this.SendReply(a);break}TRACK_FILENAMES&&(d=this.fs.Search(this.fids[e].inodeid,b),this.update_dbg_name(d,b));this.BuildReply(g,f,0);this.SendReply(a);break;case 76:d=marshall.Unmarshall(["w","s","w"],b,c);c=d[0];e=d[1];b=d[2];message.Debug("[unlink]: dirfd="+c+" name="+e+" flags="+b);k=this.fs.Search(this.fids[c].inodeid, +e);if(-1==k){this.SendError(f,"No such file or directory",ENOENT);this.SendReply(a);break}d=this.fs.Unlink(this.fids[c].inodeid,e);if(0>d){e="";d===-ENOTEMPTY?e="Directory not empty":d===-EPERM?e="Operation not permitted":(e="Unknown error: "+-d,dbg_assert(!1,"[unlink]: Unexpected error code: "+-d));this.SendError(f,e,-d);this.SendReply(a);break}this.BuildReply(g,f,0);this.SendReply(a);break;case 100:d=marshall.Unmarshall(["w","s"],b,c);message.Debug("[version]: msize="+d[0]+" version="+d[1]);this.msize= +d[0];e=marshall.Marshall(["w","s"],[this.msize,this.VERSION],this.replybuffer,7);this.BuildReply(g,f,e);this.SendReply(a);break;case 104:d=marshall.Unmarshall(["w","w","s","s","w"],b,c);k=d[0];e=d[4];message.Debug("[attach]: fid="+k+" afid="+hex8(d[1])+" uname="+d[2]+" aname="+d[3]);this.fids[k]=this.Createfid(0,FID_INODE,e,"");m=this.fs.GetInode(this.fids[k].inodeid);marshall.Marshall(["Q"],[m.qid],this.replybuffer,7);this.BuildReply(g,f,13);this.SendReply(a);this.bus.send("9p-attach");break;case 108:d= +marshall.Unmarshall(["h"],b,c);message.Debug("[flush] "+f);this.BuildReply(g,f,0);this.SendReply(a);break;case 110:d=marshall.Unmarshall(["w","w","h"],b,c);k=d[0];l=d[1];var n=d[2];message.Debug("[walk]: fid="+d[0]+" nwfid="+d[1]+" nwname="+n);if(0==n){this.fids[l]=this.Createfid(this.fids[k].inodeid,FID_INODE,this.fids[k].uid,this.fids[k].dbg_name);marshall.Marshall(["h"],[0],this.replybuffer,7);this.BuildReply(g,f,2);this.SendReply(a);break}e=[];for(d=0;db;b++)this.ports[b]=this.create_empty_entry();var c=a.memory_size[0];for(b=0;b<>>32-f|0};c||(c=g.bind(this,8));d||(d=g.bind(this,16));e||(e=g.bind(this,32))}c&&(this.ports[a].read8=c);d&&(this.ports[a].read16=d);e&&(this.ports[a].read32= +e);this.ports[a].device=b}; +IO.prototype.register_write=function(a,b,c,d,e){dbg_assert("number"===typeof a);dbg_assert("object"===typeof b);dbg_assert(!c||"function"===typeof c);dbg_assert(!d||"function"===typeof d);dbg_assert(!e||"function"===typeof e);dbg_assert(c||d||e);if(DEBUG){var g=function(f){dbg_assert(!1,"Overlapped write"+f+" "+h(a)+" ("+b.name+")")};c||(c=g.bind(this,8));d||(d=g.bind(this,16));e||(e=g.bind(this,32))}c&&(this.ports[a].write8=c);d&&(this.ports[a].write16=d);e&&(this.ports[a].write32=e);this.ports[a].device= +b};IO.prototype.register_read_consecutive=function(a,b,c,d,e,g){function f(){return c.call(this)|d.call(this)<<8}function k(){return e.call(this)|g.call(this)<<8}function m(){return c.call(this)|d.call(this)<<8|e.call(this)<<16|g.call(this)<<24}dbg_assert(4===arguments.length||6===arguments.length);e&&g?(this.register_read(a,b,c,f,m),this.register_read(a+1,b,d),this.register_read(a+2,b,e,k),this.register_read(a+3,b,g)):(this.register_read(a,b,c,f),this.register_read(a+1,b,d))}; +IO.prototype.register_write_consecutive=function(a,b,c,d,e,g){function f(l){c.call(this,l&255);d.call(this,l>>8&255)}function k(l){e.call(this,l&255);g.call(this,l>>8&255)}function m(l){c.call(this,l&255);d.call(this,l>>8&255);e.call(this,l>>16&255);g.call(this,l>>>24)}dbg_assert(4===arguments.length||6===arguments.length);e&&g?(this.register_write(a,b,c,f,m),this.register_write(a+1,b,d),this.register_write(a+2,b,e,k),this.register_write(a+3,b,g)):(this.register_write(a,b,c,f),this.register_write(a+ +1,b,d))};IO.prototype.mmap_read32_shim=function(a){var b=this.cpu.memory_map_read8[a>>>MMAP_BLOCK_BITS];return b(a)|b(a+1)<<8|b(a+2)<<16|b(a+3)<<24};IO.prototype.mmap_write32_shim=function(a,b){var c=this.cpu.memory_map_write8[a>>>MMAP_BLOCK_BITS];c(a,b&255);c(a+1,b>>8&255);c(a+2,b>>16&255);c(a+3,b>>>24)}; +IO.prototype.mmap_register=function(a,b,c,d,e,g){dbg_log("mmap_register addr="+h(a>>>0,8)+" size="+h(b,8),LOG_IO);dbg_assert(0===(a&MMAP_BLOCK_SIZE-1));dbg_assert(b&&0===(b&MMAP_BLOCK_SIZE-1));e||(e=this.mmap_read32_shim.bind(this));g||(g=this.mmap_write32_shim.bind(this));for(a>>>=MMAP_BLOCK_BITS;0>>0,8)+this.get_port_description(a),LOG_IO);return c.write32.call(c.device,b)}; +IO.prototype.port_read8=function(a){var b=this.ports[a];(b.read8===this.empty_port_read8||LOG_ALL_IO)&&dbg_log("read8 port #"+h(a,4)+this.get_port_description(a),LOG_IO);b=b.read8.call(b.device);dbg_assert("number"===typeof b);dbg_assert(256>b&&0<=b,"8 bit port returned large value: "+h(a));return b}; +IO.prototype.port_read16=function(a){var b=this.ports[a];(b.read16===this.empty_port_read16||LOG_ALL_IO)&&dbg_log("read16 port #"+h(a,4)+this.get_port_description(a),LOG_IO);b=b.read16.call(b.device);dbg_assert("number"===typeof b);dbg_assert(65536>b&&0<=b,"16 bit port returned large value: "+h(a));return b}; +IO.prototype.port_read32=function(a){var b=this.ports[a];(b.read32===this.empty_port_read32||LOG_ALL_IO)&&dbg_log("read32 port #"+h(a,4)+this.get_port_description(a),LOG_IO);a=b.read32.call(b.device);dbg_assert((a|0)===a);return a}; +var debug_port_list={4:"PORT_DMA_ADDR_2",5:"PORT_DMA_CNT_2",10:"PORT_DMA1_MASK_REG",11:"PORT_DMA1_MODE_REG",12:"PORT_DMA1_CLEAR_FF_REG",13:"PORT_DMA1_MASTER_CLEAR",32:"PORT_PIC1_CMD",33:"PORT_PIC1_DATA",64:"PORT_PIT_COUNTER0",65:"PORT_PIT_COUNTER1",66:"PORT_PIT_COUNTER2",67:"PORT_PIT_MODE",96:"PORT_PS2_DATA",97:"PORT_PS2_CTRLB",100:"PORT_PS2_STATUS",112:"PORT_CMOS_INDEX",113:"PORT_CMOS_DATA",128:"PORT_DIAG",129:"PORT_DMA_PAGE_2",146:"PORT_A20",160:"PORT_PIC2_CMD",161:"PORT_PIC2_DATA",178:"PORT_SMI_CMD", +179:"PORT_SMI_STATUS",212:"PORT_DMA2_MASK_REG",214:"PORT_DMA2_MODE_REG",218:"PORT_DMA2_MASTER_CLEAR",240:"PORT_MATH_CLEAR",368:"PORT_ATA2_CMD_BASE",496:"PORT_ATA1_CMD_BASE",632:"PORT_LPT2",744:"PORT_SERIAL4",760:"PORT_SERIAL2",884:"PORT_ATA2_CTRL_BASE",888:"PORT_LPT1",1E3:"PORT_SERIAL3",1008:"PORT_FD_BASE",1010:"PORT_FD_DOR",1012:"PORT_FD_STATUS",1013:"PORT_FD_DATA",1014:"PORT_HD_DATA",1015:"PORT_FD_DIR",1016:"PORT_SERIAL1",3320:"PORT_PCI_CMD",3321:"PORT_PCI_REBOOT",3324:"PORT_PCI_DATA",1026:"PORT_BIOS_DEBUG", +1296:"PORT_QEMU_CFG_CTL",1297:"PORT_QEMU_CFG_DATA",45056:"PORT_ACPI_PM_BASE",45312:"PORT_SMB_BASE",35072:"PORT_BIOS_APM"};IO.prototype.get_port_description=function(a){return debug_port_list[a]?" ("+debug_port_list[a]+")":""};function v86(a,b){this.stopping=this.running=!1;this.tick_counter=0;this.worker=null;this.cpu=new CPU(a,b,()=>{this.idle&&this.next_tick(0)});this.bus=a;a.register("cpu-init",this.init,this);a.register("cpu-run",this.run,this);a.register("cpu-stop",this.stop,this);a.register("cpu-restart",this.restart,this);this.register_yield()}v86.prototype.run=function(){this.stopping=!1;this.running||(this.running=!0,this.bus.send("emulator-started"));this.next_tick(0)}; +v86.prototype.do_tick=function(){if(this.stopping||!this.running)this.stopping=this.running=!1,this.bus.send("emulator-stopped");else{this.idle=!1;var a=this.cpu.main_run();this.next_tick(a)}};v86.prototype.next_tick=function(a){const b=++this.tick_counter;this.idle=!0;this.yield(a,b)};v86.prototype.yield_callback=function(a){a===this.tick_counter&&this.do_tick()};v86.prototype.stop=function(){this.running&&(this.stopping=!0)};v86.prototype.destroy=function(){this.unregister_yield()}; +v86.prototype.restart=function(){this.cpu.reset_cpu();this.cpu.load_bios()};v86.prototype.init=function(a){this.cpu.init(a,this.bus);this.bus.send("emulator-ready")}; +if("undefined"!==typeof process)v86.prototype.yield=function(a,b){1>a?global.setImmediate(c=>this.yield_callback(c),b):setTimeout(c=>this.yield_callback(c),a,b)},v86.prototype.register_yield=function(){},v86.prototype.unregister_yield=function(){};else if("undefined"!==typeof Worker){function a(){globalThis.onmessage=function(b){const c=b.data.t;1>c?postMessage(b.data.tick):setTimeout(()=>postMessage(b.data.tick),c)}}v86.prototype.register_yield=function(){const b=URL.createObjectURL(new Blob(["("+ +a.toString()+")()"],{type:"text/javascript"}));this.worker=new Worker(b);this.worker.onmessage=c=>this.yield_callback(c.data);URL.revokeObjectURL(b)};v86.prototype.yield=function(b,c){this.worker.postMessage({t:b,tick:c})};v86.prototype.unregister_yield=function(){this.worker&&this.worker.terminate();this.worker=null}}else v86.prototype.yield=function(a){setTimeout(()=>{this.do_tick()},a)},v86.prototype.register_yield=function(){},v86.prototype.unregister_yield=function(){}; +v86.prototype.save_state=function(){return this.cpu.save_state()};v86.prototype.restore_state=function(a){return this.cpu.restore_state(a)};if("object"===typeof performance&&performance.now)v86.microtick=performance.now.bind(performance);else if("function"===typeof require){const {performance:a}=require("perf_hooks");v86.microtick=a.now.bind(a)}else v86.microtick="object"===typeof process&&process.hrtime?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:Date.now;var goog=goog||{};goog.exportSymbol=function(){};goog.exportProperty=function(){};var v86util=v86util||{};v86util.pads=function(a,b){return(a||0===a?a+"":"").padEnd(b," ")};v86util.pad0=function(a,b){return(a||0===a?a+"":"").padStart(b,"0")};v86util.zeros=function(a){return Array(a).fill(0)};v86util.range=function(a){return Array.from(Array(a).keys())}; +v86util.view=function(a,b,c,d){return new Proxy({},{get:function(e,g,f){e=new a(b.buffer,c,d);f=e[g];if("function"===typeof f)return f.bind(e);dbg_assert(/^\d+$/.test(g)||"buffer"===g||"length"===g||"BYTES_PER_ELEMENT"===g||"byteOffset"===g);return f},set:function(e,g,f,k){dbg_assert(/^\d+$/.test(g));(new a(b.buffer,c,d))[g]=f;return!0}})};function h(a,b){a=a?a.toString(16):"";return"0x"+v86util.pad0(a.toUpperCase(),b||1)} +function hex_dump(a){function b(k,m){return v86util.pad0(k.toString(16).toUpperCase(),m)}const c=[];let d=0;for(;d+15g;g++)e+=b(a[d+g],2)+" ";e+=" ";for(g=0;16>g;g++){var f=a[d+g];e+=33<=f&&34!==f&&92!==f&&126>=f?String.fromCharCode(f):"."}c.push(e)}for(e=b(d,5)+" ";d=k?String.fromCharCode(k):"."}c.push(e);return"\n"+ +c.join("\n")+"\n"}if("undefined"!==typeof crypto&&crypto.getRandomValues){let a=new Int32Array(1);v86util.get_rand_int=function(){crypto.getRandomValues(a);return a[0]}}else if("undefined"!==typeof require){const a=require("crypto");v86util.get_rand_int=function(){return a.randomBytes(4).readInt32LE(0)}}else dbg_assert(!1,"Unsupported platform: No cryptographic random values"); +(function(){if("function"===typeof Math.clz32)v86util.int_log2_byte=function(d){dbg_assert(0d);return 31-Math.clz32(d)},v86util.int_log2=function(d){dbg_assert(0b;b++)b&b-1||c++,a[b]=c;v86util.int_log2_byte=function(d){dbg_assert(0d);return a[d]};v86util.int_log2=function(d){d>>>=0;dbg_assert(0>>16;if(e){var g=e>>>8;return g?24+a[g]:16+a[e]}return(g=d>>>8)?8+a[g]:a[d]}}})(); +function ByteQueue(a){var b=new Uint8Array(a),c,d;dbg_assert(0===(a&a-1));this.length=0;this.push=function(e){this.length!==a&&this.length++;b[d]=e;d=d+1&a-1};this.shift=function(){if(this.length){var e=b[c];c=c+1&a-1;this.length--;return e}return-1};this.peek=function(){return this.length?b[c]:-1};this.clear=function(){this.length=d=c=0};this.clear()}function FloatQueue(a){this.size=a;this.data=new Float32Array(a);this.length=this.end=this.start=0;dbg_assert(0===(a&a-1))} +FloatQueue.prototype.push=function(a){this.length===this.size?this.start=this.start+1&this.size-1:this.length++;this.data[this.end]=a;this.end=this.end+1&this.size-1};FloatQueue.prototype.shift=function(){if(this.length){var a=this.data[this.start];this.start=this.start+1&this.size-1;this.length--;return a}}; +FloatQueue.prototype.shift_block=function(a){var b=new Float32Array(a);a>this.length&&(a=this.length);var c=this.start+a,d=this.data.subarray(this.start,c);b.set(d);c>=this.size&&(c-=this.size,b.set(this.data.subarray(0,c),d.length));this.start=c;this.length-=a;return b};FloatQueue.prototype.peek=function(){if(this.length)return this.data[this.start]};FloatQueue.prototype.clear=function(){this.length=this.end=this.start=0};function CircularQueue(a){this.data=[];this.index=0;this.size=a} +CircularQueue.prototype.add=function(a){this.data[this.index]=a;this.index=(this.index+1)%this.size};CircularQueue.prototype.toArray=function(){return[].slice.call(this.data,this.index).concat([].slice.call(this.data,0,this.index))};CircularQueue.prototype.clear=function(){this.data=[];this.index=0};CircularQueue.prototype.set=function(a){this.data=a;this.index=0};function dump_file(a,b){a instanceof Array||(a=[a]);a=new Blob(a);download(a,b)} +function download(a,b){var c=document.createElement("a");c.download=b;c.href=window.URL.createObjectURL(a);c.dataset.downloadurl=["application/octet-stream",c.download,c.href].join(":");document.createEvent?(a=document.createEvent("MouseEvent"),a.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(a)):c.click();window.URL.revokeObjectURL(c.href)} +v86util.Bitmap=function(a){"number"===typeof a?this.view=new Uint8Array(a+7>>3):a instanceof ArrayBuffer?this.view=new Uint8Array(a):dbg_assert(!1,"v86util.Bitmap: Invalid argument")};v86util.Bitmap.prototype.set=function(a,b){const c=a>>3;a=1<<(a&7);this.view[c]=b?this.view[c]|a:this.view[c]&~a};v86util.Bitmap.prototype.get=function(a){return this.view[a>>3]>>(a&7)&1};v86util.Bitmap.prototype.get_buffer=function(){return this.view.buffer}; +v86util.load_file="undefined"===typeof XMLHttpRequest?load_file_nodejs:load_file; +function load_file(a,b,c){function d(){const m=c||0;setTimeout(()=>{load_file(a,b,m+1)},1E3*([1,1,2,3,5,8,13,21][m]||34))}var e=new XMLHttpRequest;e.open(b.method||"get",a,!0);e.responseType=b.as_json?"json":"arraybuffer";if(b.headers)for(var g=Object.keys(b.headers),f=0;fe.status&&d()):e.response&&(b.range&&(m=e.getResponseHeader("Content-Encoding"))&&"identity"!==m&&console.error("Server sent Content-Encoding in response to ranged request",{filename:a,enc:m}),b.done&&b.done(e.response,e)))};e.onerror=function(m){console.error("Loading the image "+a+" failed",m);d()};b.progress&&(e.onprogress= +function(m){b.progress(m)});e.send(null)} +function load_file_nodejs(a,b){let c=require("fs");b.range?(dbg_assert(!b.as_json),c.open(a,"r",(d,e)=>{if(d)throw d;let g=b.range.length;var f=Buffer.allocUnsafe(g);c.read(e,f,0,g,b.range.start,(k,m)=>{if(k)throw k;dbg_assert(m===g);b.done&&b.done(new Uint8Array(f));c.close(e,l=>{if(l)throw l;})})})):c.readFile(a,{encoding:b.as_json?"utf-8":null},function(d,e){d?console.log("Could not read file:",a,d):(d=e,d=b.as_json?JSON.parse(d):(new Uint8Array(d)).buffer,b.done(d))})} +v86util.read_sized_string_from_mem=function(a,b,c){return String.fromCharCode(...(new Uint8Array(a.buffer,b>>>0,c>>>0)))};(function(){function a(f){dbg_assert(f instanceof ArrayBuffer);this.buffer=f;this.byteLength=f.byteLength;this.onprogress=this.onload=void 0}function b(f,k,m){this.filename=f;this.byteLength=k;this.block_cache=new Map;this.block_cache_is_write=new Set;this.fixed_chunk_size=m;this.cache_reads=!!m;this.onprogress=this.onload=void 0}function c(f,k,m,l,n){const p=f.match(/\.[^\.]+(\.zst)?$/);this.extension=p?p[0]:"";this.basename=f.substring(0,f.length-this.extension.length);this.is_zstd=this.extension.endsWith(".zst"); +this.basename.endsWith("/")||(this.basename+="-");this.block_cache=new Map;this.block_cache_is_write=new Set;this.byteLength=k;this.fixed_chunk_size=m;this.partfile_alt_format=!!l;this.zstd_decompress=n;this.cache_reads=!!m;this.onprogress=this.onload=void 0}function d(f){this.file=f;this.byteLength=f.size;1073741824>20)+" MB ...");this.buffer=new ArrayBuffer(f.size);this.onprogress=this.onload=void 0}function e(f){this.file=f; +this.byteLength=f.size;this.block_cache=new Map;this.block_cache_is_write=new Set;this.onprogress=this.onload=void 0}v86util.SyncBuffer=a;v86util.AsyncXHRBuffer=b;v86util.AsyncXHRPartfileBuffer=c;v86util.AsyncFileBuffer=e;v86util.SyncFileBuffer=d;v86util.buffer_from_object=function(f,k){if(f.buffer instanceof ArrayBuffer)return new v86util.SyncBuffer(f.buffer);if("undefined"!==typeof File&&f.buffer instanceof File)return k=f.async,void 0===k&&(k=268435456<=f.buffer.size),k?new v86util.AsyncFileBuffer(f.buffer): +new v86util.SyncFileBuffer(f.buffer);if(f.url)return f.use_parts?new v86util.AsyncXHRPartfileBuffer(f.url,f.size,f.fixed_chunk_size,!1,k):new v86util.AsyncXHRBuffer(f.url,f.size,f.fixed_chunk_size);dbg_log("Ignored file: url="+f.url+" buffer="+f.buffer)};a.prototype.load=function(){this.onload&&this.onload({buffer:this.buffer})};a.prototype.get=function(f,k,m){dbg_assert(f+k<=this.byteLength);m(new Uint8Array(this.buffer,f,k))};a.prototype.set=function(f,k,m){dbg_assert(f+k.byteLength<=this.byteLength); +(new Uint8Array(this.buffer,f,k.byteLength)).set(k);m()};a.prototype.get_buffer=function(f){f(this.buffer)};a.prototype.get_state=function(){const f=[];f[0]=this.byteLength;f[1]=new Uint8Array(this.buffer);return f};a.prototype.set_state=function(f){this.byteLength=f[0];this.buffer=f[1].slice().buffer};b.prototype.load=function(){void 0!==this.byteLength?this.onload&&this.onload(Object.create(null)):g(this.filename,(f,k)=>{if(f)throw Error("Cannot use: "+this.filename+". "+f);dbg_assert(0<=k);this.byteLength= +k;this.onload&&this.onload(Object.create(null))})};b.prototype.get_from_cache=function(f,k){var m=k/256;f/=256;for(var l=0;l=l);p!==l&&(k.push(this.file.slice(l,p)),l=p);k.push(r);l+=r.length}l!==this.file.size&&k.push(this.file.slice(l));f=new File(k,f);dbg_assert(f.size===this.file.size);return f};var g="undefined"===typeof XMLHttpRequest?function(f,k){require("fs").stat(f,(m,l)=>{m?k(m):k(null,l.size)})}: +function(f,k){v86util.load_file(f,{done:(m,l)=>{m=l.getResponseHeader("Content-Range")||"";(l=m.match(/\/(\d+)\s*$/))?k(null,+l[1]):k("`Range: bytes=...` header not supported (Got `"+m+"`)")},headers:{Range:"bytes=0-0","X-Accept-Encoding":"identity"}})}})();var CDROM_SECTOR_SIZE=2048,HD_SECTOR_SIZE=512; +function IDEDevice(a,b,c,d,e,g){this.master=new IDEInterface(this,a,b,d,e,0,g);this.slave=new IDEInterface(this,a,c,!1,e,1,g);this.current_interface=this.master;this.cpu=a;0===e?(this.ata_port=496,this.irq=14,this.pci_id=240):1===e?(this.ata_port=368,this.irq=15,this.pci_id=248):dbg_assert(!1,"IDE device with nr "+e+" ignored",LOG_DISK);this.ata_port_high=this.ata_port|516;this.master_port=46080;this.pci_space=[134,128,16,112,5,0,160,2,0,128,1,1,0,0,0,0,this.ata_port&255|1,this.ata_port>>8,0,0,this.ata_port_high& +255|1,this.ata_port_high>>8,0,0,0,0,0,0,0,0,0,0,this.master_port&255|1,this.master_port>>8,0,0,0,0,0,0,0,0,0,0,67,16,212,130,0,0,0,0,0,0,0,0,0,0,0,0,this.irq,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.pci_bars=[{size:8},{size:4},void 0,void 0,{size:16}];this.name="ide"+e;this.device_control=2;a.io.register_read(this.ata_port|7,this,function(){dbg_log("lower irq", +LOG_DISK);this.cpu.device_lower_irq(this.irq);return this.read_status()});a.io.register_read(this.ata_port_high|2,this,this.read_status);a.io.register_write(this.ata_port_high|2,this,this.write_control);a.io.register_read(this.ata_port|0,this,function(){return this.current_interface.read_data(1)},function(){return this.current_interface.read_data(2)},function(){return this.current_interface.read_data(4)});a.io.register_read(this.ata_port|1,this,function(){dbg_log("Read error: "+h(this.current_interface.error& +255)+" slave="+(this.current_interface===this.slave),LOG_DISK);return this.current_interface.error&255});a.io.register_read(this.ata_port|2,this,function(){dbg_log("Read bytecount: "+h(this.current_interface.bytecount&255),LOG_DISK);return this.current_interface.bytecount&255});a.io.register_read(this.ata_port|3,this,function(){dbg_log("Read sector: "+h(this.current_interface.sector&255),LOG_DISK);return this.current_interface.sector&255});a.io.register_read(this.ata_port|4,this,function(){dbg_log("Read 1F4: "+ +h(this.current_interface.cylinder_low&255),LOG_DISK);return this.current_interface.cylinder_low&255});a.io.register_read(this.ata_port|5,this,function(){dbg_log("Read 1F5: "+h(this.current_interface.cylinder_high&255),LOG_DISK);return this.current_interface.cylinder_high&255});a.io.register_read(this.ata_port|6,this,function(){dbg_log("Read 1F6",LOG_DISK);return this.current_interface.drive_head&255});a.io.register_write(this.ata_port|0,this,function(f){this.current_interface.write_data_port8(f)}, +function(f){this.current_interface.write_data_port16(f)},function(f){this.current_interface.write_data_port32(f)});a.io.register_write(this.ata_port|1,this,function(f){dbg_log("1F1/lba_count: "+h(f),LOG_DISK);this.master.lba_count=(this.master.lba_count<<8|f)&65535;this.slave.lba_count=(this.slave.lba_count<<8|f)&65535});a.io.register_write(this.ata_port|2,this,function(f){dbg_log("1F2/bytecount: "+h(f),LOG_DISK);this.master.bytecount=(this.master.bytecount<<8|f)&65535;this.slave.bytecount=(this.slave.bytecount<< +8|f)&65535});a.io.register_write(this.ata_port|3,this,function(f){dbg_log("1F3/sector: "+h(f),LOG_DISK);this.master.sector=(this.master.sector<<8|f)&65535;this.slave.sector=(this.slave.sector<<8|f)&65535});a.io.register_write(this.ata_port|4,this,function(f){dbg_log("1F4/sector low: "+h(f),LOG_DISK);this.master.cylinder_low=(this.master.cylinder_low<<8|f)&65535;this.slave.cylinder_low=(this.slave.cylinder_low<<8|f)&65535});a.io.register_write(this.ata_port|5,this,function(f){dbg_log("1F5/sector high: "+ +h(f),LOG_DISK);this.master.cylinder_high=(this.master.cylinder_high<<8|f)&65535;this.slave.cylinder_high=(this.slave.cylinder_high<<8|f)&65535});a.io.register_write(this.ata_port|6,this,function(f){var k=f&16;dbg_log("1F6/drive: "+h(f,2),LOG_DISK);k?(dbg_log("Slave",LOG_DISK),this.current_interface=this.slave):this.current_interface=this.master;this.master.drive_head=f;this.slave.drive_head=f;this.master.is_lba=this.slave.is_lba=f>>6&1;this.master.head=this.slave.head=f&15});this.dma_command=this.dma_status= +this.prdt_addr=0;a.io.register_write(this.ata_port|7,this,function(f){dbg_log("lower irq",LOG_DISK);this.cpu.device_lower_irq(this.irq);this.current_interface.ata_command(f)});a.io.register_read(this.master_port|4,this,void 0,void 0,this.dma_read_addr);a.io.register_write(this.master_port|4,this,void 0,void 0,this.dma_set_addr);a.io.register_read(this.master_port,this,this.dma_read_command8,void 0,this.dma_read_command);a.io.register_write(this.master_port,this,this.dma_write_command8,void 0,this.dma_write_command); +a.io.register_read(this.master_port|2,this,this.dma_read_status);a.io.register_write(this.master_port|2,this,this.dma_write_status);a.io.register_read(this.master_port|8,this,function(){dbg_log("DMA read 0x8",LOG_DISK);return 0});a.io.register_read(this.master_port|10,this,function(){dbg_log("DMA read 0xA",LOG_DISK);return 0});a.devices.pci.register_device(this);DEBUG&&Object.seal(this)} +IDEDevice.prototype.read_status=function(){if(this.current_interface.buffer){var a=this.current_interface.status;dbg_log("ATA read status: "+h(a,2),LOG_DISK);return a}return 0};IDEDevice.prototype.write_control=function(a){dbg_log("set device control: "+h(a,2)+" interrupts "+(a&2?"disabled":"enabled"),LOG_DISK);a&4&&(dbg_log("Reset via control port",LOG_DISK),this.cpu.device_lower_irq(this.irq),this.master.device_reset(),this.slave.device_reset());this.device_control=a}; +IDEDevice.prototype.dma_read_addr=function(){dbg_log("dma get address: "+h(this.prdt_addr,8),LOG_DISK);return this.prdt_addr};IDEDevice.prototype.dma_set_addr=function(a){dbg_log("dma set address: "+h(a,8),LOG_DISK);this.prdt_addr=a};IDEDevice.prototype.dma_read_status=function(){dbg_log("DMA read status: "+h(this.dma_status),LOG_DISK);return this.dma_status};IDEDevice.prototype.dma_write_status=function(a){dbg_log("DMA set status: "+h(a),LOG_DISK);this.dma_status&=~(a&6)}; +IDEDevice.prototype.dma_read_command=function(){return this.dma_read_command8()|this.dma_read_status()<<16};IDEDevice.prototype.dma_read_command8=function(){dbg_log("DMA read command: "+h(this.dma_command),LOG_DISK);return this.dma_command};IDEDevice.prototype.dma_write_command=function(a){dbg_log("DMA write command: "+h(a),LOG_DISK);this.dma_write_command8(a&255);this.dma_write_status(a>>16&255)}; +IDEDevice.prototype.dma_write_command8=function(a){dbg_log("DMA write command8: "+h(a),LOG_DISK);let b=this.dma_command;this.dma_command=a&9;if((b&1)!==(a&1))if(0===(a&1))this.dma_status&=-2;else switch(this.dma_status|=1,this.current_interface.current_command){case 37:case 200:this.current_interface.do_ata_read_sectors_dma();break;case 202:case 53:this.current_interface.do_ata_write_sectors_dma();break;case 160:this.current_interface.do_atapi_dma();break;default:dbg_log("Spurious dma command write, current command: "+ +h(this.current_interface.current_command),LOG_DISK),dbg_assert(!1)}};IDEDevice.prototype.push_irq=function(){0===(this.device_control&2)&&(dbg_log("push irq",LOG_DISK),this.dma_status|=4,this.cpu.device_raise_irq(this.irq))}; +IDEDevice.prototype.get_state=function(){var a=[];a[0]=this.master;a[1]=this.slave;a[2]=this.ata_port;a[3]=this.irq;a[4]=this.pci_id;a[5]=this.ata_port_high;a[6]=this.master_port;a[7]=this.name;a[8]=this.device_control;a[9]=this.prdt_addr;a[10]=this.dma_status;a[11]=this.current_interface===this.master;a[12]=this.dma_command;return a}; +IDEDevice.prototype.set_state=function(a){this.master.set_state(a[0]);this.slave.set_state(a[1]);this.ata_port=a[2];this.irq=a[3];this.pci_id=a[4];this.ata_port_high=a[5];this.master_port=a[6];this.name=a[7];this.device_control=a[8];this.prdt_addr=a[9];this.dma_status=a[10];this.current_interface=a[11]?this.master:this.slave;this.dma_command=a[12]}; +function IDEInterface(a,b,c,d,e,g,f){this.device=a;this.bus=f;this.nr=e;this.cpu=b;this.buffer=c;this.sector_size=d?CDROM_SECTOR_SIZE:HD_SECTOR_SIZE;this.is_atapi=d;this.cylinder_count=this.sectors_per_track=this.head_count=this.sector_count=0;this.buffer&&(this.sector_count=this.buffer.byteLength/this.sector_size,this.sector_count!==(this.sector_count|0)&&(dbg_log("Warning: Disk size not aligned with sector size",LOG_DISK),this.sector_count=Math.ceil(this.sector_count)),d?(this.head_count=1,this.sectors_per_track= +0):(this.head_count=16,this.sectors_per_track=63),this.cylinder_count=this.sector_count/this.head_count/this.sectors_per_track,this.cylinder_count!==(this.cylinder_count|0)&&(dbg_log("Warning: Rounding up cylinder count. Choose different head number",LOG_DISK),this.cylinder_count=Math.floor(this.cylinder_count)),a=b.devices.rtc,a.cmos_write(CMOS_BIOS_DISKTRANSFLAG,a.cmos_read(CMOS_BIOS_DISKTRANSFLAG)|1<<4*this.nr),a.cmos_write(CMOS_DISK_DATA,a.cmos_read(CMOS_DISK_DATA)&15|240),b=CMOS_DISK_DRIVE1_CYL, +a.cmos_write(b+0,this.cylinder_count&255),a.cmos_write(b+1,this.cylinder_count>>8&255),a.cmos_write(b+2,this.head_count&255),a.cmos_write(b+3,255),a.cmos_write(b+4,255),a.cmos_write(b+5,200),a.cmos_write(b+6,this.cylinder_count&255),a.cmos_write(b+7,this.cylinder_count>>8&255),a.cmos_write(b+8,this.sectors_per_track&255));this.stats={sectors_read:0,sectors_written:0,bytes_read:0,bytes_written:0,loading:!1};this.buffer=c;this.drive_head=this.head=this.cylinder_high=this.cylinder_low=this.lba_count= +this.sector=this.bytecount=this.is_lba=0;this.status=80;this.sectors_per_drq=128;this.data_pointer=this.error=0;this.data=new Uint8Array(65536);this.data16=new Uint16Array(this.data.buffer);this.data32=new Int32Array(this.data.buffer);this.data_end=this.data_length=0;this.current_atapi_command=this.current_command=-1;this.last_io_id=this.write_dest=0;this.in_progress_io_ids=new Set;this.cancelled_io_ids=new Set;Object.seal(this)} +IDEInterface.prototype.device_reset=function(){this.is_atapi?(this.status=0,this.sector=this.error=this.bytecount=1,this.cylinder_low=20,this.cylinder_high=235):(this.status=81,this.sector=this.error=this.bytecount=1,this.cylinder_high=this.cylinder_low=0);this.cancel_io_operations()};IDEInterface.prototype.push_irq=function(){this.device.push_irq()}; +IDEInterface.prototype.ata_command=function(a){dbg_log("ATA Command: "+h(a)+" slave="+(this.drive_head>>4&1),LOG_DISK);if(this.buffer)switch(this.current_command=a,this.error=0,a){case 8:dbg_log("ATA device reset",LOG_DISK);this.data_length=this.data_end=this.data_pointer=0;this.device_reset();this.push_irq();break;case 16:this.status=80;this.cylinder_low=0;this.push_irq();break;case 248:this.status=80;a=this.sector_count-1;this.sector=a&255;this.cylinder_low=a>>8&255;this.cylinder_high=a>>16&255; +this.drive_head=this.drive_head&240|a>>24&15;this.push_irq();break;case 39:this.status=80;a=this.sector_count-1;this.sector=a&255;this.cylinder_low=a>>8&255;this.cylinder_high=a>>16&255;this.sector|=a>>24<<8&65280;this.push_irq();break;case 32:case 36:case 41:case 196:this.ata_read_sectors(a);break;case 48:case 52:case 57:case 197:this.ata_write_sectors(a);break;case 144:this.push_irq();this.error=257;this.status=80;break;case 145:this.status=80;this.push_irq();break;case 160:this.is_atapi&&(this.status= +88,this.data_allocate(12),this.data_end=12,this.bytecount=1,this.push_irq());break;case 161:dbg_log("ATA identify packet device",LOG_DISK);this.is_atapi?(this.create_identify_packet(),this.status=88,this.cylinder_low=20,this.cylinder_high=235):this.status=65;this.push_irq();break;case 198:dbg_log("Logical sectors per DRQ Block: "+h(this.bytecount&255),LOG_DISK);this.sectors_per_drq=this.bytecount&255;this.status=80;this.push_irq();break;case 37:case 200:this.ata_read_sectors_dma(a);break;case 53:case 202:this.ata_write_sectors_dma(a); +break;case 64:dbg_log("read verify sectors",LOG_DISK);this.status=80;this.push_irq();break;case 218:dbg_log("Unimplemented: get media status",LOG_DISK);this.status=65;this.error=4;this.push_irq();break;case 224:dbg_log("ATA standby immediate",LOG_DISK);this.status=80;this.push_irq();break;case 225:dbg_log("ATA idle immediate",LOG_DISK);this.status=80;this.push_irq();break;case 231:dbg_log("ATA flush cache",LOG_DISK);this.status=80;this.push_irq();break;case 236:dbg_log("ATA identify device",LOG_DISK); +if(this.is_atapi){this.status=65;this.error=4;this.push_irq();break}this.create_identify_packet();this.status=88;this.push_irq();break;case 234:dbg_log("flush cache ext",LOG_DISK);this.status=80;this.push_irq();break;case 239:dbg_log("set features: "+h(this.bytecount&255),LOG_DISK);this.status=80;this.push_irq();break;case 222:this.status=80;this.push_irq();break;case 245:dbg_log("security freeze lock",LOG_DISK);this.status=80;this.push_irq();break;case 249:dbg_log("Unimplemented: set max address", +LOG_DISK);this.status=65;this.error=4;break;default:dbg_assert(!1,"New ATA cmd on 1F7: "+h(a),LOG_DISK),this.status=65,this.error=4}else dbg_log("abort: No buffer",LOG_DISK),this.error=4,this.status=65,this.push_irq()}; +IDEInterface.prototype.atapi_handle=function(){dbg_log("ATAPI Command: "+h(this.data[0])+" slave="+(this.drive_head>>4&1),LOG_DISK);this.data_pointer=0;this.current_atapi_command=this.data[0];switch(this.current_atapi_command){case 0:dbg_log("test unit ready",LOG_DISK);this.data_allocate(0);this.data_end=this.data_length;this.status=80;break;case 3:this.data_allocate(this.data[4]);this.data_end=this.data_length;this.status=88;this.data[0]=240;this.data[2]=5;this.data[7]=8;break;case 18:var a=this.data[4]; +this.status=88;dbg_log("inquiry: "+h(this.data[1],2)+" length="+a,LOG_DISK);this.data.set([5,128,1,49,31,0,0,0,83,79,78,89,32,32,32,32,67,68,45,82,79,77,32,67,68,85,45,49,48,48,48,32,49,46,49,97]);this.data_end=this.data_length=Math.min(36,a);break;case 26:this.data_allocate(this.data[4]);this.data_end=this.data_length;this.status=88;break;case 30:this.data_allocate(0);this.data_end=this.data_length;this.status=80;break;case 37:a=this.sector_count-1;this.data_set(new Uint8Array([a>>24&255,a>>16&255, +a>>8&255,a&255,0,0,this.sector_size>>8&255,this.sector_size&255]));this.data_end=this.data_length;this.status=88;break;case 40:this.lba_count&1?this.atapi_read_dma(this.data):this.atapi_read(this.data);break;case 66:a=this.data[8];this.data_allocate(Math.min(8,a));this.data_end=this.data_length;dbg_log("read q subcode: length="+a,LOG_DISK);this.status=88;break;case 67:a=this.data[8]|this.data[7]<<8;var b=this.data[9]>>6;this.data_allocate(a);this.data_end=this.data_length;dbg_log("read toc: "+h(b, +2)+" length="+a+" "+(this.data[1]&2)+" "+h(this.data[6]),LOG_DISK);0===b?(a=this.sector_count,this.data.set(new Uint8Array([0,18,1,1,0,20,1,0,0,0,0,0,0,22,170,0,a>>24,a>>16&255,a>>8&255,a&255]))):1===b?this.data.set(new Uint8Array([0,10,1,1,0,0,0,0,0,0,0,0])):dbg_assert(!1,"Unimplemented format: "+b);this.status=88;break;case 70:a=this.data[8]|this.data[7]<<8;a=Math.min(a,32);this.data_allocate(a);this.data_end=this.data_length;this.data[0]=a-4>>24&255;this.data[1]=a-4>>16&255;this.data[2]=a-4>>8& +255;this.data[3]=a-4&255;this.data[6]=8;this.data[10]=3;this.status=88;break;case 81:this.data_allocate(0);this.data_end=this.data_length;this.status=80;break;case 82:dbg_log("Unimplemented ATAPI command: "+h(this.data[0]),LOG_DISK);this.status=81;this.data_length=0;this.error=80;break;case 90:a=this.data[8]|this.data[7]<<8;b=this.data[2];dbg_log("mode sense: "+h(b)+" length="+a,LOG_DISK);42===b&&this.data_allocate(Math.min(30,a));this.data_end=this.data_length;this.status=88;break;case 189:this.data_allocate(this.data[9]| +this.data[8]<<8);this.data_end=this.data_length;this.data[5]=1;this.status=88;break;case 74:this.status=81;this.data_length=0;this.error=80;dbg_log("Unimplemented ATAPI command: "+h(this.data[0]),LOG_DISK);break;case 190:dbg_log("Unimplemented ATAPI command: "+h(this.data[0]),LOG_DISK);this.data_allocate(0);this.data_end=this.data_length;this.status=80;break;default:this.status=81,this.data_length=0,this.error=80,dbg_log("Unimplemented ATAPI command: "+h(this.data[0]),LOG_DISK),dbg_assert(!1)}this.bytecount= +this.bytecount&-8|2;0===(this.status&128)&&this.push_irq();0===(this.status&128)&&0===this.data_length&&(this.bytecount|=1,this.status&=-9)};IDEInterface.prototype.do_write=function(){this.status=80;dbg_assert(this.data_length<=this.data.length);var a=this.data.subarray(0,this.data_length);dbg_assert(0===this.data_length%512);this.ata_advance(this.current_command,this.data_length/512);this.push_irq();this.buffer.set(this.write_dest,a,function(){});this.report_write(this.data_length)}; +IDEInterface.prototype.atapi_read=function(a){var b=a[2]<<24|a[3]<<16|a[4]<<8|a[5],c=a[7]<<8|a[8];a=a[1];var d=c*this.sector_size,e=b*this.sector_size;dbg_log("CD read lba="+h(b)+" lbacount="+h(c)+" bytecount="+h(d)+" flags="+h(a),LOG_DISK);this.data_length=0;var g=this.cylinder_high<<8&65280|this.cylinder_low&255;dbg_log(h(this.cylinder_high,2)+" "+h(this.cylinder_low,2),LOG_DISK);this.cylinder_low=this.cylinder_high=0;65535===g&&g--;g>d&&(g=d);e>=this.buffer.byteLength?(dbg_assert(!1,"CD read: Outside of disk end="+ +h(e+d)+" size="+h(this.buffer.byteLength),LOG_DISK),this.status=255,this.push_irq()):0===d?(this.status=80,this.data_pointer=0):(d=Math.min(d,this.buffer.byteLength-e),this.status=208,this.report_read_start(),this.read_buffer(e,d,f=>{dbg_log("cd read: data arrived",LOG_DISK);this.data_set(f);this.status=88;this.bytecount=this.bytecount&-8|2;this.push_irq();this.data_end=g&=-4;this.data_end>this.data_length&&(this.data_end=this.data_length);this.cylinder_low=this.data_end&255;this.cylinder_high=this.data_end>> +8&255;this.report_read_end(d)}))}; +IDEInterface.prototype.atapi_read_dma=function(a){var b=a[2]<<24|a[3]<<16|a[4]<<8|a[5],c=a[7]<<8|a[8];a=a[1];var d=c*this.sector_size,e=b*this.sector_size;dbg_log("CD read DMA lba="+h(b)+" lbacount="+h(c)+" bytecount="+h(d)+" flags="+h(a),LOG_DISK);e>=this.buffer.byteLength?(dbg_assert(!1,"CD read: Outside of disk end="+h(e+d)+" size="+h(this.buffer.byteLength),LOG_DISK),this.status=255,this.push_irq()):(this.status=208,this.report_read_start(),this.read_buffer(e,d,g=>{dbg_log("atapi_read_dma: Data arrived"); +this.report_read_end(d);this.status=88;this.bytecount=this.bytecount&-8|2;this.data_set(g);this.do_atapi_dma()}))}; +IDEInterface.prototype.do_atapi_dma=function(){if(0===(this.device.dma_status&1))dbg_log("do_atapi_dma: Status not set",LOG_DISK);else if(0===(this.status&8))dbg_log("do_atapi_dma: DRQ not set",LOG_DISK);else{dbg_log("atapi dma transfer len="+this.data_length,LOG_DISK);var a=this.device.prdt_addr,b=0,c=this.data;do{var d=this.cpu.read32s(a),e=this.cpu.read16(a+4),g=this.cpu.read8(a+7)&128;e||(e=65536);dbg_log("dma read dest="+h(d)+" count="+h(e)+" datalen="+h(this.data_length),LOG_DISK);this.cpu.write_blob(c.subarray(b, +Math.min(b+e,this.data_length)),d);b+=e;a+=8;if(b>=this.data_length&&!g){dbg_log("leave early end="+ +g+" offset="+h(b)+" data_length="+h(this.data_length)+" cmd="+h(this.current_command),LOG_DISK);break}}while(!g);dbg_log("end offset="+b,LOG_DISK);this.status=80;this.device.dma_status&=-2;this.bytecount=this.bytecount&-8|3;this.push_irq()}}; +IDEInterface.prototype.read_data=function(a){if(this.data_pointer>>1]:this.data32[this.data_pointer>>>2];this.data_pointer+=a;0===(this.data_pointer&(0===(this.data_end&4095)?4095:255))&&dbg_log("Read 1F0: "+h(this.data[this.data_pointer],2)+" cur="+h(this.data_pointer)+" cnt="+h(this.data_length), +LOG_DISK);this.data_pointer>=this.data_end&&this.read_end();return b}dbg_log("Read 1F0: empty",LOG_DISK);this.data_pointer+=a;return 0}; +IDEInterface.prototype.read_end=function(){dbg_log("read_end cmd="+h(this.current_command)+" data_pointer="+h(this.data_pointer)+" end="+h(this.data_end)+" length="+h(this.data_length),LOG_DISK);if(160===this.current_command)if(this.data_end===this.data_length)this.status=80,this.bytecount=this.bytecount&-8|3,this.push_irq();else{this.status=88;this.bytecount=this.bytecount&-8|2;this.push_irq();var a=this.cylinder_high<<8&65280|this.cylinder_low&255;this.data_end+a>this.data_length?(this.cylinder_low= +this.data_length-this.data_end&255,this.cylinder_high=this.data_length-this.data_end>>8&255,this.data_end=this.data_length):this.data_end+=a;dbg_log("data_end="+h(this.data_end),LOG_DISK)}else this.error=0,this.data_pointer>=this.data_length?this.status=80:(196===this.current_command||41===this.current_command?(a=Math.min(this.sectors_per_drq,(this.data_length-this.data_end)/512),dbg_assert(0===a%1)):(dbg_assert(32===this.current_command||36===this.current_command),a=1),this.ata_advance(this.current_command, +a),this.data_end+=512*a,this.status=88),this.push_irq()}; +IDEInterface.prototype.write_data_port=function(a,b){dbg_assert(0===this.data_pointer%b);this.data_pointer>=this.data_end?dbg_log("Redundant write to data port: "+h(a)+" count="+h(this.data_end)+" cur="+h(this.data_pointer),LOG_DISK):((0===(this.data_pointer+b&(0===(this.data_end&4095)?4095:255))||20>this.data_end)&&dbg_log("Data port: "+h(a>>>0)+" count="+h(this.data_end)+" cur="+h(this.data_pointer),LOG_DISK),1===b?this.data[this.data_pointer++]=a:2===b?(this.data16[this.data_pointer>>>1]=a,this.data_pointer+= +2):(this.data32[this.data_pointer>>>2]=a,this.data_pointer+=4),dbg_assert(this.data_pointer<=this.data_end),this.data_pointer===this.data_end&&this.write_end())};IDEInterface.prototype.write_data_port8=function(a){this.write_data_port(a,1)};IDEInterface.prototype.write_data_port16=function(a){this.write_data_port(a,2)};IDEInterface.prototype.write_data_port32=function(a){this.write_data_port(a,4)}; +IDEInterface.prototype.write_end=function(){160===this.current_command?this.atapi_handle():(dbg_log("write_end data_pointer="+h(this.data_pointer)+" data_length="+h(this.data_length),LOG_DISK),this.data_pointer>=this.data_length?this.do_write():(dbg_assert(48===this.current_command||52===this.current_command||197===this.current_command,"Unexpected command: "+h(this.current_command)),this.status=88,this.data_end+=512,this.push_irq()))}; +IDEInterface.prototype.ata_advance=function(a,b){dbg_log("Advance sectors="+b+" old_bytecount="+this.bytecount,LOG_DISK);this.bytecount-=b;36===a||41===a||52===a||57===a||37===a||53===a?(a=b+this.get_lba48(),this.sector=a&255|a>>16&65280,this.cylinder_low=a>>8&255,this.cylinder_high=a>>16&255):this.is_lba?(a=b+this.get_lba28(),this.sector=a&255,this.cylinder_low=a>>8&255,this.cylinder_high=a>>16&255,this.head=this.head&-16|a&15):(a=b+this.get_chs(),b=a/(this.head_count*this.sectors_per_track)|0,this.cylinder_low= +b&255,this.cylinder_high=b>>8&255,this.head=(a/this.sectors_per_track|0)%this.head_count&15,this.sector=a%this.sectors_per_track+1&255,dbg_assert(a===this.get_chs()))}; +IDEInterface.prototype.ata_read_sectors=function(a){var b=36===a||41===a,c=this.get_count(b);b=this.get_lba(b);var d=32===a||36===a,e=c*this.sector_size,g=b*this.sector_size;dbg_log("ATA read cmd="+h(a)+" mode="+(this.is_lba?"lba":"chs")+" lba="+h(b)+" lbacount="+h(c)+" bytecount="+h(e),LOG_DISK);g+e>this.buffer.byteLength?(dbg_assert(!1,"ATA read: Outside of disk",LOG_DISK),this.status=255,this.push_irq()):(this.status=192,this.report_read_start(),this.read_buffer(g,e,f=>{dbg_log("ata_read: Data arrived", +LOG_DISK);this.data_set(f);this.status=88;this.data_end=d?512:Math.min(e,512*this.sectors_per_drq);this.ata_advance(a,d?1:Math.min(c,this.sectors_per_track));this.push_irq();this.report_read_end(e)}))}; +IDEInterface.prototype.ata_read_sectors_dma=function(a){var b=37===a;a=this.get_count(b);b=this.get_lba(b);var c=a*this.sector_size,d=b*this.sector_size;dbg_log("ATA DMA read lba="+h(b)+" lbacount="+h(a)+" bytecount="+h(c),LOG_DISK);d+c>this.buffer.byteLength?(dbg_assert(!1,"ATA read: Outside of disk",LOG_DISK),this.status=255,this.push_irq()):(this.status=88,this.device.dma_status|=1)}; +IDEInterface.prototype.do_ata_read_sectors_dma=function(){var a=37===this.current_command,b=this.get_count(a);a=this.get_lba(a);var c=b*this.sector_size,d=a*this.sector_size;dbg_assert(a{dbg_log("do_ata_read_sectors_dma: Data arrived",LOG_DISK);var f=this.device.prdt_addr,k=0;dbg_assert(e===f);do{var m=this.cpu.read32s(f),l=this.cpu.read16(f+4),n=this.cpu.read8(f+7)&128;l||(l=65536,dbg_log("dma: prd count was 0", +LOG_DISK));dbg_log("dma read transfer dest="+h(m)+" prd_count="+h(l),LOG_DISK);this.cpu.write_blob(g.subarray(k,k+l),m);k+=l;f+=8}while(!n);dbg_assert(k===c);this.ata_advance(this.current_command,b);this.status=80;this.device.dma_status&=-2;this.current_command=-1;this.push_irq();this.report_read_end(c)})}; +IDEInterface.prototype.ata_write_sectors=function(a){var b=52===a||57===a,c=this.get_count(b);b=this.get_lba(b);a=48===a||52===a;var d=c*this.sector_size,e=b*this.sector_size;dbg_log("ATA write lba="+h(b)+" mode="+(this.is_lba?"lba":"chs")+" lbacount="+h(c)+" bytecount="+h(d),LOG_DISK);e+d>this.buffer.byteLength?(dbg_assert(!1,"ATA write: Outside of disk",LOG_DISK),this.status=255,this.push_irq()):(this.status=88,this.data_allocate_noclear(d),this.data_end=a?512:Math.min(d,512*this.sectors_per_drq), +this.write_dest=e)};IDEInterface.prototype.ata_write_sectors_dma=function(a){var b=53===a;a=this.get_count(b);b=this.get_lba(b);var c=a*this.sector_size,d=b*this.sector_size;dbg_log("ATA DMA write lba="+h(b)+" lbacount="+h(a)+" bytecount="+h(c),LOG_DISK);d+c>this.buffer.byteLength?(dbg_assert(!1,"ATA DMA write: Outside of disk",LOG_DISK),this.status=255,this.push_irq()):(this.status=88,this.device.dma_status|=1)}; +IDEInterface.prototype.do_ata_write_sectors_dma=function(){var a=53===this.current_command,b=this.get_count(a),c=this.get_lba(a);a=b*this.sector_size;c*=this.sector_size;var d=this.device.prdt_addr,e=0;dbg_log("prdt addr: "+h(d,8),LOG_DISK);const g=new Uint8Array(a);do{var f=this.cpu.read32s(d),k=this.cpu.read16(d+4),m=this.cpu.read8(d+7)&128;k||(k=65536,dbg_log("dma: prd count was 0",LOG_DISK));dbg_log("dma write transfer dest="+h(f)+" prd_count="+h(k),LOG_DISK);f=this.cpu.mem8.subarray(f,f+k);dbg_assert(f.length=== +k);g.set(f,e);e+=k;d+=8}while(!m);dbg_assert(e===g.length);this.buffer.set(c,g,()=>{dbg_log("dma write completed",LOG_DISK);this.ata_advance(this.current_command,b);this.status=80;this.push_irq();this.device.dma_status&=-2;this.current_command=-1});this.report_write(a)}; +IDEInterface.prototype.get_chs=function(){var a=this.cylinder_low&255|this.cylinder_high<<8&65280,b=this.head,c=this.sector&255;dbg_log("get_chs: c="+a+" h="+b+" s="+c,LOG_DISK);return(a*this.head_count+b)*this.sectors_per_track+c-1};IDEInterface.prototype.get_lba28=function(){return this.sector&255|this.cylinder_low<<8&65280|this.cylinder_high<<16&16711680|(this.head&15)<<24}; +IDEInterface.prototype.get_lba48=function(){return(this.sector&255|this.cylinder_low<<8&65280|this.cylinder_high<<16&16711680|this.sector>>8<<24&4278190080)>>>0};IDEInterface.prototype.get_lba=function(a){return a?this.get_lba48():this.is_lba?this.get_lba28():this.get_chs()};IDEInterface.prototype.get_count=function(a){a?(a=this.bytecount,0===a&&(a=65536)):(a=this.bytecount&255,0===a&&(a=256));return a}; +IDEInterface.prototype.create_identify_packet=function(){if(this.drive_head&16)this.data_allocate(0);else{for(var a=0;512>a;a++)this.data[a]=0;a=Math.min(16383,this.cylinder_count);this.data_set([64,this.is_atapi?133:0,a,a>>8,0,0,this.head_count,this.head_count>>8,this.sectors_per_track/512,this.sectors_per_track/512>>8,0,2,this.sectors_per_track,this.sectors_per_track>>8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,4,0,0,0,0,0,0,0,0,0,56,118,32,54,68,72,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,128,0,1,0,0,2,0,0,0,2,0,2,7,0,a,a>>8,this.head_count,this.head_count>>8,this.sectors_per_track,0,this.sector_count&255,this.sector_count>>8&255,this.sector_count>>16&255,this.sector_count>>24&255,0,0,this.sector_count&255,this.sector_count>>8&255,this.sector_count>>16&255,this.sector_count>>24&255,0,0,160===this.current_command?0:7,160===this.current_command?0:4,0,0,30,0,30,0,30,0,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,126,0,0,0,0,0,0,116,0,64,0,64,0,116,0,64,0,0,0,0,0,0,0,0,0,0,1,96,0,0,0,0,0,0,0,0,0,0,0,0,this.sector_count&255,this.sector_count>>8&255,this.sector_count>>16&255,this.sector_count>>24&255]);this.data_end=this.data_length=512}};IDEInterface.prototype.data_allocate=function(a){this.data_allocate_noclear(a);for(var b=0;b>2;b++)this.data32[b]=0}; +IDEInterface.prototype.data_allocate_noclear=function(a){this.data.length{if(this.cancelled_io_ids.delete(d))dbg_assert(!this.in_progress_io_ids.has(d));else{var g=this.in_progress_io_ids.delete(d);dbg_assert(g);c(e)}})};IDEInterface.prototype.cancel_io_operations=function(){for(const a of this.in_progress_io_ids)this.cancelled_io_ids.add(a);this.in_progress_io_ids.clear()}; +IDEInterface.prototype.get_state=function(){var a=[];a[0]=this.bytecount;a[1]=this.cylinder_count;a[2]=this.cylinder_high;a[3]=this.cylinder_low;a[4]=this.data_pointer;a[5]=0;a[6]=0;a[7]=0;a[8]=0;a[9]=this.drive_head;a[10]=this.error;a[11]=this.head;a[12]=this.head_count;a[13]=this.is_atapi;a[14]=this.is_lba;a[15]=this.lba_count;a[16]=this.data;a[17]=this.data_length;a[18]=this.sector;a[19]=this.sector_count;a[20]=this.sector_size;a[21]=this.sectors_per_drq;a[22]=this.sectors_per_track;a[23]=this.status; +a[24]=this.write_dest;a[25]=this.current_command;a[26]=this.data_end;a[27]=this.current_atapi_command;a[28]=this.buffer;return a}; +IDEInterface.prototype.set_state=function(a){this.bytecount=a[0];this.cylinder_count=a[1];this.cylinder_high=a[2];this.cylinder_low=a[3];this.data_pointer=a[4];this.drive_head=a[9];this.error=a[10];this.head=a[11];this.head_count=a[12];this.is_atapi=a[13];this.is_lba=a[14];this.lba_count=a[15];this.data=a[16];this.data_length=a[17];this.sector=a[18];this.sector_count=a[19];this.sector_size=a[20];this.sectors_per_drq=a[21];this.sectors_per_track=a[22];this.status=a[23];this.write_dest=a[24];this.current_command= +a[25];this.data_end=a[26];this.current_atapi_command=a[27];this.data16=new Uint16Array(this.data.buffer);this.data32=new Int32Array(this.data.buffer);this.buffer&&this.buffer.set_state(a[28])};var PCI_CONFIG_ADDRESS=3320,PCI_CONFIG_DATA=3324; +function PCI(a){this.pci_addr=new Uint8Array(4);this.pci_value=new Uint8Array(4);this.pci_response=new Uint8Array(4);this.pci_status=new Uint8Array(4);this.pci_addr32=new Int32Array(this.pci_addr.buffer);this.pci_value32=new Int32Array(this.pci_value.buffer);this.pci_response32=new Int32Array(this.pci_response.buffer);this.pci_status32=new Int32Array(this.pci_status.buffer);this.device_spaces=[];this.devices=[];this.cpu=a;for(var b=0;256>b;b++)this.device_spaces[b]=void 0,this.devices[b]=void 0;this.io= +a.io;a.io.register_write(PCI_CONFIG_DATA,this,function(c){this.pci_write8(this.pci_addr32[0],c)},function(c){this.pci_write16(this.pci_addr32[0],c)},function(c){this.pci_write32(this.pci_addr32[0],c)});a.io.register_write(PCI_CONFIG_DATA+1,this,function(c){this.pci_write8(this.pci_addr32[0]+1|0,c)});a.io.register_write(PCI_CONFIG_DATA+2,this,function(c){this.pci_write8(this.pci_addr32[0]+2|0,c)},function(c){this.pci_write16(this.pci_addr32[0]+2|0,c)});a.io.register_write(PCI_CONFIG_DATA+3,this,function(c){this.pci_write8(this.pci_addr32[0]+ +3|0,c)});a.io.register_read_consecutive(PCI_CONFIG_DATA,this,function(){return this.pci_response[0]},function(){return this.pci_response[1]},function(){return this.pci_response[2]},function(){return this.pci_response[3]});a.io.register_read_consecutive(PCI_CONFIG_ADDRESS,this,function(){return this.pci_status[0]},function(){return this.pci_status[1]},function(){return this.pci_status[2]},function(){return this.pci_status[3]});a.io.register_write_consecutive(PCI_CONFIG_ADDRESS,this,function(c){this.pci_addr[0]= +c&252},function(c){2===(this.pci_addr[1]&6)&&6===(c&6)?(dbg_log("CPU reboot via PCI"),a.reboot_internal()):this.pci_addr[1]=c},function(c){this.pci_addr[2]=c},function(c){this.pci_addr[3]=c;this.pci_query()});this.register_device({pci_id:0,pci_space:[134,128,55,18,0,0,0,0,2,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0],pci_bars:[],name:"82441FX PMC"});this.isa_bridge={pci_id:8, +pci_space:[134,128,0,112,7,0,0,2,0,0,1,6,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],pci_bars:[],name:"82371SB PIIX3 ISA"};this.isa_bridge_space=this.register_device(this.isa_bridge);this.isa_bridge_space8=new Uint8Array(this.isa_bridge_space.buffer)}PCI.prototype.get_state=function(){for(var a=[],b=0;256>b;b++)a[b]=this.device_spaces[b];a[256]=this.pci_addr;a[257]=this.pci_value;a[258]=this.pci_response;a[259]=this.pci_status;return a}; +PCI.prototype.set_state=function(a){for(var b=0;256>b;b++){var c=this.devices[b],d=a[b];if(c&&d){for(var e=0;e>3&31;var d="query enabled="+(this.pci_addr[3]>>7)+(" bdf="+h(a,4));d+=" dev="+h(c,2);d+=" addr="+h(b,2);c=this.device_spaces[a];void 0!==c?(this.pci_status32[0]=-2147483648,this.pci_response32[0]=b>2]:0,d+=" "+h(this.pci_addr32[0]>>>0,8)+" -> "+h(this.pci_response32[0]>>>0,8),b>=c.byteLength&&(d+=" (undef)"),d+=" ("+this.devices[a].name+")",dbg_log(d,LOG_PCI)):(this.pci_response32[0]= +-1,this.pci_status32[0]=0)};PCI.prototype.pci_write8=function(a,b){var c=a>>8&65535;a&=255;var d=new Uint8Array(this.device_spaces[c].buffer),e=this.devices[c];d&&(dbg_assert(!(16<=a&&44>a||48<=a&&52>a),"PCI: Expected 32-bit write, got 8-bit (addr: "+h(a)+")"),dbg_log("PCI write8 dev="+h(c>>3,2)+" ("+e.name+") addr="+h(a,4)+" value="+h(b,2),LOG_PCI),d[a]=b)}; +PCI.prototype.pci_write16=function(a,b){dbg_assert(0===(a&1));var c=a>>8&65535;a&=255;var d=new Uint16Array(this.device_spaces[c].buffer),e=this.devices[c];d&&(16<=a&&44>a?dbg_log("Warning: PCI: Expected 32-bit write, got 16-bit (addr: "+h(a)+")"):(dbg_assert(!(48<=a&&52>a),"PCI: Expected 32-bit write, got 16-bit (addr: "+h(a)+")"),dbg_log("PCI writ16 dev="+h(c>>3,2)+" ("+e.name+") addr="+h(a,4)+" value="+h(b,4),LOG_PCI),d[a>>>1]=b))}; +PCI.prototype.pci_write32=function(a,b){dbg_assert(0===(a&3));var c=a>>8&65535;a&=255;var d=this.device_spaces[c],e=this.devices[c];if(d)if(16<=a&&40>a){var g=a-16>>2,f=e.pci_bars[g];dbg_log("BAR"+g+" exists="+(f?"y":"n")+" changed to "+h(b>>>0)+" dev="+h(c>>3,2)+" ("+e.name+") ",LOG_PCI);f?(dbg_assert(!(f.size&f.size-1),"bar size should be power of 2"),c=a>>2,e=d[c]&1,-1===(b|3|f.size-1)?(b=~(f.size-1)|e,0===e&&(d[c]=b)):0===e&&(g=f.original_bar,(b&-16)!==(g&-16)&&dbg_log("Warning: Changing memory bar not supported, ignored", +LOG_PCI),d[c]=g),1===e&&(dbg_assert(1===e),e=d[c]&65534,g=b&65534,dbg_log("io bar changed from "+h(e>>>0,8)+" to "+h(g>>>0,8)+" size="+f.size,LOG_PCI),this.set_io_bars(f,e,g),d[c]=b|1)):d[a>>2]=0;dbg_log("BAR effective value: "+h(d[a>>2]>>>0),LOG_PCI)}else 48===a?(dbg_log("PCI write rom address dev="+h(c>>3,2)+" ("+e.name+") value="+h(b>>>0,8),LOG_PCI),d[a>>2]=e.pci_rom_size?-1===(b|2047)?-e.pci_rom_size|0:e.pci_rom_address|0:0):4===a?dbg_log("PCI write dev="+h(c>>3,2)+" ("+e.name+") addr="+h(a,4)+ +" value="+h(b>>>0,8),LOG_PCI):(dbg_log("PCI write dev="+h(c>>3,2)+" ("+e.name+") addr="+h(a,4)+" value="+h(b>>>0,8),LOG_PCI),d[a>>>2]=b)}; +PCI.prototype.register_device=function(a){dbg_assert(void 0!==a.pci_id);dbg_assert(void 0!==a.pci_space);dbg_assert(void 0!==a.pci_bars);var b=a.pci_id;dbg_log("PCI register bdf="+h(b)+" ("+a.name+")",LOG_PCI);dbg_assert(!this.devices[b]);dbg_assert(64<=a.pci_space.length);dbg_assert(b>4),LOG_FLOPPY);dbg_log("enable dma/irq: "+!!(a&8),LOG_FLOPPY);dbg_log("reset fdc: "+!!(a&4),LOG_FLOPPY);dbg_log("drive select: "+(a&3),LOG_FLOPPY);0!==(a&3)&&dbg_log("guest: fdb not implemented");dbg_log("DOR = "+h(a),LOG_FLOPPY);this.dor=a}; +FloppyController.prototype.check_drive_status=function(a){dbg_log("check drive status",LOG_FLOPPY);this.status_reg1=this.fda_image?0:ST1_NDAT|ST1_NID;this.response_index=0;this.response_length=1;this.response_data[0]=0}; +FloppyController.prototype.seek=function(a){dbg_log("seek",LOG_FLOPPY);if(0!==(a[0]&3))dbg_log("seek on fdb");else{var b=a[1];a=a[0]>>2&1;b!==this.last_cylinder&&(this.dir=0);this.status_reg1=this.fda_image?0:ST1_NDAT|ST1_NID;this.status_reg0=32;this.last_cylinder=b;this.last_head=a}this.raise_irq()};FloppyController.prototype.calibrate=function(a){dbg_log("floppy calibrate",LOG_FLOPPY);this.seek([a[0],0])}; +FloppyController.prototype.check_interrupt_status=function(){dbg_log("floppy check interrupt status",LOG_FLOPPY);this.response_index=0;this.response_length=2;this.response_data[0]=this.status_reg0;this.response_data[1]=this.last_cylinder}; +FloppyController.prototype.do_sector=function(a,b){var c=b[2],d=b[1],e=b[3],g=128<this.sectors_per_track&&(d=1,c++,c>=this.number_of_heads&&(c=0,b++)),b!==this.last_cylinder&&(this.dir=0),this.status_reg0=32,this.last_cylinder=b,this.last_head=c,this.last_sector=d,this.response_index=0,this.response_length=7,this.response_data[0]=c<<2|32,this.response_data[1]=0,this.response_data[2]=0,this.response_data[3]=b,this.response_data[4]=c,this.response_data[5]=d,this.response_data[6]=a[4],this.raise_irq())}; +FloppyController.prototype.fix_drive_data=function(a){dbg_log("floppy fix drive data "+a.slice(0,this.bytes_expecting),LOG_FLOPPY)};FloppyController.prototype.configure=function(a){dbg_log("floppy configure "+a.slice(0,this.bytes_expecting),LOG_FLOPPY)}; +FloppyController.prototype.read_sector_id=function(a){dbg_log("floppy read sector id "+a,LOG_FLOPPY);this.response_index=0;this.response_length=7;this.response_data[0]=0;this.response_data[1]=0;this.response_data[2]=0;this.response_data[3]=0;this.response_data[4]=0;this.response_data[5]=0;this.response_data[6]=0;this.raise_irq()};FloppyController.prototype.raise_irq=function(){this.dor&8&&this.cpu.device_raise_irq(6)};CPU.prototype.mmap_read8=function(a){a=this.memory_map_read8[a>>>MMAP_BLOCK_BITS](a);dbg_assert(0<=a&&255>=a);return a};CPU.prototype.mmap_write8=function(a,b){dbg_assert(0<=b&&255>=b);this.memory_map_write8[a>>>MMAP_BLOCK_BITS](a,b)};CPU.prototype.mmap_read16=function(a){var b=this.memory_map_read8[a>>>MMAP_BLOCK_BITS];a=b(a)|b(a+1|0)<<8;dbg_assert(0<=a&&65535>=a);return a}; +CPU.prototype.mmap_write16=function(a,b){var c=this.memory_map_write8[a>>>MMAP_BLOCK_BITS];dbg_assert(0<=b&&65535>=b);c(a,b&255);c(a+1|0,b>>8)};CPU.prototype.mmap_read32=function(a){return this.memory_map_read32[a>>>MMAP_BLOCK_BITS](a)};CPU.prototype.mmap_write32=function(a,b){this.memory_map_write32[a>>>MMAP_BLOCK_BITS](a,b)};CPU.prototype.mmap_write64=function(a,b,c){var d=a>>>MMAP_BLOCK_BITS;dbg_assert(d===a+7>>>MMAP_BLOCK_BITS);d=this.memory_map_write32[d];d(a,b);d(a+4,c)}; +CPU.prototype.mmap_write128=function(a,b,c,d,e){var g=a>>>MMAP_BLOCK_BITS;dbg_assert(g===a+12>>>MMAP_BLOCK_BITS);g=this.memory_map_write32[g];g(a,b);g(a+4,c);g(a+8,d);g(a+12,e)};CPU.prototype.write_blob=function(a,b){dbg_assert(a&&0<=a.length);a.length&&(dbg_assert(!this.in_mapped_range(b)),dbg_assert(!this.in_mapped_range(b+a.length-1)),this.jit_dirty_cache(b,b+a.length),this.mem8.set(a,b))}; +CPU.prototype.read_blob=function(a,b){b&&(dbg_assert(!this.in_mapped_range(a)),dbg_assert(!this.in_mapped_range(a+b-1)));return this.mem8.subarray(a,a+b)};function DMA(a){this.cpu=a;this.channel_page=new Uint8Array(8);this.channel_pagehi=new Uint8Array(8);this.channel_addr=new Uint16Array(8);this.channel_addr_init=new Uint16Array(8);this.channel_count=new Uint16Array(8);this.channel_count_init=new Uint16Array(8);this.channel_mask=new Uint8Array(8);this.channel_mode=new Uint8Array(8);this.unmask_listeners=[];this.lsb_msb_flipflop=0;a=a.io;a.register_write(0,this,this.port_addr_write.bind(this,0));a.register_write(2,this,this.port_addr_write.bind(this, +1));a.register_write(4,this,this.port_addr_write.bind(this,2));a.register_write(6,this,this.port_addr_write.bind(this,3));a.register_write(1,this,this.port_count_write.bind(this,0));a.register_write(3,this,this.port_count_write.bind(this,1));a.register_write(5,this,this.port_count_write.bind(this,2));a.register_write(7,this,this.port_count_write.bind(this,3));a.register_read(0,this,this.port_addr_read.bind(this,0));a.register_read(2,this,this.port_addr_read.bind(this,1));a.register_read(4,this,this.port_addr_read.bind(this, +2));a.register_read(6,this,this.port_addr_read.bind(this,3));a.register_read(1,this,this.port_count_read.bind(this,0));a.register_read(3,this,this.port_count_read.bind(this,1));a.register_read(5,this,this.port_count_read.bind(this,2));a.register_read(7,this,this.port_count_read.bind(this,3));a.register_write(192,this,this.port_addr_write.bind(this,4));a.register_write(196,this,this.port_addr_write.bind(this,5));a.register_write(200,this,this.port_addr_write.bind(this,6));a.register_write(204,this, +this.port_addr_write.bind(this,7));a.register_write(194,this,this.port_count_write.bind(this,4));a.register_write(198,this,this.port_count_write.bind(this,5));a.register_write(202,this,this.port_count_write.bind(this,6));a.register_write(206,this,this.port_count_write.bind(this,7));a.register_read(192,this,this.port_addr_read.bind(this,4));a.register_read(196,this,this.port_addr_read.bind(this,5));a.register_read(200,this,this.port_addr_read.bind(this,6));a.register_read(204,this,this.port_addr_read.bind(this, +7));a.register_read(194,this,this.port_count_read.bind(this,4));a.register_read(198,this,this.port_count_read.bind(this,5));a.register_read(202,this,this.port_count_read.bind(this,6));a.register_read(206,this,this.port_count_read.bind(this,7));a.register_write(135,this,this.port_page_write.bind(this,0));a.register_write(131,this,this.port_page_write.bind(this,1));a.register_write(129,this,this.port_page_write.bind(this,2));a.register_write(130,this,this.port_page_write.bind(this,3));a.register_write(143, +this,this.port_page_write.bind(this,4));a.register_write(139,this,this.port_page_write.bind(this,5));a.register_write(137,this,this.port_page_write.bind(this,6));a.register_write(138,this,this.port_page_write.bind(this,7));a.register_read(135,this,this.port_page_read.bind(this,0));a.register_read(131,this,this.port_page_read.bind(this,1));a.register_read(129,this,this.port_page_read.bind(this,2));a.register_read(130,this,this.port_page_read.bind(this,3));a.register_read(143,this,this.port_page_read.bind(this, +4));a.register_read(139,this,this.port_page_read.bind(this,5));a.register_read(137,this,this.port_page_read.bind(this,6));a.register_read(138,this,this.port_page_read.bind(this,7));a.register_write(1159,this,this.port_pagehi_write.bind(this,0));a.register_write(1155,this,this.port_pagehi_write.bind(this,1));a.register_write(1153,this,this.port_pagehi_write.bind(this,2));a.register_write(1154,this,this.port_pagehi_write.bind(this,3));a.register_write(1163,this,this.port_pagehi_write.bind(this,5)); +a.register_write(1161,this,this.port_pagehi_write.bind(this,6));a.register_write(1162,this,this.port_pagehi_write.bind(this,7));a.register_read(1159,this,this.port_pagehi_read.bind(this,0));a.register_read(1155,this,this.port_pagehi_read.bind(this,1));a.register_read(1153,this,this.port_pagehi_read.bind(this,2));a.register_read(1154,this,this.port_pagehi_read.bind(this,3));a.register_read(1163,this,this.port_pagehi_read.bind(this,5));a.register_read(1161,this,this.port_pagehi_read.bind(this,6));a.register_read(1162, +this,this.port_pagehi_read.bind(this,7));a.register_write(10,this,this.port_singlemask_write.bind(this,0));a.register_write(212,this,this.port_singlemask_write.bind(this,4));a.register_write(15,this,this.port_multimask_write.bind(this,0));a.register_write(222,this,this.port_multimask_write.bind(this,4));a.register_read(15,this,this.port_multimask_read.bind(this,0));a.register_read(222,this,this.port_multimask_read.bind(this,4));a.register_write(11,this,this.port_mode_write.bind(this,0));a.register_write(214, +this,this.port_mode_write.bind(this,4));a.register_write(12,this,this.portC_write);a.register_write(216,this,this.portC_write)}DMA.prototype.get_state=function(){return[this.channel_page,this.channel_pagehi,this.channel_addr,this.channel_addr_init,this.channel_count,this.channel_count_init,this.channel_mask,this.channel_mode,this.lsb_msb_flipflop]}; +DMA.prototype.set_state=function(a){this.channel_page=a[0];this.channel_pagehi=a[1];this.channel_addr=a[2];this.channel_addr_init=a[3];this.channel_count=a[4];this.channel_count_init=a[5];this.channel_mask=a[6];this.channel_mode=a[7];this.lsb_msb_flipflop=a[8]};DMA.prototype.port_count_write=function(a,b){dbg_log("count write ["+a+"] = "+h(b),LOG_DMA);this.channel_count[a]=this.flipflop_get(this.channel_count[a],b,!1);this.channel_count_init[a]=this.flipflop_get(this.channel_count_init[a],b,!0)}; +DMA.prototype.port_count_read=function(a){dbg_log("count read ["+a+"] -> "+h(this.channel_count[a]),LOG_DMA);return this.flipflop_read(this.channel_count[a])};DMA.prototype.port_addr_write=function(a,b){dbg_log("addr write ["+a+"] = "+h(b),LOG_DMA);this.channel_addr[a]=this.flipflop_get(this.channel_addr[a],b,!1);this.channel_addr_init[a]=this.flipflop_get(this.channel_addr_init[a],b,!0)};DMA.prototype.port_addr_read=function(a){dbg_log("addr read ["+a+"] -> "+h(this.channel_addr[a]),LOG_DMA);return this.flipflop_read(this.channel_addr[a])}; +DMA.prototype.port_pagehi_write=function(a,b){dbg_log("pagehi write ["+a+"] = "+h(b),LOG_DMA);this.channel_pagehi[a]=b};DMA.prototype.port_pagehi_read=function(a){dbg_log("pagehi read ["+a+"]",LOG_DMA);return this.channel_pagehi[a]};DMA.prototype.port_page_write=function(a,b){dbg_log("page write ["+a+"] = "+h(b),LOG_DMA);this.channel_page[a]=b};DMA.prototype.port_page_read=function(a){dbg_log("page read ["+a+"]",LOG_DMA);return this.channel_page[a]}; +DMA.prototype.port_singlemask_write=function(a,b){a=(b&3)+a;b=b&4?1:0;dbg_log("singlechannel mask write ["+a+"] = "+b,LOG_DMA);this.update_mask(a,b)};DMA.prototype.port_multimask_write=function(a,b){dbg_log("multichannel mask write: "+h(b),LOG_DMA);for(var c=0;4>c;c++)this.update_mask(a+c,b&1<a.byteLength)dbg_log("DMA read outside of buffer",LOG_DMA),e(!0);else{var k=this.cpu;this.channel_addr[d]+=g;a.get(b,g,function(m){k.write_blob(m,f);e(!1)})}}; +DMA.prototype.do_write=function(a,b,c,d,e){var g=this.channel_count[d]+1&65535,f=5<=d?2:1,k=g*f,m=this.address_get_8bit(d),l=!1,n=!1,p=this.channel_mode[d]&16;dbg_log("DMA write channel "+d,LOG_DMA);dbg_log("to "+h(m)+" len "+h(k),LOG_DMA);ck&&(dbg_log("DMA attempted to read more than provided",LOG_DMA),n=!0);b+k>a.byteLength?(dbg_log("DMA write outside of buffer",LOG_DMA),e(!0)):(this.channel_addr[d]+=g,this.channel_count[d]-= +g,!l&&p&&(dbg_log("DMA autoinit",LOG_DMA),this.channel_addr[d]=this.channel_addr_init[d],this.channel_count[d]=this.channel_count_init[d]),a.set(b,this.cpu.mem8.subarray(m,m+k),()=>{n&&p?(dbg_log("DMA continuing from start",LOG_DMA),this.do_write(a,b+k,c-k,d,e)):e(!1)}))};DMA.prototype.address_get_8bit=function(a){var b=this.channel_addr[a];5<=a&&(b<<=1);b=b&65535|this.channel_page[a]<<16;return b|=this.channel_pagehi[a]<<24}; +DMA.prototype.count_get_8bit=function(a){var b=this.channel_count[a]+1;5<=a&&(b*=2);return b};DMA.prototype.flipflop_get=function(a,b,c){c||(this.lsb_msb_flipflop^=1);return this.lsb_msb_flipflop?a&-256|b:a&-65281|b<<8};DMA.prototype.flipflop_read=function(a){return(this.lsb_msb_flipflop^=1)?a&255:a>>8&255};var OSCILLATOR_FREQ=1193.1816666; +function PIT(a,b){this.cpu=a;this.bus=b;this.counter_start_time=new Float64Array(3);this.counter_start_value=new Uint16Array(3);this.counter_next_low=new Uint8Array(4);this.counter_enabled=new Uint8Array(4);this.counter_mode=new Uint8Array(4);this.counter_read_mode=new Uint8Array(4);this.counter_latch=new Uint8Array(4);this.counter_latch_value=new Uint16Array(3);this.counter_reload=new Uint16Array(3);a.io.register_read(97,this,function(){var c=v86.microtick(),d=66.66666666666667*c&1;c=this.did_rollover(2, +c);return d<<4|c<<5});a.io.register_write(97,this,function(c){c&1?this.bus.send("pcspeaker-enable"):this.bus.send("pcspeaker-disable")});a.io.register_read(64,this,function(){return this.counter_read(0)});a.io.register_read(65,this,function(){return this.counter_read(1)});a.io.register_read(66,this,function(){return this.counter_read(2)});a.io.register_write(64,this,function(c){this.counter_write(0,c)});a.io.register_write(65,this,function(c){this.counter_write(1,c)});a.io.register_write(66,this, +function(c){this.counter_write(2,c);this.bus.send("pcspeaker-update",[this.counter_mode[2],this.counter_reload[2]])});a.io.register_write(67,this,this.port43_write)}PIT.prototype.get_state=function(){var a=[];a[0]=this.counter_next_low;a[1]=this.counter_enabled;a[2]=this.counter_mode;a[3]=this.counter_read_mode;a[4]=this.counter_latch;a[5]=this.counter_latch_value;a[6]=this.counter_reload;a[7]=this.counter_start_time;a[8]=this.counter_start_value;return a}; +PIT.prototype.set_state=function(a){this.counter_next_low=a[0];this.counter_enabled=a[1];this.counter_mode=a[2];this.counter_read_mode=a[3];this.counter_latch=a[4];this.counter_latch_value=a[5];this.counter_reload=a[6];this.counter_start_time=a[7];this.counter_start_value=a[8]}; +PIT.prototype.timer=function(a,b){var c=100;b||(this.counter_enabled[0]&&this.did_rollover(0,a)?(this.counter_start_value[0]=this.get_counter_value(0,a),this.counter_start_time[0]=a,dbg_log("pit interrupt. new value: "+this.counter_start_value[0],LOG_PIT),this.cpu.device_lower_irq(0),this.cpu.device_raise_irq(0),0===this.counter_mode[0]&&(this.counter_enabled[0]=0)):this.cpu.device_lower_irq(0),this.counter_enabled[0]&&(c=(this.counter_start_value[0]-Math.floor((a-this.counter_start_time[0])*OSCILLATOR_FREQ))/ +OSCILLATOR_FREQ));return c};PIT.prototype.get_counter_value=function(a,b){if(!this.counter_enabled[a])return 0;var c=b-this.counter_start_time[a],d=Math.floor(c*OSCILLATOR_FREQ);b=this.counter_start_value[a]-d;dbg_log("diff="+c+" dticks="+d+" value="+b+" reload="+this.counter_reload[a],LOG_PIT);c=this.counter_reload[a];b>=c?(dbg_log("Warning: Counter"+a+" value "+b+" is larger than reload "+c,LOG_PIT),b%=c):0>b&&(b=b%c+c);return b}; +PIT.prototype.did_rollover=function(a,b){b-=this.counter_start_time[a];return 0>b?(dbg_log("Warning: PIT timer difference is negative, resetting (timer "+a+")"),!0):this.counter_start_value[a]>8;b=this.counter_next_low[a];3===this.counter_mode[a]&&(this.counter_next_low[a]^=1);a=this.get_counter_value(a,v86.microtick());return b?a&255:a>>8}; +PIT.prototype.counter_write=function(a,b){this.counter_reload[a]=this.counter_next_low[a]?this.counter_reload[a]&-256|b:this.counter_reload[a]&255|b<<8;3===this.counter_read_mode[a]&&this.counter_next_low[a]||(this.counter_reload[a]||(this.counter_reload[a]=65535),this.counter_start_value[a]=this.counter_reload[a],this.counter_enabled[a]=!0,this.counter_start_time[a]=v86.microtick(),dbg_log("counter"+a+" reload="+h(this.counter_reload[a])+" tick="+(this.counter_reload[a]||65536)/OSCILLATOR_FREQ+"ms", +LOG_PIT));3===this.counter_read_mode[a]&&(this.counter_next_low[a]^=1)}; +PIT.prototype.port43_write=function(a){var b=a>>1&7,c=a&1,d=a>>6&3;a=a>>4&3;1===d&&dbg_log("Unimplemented timer1",LOG_PIT);3===d?dbg_log("Unimplemented read back",LOG_PIT):0===a?(this.counter_latch[d]=2,b=this.get_counter_value(d,v86.microtick()),dbg_log("latch: "+b,LOG_PIT),this.counter_latch_value[d]=b?b-1:0):(6<=b&&(b&=-5),dbg_log("Control: mode="+b+" ctr="+d+" read_mode="+a+" bcd="+c,LOG_PIT),this.counter_next_low[d]=1===a?0:1,0===d&&this.cpu.device_lower_irq(0),0!==b&&3!==b&&2!==b&&dbg_log("Unimplemented counter mode: "+ +h(b),LOG_PIT),this.counter_mode[d]=b,this.counter_read_mode[d]=a,2===d&&this.bus.send("pcspeaker-update",[this.counter_mode[2],this.counter_reload[2]]))};PIT.prototype.dump=function(){const a=this.counter_reload[0];dbg_log("counter0 ticks every "+(a||65536)/OSCILLATOR_FREQ+"ms (reload="+a+")")};var VGA_BANK_SIZE=65536,MAX_XRES=2560,MAX_YRES=1600,MAX_BPP=32,VGA_LFB_ADDRESS=3758096384,VGA_PIXEL_BUFFER_SIZE=8*VGA_BANK_SIZE,VGA_MIN_MEMORY_SIZE=4*VGA_BANK_SIZE,VGA_HOST_MEMORY_SPACE_START=Uint32Array.from([655360,655360,720896,753664]),VGA_HOST_MEMORY_SPACE_SIZE=Uint32Array.from([131072,65536,32768,32768]); +function VGAScreen(a,b,c){this.cpu=a;this.bus=b;this.vga_memory_size=c;this.cursor_address=0;this.cursor_scanline_start=14;this.cursor_scanline_end=15;this.max_cols=80;this.max_rows=25;this.virtual_height=this.virtual_width=this.screen_height=this.screen_width=0;this.layers=[];this.start_address_latched=this.start_address=0;this.crtc=new Uint8Array(25);this.line_compare=this.offset_register=this.preset_row_scan=this.underline_location_register=this.vertical_blank_start=this.vertical_display_enable_end= +this.horizontal_blank_start=this.horizontal_display_enable_end=this.crtc_mode=0;this.graphical_mode_is_linear=!0;this.graphical_mode=!1;setTimeout(()=>{b.send("screen-set-mode",this.graphical_mode)},0);this.vga256_palette=new Int32Array(256);this.latch_dword=0;this.svga_version=45253;this.svga_height=this.svga_width=0;this.svga_enabled=!1;this.svga_bpp=32;this.svga_offset=this.svga_bank_offset=0;this.pci_space=[52,18,17,17,3,1,0,0,0,0,0,3,0,0,0,0,8,VGA_LFB_ADDRESS>>>8,VGA_LFB_ADDRESS>>>16,VGA_LFB_ADDRESS>>> +24,0,0,0,0,0,0,191,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,26,0,17,0,0,190,254,0,0,0,0,0,0,0,0,0,0,0,0];this.pci_id=144;this.pci_bars=[{size:c}];this.pci_rom_size=65536;this.pci_rom_address=4272947200;this.name="vga";this.stats={is_graphical:!1,res_x:0,res_y:0,bpp:0};this.dac_state=this.dac_color_index_read=this.dac_color_index_write=this.index_crtc=0;this.dac_mask=255;this.dac_map=new Uint8Array(16);this.attribute_controller_index=-1;this.palette_source=32;this.color_select=this.horizontal_panning= +this.color_plane_enable=this.attribute_mode=0;this.sequencer_index=-1;this.plane_write_bm=15;this.clocking_mode=this.sequencer_memory_mode=0;this.graphics_index=-1;this.planar_rotate_reg=this.planar_mode=this.plane_read=0;this.planar_bitmap=255;this.max_scan_line=this.color_dont_care=this.color_compare=this.miscellaneous_graphics_register=this.planar_setreset_enable=this.planar_setreset=0;this.port_3DA_value=this.miscellaneous_output_register=255;c=a.io;c.register_write(960,this,this.port3C0_write); +c.register_read(960,this,this.port3C0_read,this.port3C0_read16);c.register_read(961,this,this.port3C1_read);c.register_write(962,this,this.port3C2_write);c.register_write_consecutive(964,this,this.port3C4_write,this.port3C5_write);c.register_read(964,this,this.port3C4_read);c.register_read(965,this,this.port3C5_read);c.register_write_consecutive(974,this,this.port3CE_write,this.port3CF_write);c.register_read(974,this,this.port3CE_read);c.register_read(975,this,this.port3CF_read);c.register_read(966, +this,this.port3C6_read);c.register_write(966,this,this.port3C6_write);c.register_write(967,this,this.port3C7_write);c.register_read(967,this,this.port3C7_read);c.register_write(968,this,this.port3C8_write);c.register_read(968,this,this.port3C8_read);c.register_write(969,this,this.port3C9_write);c.register_read(969,this,this.port3C9_read);c.register_read(972,this,this.port3CC_read);c.register_write_consecutive(980,this,this.port3D4_write,this.port3D5_write);c.register_read(980,this,this.port3D4_read); +c.register_read(981,this,this.port3D5_read,()=>{dbg_log("Warning: 16-bit read from 3D5",LOG_VGA);return this.port3D5_read()});c.register_read(970,this,function(){dbg_log("3CA read",LOG_VGA);return 0});c.register_read(986,this,this.port3DA_read);c.register_read(954,this,this.port3DA_read);this.dispi_index=-1;this.dispi_enable_value=0;c.register_write(462,this,void 0,this.port1CE_write);c.register_write(463,this,void 0,this.port1CF_write);c.register_read(463,this,void 0,this.port1CF_read);void 0=== +this.vga_memory_size||this.vga_memory_size>2&3;a-=VGA_HOST_MEMORY_SPACE_START[b];if(0>a||a>=VGA_HOST_MEMORY_SPACE_SIZE[b])return dbg_log("vga read outside memory space: addr:"+h(a),LOG_VGA),0;this.latch_dword=this.plane0[a];this.latch_dword|=this.plane1[a]<<8;this.latch_dword|=this.plane2[a]<<16;this.latch_dword|=this.plane3[a]<< +24;if(this.planar_mode&8)return b=255,this.color_dont_care&1&&(b&=this.plane0[a]^~(this.color_compare&1?255:0)),this.color_dont_care&2&&(b&=this.plane1[a]^~(this.color_compare&2?255:0)),this.color_dont_care&4&&(b&=this.plane2[a]^~(this.color_compare&4?255:0)),this.color_dont_care&8&&(b&=this.plane3[a]^~(this.color_compare&8?255:0)),b;b=this.plane_read;this.graphical_mode?this.sequencer_memory_mode&8?(b=a&3,a&=-4):this.planar_mode&16&&(b=a&1,a&=-2):b=0;return this.vga_memory[b<<16|a]}; +VGAScreen.prototype.vga_memory_write=function(a,b){if(this.svga_enabled&&this.graphical_mode&&this.graphical_mode_is_linear)this.cpu.write8((a-655360|this.svga_bank_offset)+VGA_LFB_ADDRESS|0,b);else{var c=this.miscellaneous_graphics_register>>2&3;a-=VGA_HOST_MEMORY_SPACE_START[c];0>a||a>=VGA_HOST_MEMORY_SPACE_SIZE[c]?dbg_log("vga write outside memory space: addr:"+h(a)+", value:"+h(b),LOG_VGA):this.graphical_mode?this.vga_memory_write_graphical(a,b):this.plane_write_bm&3&&this.vga_memory_write_text_mode(a, +b)}}; +VGAScreen.prototype.vga_memory_write_graphical=function(a,b){var c=this.planar_mode&3,d=this.apply_feed(this.planar_bitmap),e=this.apply_expand(this.planar_setreset),g=this.apply_expand(this.planar_setreset_enable);switch(c){case 0:b=this.apply_rotate(b);var f=this.apply_feed(b);f=this.apply_setreset(f,g);f=this.apply_logical(f,this.latch_dword);f=this.apply_bitmask(f,d);break;case 1:f=this.latch_dword;break;case 2:f=this.apply_expand(b);f=this.apply_logical(f,this.latch_dword);f=this.apply_bitmask(f,d); +break;case 3:b=this.apply_rotate(b),d&=this.apply_feed(b),f=this.apply_bitmask(e,d)}b=15;switch(this.sequencer_memory_mode&12){case 0:b=5<<(a&1);a&=-2;break;case 8:case 12:b=1<<(a&3),a&=-4}b&=this.plane_write_bm;b&1&&(this.plane0[a]=f>>0&255);b&2&&(this.plane1[a]=f>>8&255);b&4&&(this.plane2[a]=f>>16&255);b&8&&(this.plane3[a]=f>>24&255);a=this.vga_addr_to_pixel(a);this.partial_replot(a,a+7)};VGAScreen.prototype.apply_feed=function(a){return a|a<<8|a<<16|a<<24}; +VGAScreen.prototype.apply_expand=function(a){return(a&1?255:0)|(a&2?255:0)<<8|(a&4?255:0)<<16|(a&8?255:0)<<24};VGAScreen.prototype.apply_rotate=function(a){return(a|a<<8)>>>(this.planar_rotate_reg&7)&255};VGAScreen.prototype.apply_setreset=function(a,b){var c=this.apply_expand(this.planar_setreset);return(a|b&c)&(~b|c)};VGAScreen.prototype.apply_logical=function(a,b){switch(this.planar_rotate_reg&24){case 8:return a&b;case 16:return a|b;case 24:return a^b}return a}; +VGAScreen.prototype.apply_bitmask=function(a,b){return b&a|~b&this.latch_dword};VGAScreen.prototype.text_mode_redraw=function(){for(var a=this.start_address<<1,b,c,d=0;d>4&15]],this.vga256_palette[this.dac_mask&this.dac_map[c&15]]]),a+=2}; +VGAScreen.prototype.vga_memory_write_text_mode=function(a,b){var c=(a>>1)-this.start_address,d=c/this.max_cols|0;c%=this.max_cols;if(a&1){var e=b;var g=this.vga_memory[a&-2]}else g=b,e=this.vga_memory[a|1];this.bus.send("screen-put-char",[d,c,g,this.vga256_palette[this.dac_mask&this.dac_map[e>>4&15]],this.vga256_palette[this.dac_mask&this.dac_map[e&15]]]);this.vga_memory[a]=b}; +VGAScreen.prototype.update_cursor=function(){var a=(this.cursor_address-this.start_address)/this.max_cols|0,b=(this.cursor_address-this.start_address)%this.max_cols;a=Math.min(this.max_rows-1,a);this.bus.send("screen-update-cursor",[a,b])};VGAScreen.prototype.complete_redraw=function(){dbg_log("complete redraw",LOG_VGA);this.graphical_mode?this.svga_enabled?this.cpu.svga_mark_dirty():(this.diff_addr_min=0,this.diff_addr_max=VGA_PIXEL_BUFFER_SIZE):this.text_mode_redraw()}; +VGAScreen.prototype.complete_replot=function(){dbg_log("complete replot",LOG_VGA);this.graphical_mode&&!this.svga_enabled&&(this.diff_plot_min=0,this.diff_plot_max=VGA_PIXEL_BUFFER_SIZE,this.complete_redraw())};VGAScreen.prototype.partial_redraw=function(a,b){athis.diff_addr_max&&(this.diff_addr_max=b)}; +VGAScreen.prototype.partial_replot=function(a,b){athis.diff_plot_max&&(this.diff_plot_max=b);this.partial_redraw(a,b)};VGAScreen.prototype.reset_diffs=function(){this.diff_addr_min=this.vga_memory_size;this.diff_addr_max=0;this.diff_plot_min=this.vga_memory_size;this.diff_plot_max=0};VGAScreen.prototype.destroy=function(){}; +VGAScreen.prototype.vga_bytes_per_line=function(){var a=this.offset_register<<2;this.underline_location_register&64?a<<=1:this.crtc_mode&64&&(a>>>=1);return a};VGAScreen.prototype.vga_addr_shift_count=function(){var a=128+(~this.underline_location_register&this.crtc_mode&64);a-=this.underline_location_register&64;a-=this.attribute_mode&64;return a>>>6}; +VGAScreen.prototype.vga_addr_to_pixel=function(a){var b=this.vga_addr_shift_count();if(~this.crtc_mode&3){var c=a-this.start_address;c&=this.crtc_mode<<13|-24577;c<<=b;var d=c/this.virtual_width|0;c%=this.virtual_width;switch(this.crtc_mode&3){case 2:d=d<<1|a>>13&1;break;case 1:d=d<<1|a>>14&1;break;case 0:d=d<<2|a>>13&3}return d*this.virtual_width+c+(this.start_address<>>=1);a=Math.ceil(a/(1+(this.max_scan_line&31)));this.crtc_mode&1||(a<<=1);this.crtc_mode&2||(a<<=1);return a};VGAScreen.prototype.set_size_text=function(a,b){this.max_cols=a;this.max_rows=b;this.bus.send("screen-set-size-text",[a,b])}; +VGAScreen.prototype.set_size_graphical=function(a,b,c,d,e){if(!this.stats.is_graphical||this.stats.bpp!==c||this.screen_width!==a||this.screen_height!==b||this.virtual_width!==d||this.virtual_height!==e){this.screen_width=a;this.screen_height=b;this.virtual_width=d;this.virtual_height=e;this.stats.bpp=c;this.stats.is_graphical=!0;this.stats.res_x=a;this.stats.res_y=b;if("undefined"!==typeof ImageData){const g=d*e,f=this.cpu.svga_allocate_dest_buffer(g)>>>0;this.dest_buffet_offset=f;this.image_data= +new ImageData(new Uint8ClampedArray(this.cpu.wasm_memory.buffer,f,4*g),d,e);this.cpu.svga_mark_dirty()}this.bus.send("screen-set-size-graphical",[a,b,d,e,c])}}; +VGAScreen.prototype.update_vga_size=function(){if(!this.svga_enabled){var a=Math.min(1+this.horizontal_display_enable_end,this.horizontal_blank_start),b=Math.min(1+this.vertical_display_enable_end,this.vertical_blank_start);if(a&&b)if(this.graphical_mode){a<<=3;var c=this.offset_register<<4;this.attribute_mode&64&&(a>>>=1,c>>>=1);b=this.scan_line_to_screen_row(b);var d=Math.ceil(VGA_HOST_MEMORY_SPACE_SIZE[0]/this.vga_bytes_per_line());this.set_size_graphical(a,b,8,c,d);this.update_vertical_retrace(); +this.update_layers()}else this.max_scan_line&128&&(b>>>=1),c=b/(1+(this.max_scan_line&31))|0,a&&c&&this.set_size_text(a,c)}}; +VGAScreen.prototype.update_layers=function(){this.graphical_mode||this.text_mode_redraw();if(this.svga_enabled)this.layers=[];else if(this.virtual_width&&this.screen_width)if(!this.palette_source||this.clocking_mode&32)this.layers=[],this.bus.send("screen-clear");else{var a=this.start_address_latched,b=this.horizontal_panning;this.attribute_mode&64&&(b>>>=1);var c=this.preset_row_scan>>5&3,d=this.vga_addr_to_pixel(a+c);a=d/this.virtual_width|0;var e=d%this.virtual_width+b;d=this.scan_line_to_screen_row(1+ +this.line_compare);d=Math.min(d,this.screen_height);var g=this.screen_height-d;this.layers=[];e=-e;for(var f=0;ethis.attribute_controller_index)dbg_log("internal palette: "+h(this.attribute_controller_index)+" -> "+h(a),LOG_VGA),this.dac_map[this.attribute_controller_index]= +a,this.attribute_mode&64||this.complete_redraw();else switch(this.attribute_controller_index){case 16:dbg_log("3C0 / attribute mode control: "+h(a),LOG_VGA);if(this.attribute_mode!==a){var b=this.attribute_mode;this.attribute_mode=a;var c=0<(a&1);this.svga_enabled||this.graphical_mode===c||(this.graphical_mode=c,this.bus.send("screen-set-mode",this.graphical_mode));(b^a)&64&&this.complete_replot();this.update_vga_size();this.complete_redraw()}break;case 18:dbg_log("3C0 / color plane enable: "+h(a), +LOG_VGA);this.color_plane_enable!==a&&(this.color_plane_enable=a,this.complete_redraw());break;case 19:dbg_log("3C0 / horizontal panning: "+h(a),LOG_VGA);this.horizontal_panning!==a&&(this.horizontal_panning=a&15,this.update_layers());break;case 20:dbg_log("3C0 / color select: "+h(a),LOG_VGA);this.color_select!==a&&(this.color_select=a,this.complete_redraw());break;default:dbg_log("3C0 / attribute controller write "+h(this.attribute_controller_index)+": "+h(a),LOG_VGA)}this.attribute_controller_index= +-1}};VGAScreen.prototype.port3C0_read=function(){dbg_log("3C0 read",LOG_VGA);return(this.attribute_controller_index|this.palette_source)&255};VGAScreen.prototype.port3C0_read16=function(){dbg_log("3C0 read16",LOG_VGA);return this.port3C0_read()|this.port3C1_read()<<8&65280}; +VGAScreen.prototype.port3C1_read=function(){if(16>this.attribute_controller_index)return dbg_log("3C1 / internal palette read: "+h(this.attribute_controller_index)+" -> "+h(this.dac_map[this.attribute_controller_index]),LOG_VGA),this.dac_map[this.attribute_controller_index]&255;switch(this.attribute_controller_index){case 16:return dbg_log("3C1 / attribute mode read: "+h(this.attribute_mode),LOG_VGA),this.attribute_mode;case 18:return dbg_log("3C1 / color plane enable read: "+h(this.color_plane_enable), +LOG_VGA),this.color_plane_enable;case 19:return dbg_log("3C1 / horizontal panning read: "+h(this.horizontal_panning),LOG_VGA),this.horizontal_panning;case 20:return dbg_log("3C1 / color select read: "+h(this.color_select),LOG_VGA),this.color_select;default:dbg_log("3C1 / attribute controller read "+h(this.attribute_controller_index),LOG_VGA)}return 255};VGAScreen.prototype.port3C2_write=function(a){dbg_log("3C2 / miscellaneous output register = "+h(a),LOG_VGA);this.miscellaneous_output_register=a}; +VGAScreen.prototype.port3C4_write=function(a){this.sequencer_index=a};VGAScreen.prototype.port3C4_read=function(){return this.sequencer_index}; +VGAScreen.prototype.port3C5_write=function(a){switch(this.sequencer_index){case 1:dbg_log("clocking mode: "+h(a),LOG_VGA);var b=this.clocking_mode;this.clocking_mode=a;(b^a)&32&&this.update_layers();break;case 2:dbg_log("plane write mask: "+h(a),LOG_VGA);this.plane_write_bm=a;break;case 4:dbg_log("sequencer memory mode: "+h(a),LOG_VGA);this.sequencer_memory_mode=a;break;default:dbg_log("3C5 / sequencer write "+h(this.sequencer_index)+": "+h(a),LOG_VGA)}}; +VGAScreen.prototype.port3C5_read=function(){dbg_log("3C5 / sequencer read "+h(this.sequencer_index),LOG_VGA);switch(this.sequencer_index){case 1:return this.clocking_mode;case 2:return this.plane_write_bm;case 4:return this.sequencer_memory_mode;case 6:return 18}return 0};VGAScreen.prototype.port3C6_write=function(a){this.dac_mask=a};VGAScreen.prototype.port3C6_read=function(){return this.dac_mask}; +VGAScreen.prototype.port3C7_write=function(a){dbg_log("3C7 write: "+h(a),LOG_VGA);this.dac_color_index_read=3*a;this.dac_state&=0};VGAScreen.prototype.port3C7_read=function(){return this.dac_state};VGAScreen.prototype.port3C8_write=function(a){this.dac_color_index_write=3*a;this.dac_state|=3};VGAScreen.prototype.port3C8_read=function(){return this.dac_color_index_write/3&255}; +VGAScreen.prototype.port3C9_write=function(a){var b=this.dac_color_index_write/3|0,c=this.dac_color_index_write%3,d=this.vga256_palette[b];if(0===(this.dispi_enable_value&32)){a&=63;const e=a&1;a=a<<2|e<<1|e}0===c?d=d&-16711681|a<<16:1===c?d=d&-65281|a<<8:(d=d&-256|a,dbg_log("dac set color, index="+h(b)+" value="+h(d),LOG_VGA));this.vga256_palette[b]!==d&&(this.vga256_palette[b]=d,this.complete_redraw());this.dac_color_index_write++}; +VGAScreen.prototype.port3C9_read=function(){dbg_log("3C9 read",LOG_VGA);var a=this.vga256_palette[this.dac_color_index_read/3|0]>>8*(2-this.dac_color_index_read%3)&255;this.dac_color_index_read++;return this.dispi_enable_value&32?a:a>>2};VGAScreen.prototype.port3CC_read=function(){dbg_log("3CC read",LOG_VGA);return this.miscellaneous_output_register};VGAScreen.prototype.port3CE_write=function(a){this.graphics_index=a};VGAScreen.prototype.port3CE_read=function(){return this.graphics_index}; +VGAScreen.prototype.port3CF_write=function(a){switch(this.graphics_index){case 0:this.planar_setreset=a;dbg_log("plane set/reset: "+h(a),LOG_VGA);break;case 1:this.planar_setreset_enable=a;dbg_log("plane set/reset enable: "+h(a),LOG_VGA);break;case 2:this.color_compare=a;dbg_log("color compare: "+h(a),LOG_VGA);break;case 3:this.planar_rotate_reg=a;dbg_log("plane rotate: "+h(a),LOG_VGA);break;case 4:this.plane_read=a;dbg_log("plane read: "+h(a),LOG_VGA);break;case 5:var b=this.planar_mode;this.planar_mode= +a;dbg_log("planar mode: "+h(a),LOG_VGA);(b^a)&96&&this.complete_replot();break;case 6:dbg_log("miscellaneous graphics register: "+h(a),LOG_VGA);this.miscellaneous_graphics_register!==a&&(this.miscellaneous_graphics_register=a,this.update_vga_size());break;case 7:this.color_dont_care=a;dbg_log("color don't care: "+h(a),LOG_VGA);break;case 8:this.planar_bitmap=a;dbg_log("planar bitmap: "+h(a),LOG_VGA);break;default:dbg_log("3CF / graphics write "+h(this.graphics_index)+": "+h(a),LOG_VGA)}}; +VGAScreen.prototype.port3CF_read=function(){dbg_log("3CF / graphics read "+h(this.graphics_index),LOG_VGA);switch(this.graphics_index){case 0:return this.planar_setreset;case 1:return this.planar_setreset_enable;case 2:return this.color_compare;case 3:return this.planar_rotate_reg;case 4:return this.plane_read;case 5:return this.planar_mode;case 6:return this.miscellaneous_graphics_register;case 7:return this.color_dont_care;case 8:return this.planar_bitmap}return 0}; +VGAScreen.prototype.port3D4_write=function(a){dbg_log("3D4 / crtc index: "+a,LOG_VGA);this.index_crtc=a};VGAScreen.prototype.port3D4_read=function(){dbg_log("3D4 read / crtc index: "+this.index_crtc,LOG_VGA);return this.index_crtc}; +VGAScreen.prototype.port3D5_write=function(a){switch(this.index_crtc){case 1:dbg_log("3D5 / hdisp enable end write: "+h(a),LOG_VGA);this.horizontal_display_enable_end!==a&&(this.horizontal_display_enable_end=a,this.update_vga_size());break;case 2:this.horizontal_blank_start!==a&&(this.horizontal_blank_start=a,this.update_vga_size());break;case 7:dbg_log("3D5 / overflow register write: "+h(a),LOG_VGA);var b=this.vertical_display_enable_end;this.vertical_display_enable_end&=255;this.vertical_display_enable_end= +this.vertical_display_enable_end|a<<3&512|a<<7&256;b!=this.vertical_display_enable_end&&this.update_vga_size();this.line_compare=this.line_compare&767|a<<4&256;b=this.vertical_blank_start;this.vertical_blank_start=this.vertical_blank_start&767|a<<5&256;b!==this.vertical_blank_start&&this.update_vga_size();this.update_layers();break;case 8:dbg_log("3D5 / preset row scan write: "+h(a),LOG_VGA);this.preset_row_scan=a;this.update_layers();break;case 9:dbg_log("3D5 / max scan line write: "+h(a),LOG_VGA); +this.max_scan_line=a;this.line_compare=this.line_compare&511|a<<3&512;b=this.vertical_blank_start;this.vertical_blank_start=this.vertical_blank_start&511|a<<4&512;b!==this.vertical_blank_start&&this.update_vga_size();this.update_layers();break;case 10:dbg_log("3D5 / cursor scanline start write: "+h(a),LOG_VGA);this.cursor_scanline_start=a;this.update_cursor_scanline();break;case 11:dbg_log("3D5 / cursor scanline end write: "+h(a),LOG_VGA);this.cursor_scanline_end=a;this.update_cursor_scanline();break; +case 12:(this.start_address>>8&255)!==a&&(this.start_address=this.start_address&255|a<<8,this.update_layers(),~this.crtc_mode&3&&this.complete_replot());dbg_log("3D5 / start addr hi write: "+h(a)+" -> "+h(this.start_address,4),LOG_VGA);break;case 13:(this.start_address&255)!==a&&(this.start_address=this.start_address&65280|a,this.update_layers(),~this.crtc_mode&3&&this.complete_replot());dbg_log("3D5 / start addr lo write: "+h(a)+" -> "+h(this.start_address,4),LOG_VGA);break;case 14:dbg_log("3D5 / cursor address hi write: "+ +h(a),LOG_VGA);this.cursor_address=this.cursor_address&255|a<<8;this.update_cursor();break;case 15:dbg_log("3D5 / cursor address lo write: "+h(a),LOG_VGA);this.cursor_address=this.cursor_address&65280|a;this.update_cursor();break;case 18:dbg_log("3D5 / vdisp enable end write: "+h(a),LOG_VGA);(this.vertical_display_enable_end&255)!==a&&(this.vertical_display_enable_end=this.vertical_display_enable_end&768|a,this.update_vga_size());break;case 19:dbg_log("3D5 / offset register write: "+h(a),LOG_VGA); +this.offset_register!==a&&(this.offset_register=a,this.update_vga_size(),~this.crtc_mode&3&&this.complete_replot());break;case 20:dbg_log("3D5 / underline location write: "+h(a),LOG_VGA);this.underline_location_register!==a&&(b=this.underline_location_register,this.underline_location_register=a,this.update_vga_size(),(b^a)&64&&this.complete_replot());break;case 21:dbg_log("3D5 / vertical blank start write: "+h(a),LOG_VGA);(this.vertical_blank_start&255)!==a&&(this.vertical_blank_start=this.vertical_blank_start& +768|a,this.update_vga_size());break;case 23:dbg_log("3D5 / crtc mode write: "+h(a),LOG_VGA);this.crtc_mode!==a&&(b=this.crtc_mode,this.crtc_mode=a,this.update_vga_size(),(b^a)&67&&this.complete_replot());break;case 24:dbg_log("3D5 / line compare write: "+h(a),LOG_VGA);this.line_compare=this.line_compare&768|a;this.update_layers();break;default:this.index_crtc>7&2|this.vertical_blank_start>>5&8|this.line_compare>>4&16|this.vertical_display_enable_end>>3&64;case 8:return this.preset_row_scan;case 9:return this.max_scan_line;case 10:return this.cursor_scanline_start;case 11:return this.cursor_scanline_end; +case 12:return this.start_address&255;case 13:return this.start_address>>8;case 14:return this.cursor_address>>8;case 15:return this.cursor_address&255;case 18:return this.vertical_display_enable_end&255;case 19:return this.offset_register;case 20:return this.underline_location_register;case 21:return this.vertical_blank_start&255;case 23:return this.crtc_mode;case 24:return this.line_compare&255}return this.index_crtc=a?this.svga_version=a:dbg_log("Invalid version value: "+h(a),LOG_VGA);break;case 1:this.svga_width=a;this.svga_width>MAX_XRES&&(dbg_log("svga_width reduced from "+this.svga_width+" to "+MAX_XRES,LOG_VGA),this.svga_width=MAX_XRES);break;case 2:this.svga_height=a;this.svga_height>MAX_YRES&&(dbg_log("svga_height reduced from "+this.svga_height+ +" to "+MAX_YRES,LOG_VGA),this.svga_height=MAX_YRES);break;case 3:this.svga_bpp=a;break;case 4:this.svga_enabled=1===(a&1);this.dispi_enable_value=a;break;case 5:dbg_log("SVGA bank offset: "+h(a<<16),LOG_VGA);this.svga_bank_offset=a<<16;break;case 9:const b=a*this.svga_width;dbg_log("SVGA offset: "+h(b)+" y="+h(a),LOG_VGA);this.svga_offset!==b&&(this.svga_offset=b,this.complete_redraw())}!this.svga_enabled||this.svga_width&&this.svga_height||(dbg_log("SVGA: disabled because of invalid width/height: "+ +this.svga_width+"x"+this.svga_height,LOG_VGA),this.svga_enabled=!1);dbg_assert(4!==this.svga_bpp,"unimplemented svga bpp: 4");dbg_assert(4===this.svga_bpp||8===this.svga_bpp||15===this.svga_bpp||16===this.svga_bpp||24===this.svga_bpp||32===this.svga_bpp,"unexpected svga bpp: "+this.svga_bpp);dbg_log("SVGA: enabled="+this.svga_enabled+", "+this.svga_width+"x"+this.svga_height+"x"+this.svga_bpp,LOG_VGA);this.svga_enabled&&4===this.dispi_index&&(this.set_size_graphical(this.svga_width,this.svga_height, +this.svga_bpp,this.svga_width,this.svga_height),this.bus.send("screen-set-mode",!0),this.graphical_mode_is_linear=this.graphical_mode=!0);this.svga_enabled||(this.svga_bank_offset=0);this.update_layers()};VGAScreen.prototype.port1CF_read=function(){dbg_log("1CF / dispi read "+h(this.dispi_index),LOG_VGA);return this.svga_register_read(this.dispi_index)}; +VGAScreen.prototype.svga_register_read=function(a){switch(a){case 0:return this.svga_version;case 1:return this.dispi_enable_value&2?MAX_XRES:this.svga_width;case 2:return this.dispi_enable_value&2?MAX_YRES:this.svga_height;case 3:return this.dispi_enable_value&2?MAX_BPP:this.svga_bpp;case 4:return this.dispi_enable_value;case 5:return this.svga_bank_offset>>>16;case 6:return this.screen_width?this.screen_width:1;case 8:return 0;case 10:return this.vga_memory_size/VGA_BANK_SIZE|0}return 255}; +VGAScreen.prototype.vga_replot=function(){for(var a=this.diff_plot_min&-16,b=Math.min(this.diff_plot_max|15,VGA_PIXEL_BUFFER_SIZE-1),c=this.vga_addr_shift_count(),d=~this.crtc_mode&3,e=this.planar_mode&96,g=this.attribute_mode&64;a<=b;){var f=a>>>c;if(d){var k=a/this.virtual_width|0,m=a-this.virtual_width*k;switch(d){case 1:f=(k&1)<<13;k>>>=1;break;case 2:f=(k&1)<<14;k>>>=1;break;case 3:f=(k&3)<<13,k>>>=2}f|=(k*this.virtual_width+m>>>c)+this.start_address}k=this.plane0[f];m=this.plane1[f];var l=this.plane2[f], +n=this.plane3[f];f=new Uint8Array(8);switch(e){case 0:k<<=0;m<<=1;l<<=2;n<<=3;for(var p=7;0<=p;p--)f[7-p]=k>>p&1|m>>p&2|l>>p&4|n>>p&8;break;case 32:f[0]=k>>6&3|l>>4&12;f[1]=k>>4&3|l>>2&12;f[2]=k>>2&3|l>>0&12;f[3]=k>>0&3|l<<2&12;f[4]=m>>6&3|n>>4&12;f[5]=m>>4&3|n>>2&12;f[6]=m>>2&3|n>>0&12;f[7]=m>>0&3|n<<2&12;break;case 64:case 96:f[0]=k>>4&15,f[1]=k>>0&15,f[2]=m>>4&15,f[3]=m>>0&15,f[4]=l>>4&15,f[5]=l>>0&15,f[6]=n>>4&15,f[7]=n>>0&15}if(g)for(k=p=0;4>p;p++,a++,k+=2)this.pixel_buffer[a]=f[k]<<4|f[k+1]; +else for(p=0;8>p;p++,a++)this.pixel_buffer[a]=f[p]}}; +VGAScreen.prototype.vga_redraw=function(){var a=this.diff_addr_min,b=Math.min(this.diff_addr_max,VGA_PIXEL_BUFFER_SIZE-1);const c=new Int32Array(this.cpu.wasm_memory.buffer,this.dest_buffet_offset,this.virtual_width*this.virtual_height);var d=255,e=0;this.attribute_mode&128&&(d&=207,e|=this.color_select<<4&48);if(this.attribute_mode&64)for(;a<=b;a++){var g=this.pixel_buffer[a]&d|e;g=this.vga256_palette[g];c[a]=g&65280|g<<16|g>>16|4278190080}else for(d&=63,e|=this.color_select<<4&192;a<=b;a++)g=this.dac_map[this.pixel_buffer[a]& +this.color_plane_enable]&d|e,g=this.vga256_palette[g],c[a]=g&65280|g<<16|g>>16|4278190080}; +VGAScreen.prototype.screen_fill_buffer=function(){if(this.graphical_mode){if(0===this.image_data.data.byteLength){var a=new Uint8ClampedArray(this.cpu.wasm_memory.buffer,this.dest_buffet_offset,4*this.virtual_width*this.virtual_height);this.image_data=new ImageData(a,this.virtual_width,this.virtual_height);this.update_layers()}if(this.svga_enabled){a=0;let d=this.svga_height;if(8===this.svga_bpp){const e=new Int32Array(this.cpu.wasm_memory.buffer,this.dest_buffet_offset,this.screen_width*this.screen_height), +g=new Uint8Array(this.cpu.wasm_memory.buffer,this.svga_memory.byteOffset,this.vga_memory_size);for(var b=0;b>16|4278190080}}else this.cpu.svga_fill_pixel_buffer(this.svga_bpp,this.svga_offset),b=15===this.svga_bpp?2:this.svga_bpp/8,a=((this.cpu.svga_dirty_bitmap_min_offset[0]/b|0)-this.svga_offset)/this.svga_width|0,d=(((this.cpu.svga_dirty_bitmap_max_offset[0]/b|0)-this.svga_offset)/this.svga_width|0)+1;ab)<<5|(0>a)<<4|8|this.mouse_clicks;this.last_mouse_packet=Date.now();this.mouse_buffer.push(c);this.mouse_buffer.push(a);this.mouse_buffer.push(b);4===this.mouse_id?(this.mouse_buffer.push(0|this.wheel_movement&15),this.wheel_movement=0):3===this.mouse_id&&(this.mouse_buffer.push(this.wheel_movement&255),this.wheel_movement=0);PS2_LOG_VERBOSE&&dbg_log("adding mouse packets: "+[c,a,b],LOG_PS2);this.raise_irq()}; +PS2.prototype.apply_scaling2=function(a){var b=a>>31;switch(Math.abs(a)){case 0:case 1:case 3:return a;case 2:return b;case 4:return 6*b;case 5:return 9*b;default:return a<<1}}; +PS2.prototype.port60_read=function(){this.next_byte_is_ready=!1;if(!this.kbd_buffer.length&&!this.mouse_buffer.length)return dbg_log("Port 60 read: Empty",LOG_PS2),this.last_port60_byte;this.next_byte_is_aux?(this.cpu.device_lower_irq(12),this.last_port60_byte=this.mouse_buffer.shift(),dbg_log("Port 60 read (mouse): "+h(this.last_port60_byte),LOG_PS2)):(this.cpu.device_lower_irq(1),this.last_port60_byte=this.kbd_buffer.shift(),dbg_log("Port 60 read (kbd) : "+h(this.last_port60_byte),LOG_PS2));(this.kbd_buffer.length|| +this.mouse_buffer.length)&&this.raise_irq();return this.last_port60_byte};PS2.prototype.port64_read=function(){var a=16;this.next_byte_is_ready&&(a|=1);this.next_byte_is_aux&&(a|=32);dbg_log("port 64 read: "+h(a),LOG_PS2);return a}; +PS2.prototype.port60_write=function(a){dbg_log("port 60 write: "+h(a),LOG_PS2);if(this.read_command_register)this.command_register=a,this.read_command_register=!1,dbg_log("Keyboard command register = "+h(this.command_register),LOG_PS2);else if(this.read_output_register)this.read_output_register=!1,this.mouse_buffer.clear(),this.mouse_buffer.push(a),this.mouse_irq();else if(this.next_read_sample){this.next_read_sample=!1;this.mouse_buffer.clear();this.mouse_buffer.push(250);this.sample_rate=a;switch(this.mouse_detect_state){case -1:60=== +a?(this.mouse_reset_workaround=!0,this.mouse_detect_state=0):(this.mouse_reset_workaround=!1,this.mouse_detect_state=200===a?1:0);break;case 0:200===a&&(this.mouse_detect_state=1);break;case 1:this.mouse_detect_state=100===a?2:200===a?3:0;break;case 2:80===a&&(this.mouse_id=3);this.mouse_detect_state=-1;break;case 3:80===a&&(this.mouse_id=4),this.mouse_detect_state=-1}dbg_log("mouse sample rate: "+h(a)+", mouse id: "+h(this.mouse_id),LOG_PS2);this.sample_rate||(dbg_log("invalid sample rate, reset to 100", +LOG_PS2),this.sample_rate=100);this.mouse_irq()}else if(this.next_read_resolution)this.next_read_resolution=!1,this.mouse_buffer.clear(),this.mouse_buffer.push(250),3 Already requested irq: "+this.requested_irq, +LOG_PIC),this.cpu.handle_irqs();else{var c=this.irr&this.irq_mask;if(c){c&=-c;var d=this.special_mask_mode?this.irq_mask:-1;this.isr&&(this.isr&-this.isr&d)<=c?dbg_log("master> higher prio: isr="+h(this.isr,2)+" mask="+h(this.irq_mask&255,2)+" irq="+h(c,2),LOG_PIC):(dbg_assert(0!==c),d=v86util.int_log2_byte(c),dbg_assert(c===1< request irq "+d,LOG_PIC),this.requested_irq=d,this.cpu.handle_irqs())}else PIC_LOG_VERBOSE&&dbg_log("master> no unmasked irrs. irr="+h(this.irr, +2)+" mask="+h(this.irq_mask&255,2)+" isr="+h(this.isr,2),LOG_PIC)}},this.acknowledge_irq=function(){if(-1!==this.requested_irq)if(0===this.irr)PIC_LOG_VERBOSE&&dbg_log("master> spurious requested="+this.requested_irq,LOG_PIC),this.requested_irq=-1;else{dbg_assert(this.irr);dbg_assert(0<=this.requested_irq);var c=1< acknowledge "+this.requested_irq,LOG_PIC);2===this.requested_irq?this.slave.acknowledge_irq(): +this.cpu.pic_call_irq(this.irq_map|this.requested_irq);this.requested_irq=-1;this.check_irqs()}}):(this.check_irqs=function(){if(0<=this.requested_irq)PIC_LOG_VERBOSE&&dbg_log("slave > Already requested irq: "+this.requested_irq,LOG_PIC),this.cpu.handle_irqs();else{var c=this.irr&this.irq_mask;if(c){c&=-c;var d=this.special_mask_mode?this.irq_mask:-1;this.isr&&(this.isr&-this.isr&d)<=c?PIC_LOG_VERBOSE&&dbg_log("slave > higher prio: isr="+h(this.isr,2)+" irq="+h(c,2),LOG_PIC):(dbg_assert(0!==c),d= +v86util.int_log2_byte(c),dbg_assert(c===1< request irq "+d,LOG_PIC),this.requested_irq=d,this.master.set_irq(2))}else PIC_LOG_VERBOSE&&dbg_log("slave > no unmasked irrs. irr="+h(this.irr,2)+" mask="+h(this.irq_mask&255,2)+" isr="+h(this.isr,2),LOG_PIC)}},this.acknowledge_irq=function(){if(-1!==this.requested_irq)if(0===this.irr)PIC_LOG_VERBOSE&&dbg_log("slave > spurious requested="+this.requested_irq,LOG_PIC),this.requested_irq=-1,this.master.irq_value&=-5,this.cpu.pic_call_irq(this.irq_map| +7);else{dbg_assert(this.irr);dbg_assert(0<=this.requested_irq);var c=1< acknowledge "+this.requested_irq,LOG_PIC);this.cpu.pic_call_irq(this.irq_map|this.requested_irq);this.requested_irq=-1;this.check_irqs()}});this.dump=function(){dbg_log("mask: "+h(this.irq_mask&255),LOG_PIC);dbg_log("base: "+h(this.irq_map),LOG_PIC);dbg_log("requested: "+h(this.irr),LOG_PIC); +dbg_log("serviced: "+h(this.isr),LOG_PIC);this.is_master&&this.slave.dump()};this.is_master?(a=32,b=1232):(a=160,b=1233);this.cpu.io.register_write(a,this,this.port20_write);this.cpu.io.register_read(a,this,this.port20_read);this.cpu.io.register_write(a|1,this,this.port21_write);this.cpu.io.register_read(a|1,this,this.port21_read);this.cpu.io.register_write(b,this,this.port4D0_write);this.cpu.io.register_read(b,this,this.port4D0_read);this.is_master?(this.set_irq=function(c){dbg_assert(0<=c&&16>c); +if(8<=c)this.slave.set_irq(c-8);else{var d=1< set irq "+c,LOG_PIC),this.irr|=d,this.irq_value|=d,this.check_irqs()):PIC_LOG_VERBOSE&&dbg_log("master> set irq "+c+": already set!",LOG_PIC)}},this.clear_irq=function(c){dbg_assert(0<=c&&16>c);PIC_LOG_VERBOSE&&dbg_log("master> clear irq "+c,LOG_PIC);8<=c?this.slave.clear_irq(c-8):(c=1<c);var d=1< set irq "+c,LOG_PIC),this.irr|=d,this.irq_value|=d,this.check_irqs()):PIC_LOG_VERBOSE&&dbg_log("slave > set irq "+c+": already set!",LOG_PIC)},this.clear_irq=function(c){dbg_assert(0<=c&&8>c);PIC_LOG_VERBOSE&&dbg_log("slave > clear irq "+c,LOG_PIC);c=1<>5;1===b?(this.isr&= +this.isr-1,dbg_log("new isr: "+h(this.isr,2),LOG_PIC)):3===b?this.isr&=~(1<<(a&7)):192===(a&200)?dbg_log("lowest priority: "+h(a&7),LOG_PIC):(dbg_log("Unknown eoi: "+h(a),LOG_PIC),dbg_assert(!1),this.isr&=this.isr-1);this.check_irqs()}};PIC.prototype.port20_read=function(){if(this.read_isr)return dbg_log("read port 20h (isr): "+h(this.isr),LOG_PIC),this.isr;dbg_log("read port 20h (irr): "+h(this.irr),LOG_PIC);return this.irr}; +PIC.prototype.port21_write=function(a){0===this.state?this.expect_icw4?(this.expect_icw4=!1,this.auto_eoi=a&2,dbg_log("icw4: "+h(a)+" autoeoi="+this.auto_eoi,LOG_PIC),0===(a&1)&&dbg_assert(!1,"unimplemented: not 8086 mode",LOG_PIC)):(this.irq_mask=~a,PIC_LOG_VERBOSE&&dbg_log("interrupt mask: "+(this.irq_mask&255).toString(2)+" ("+this.name+")",LOG_PIC),this.check_irqs()):1===this.state?(this.irq_map=a,dbg_log("interrupts are mapped to "+h(this.irq_map)+" ("+this.name+")",LOG_PIC),this.state++):2=== +this.state&&(this.state=0,dbg_log("icw3: "+h(a),LOG_PIC))};PIC.prototype.port21_read=function(){dbg_log("21h read "+h(~this.irq_mask&255),LOG_PIC);return~this.irq_mask&255};PIC.prototype.port4D0_read=function(){dbg_log("elcr read: "+h(this.elcr,2),LOG_PIC);return this.elcr};PIC.prototype.port4D0_write=function(a){dbg_log("elcr write: "+h(a,2),LOG_PIC);this.elcr=a};var CMOS_RTC_SECONDS=0,CMOS_RTC_SECONDS_ALARM=1,CMOS_RTC_MINUTES=2,CMOS_RTC_MINUTES_ALARM=3,CMOS_RTC_HOURS=4,CMOS_RTC_HOURS_ALARM=5,CMOS_RTC_DAY_WEEK=6,CMOS_RTC_DAY_MONTH=7,CMOS_RTC_MONTH=8,CMOS_RTC_YEAR=9,CMOS_STATUS_A=10,CMOS_STATUS_B=11,CMOS_STATUS_C=12,CMOS_STATUS_D=13,CMOS_RESET_CODE=15,CMOS_FLOPPY_DRIVE_TYPE=16,CMOS_DISK_DATA=18,CMOS_EQUIPMENT_INFO=20,CMOS_MEM_BASE_LOW=21,CMOS_MEM_BASE_HIGH=22,CMOS_MEM_OLD_EXT_LOW=23,CMOS_MEM_OLD_EXT_HIGH=24,CMOS_DISK_DRIVE1_TYPE=25,CMOS_DISK_DRIVE2_TYPE=26, +CMOS_DISK_DRIVE1_CYL=27,CMOS_DISK_DRIVE2_CYL=36,CMOS_MEM_EXTMEM_LOW=48,CMOS_MEM_EXTMEM_HIGH=49,CMOS_CENTURY=50,CMOS_MEM_EXTMEM2_LOW=52,CMOS_MEM_EXTMEM2_HIGH=53,CMOS_BIOS_BOOTFLAG1=56,CMOS_BIOS_DISKTRANSFLAG=57,CMOS_BIOS_BOOTFLAG2=61,CMOS_MEM_HIGHMEM_LOW=91,CMOS_MEM_HIGHMEM_MID=92,CMOS_MEM_HIGHMEM_HIGH=93,CMOS_BIOS_SMP_COUNT=95;const BOOT_ORDER_CD_FIRST=291,BOOT_ORDER_HD_FIRST=786,BOOT_ORDER_FD_FIRST=801; +function RTC(a){this.cpu=a;this.cmos_index=0;this.cmos_data=new Uint8Array(128);this.last_update=this.rtc_time=Date.now();this.next_interrupt_alarm=this.next_interrupt=0;this.periodic_interrupt=!1;this.periodic_interrupt_time=.9765625;this.cmos_a=38;this.cmos_b=2;this.nmi_disabled=this.cmos_c=0;a.io.register_write(112,this,function(b){this.cmos_index=b&127;this.nmi_disabled=b>>7});a.io.register_write(113,this,this.cmos_port_write);a.io.register_read(113,this,this.cmos_port_read)} +RTC.prototype.get_state=function(){var a=[];a[0]=this.cmos_index;a[1]=this.cmos_data;a[2]=this.rtc_time;a[3]=this.last_update;a[4]=this.next_interrupt;a[5]=this.next_interrupt_alarm;a[6]=this.periodic_interrupt;a[7]=this.periodic_interrupt_time;a[8]=this.cmos_a;a[9]=this.cmos_b;a[10]=this.cmos_c;a[11]=this.nmi_disabled;return a}; +RTC.prototype.set_state=function(a){this.cmos_index=a[0];this.cmos_data=a[1];this.rtc_time=a[2];this.last_update=a[3];this.next_interrupt=a[4];this.next_interrupt_alarm=a[5];this.periodic_interrupt=a[6];this.periodic_interrupt_time=a[7];this.cmos_a=a[8];this.cmos_b=a[9];this.cmos_c=a[10];this.nmi_disabled=a[11]}; +RTC.prototype.timer=function(a,b){a=Date.now();this.rtc_time+=a-this.last_update;this.last_update=a;this.periodic_interrupt&&this.next_interrupt>4&15;dbg_assert(256>a);dbg_assert(10>b);dbg_assert(10>c);return b+10*c};RTC.prototype.encode_time=function(a){return this.cmos_b&4?a:this.bcd_pack(a)};RTC.prototype.decode_time=function(a){return this.cmos_b&4?a:this.bcd_unpack(a)}; +RTC.prototype.cmos_port_read=function(){var a=this.cmos_index;switch(a){case CMOS_RTC_SECONDS:return this.encode_time((new Date(this.rtc_time)).getUTCSeconds());case CMOS_RTC_MINUTES:return this.encode_time((new Date(this.rtc_time)).getUTCMinutes());case CMOS_RTC_HOURS:return this.encode_time((new Date(this.rtc_time)).getUTCHours());case CMOS_RTC_DAY_MONTH:return this.encode_time((new Date(this.rtc_time)).getUTCDate());case CMOS_RTC_MONTH:return this.encode_time((new Date(this.rtc_time)).getUTCMonth()+ +1);case CMOS_RTC_YEAR:return this.encode_time((new Date(this.rtc_time)).getUTCFullYear()%100);case CMOS_STATUS_A:return 999<=v86.microtick()%1E3?this.cmos_a|128:this.cmos_a;case CMOS_STATUS_B:return this.cmos_b;case CMOS_STATUS_C:return this.cpu.device_lower_irq(8),dbg_log("cmos reg C read",LOG_RTC),a=this.cmos_c,this.cmos_c&=-241,a;case CMOS_STATUS_D:return 0;case CMOS_CENTURY:return this.encode_time((new Date(this.rtc_time)).getUTCFullYear()/100|0);default:return dbg_log("cmos read from index "+ +h(a),LOG_RTC),this.cmos_data[this.cmos_index]}}; +RTC.prototype.cmos_port_write=function(a){switch(this.cmos_index){case 10:this.cmos_a=a&127;this.periodic_interrupt_time=1E3/(32768>>(this.cmos_a&15)-1);dbg_log("Periodic interrupt, a="+h(this.cmos_a,2)+" t="+this.periodic_interrupt_time,LOG_RTC);break;case 11:this.cmos_b=a;this.cmos_b&64&&(this.next_interrupt=Date.now());if(this.cmos_b&32){a=new Date;const b=this.decode_time(this.cmos_data[CMOS_RTC_SECONDS_ALARM]),c=this.decode_time(this.cmos_data[CMOS_RTC_MINUTES_ALARM]),d=this.decode_time(this.cmos_data[CMOS_RTC_HOURS_ALARM]), +e=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),d,c,b));dbg_log("RTC alarm scheduled for "+e+" hh:mm:ss="+d+":"+c+":"+b+" ms_from_now="+(e-a),LOG_RTC);this.next_interrupt_alarm=+e}this.cmos_b&16&&dbg_log("Unimplemented: updated interrupt",LOG_RTC);dbg_log("cmos b="+h(this.cmos_b,2),LOG_RTC);break;case CMOS_RTC_SECONDS_ALARM:case CMOS_RTC_MINUTES_ALARM:case CMOS_RTC_HOURS_ALARM:this.cmos_write(this.cmos_index,a);break;default:dbg_log("cmos write index "+h(this.cmos_index)+": "+ +h(a),LOG_RTC)}this.periodic_interrupt=64===(this.cmos_b&64)&&0<(this.cmos_a&15)};RTC.prototype.cmos_read=function(a){dbg_assert(128>a);return this.cmos_data[a]};RTC.prototype.cmos_write=function(a,b){dbg_log("cmos "+h(a)+" <- "+h(b),LOG_RTC);dbg_assert(128>a);this.cmos_data[a]=b};var DLAB=128,UART_IER_MSI=8,UART_IER_THRI=2,UART_IER_RDI=1,UART_IIR_MSI=0,UART_IIR_NO_INT=1,UART_IIR_THRI=2,UART_IIR_RDI=4,UART_IIR_RLSI=6,UART_IIR_CTI=12,UART_LSR_DATA_READY=1,UART_LSR_TX_EMPTY=32,UART_LSR_TRANSMITTER_EMPTY=64; +function UART(a,b,c){this.bus=c;this.cpu=a;this.ints=1<>8)});a.register_write(b|1,this,function(d){this.line_control&DLAB?(this.baud_rate=this.baud_rate&255|d<<8,dbg_log("baud rate: "+h(this.baud_rate),LOG_SERIAL)):(0===(this.ier&UART_IIR_THRI)&&d&UART_IIR_THRI&&this.ThrowInterrupt(UART_IIR_THRI),this.ier=d&15,dbg_log("interrupt enable: "+ +h(d),LOG_SERIAL),this.CheckInterrupt())});a.register_read(b,this,function(){if(this.line_control&DLAB)return this.baud_rate&255;let d=0;0===this.input.length?dbg_log("Read input empty",LOG_SERIAL):(d=this.input.shift(),dbg_log("Read input: "+h(d),LOG_SERIAL));0===this.input.length&&(this.lsr&=~UART_LSR_DATA_READY,this.ClearInterrupt(UART_IIR_CTI),this.ClearInterrupt(UART_IIR_RDI));return d});a.register_read(b|1,this,function(){return this.line_control&DLAB?this.baud_rate>>8:this.ier&15});a.register_read(b| +2,this,function(){var d=this.iir&15;dbg_log("read interrupt identification: "+h(this.iir),LOG_SERIAL);this.iir==UART_IIR_THRI&&this.ClearInterrupt(UART_IIR_THRI);this.fifo_control&1&&(d|=192);return d});a.register_write(b|2,this,function(d){dbg_log("fifo control: "+h(d),LOG_SERIAL);this.fifo_control=d});a.register_read(b|3,this,function(){dbg_log("read line control: "+h(this.line_control),LOG_SERIAL);return this.line_control});a.register_write(b|3,this,function(d){dbg_log("line control: "+h(d),LOG_SERIAL); +this.line_control=d});a.register_read(b|4,this,function(){return this.modem_control});a.register_write(b|4,this,function(d){dbg_log("modem control: "+h(d),LOG_SERIAL);this.modem_control=d});a.register_read(b|5,this,function(){dbg_log("read line status: "+h(this.lsr),LOG_SERIAL);return this.lsr});a.register_write(b|5,this,function(d){dbg_log("Factory test write",LOG_SERIAL)});a.register_read(b|6,this,function(){dbg_log("read modem status: "+h(this.modem_status),LOG_SERIAL);return this.modem_status}); +a.register_write(b|6,this,function(d){dbg_log("Unkown register write (base+6)",LOG_SERIAL)});a.register_read(b|7,this,function(){return this.scratch_register});a.register_write(b|7,this,function(d){this.scratch_register=d})}UART.prototype.get_state=function(){var a=[];a[0]=this.ints;a[1]=this.baud_rate;a[2]=this.line_control;a[3]=this.lsr;a[4]=this.fifo_control;a[5]=this.ier;a[6]=this.iir;a[7]=this.modem_control;a[8]=this.modem_status;a[9]=this.scratch_register;a[10]=this.irq;return a}; +UART.prototype.set_state=function(a){this.ints=a[0];this.baud_rate=a[1];this.line_control=a[2];this.lsr=a[3];this.fifo_control=a[4];this.ier=a[5];this.iir=a[6];this.modem_control=a[7];this.modem_status=a[8];this.scratch_register=a[9];this.irq=a[10]}; +UART.prototype.CheckInterrupt=function(){this.ints&1<>>0;for(var v,u,w=0;w>>0,q<=t?u>q&&u<=t:u>q||u<=t)u=v&4,v&2?(u= +u&&!(l&1<>2&7,u=t-256>>5;if(256>t||u>=HPET_NUM_COUNTERS||5this.timer_last_value),this.timer_last_value+this.timer_imprecision_offset<=a?(this.timer_imprecision_offset=0,this.timer_last_value=a):dbg_log("Warning: Overshot pmtimer, waiting; current="+a+" last="+this.timer_last_value+" offset="+this.timer_imprecision_offset,LOG_ACPI));return this.timer_last_value+ +this.timer_imprecision_offset};ACPI.prototype.get_state=function(){var a=[];a[0]=this.status;a[1]=this.pm1_status;a[2]=this.pm1_enable;a[3]=this.gpe;return a};ACPI.prototype.set_state=function(a){this.status=a[0];this.pm1_status=a[1];this.pm1_enable=a[2];this.gpe=a[3]};var APIC_LOG_VERBOSE=!1,APIC_ADDRESS=4276092928,APIC_TIMER_MODE_MASK=393216,APIC_TIMER_MODE_ONE_SHOT=0,APIC_TIMER_MODE_PERIODIC=131072,APIC_TIMER_MODE_TSC=262144,DELIVERY_MODES="Fixed (0);Lowest Prio (1);SMI (2);Reserved (3);NMI (4);INIT (5);Reserved (6);ExtINT (7)".split(";"),DESTINATION_MODES=["physical","logical"]; +function APIC(a){this.cpu=a;this.timer_divider=this.apic_id=0;this.timer_divider_shift=1;this.timer_current_count=this.timer_initial_count=0;this.next_tick=v86.microtick();this.lvt_error=this.lvt_int1=this.lvt_int0=this.lvt_perf_counter=this.lvt_timer=IOAPIC_CONFIG_MASKED;this.icr1=this.icr0=this.tpr=0;this.irr=new Int32Array(8);this.isr=new Int32Array(8);this.tmr=new Int32Array(8);this.spurious_vector=254;this.destination_format=-1;this.read_error=this.error=this.local_destination=0;a.io.mmap_register(APIC_ADDRESS, +1048576,b=>{dbg_log("Unsupported read8 from apic: "+h(b>>>0),LOG_APIC);var c=b&3;return this.read32(b&-4)>>8*c&255},(b,c)=>{dbg_log("Unsupported write8 from apic: "+h(b)+" <- "+h(c),LOG_APIC);dbg_trace();dbg_assert(!1)},b=>this.read32(b),(b,c)=>this.write32(b,c))} +APIC.prototype.read32=function(a){a=a-APIC_ADDRESS|0;switch(a){case 32:return dbg_log("APIC read id",LOG_APIC),this.apic_id;case 48:return dbg_log("APIC read version",LOG_APIC),327700;case 128:return APIC_LOG_VERBOSE&&dbg_log("APIC read tpr",LOG_APIC),this.tpr;case 208:return dbg_log("Read local destination",LOG_APIC),this.local_destination;case 224:return dbg_log("Read destination format",LOG_APIC),this.destination_format;case 240:return this.spurious_vector;case 256:case 272:case 288:case 304:case 320:case 336:case 352:case 368:return a= +a-256>>4,dbg_log("Read isr "+a+": "+h(this.isr[a]>>>0,8),LOG_APIC),this.isr[a];case 384:case 400:case 416:case 432:case 448:case 464:case 480:case 496:return a=a-384>>4,dbg_log("Read tmr "+a+": "+h(this.tmr[a]>>>0,8),LOG_APIC),this.tmr[a];case 512:case 528:case 544:case 560:case 576:case 592:case 608:case 624:return a=a-512>>4,dbg_log("Read irr "+a+": "+h(this.irr[a]>>>0,8),LOG_APIC),this.irr[a];case 640:return dbg_log("Read error: "+h(this.read_error>>>0,8),LOG_APIC),this.read_error;case 768:return APIC_LOG_VERBOSE&& +dbg_log("APIC read icr0",LOG_APIC),this.icr0;case 784:return dbg_log("APIC read icr1",LOG_APIC),this.icr1;case 800:return dbg_log("read timer lvt",LOG_APIC),this.lvt_timer;case 832:return dbg_log("read lvt perf counter",LOG_APIC),this.lvt_perf_counter;case 848:return dbg_log("read lvt int0",LOG_APIC),this.lvt_int0;case 864:return dbg_log("read lvt int1",LOG_APIC),this.lvt_int1;case 880:return dbg_log("read lvt error",LOG_APIC),this.lvt_error;case 992:return dbg_log("read timer divider",LOG_APIC), +this.timer_divider;case 896:return dbg_log("read timer initial count",LOG_APIC),this.timer_initial_count;case 912:return dbg_log("read timer current count: "+h(this.timer_current_count>>>0,8),LOG_APIC),this.timer_current_count;default:return dbg_log("APIC read "+h(a),LOG_APIC),dbg_assert(!1),0}}; +APIC.prototype.write32=function(a,b){a=a-APIC_ADDRESS|0;switch(a){case 48:dbg_log("APIC write version: "+h(b>>>0,8)+", ignored",LOG_APIC);break;case 128:APIC_LOG_VERBOSE&&dbg_log("Set tpr: "+h(b&255,2),LOG_APIC);this.tpr=b&255;this.check_vector();break;case 176:a=this.highest_isr();-1!==a?(APIC_LOG_VERBOSE&&dbg_log("eoi: "+h(b>>>0,8)+" for vector "+h(a),LOG_APIC),this.register_clear_bit(this.isr,a),this.register_get_bit(this.tmr,a)&&this.cpu.devices.ioapic.remote_eoi(a),this.check_vector()):dbg_log("Bad eoi: No isr set", +LOG_APIC);break;case 208:dbg_log("Set local destination: "+h(b>>>0,8),LOG_APIC);this.local_destination=b&4278190080;break;case 224:dbg_log("Set destination format: "+h(b>>>0,8),LOG_APIC);this.destination_format=b|16777215;break;case 240:dbg_log("Set spurious vector: "+h(b>>>0,8),LOG_APIC);this.spurious_vector=b;break;case 640:dbg_log("Write error: "+h(b>>>0,8),LOG_APIC);this.read_error=this.error;this.error=0;break;case 768:a=b&255;var c=b>>8&7,d=b>>11&1,e=b>>15&1,g=b>>18&3,f=this.icr1>>>24;dbg_log("APIC write icr0: "+ +h(b,8)+" vector="+h(a,2)+" destination_mode="+DESTINATION_MODES[d]+" delivery_mode="+DELIVERY_MODES[c]+" destination_shorthand="+["no","self","all with self","all without self"][g],LOG_APIC);this.icr0=b&-4097;0===g?this.route(a,c,e,f,d):1===g?this.deliver(a,IOAPIC_DELIVERY_FIXED,e):2===g?this.deliver(a,c,e):3!==g&&dbg_assert(!1);break;case 784:dbg_log("APIC write icr1: "+h(b>>>0,8),LOG_APIC);this.icr1=b;break;case 800:dbg_log("timer lvt: "+h(b>>>0,8),LOG_APIC);this.lvt_timer=b;break;case 832:dbg_log("lvt perf counter: "+ +h(b>>>0,8),LOG_APIC);this.lvt_perf_counter=b;break;case 848:dbg_log("lvt int0: "+h(b>>>0,8),LOG_APIC);this.lvt_int0=b;break;case 864:dbg_log("lvt int1: "+h(b>>>0,8),LOG_APIC);this.lvt_int1=b;break;case 880:dbg_log("lvt error: "+h(b>>>0,8),LOG_APIC);this.lvt_error=b;break;case 992:dbg_log("timer divider: "+h(b>>>0,8),LOG_APIC);this.timer_divider=b;b=b&3|(b&8)>>1;this.timer_divider_shift=7===b?0:b+1;break;case 896:dbg_log("timer initial: "+h(b>>>0,8),LOG_APIC);this.timer_initial_count=b>>>0;this.timer_current_count= +b>>>0;this.next_tick=v86.microtick();this.timer_active=!0;break;case 912:dbg_log("timer current: "+h(b>>>0,8),LOG_APIC);dbg_assert(!1,"read-only register");break;default:dbg_log("APIC write32 "+h(a)+" <- "+h(b>>>0,8),LOG_APIC),dbg_assert(!1)}}; +APIC.prototype.timer=function(a){if(0===this.timer_current_count)return 100;const b=TSC_RATE/(1<>>0;this.next_tick+=a/b;this.timer_current_count-=a;0>=this.timer_current_count&&(a=this.lvt_timer&APIC_TIMER_MODE_MASK,a===APIC_TIMER_MODE_PERIODIC?(this.timer_current_count%=this.timer_initial_count,0>=this.timer_current_count&&(this.timer_current_count+=this.timer_initial_count),dbg_assert(0!==this.timer_current_count),0===(this.lvt_timer&IOAPIC_CONFIG_MASKED)&& +this.deliver(this.lvt_timer&255,IOAPIC_DELIVERY_FIXED,!1)):a===APIC_TIMER_MODE_ONE_SHOT&&(this.timer_current_count=0,dbg_log("APIC timer one shot end",LOG_APIC),0===(this.lvt_timer&IOAPIC_CONFIG_MASKED)&&this.deliver(this.lvt_timer&255,IOAPIC_DELIVERY_FIXED,!1)));return Math.max(0,this.timer_current_count/b)};APIC.prototype.route=function(a,b,c,d,e){this.deliver(a,b,c)}; +APIC.prototype.deliver=function(a,b,c){APIC_LOG_VERBOSE&&dbg_log("Deliver "+h(a,2)+" mode="+b+" level="+c,LOG_APIC);b!==IOAPIC_DELIVERY_INIT&&b!==IOAPIC_DELIVERY_NMI&&((16>a||255===a)&&dbg_assert(!1,"TODO: Invalid vector"),this.register_get_bit(this.irr,a)?dbg_log("Not delivered: irr already set, vector="+h(a,2),LOG_APIC):(this.register_set_bit(this.irr,a),c?this.register_set_bit(this.tmr,a):this.register_clear_bit(this.tmr,a),this.check_vector()))}; +APIC.prototype.highest_irr=function(){var a=this.register_get_highest_bit(this.irr);dbg_assert(255!==a);dbg_assert(16<=a||-1===a);return a};APIC.prototype.highest_isr=function(){var a=this.register_get_highest_bit(this.isr);dbg_assert(255!==a);dbg_assert(16<=a||-1===a);return a}; +APIC.prototype.check_vector=function(){var a=this.highest_irr();if(-1!==a){var b=this.highest_isr();b>=a?APIC_LOG_VERBOSE&&dbg_log("Higher isr, isr="+h(b)+" irr="+h(a),LOG_APIC):(a&240)<=(this.tpr&240)?APIC_LOG_VERBOSE&&dbg_log("Higher tpr, tpr="+h(this.tpr&240)+" irr="+h(a),LOG_APIC):this.cpu.handle_irqs()}}; +APIC.prototype.acknowledge_irq=function(){var a=this.highest_irr();if(-1!==a){var b=this.highest_isr();b>=a?APIC_LOG_VERBOSE&&dbg_log("Higher isr, isr="+h(b)+" irr="+h(a),LOG_APIC):(a&240)<=(this.tpr&240)?APIC_LOG_VERBOSE&&dbg_log("Higher tpr, tpr="+h(this.tpr&240)+" irr="+h(a),LOG_APIC):(this.register_clear_bit(this.irr,a),this.register_set_bit(this.isr,a),APIC_LOG_VERBOSE&&dbg_log("Calling vector "+h(a),LOG_APIC),this.cpu.pic_call_irq(a),this.check_vector())}}; +APIC.prototype.get_state=function(){var a=[];a[0]=this.apic_id;a[1]=this.timer_divider;a[2]=this.timer_divider_shift;a[3]=this.timer_initial_count;a[4]=this.timer_current_count;a[5]=this.next_tick;a[6]=this.lvt_timer;a[7]=this.lvt_perf_counter;a[8]=this.lvt_int0;a[9]=this.lvt_int1;a[10]=this.lvt_error;a[11]=this.tpr;a[12]=this.icr0;a[13]=this.icr1;a[14]=this.irr;a[15]=this.isr;a[16]=this.tmr;a[17]=this.spurious_vector;a[18]=this.destination_format;a[19]=this.local_destination;a[20]=this.error;a[21]= +this.read_error;return a}; +APIC.prototype.set_state=function(a){this.apic_id=a[0];this.timer_divider=a[1];this.timer_divider_shift=a[2];this.timer_initial_count=a[3];this.timer_current_count=a[4];this.next_tick=a[5];this.lvt_timer=a[6];this.lvt_perf_counter=a[7];this.lvt_int0=a[8];this.lvt_int1=a[9];this.lvt_error=a[10];this.tpr=a[11];this.icr0=a[12];this.icr1=a[13];this.irr=a[14];this.isr=a[15];this.tmr=a[16];this.spurious_vector=a[17];this.destination_format=a[18];this.local_destination=a[19];this.error=a[20];this.read_error= +a[21]};APIC.prototype.register_get_bit=function(a,b){dbg_assert(0<=b&&256>b);return a[b>>5]>>(b&31)&1};APIC.prototype.register_set_bit=function(a,b){dbg_assert(0<=b&&256>b);a[b>>5]|=1<<(b&31)};APIC.prototype.register_clear_bit=function(a,b){dbg_assert(0<=b&&256>b);a[b>>5]&=~(1<<(b&31))};APIC.prototype.register_get_highest_bit=function(a){for(var b=7;0<=b;b--){var c=a[b];if(c)return v86util.int_log2(c>>>0)|b<<5}return-1};var IOAPIC_ADDRESS=4273995776,IOREGSEL=0,IOWIN=16,IOAPIC_IRQ_COUNT=24,IOAPIC_ID=0,IOAPIC_CONFIG_TRIGGER_MODE_LEVEL=32768,IOAPIC_CONFIG_MASKED=65536,IOAPIC_CONFIG_DELIVS=4096,IOAPIC_CONFIG_REMOTE_IRR=16384,IOAPIC_CONFIG_READONLY_MASK=IOAPIC_CONFIG_REMOTE_IRR|IOAPIC_CONFIG_DELIVS|4294836224,IOAPIC_DELIVERY_FIXED=0,IOAPIC_DELIVERY_LOWEST_PRIORITY=1,IOAPIC_DELIVERY_NMI=4,IOAPIC_DELIVERY_INIT=5; +function IOAPIC(a){this.cpu=a;this.ioredtbl_config=new Int32Array(IOAPIC_IRQ_COUNT);this.ioredtbl_destination=new Int32Array(IOAPIC_IRQ_COUNT);for(var b=0;b{c=c-IOAPIC_ADDRESS|0;if(c>=IOWIN&&c>8*c&255;dbg_log("Unexpected IOAPIC register read: "+h(c>>>0),LOG_APIC);dbg_assert(!1);return 0},(c,d)=>{dbg_assert(!1,"unsupported write8 from ioapic: "+h(c>>>0))},c=>{c=c-IOAPIC_ADDRESS|0;if(c===IOREGSEL)return this.ioregsel;if(c===IOWIN)return this.read(this.ioregsel);dbg_log("Unexpected IOAPIC register read: "+h(c>>>0),LOG_APIC);dbg_assert(!1);return 0},(c,d)=>{c=c-IOAPIC_ADDRESS|0;c===IOREGSEL?this.ioregsel=d:c===IOWIN?this.write(this.ioregsel,d):(dbg_log("Unexpected IOAPIC register write: "+ +h(c>>>0)+" <- "+h(d>>>0,8),LOG_APIC),dbg_assert(!1))})}IOAPIC.prototype.remote_eoi=function(a){for(var b=0;b=IOAPIC_IRQ_COUNT)dbg_assert(!1,"Bad irq: "+a,LOG_APIC);else{var b=1<=IOAPIC_IRQ_COUNT)dbg_assert(!1,"Bad irq: "+a,LOG_APIC);else{var b=1<>1;a&1?(a=this.ioredtbl_destination[b],dbg_log("IOAPIC Read destination irq="+h(b)+" -> "+h(a,8),LOG_APIC)):(a=this.ioredtbl_config[b],dbg_log("IOAPIC Read config irq="+h(b)+" -> "+h(a,8), +LOG_APIC));return a}dbg_log("IOAPIC register read outside of range "+h(a),LOG_APIC);dbg_assert(!1);return 0}; +IOAPIC.prototype.write=function(a,b){if(0===a)this.ioapic_id=b>>>24&15;else if(1===a||2===a)dbg_log("Invalid write: "+a,LOG_APIC);else if(16<=a&&a<16+2*IOAPIC_IRQ_COUNT){var c=a-16>>1;if(a&1)this.ioredtbl_destination[c]=b&4278190080,dbg_log("Write destination "+h(b>>>0,8)+" irq="+h(c)+" dest="+h(b>>>24,2),LOG_APIC);else{this.ioredtbl_config[c]=b&~IOAPIC_CONFIG_READONLY_MASK|this.ioredtbl_config[c]&IOAPIC_CONFIG_READONLY_MASK;a=b&255;var d=b>>8&7,e=b>>11&1,g=b>>15&1,f=b>>16&1;dbg_log("Write config "+ +h(b>>>0,8)+" irq="+h(c)+" vector="+h(a,2)+" deliverymode="+DELIVERY_MODES[d]+" destmode="+DESTINATION_MODES[e]+" is_level="+g+" disabled="+f,LOG_APIC);this.check_irq(c)}}else dbg_log("IOAPIC register write outside of range "+h(a)+": "+h(b>>>0,8),LOG_APIC),dbg_assert(!1)};IOAPIC.prototype.get_state=function(){var a=[];a[0]=this.ioredtbl_config;a[1]=this.ioredtbl_destination;a[2]=this.ioregsel;a[3]=this.ioapic_id;a[4]=this.irr;a[5]=this.irq_value;return a}; +IOAPIC.prototype.set_state=function(a){this.ioredtbl_config=a[0];this.ioredtbl_destination=a[1];this.ioregsel=a[2];this.ioapic_id=a[3];this.irr=a[4];this.irq_value=a[5]};var STATE_VERSION=6,STATE_MAGIC=-2039052682,STATE_INDEX_MAGIC=0,STATE_INDEX_VERSION=1,STATE_INDEX_TOTAL_LEN=2,STATE_INDEX_INFO_LEN=3,STATE_INFO_BLOCK_START=16;const ZSTD_MAGIC=4247762216;function StateLoadError(a){this.message=a}StateLoadError.prototype=Error();const CONSTRUCTOR_TABLE={Uint8Array,Int8Array,Uint16Array,Int16Array,Uint32Array,Int32Array,Float32Array,Float64Array}; +function save_object(a,b){if("object"!==typeof a||null===a)return dbg_assert("function"!==typeof a),a;if(a instanceof Array)return a.map(g=>save_object(g,b));a.constructor===Object&&(console.log(a),dbg_assert(a.constructor!==Object,"Expected non-object"));if(a.BYTES_PER_ELEMENT){var c=new Uint8Array(a.buffer,a.byteOffset,a.length*a.BYTES_PER_ELEMENT);a=a.constructor.name.replace("bound ","");dbg_assert(CONSTRUCTOR_TABLE[a]);return{__state_type__:a,buffer_id:b.push(c)-1}}DEBUG&&!a.get_state&&console.log("Object without get_state: ", +a);c=a.get_state();a=[];for(var d=0;d>10)+"k");dbg_log("State: Total buffers size "+(g.byteLength>>10)+"k");return d}; +CPU.prototype.restore_state=function(a){function b(r,q){const t=r.length;if(t>>0));if(r[STATE_INDEX_VERSION]!==STATE_VERSION)throw new StateLoadError("Version mismatch: dump="+r[STATE_INDEX_VERSION]+" we="+STATE_VERSION);if(q&&r[STATE_INDEX_TOTAL_LEN]!==t)throw new StateLoadError("Length doesn't match header: real="+ +t+" header="+r[STATE_INDEX_TOTAL_LEN]);return r[STATE_INDEX_INFO_LEN]}function c(r){r=(new TextDecoder).decode(r);return JSON.parse(r)}a=new Uint8Array(a);if((new Uint32Array(a.buffer,0,1))[0]===ZSTD_MAGIC){var d=this.zstd_create_ctx(a.length);(new Uint8Array(this.wasm_memory.buffer,this.zstd_get_src_ptr(d),a.length)).set(a);var e=this.zstd_read(d,16),g=new Uint8Array(this.wasm_memory.buffer,e,16),f=b(g,!1);this.zstd_read_free(e,16);e=this.zstd_read(d,f);g=new Uint8Array(this.wasm_memory.buffer,e, +f);g=c(g);this.zstd_read_free(e,f);e=g.state;var k=g.buffer_infos;g=[];f=STATE_INFO_BLOCK_START+f;for(var m of k){k=(f+3&-4)-f;if(1048576d||d+12>=a.length)throw new StateLoadError("Invalid info block length: "+d);m=a.subarray(STATE_INFO_BLOCK_START,STATE_INFO_BLOCK_START+d);e=c(m);m=e.state;e=e.buffer_infos;let r=STATE_INFO_BLOCK_START+d;r=r+3&-4;d=e.map(q=>{const t=r+q.offset;return a.buffer.slice(t,t+q.length)});m=restore_buffers(m,d);this.set_state(m)}};const NE2K_LOG_VERBOSE=!1,NE2K_LOG_PACKETS=!1; +var E8390_CMD=0,EN0_CLDALO=1,EN0_STARTPG=1,EN0_CLDAHI=2,EN0_STOPPG=2,EN0_BOUNDARY=3,EN0_TSR=4,EN0_TPSR=4,EN0_NCR=5,EN0_TCNTLO=5,EN0_FIFO=6,EN0_TCNTHI=6,EN0_ISR=7,EN0_CRDALO=8,EN0_RSARLO=8,EN0_CRDAHI=9,EN0_RSARHI=9,EN0_RCNTLO=10,EN0_RCNTHI=11,EN0_RSR=12,EN0_RXCR=12,EN0_TXCR=13,EN0_COUNTER0=13,EN0_DCFG=14,EN0_COUNTER1=14,EN0_IMR=15,EN0_COUNTER2=15,NE_DATAPORT=16,NE_RESET=31,ENISR_RX=1,ENISR_TX=2,ENISR_RX_ERR=4,ENISR_TX_ERR=8,ENISR_OVER=16,ENISR_COUNTERS=32,ENISR_RDC=64,ENISR_RESET=128,ENISR_ALL=63, +ENRSR_RXOK=1,START_PAGE=64,START_RX_PAGE=76,STOP_PAGE=128; +function translate_mac_address(a,b,c){a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&(dbg_log("Replace mac in eth destination field",LOG_NET),a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[4]=c[4],a[5]=c[5]);a[6]===b[0]&&a[7]===b[1]&&a[8]===b[2]&&a[9]===b[3]&&a[10]===b[4]&&a[11]===b[5]&&(dbg_log("Replace mac in eth source field",LOG_NET),a[6]=c[0],a[7]=c[1],a[8]=c[2],a[9]=c[3],a[10]=c[4],a[11]=c[5]);var d=a[12]<<8|a[13];if(2048===d)if(a=a.subarray(14),d=a[0]>>4,4!==d)dbg_log("Expected ipv4.version==4 but got: "+ +d,LOG_NET);else{if(dbg_assert(5===(a[0]&15),"TODO: ihl!=5"),17===a[9]){a=a.subarray(20);d=a[0]<<8|a[1];var e=a[2]<<8|a[3];dbg_log("udp srcport="+d+" dstport="+e+" checksum="+h(a[6]<<8|a[7],4),LOG_NET);if(67===d||67===e)if(d=a.subarray(8),e=d[236]<<24|d[237]<<16|d[238]<<8|d[239],1669485411!==e)dbg_log("dhcp packet didn't match magic: "+h(e,8));else for(d[28]===b[0]&&d[29]===b[1]&&d[30]===b[2]&&d[31]===b[3]&&d[32]===b[4]&&d[33]===b[5]&&(dbg_log("Replace mac in dhcp.chaddr",LOG_NET),d[28]=c[0],d[29]= +c[1],d[30]=c[2],d[31]=c[3],d[32]=c[4],d[33]=c[5],a[6]=a[7]=0),e=240;e>8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,26,0,17,0,0,184,254,0,0,0,0,0,0,0,0,0,1,0,0];this.pci_id=40;this.pci_bars=[{size:32}];this.imr=this.isr=0;this.cr=1;this.tpsr=this.tcnt= +this.rcnt=this.dcfg=0;this.memory=new Uint8Array(32768);this.txcr=this.rxcr=0;this.tsr=1;this.mac=new Uint8Array([0,34,21,255*Math.random()|0,255*Math.random()|0,255*Math.random()|0]);this.mac_address_in_state=null;for(b=0;6>b;b++)this.memory[b<<1]=this.memory[b<<1|1]=this.mac[b];this.memory[28]=this.memory[29]=87;this.memory[30]=this.memory[31]=87;dbg_log("Mac: "+format_mac(this.mac),LOG_NET);this.rsar=0;this.pstart=START_PAGE;this.pstop=STOP_PAGE;this.boundary=this.curpg=START_RX_PAGE;b=a.io;b.register_read(this.port| +E8390_CMD,this,function(){dbg_log("Read cmd",LOG_NET);return this.cr});b.register_write(this.port|E8390_CMD,this,function(e){this.cr=e;dbg_log("Write command: "+h(e,2)+" newpg="+(this.cr>>6)+" txcr="+h(this.txcr,2),LOG_NET);this.cr&1||(e&24&&0===this.rcnt&&this.do_interrupt(ENISR_RDC),e&4&&(e=this.tpsr<<8,e=this.memory.subarray(e,e+this.tcnt),NE2K_LOG_PACKETS&&dump_packet(e,"send"),this.mac_address_in_state&&(e=new Uint8Array(e),translate_mac_address(e,this.mac_address_in_state,this.mac)),this.bus.send("net0-send", +e),this.bus.send("eth-transmit-end",[e.length]),this.cr&=-5,this.do_interrupt(ENISR_TX),dbg_log("Command: Transfer. length="+h(e.byteLength),LOG_NET)))});b.register_read(this.port|EN0_COUNTER0,this,function(){dbg_log("Read counter0",LOG_NET);return 0});b.register_read(this.port|EN0_COUNTER1,this,function(){dbg_log("Read8 counter1",LOG_NET);return 0},function(){dbg_log("Read16 counter1",LOG_NET);return 0});b.register_read(this.port|EN0_COUNTER2,this,function(){dbg_log("Read counter2",LOG_NET);return 0}); +b.register_read(this.port|NE_RESET,this,function(){this.get_page();dbg_log("Read reset",LOG_NET);this.do_interrupt(ENISR_RESET);return 0});b.register_write(this.port|NE_RESET,this,function(e){this.get_page();dbg_log("Write reset: "+h(e,2),LOG_NET)});b.register_read(this.port|EN0_STARTPG,this,function(){var e=this.get_page();if(0===e)return this.pstart;if(1===e)return dbg_log("Read pg1/01 (mac[0])",LOG_NET),this.mac[0];if(2===e)return this.pstart;dbg_log("Read pg"+e+"/01");dbg_assert(!1);return 0}); +b.register_write(this.port|EN0_STARTPG,this,function(e){var g=this.get_page();0===g?(dbg_log("start page: "+h(e,2),LOG_NET),this.pstart=e):1===g?(dbg_log("mac[0] = "+h(e),LOG_NET),this.mac[0]=e):3===g?dbg_log("Unimplemented: Write pg3/01 (9346CR): "+h(e),LOG_NET):(dbg_log("Write pg"+g+"/01: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_STOPPG,this,function(){var e=this.get_page();if(0===e)return this.pstop;if(1===e)return dbg_log("Read pg1/02 (mac[1])",LOG_NET),this.mac[1];if(2=== +e)return this.pstop;dbg_log("Read pg"+e+"/02",LOG_NET);dbg_assert(!1);return 0});b.register_write(this.port|EN0_STOPPG,this,function(e){var g=this.get_page();0===g?(dbg_log("stop page: "+h(e,2),LOG_NET),e>this.memory.length>>8&&(e=this.memory.length>>8,dbg_log("XXX: Adjusting stop page to "+h(e),LOG_NET)),this.pstop=e):1===g?(dbg_log("mac[1] = "+h(e),LOG_NET),this.mac[1]=e):(dbg_log("Write pg"+g+"/02: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_ISR,this,function(){var e=this.get_page(); +if(0===e)return dbg_log("Read isr: "+h(this.isr,2),LOG_NET),this.isr;if(1===e)return dbg_log("Read curpg: "+h(this.curpg,2),LOG_NET),this.curpg;dbg_assert(!1)});b.register_write(this.port|EN0_ISR,this,function(e){var g=this.get_page();0===g?(dbg_log("Write isr: "+h(e,2),LOG_NET),this.isr&=~e,this.update_irq()):1===g?(dbg_log("Write curpg: "+h(e,2),LOG_NET),this.curpg=e):dbg_assert(!1)});b.register_write(this.port|EN0_TXCR,this,function(e){var g=this.get_page();0===g?(this.txcr=e,dbg_log("Write tx config: "+ +h(e,2),LOG_NET)):dbg_log("Unimplemented: Write pg"+g+"/0d "+h(e,2),LOG_NET)});b.register_write(this.port|EN0_DCFG,this,function(e){var g=this.get_page();0===g?(dbg_log("Write data configuration: "+h(e,2),LOG_NET),this.dcfg=e):dbg_log("Unimplemented: Write pg"+g+"/0e "+h(e,2),LOG_NET)});b.register_read(this.port|EN0_RCNTLO,this,function(){if(0===this.get_page())return dbg_log("Read pg0/0a",LOG_NET),80;dbg_assert(!1,"TODO");return 0});b.register_write(this.port|EN0_RCNTLO,this,function(e){var g=this.get_page(); +0===g?(dbg_log("Write remote byte count low: "+h(e,2),LOG_NET),this.rcnt=this.rcnt&65280|e&255):dbg_log("Unimplemented: Write pg"+g+"/0a "+h(e,2),LOG_NET)});b.register_read(this.port|EN0_RCNTHI,this,function(){if(0===this.get_page())return dbg_log("Read pg0/0b",LOG_NET),67;dbg_assert(!1,"TODO");return 0});b.register_write(this.port|EN0_RCNTHI,this,function(e){var g=this.get_page();0===g?(dbg_log("Write remote byte count high: "+h(e,2),LOG_NET),this.rcnt=this.rcnt&255|e<<8&65280):dbg_log("Unimplemented: Write pg"+ +g+"/0b "+h(e,2),LOG_NET)});b.register_read(this.port|EN0_RSARLO,this,function(){var e=this.get_page();if(0===e)return dbg_log("Read remote start address low",LOG_NET),this.rsar&255;dbg_log("Unimplemented: Read pg"+e+"/08",LOG_NET);dbg_assert(!1)});b.register_write(this.port|EN0_RSARLO,this,function(e){var g=this.get_page();0===g?(dbg_log("Write remote start address low: "+h(e,2),LOG_NET),this.rsar=this.rsar&65280|e&255):dbg_log("Unimplemented: Write pg"+g+"/08 "+h(e,2),LOG_NET)});b.register_read(this.port| +EN0_RSARHI,this,function(){var e=this.get_page();if(0===e)return dbg_log("Read remote start address high",LOG_NET),this.rsar>>8&255;dbg_log("Unimplemented: Read pg"+e+"/09",LOG_NET);dbg_assert(!1)});b.register_write(this.port|EN0_RSARHI,this,function(e){var g=this.get_page();0===g?(dbg_log("Write remote start address low: "+h(e,2),LOG_NET),this.rsar=this.rsar&255|e<<8&65280):dbg_log("Unimplemented: Write pg"+g+"/09 "+h(e,2),LOG_NET)});b.register_write(this.port|EN0_IMR,this,function(e){var g=this.get_page(); +0===g?(dbg_log("Write interrupt mask register: "+h(e,2)+" isr="+h(this.isr,2),LOG_NET),this.imr=e,this.update_irq()):dbg_log("Unimplemented: Write pg"+g+"/0f "+h(e,2),LOG_NET)});b.register_read(this.port|EN0_BOUNDARY,this,function(){var e=this.get_page();if(0===e)return dbg_log("Read boundary: "+h(this.boundary,2),LOG_NET),this.boundary;if(1===e)return dbg_log("Read pg1/03 (mac[2])",LOG_NET),this.mac[2];3===e?dbg_log("Unimplemented: Read pg3/03 (CONFIG0)",LOG_NET):(dbg_log("Read pg"+e+"/03",LOG_NET), +dbg_assert(!1));return 0});b.register_write(this.port|EN0_BOUNDARY,this,function(e){var g=this.get_page();0===g?(dbg_log("Write boundary: "+h(e,2),LOG_NET),this.boundary=e):1===g?(dbg_log("mac[2] = "+h(e),LOG_NET),this.mac[2]=e):(dbg_log("Write pg"+g+"/03: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_TSR,this,function(){var e=this.get_page();if(0===e)return this.tsr;if(1===e)return dbg_log("Read pg1/04 (mac[3])",LOG_NET),this.mac[3];dbg_log("Read pg"+e+"/04",LOG_NET);dbg_assert(!1); +return 0});b.register_write(this.port|EN0_TPSR,this,function(e){var g=this.get_page();0===g?(dbg_log("Write tpsr: "+h(e,2),LOG_NET),this.tpsr=e):1===g?(dbg_log("mac[3] = "+h(e),LOG_NET),this.mac[3]=e):(dbg_log("Write pg"+g+"/04: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_TCNTLO,this,function(){var e=this.get_page();if(0===e)return dbg_log("Unimplemented: Read pg0/05 (NCR: Number of Collisions Register)",LOG_NET),0;if(1===e)return dbg_log("Read pg1/05 (mac[4])",LOG_NET),this.mac[4]; +3===e?dbg_log("Unimplemented: Read pg3/05 (CONFIG2)",LOG_NET):(dbg_log("Read pg"+e+"/05",LOG_NET),dbg_assert(!1));return 0});b.register_write(this.port|EN0_TCNTLO,this,function(e){var g=this.get_page();0===g?(dbg_log("Write tcnt low: "+h(e,2),LOG_NET),this.tcnt=this.tcnt&-256|e):1===g?(dbg_log("mac[4] = "+h(e),LOG_NET),this.mac[4]=e):3===g?dbg_log("Unimplemented: Write pg3/05 (CONFIG2): "+h(e),LOG_NET):(dbg_log("Write pg"+g+"/05: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_TCNTHI, +this,function(){var e=this.get_page();if(0===e)return dbg_assert(!1,"TODO"),0;if(1===e)return dbg_log("Read pg1/06 (mac[5])",LOG_NET),this.mac[5];3===e?dbg_log("Unimplemented: Read pg3/06 (CONFIG3)",LOG_NET):(dbg_log("Read pg"+e+"/06",LOG_NET),dbg_assert(!1));return 0});b.register_write(this.port|EN0_TCNTHI,this,function(e){var g=this.get_page();0===g?(dbg_log("Write tcnt high: "+h(e,2),LOG_NET),this.tcnt=this.tcnt&255|e<<8):1===g?(dbg_log("mac[5] = "+h(e),LOG_NET),this.mac[5]=e):3===g?dbg_log("Unimplemented: Write pg3/06 (CONFIG3): "+ +h(e),LOG_NET):(dbg_log("Write pg"+g+"/06: "+h(e),LOG_NET),dbg_assert(!1))});b.register_read(this.port|EN0_RSR,this,function(){var e=this.get_page();if(0===e)return 9;dbg_log("Unimplemented: Read pg"+e+"/0c",LOG_NET);dbg_assert(!1);return 0});b.register_write(this.port|EN0_RXCR,this,function(e){var g=this.get_page();0===g?(dbg_log("RX configuration reg write: "+h(e,2),LOG_NET),this.rxcr=e):dbg_log("Unimplemented: Write pg"+g+"/0c: "+h(e),LOG_NET)});b.register_read(this.port|NE_DATAPORT|0,this,this.data_port_read8, +this.data_port_read16,this.data_port_read32);b.register_write(this.port|NE_DATAPORT|0,this,this.data_port_write16,this.data_port_write16,this.data_port_write32);a.devices.pci.register_device(this)} +Ne2k.prototype.get_state=function(){var a=[];a[0]=this.isr;a[1]=this.imr;a[2]=this.cr;a[3]=this.dcfg;a[4]=this.rcnt;a[5]=this.tcnt;a[6]=this.tpsr;a[7]=this.rsar;a[8]=this.pstart;a[9]=this.curpg;a[10]=this.boundary;a[11]=this.pstop;a[12]=this.rxcr;a[13]=this.txcr;a[14]=this.tsr;a[15]=this.mac;a[16]=this.memory;return a}; +Ne2k.prototype.set_state=function(a){this.isr=a[0];this.imr=a[1];this.cr=a[2];this.dcfg=a[3];this.rcnt=a[4];this.tcnt=a[5];this.tpsr=a[6];this.rsar=a[7];this.pstart=a[8];this.curpg=a[9];this.boundary=a[10];this.pstop=a[11];this.rxcr=a[12];this.txcr=a[13];this.tsr=a[14];this.preserve_mac_from_state_image?(this.mac=a[15],this.memory=a[16]):this.mac_address_translation&&(this.mac_address_in_state=a[15],this.memory=a[16],dbg_log("Using mac address translation guest_os_mac="+format_mac(this.mac_address_in_state)+ +" real_mac="+format_mac(this.mac),LOG_NET))};Ne2k.prototype.do_interrupt=function(a){dbg_log("Do interrupt "+h(a,2),LOG_NET);this.isr|=a;this.update_irq()};Ne2k.prototype.update_irq=function(){this.imr&this.isr?this.pci.raise_irq(this.pci_id):this.pci.lower_irq(this.pci_id)}; +Ne2k.prototype.data_port_write=function(a){NE2K_LOG_VERBOSE&&dbg_log("Write data port: data="+h(a&255,2)+" rsar="+h(this.rsar,4)+" rcnt="+h(this.rcnt,4),LOG_NET);if(16>=this.rsar||this.rsar>=START_PAGE<<8&&this.rsar=this.pstop<<8&&(this.rsar+=this.pstart-this.pstop<<8);0===this.rcnt&&this.do_interrupt(ENISR_RDC)};Ne2k.prototype.data_port_write16=function(a){this.data_port_write(a);this.dcfg&1&&this.data_port_write(a>>8)}; +Ne2k.prototype.data_port_write32=function(a){this.data_port_write(a);this.data_port_write(a>>8);this.data_port_write(a>>16);this.data_port_write(a>>24)};Ne2k.prototype.data_port_read=function(){let a=0;this.rsar>8),g=b+c,f=1+(c>>8),k=this.boundary>this.curpg?this.boundary-this.curpg:this.pstop-this.curpg+this.boundary-this.pstart;k exit highspeed",LOG_SB16),this.dsp_highspeed=!1):a&&(dbg_log(" -> reset",LOG_SB16),this.dsp_reset());this.read_buffer.clear();this.read_buffer.push(170)};SB16.prototype.port2x7_write=function(a){dbg_log("227 write: undocumented",LOG_SB16)}; +SB16.prototype.port2x8_write=function(a){dbg_log("228 write: fm music register port (unimplemented)",LOG_SB16)};SB16.prototype.port2x9_write=function(a){dbg_log("229 write: fm music data port (unimplemented)",LOG_SB16)};SB16.prototype.port2xA_write=function(a){dbg_log("22A write: dsp read data port (read only)",LOG_SB16)};SB16.prototype.port2xB_write=function(a){dbg_log("22B write: undocumented",LOG_SB16)}; +SB16.prototype.port2xC_write=function(a){dbg_log("22C write: write command/data",LOG_SB16);this.command===DSP_NO_COMMAND?(dbg_log("22C write: command = "+h(a),LOG_SB16),this.command=a,this.write_buffer.clear(),this.command_size=DSP_COMMAND_SIZES[a]):(dbg_log("22C write: data: "+h(a),LOG_SB16),this.write_buffer.push(a));this.write_buffer.length>=this.command_size&&this.command_do()};SB16.prototype.port2xD_write=function(a){dbg_log("22D write: undocumented",LOG_SB16)}; +SB16.prototype.port2xE_write=function(a){dbg_log("22E write: dsp read buffer status (read only)",LOG_SB16)};SB16.prototype.port2xF_write=function(a){dbg_log("22F write: undocumented",LOG_SB16)};SB16.prototype.port3x0_read=function(){dbg_log("330 read: mpu data",LOG_SB16);this.mpu_read_buffer.length&&(this.mpu_read_buffer_lastvalue=this.mpu_read_buffer.shift());dbg_log(" <- "+h(this.mpu_read_buffer_lastvalue),LOG_SB16);return this.mpu_read_buffer_lastvalue}; +SB16.prototype.port3x0_write=function(a){dbg_log("330 write: mpu data (unimplemented) : "+h(a),LOG_SB16)};SB16.prototype.port3x1_read=function(){dbg_log("331 read: mpu status",LOG_SB16);return 0|128*!this.mpu_read_buffer.length};SB16.prototype.port3x1_write=function(a){dbg_log("331 write: mpu command: "+h(a),LOG_SB16);255==a&&(this.mpu_read_buffer.clear(),this.mpu_read_buffer.push(254))}; +SB16.prototype.command_do=function(){var a=DSP_COMMAND_HANDLERS[this.command];a||(a=this.dsp_default_handler);a.call(this);this.command=DSP_NO_COMMAND;this.command_size=0;this.write_buffer.clear()};SB16.prototype.dsp_default_handler=function(){dbg_log("Unhandled command: "+h(this.command),LOG_SB16)};function register_dsp_command(a,b,c){c||(c=SB16.prototype.dsp_default_handler);for(var d=0;dc;c++)b.push(a+c);return b}register_dsp_command([14],2,function(){this.asp_registers[this.write_buffer.shift()]=this.write_buffer.shift()});register_dsp_command([15],1,function(){this.read_buffer.clear();this.read_buffer.push(this.asp_registers[this.write_buffer.shift()])});register_dsp_command([16],1,function(){var a=audio_normalize(this.write_buffer.shift(),127.5,-1);this.dac_buffers[0].push(a);this.dac_buffers[1].push(a);this.bus.send("dac-enable")}); +register_dsp_command([20,21],2,function(){this.dma_irq=SB_IRQ_8BIT;this.dma_channel=this.dma_channel_8bit;this.dsp_highspeed=this.dsp_16bit=this.dsp_signed=this.dma_autoinit=!1;this.dma_transfer_size_set();this.dma_transfer_start()});register_dsp_command([22],2);register_dsp_command([23],2);register_dsp_command([28],0,function(){this.dma_irq=SB_IRQ_8BIT;this.dma_channel=this.dma_channel_8bit;this.dma_autoinit=!0;this.dsp_highspeed=this.dsp_16bit=this.dsp_signed=!1;this.dma_transfer_start()}); +register_dsp_command([31],0);register_dsp_command([32],0,function(){this.read_buffer.clear();this.read_buffer.push(127)});register_dsp_command([36],2);register_dsp_command([44],0);register_dsp_command([48],0);register_dsp_command([49],0);register_dsp_command([52],0);register_dsp_command([53],0);register_dsp_command([54],0);register_dsp_command([55],0);register_dsp_command([56],0);register_dsp_command([64],1,function(){this.sampling_rate_change(1E6/(256-this.write_buffer.shift())/this.get_channel_count())}); +register_dsp_command([65,66],2,function(){this.sampling_rate_change(this.write_buffer.shift()<<8|this.write_buffer.shift())});register_dsp_command([72],2,function(){this.dma_transfer_size_set()});register_dsp_command([116],2);register_dsp_command([117],2);register_dsp_command([118],2);register_dsp_command([119],2);register_dsp_command([125],0);register_dsp_command([127],0);register_dsp_command([128],2); +register_dsp_command([144],0,function(){this.dma_irq=SB_IRQ_8BIT;this.dma_channel=this.dma_channel_8bit;this.dma_autoinit=!0;this.dsp_signed=!1;this.dsp_highspeed=!0;this.dsp_16bit=!1;this.dma_transfer_start()});register_dsp_command([145],0);register_dsp_command([152],0);register_dsp_command([153],0);register_dsp_command([160],0);register_dsp_command([168],0); +register_dsp_command(any_first_digit(176),3,function(){if(this.command&8)this.dsp_default_handler();else{var a=this.write_buffer.shift();this.dma_irq=SB_IRQ_16BIT;this.dma_channel=this.dma_channel_16bit;this.dma_autoinit=!!(this.command&4);this.dsp_signed=!!(a&16);this.dsp_stereo=!!(a&32);this.dsp_16bit=!0;this.dma_transfer_size_set();this.dma_transfer_start()}}); +register_dsp_command(any_first_digit(192),3,function(){if(this.command&8)this.dsp_default_handler();else{var a=this.write_buffer.shift();this.dma_irq=SB_IRQ_8BIT;this.dma_channel=this.dma_channel_8bit;this.dma_autoinit=!!(this.command&4);this.dsp_signed=!!(a&16);this.dsp_stereo=!!(a&32);this.dsp_16bit=!1;this.dma_transfer_size_set();this.dma_transfer_start()}});register_dsp_command([208],0,function(){this.dma_paused=!0;this.bus.send("dac-disable")}); +register_dsp_command([209],0,function(){this.dummy_speaker_enabled=!0});register_dsp_command([211],0,function(){this.dummy_speaker_enabled=!1});register_dsp_command([212],0,function(){this.dma_paused=!1;this.bus.send("dac-enable")});register_dsp_command([213],0,function(){this.dma_paused=!0;this.bus.send("dac-disable")});register_dsp_command([214],0,function(){this.dma_paused=!1;this.bus.send("dac-enable")}); +register_dsp_command([216],0,function(){this.read_buffer.clear();this.read_buffer.push(255*this.dummy_speaker_enabled)});register_dsp_command([217,218],0,function(){this.dma_autoinit=!1});register_dsp_command([224],1,function(){this.read_buffer.clear();this.read_buffer.push(~this.write_buffer.shift())});register_dsp_command([225],0,function(){this.read_buffer.clear();this.read_buffer.push(4);this.read_buffer.push(5)});register_dsp_command([226],1); +register_dsp_command([227],0,function(){this.read_buffer.clear();for(var a=0;a>>4};MIXER_WRITE_HANDLERS[a]=function(d){this.mixer_registers[a]=d;var e=d<<4&240|this.mixer_registers[c]&15;this.mixer_write(b,d&240|this.mixer_registers[b]&15);this.mixer_write(c,e)}} +function register_mixer_volume(a,b,c){MIXER_READ_HANDLERS[a]=SB16.prototype.mixer_default_read;MIXER_WRITE_HANDLERS[a]=function(d){this.mixer_registers[a]=d;this.bus.send("mixer-volume",[b,c,(d>>>2)-62])}}register_mixer_read(0,function(){this.mixer_reset();return 0});register_mixer_write(0);register_mixer_legacy(4,50,51);register_mixer_legacy(34,48,49);register_mixer_legacy(38,52,53);register_mixer_legacy(40,54,55);register_mixer_legacy(46,56,57);register_mixer_volume(48,MIXER_SRC_MASTER,MIXER_CHANNEL_LEFT); +register_mixer_volume(49,MIXER_SRC_MASTER,MIXER_CHANNEL_RIGHT);register_mixer_volume(50,MIXER_SRC_DAC,MIXER_CHANNEL_LEFT);register_mixer_volume(51,MIXER_SRC_DAC,MIXER_CHANNEL_RIGHT);register_mixer_read(59);register_mixer_write(59,function(a){this.mixer_registers[59]=a;this.bus.send("mixer-volume",[MIXER_SRC_PCSPEAKER,MIXER_CHANNEL_BOTH,6*(a>>>6)-18])});register_mixer_read(65);register_mixer_write(65,function(a){this.mixer_registers[65]=a;this.bus.send("mixer-gain-left",6*(a>>>6))});register_mixer_read(66); +register_mixer_write(66,function(a){this.mixer_registers[66]=a;this.bus.send("mixer-gain-right",6*(a>>>6))});register_mixer_read(68);register_mixer_write(68,function(a){this.mixer_registers[68]=a;a>>>=3;this.bus.send("mixer-treble-left",a-(16>a?14:16))});register_mixer_read(69);register_mixer_write(69,function(a){this.mixer_registers[69]=a;a>>>=3;this.bus.send("mixer-treble-right",a-(16>a?14:16))});register_mixer_read(70); +register_mixer_write(70,function(a){this.mixer_registers[70]=a;a>>>=3;this.bus.send("mixer-bass-right",a-(16>a?14:16))});register_mixer_read(71);register_mixer_write(71,function(a){this.mixer_registers[71]=a;a>>>=3;this.bus.send("mixer-bass-right",a-(16>a?14:16))});register_mixer_read(128,function(){switch(this.irq){case SB_IRQ2:return 1;case SB_IRQ5:return 2;case SB_IRQ7:return 4;case SB_IRQ10:return 8;default:return 0}}); +register_mixer_write(128,function(a){a&1&&(this.irq=SB_IRQ2);a&2&&(this.irq=SB_IRQ5);a&4&&(this.irq=SB_IRQ7);a&8&&(this.irq=SB_IRQ10)});register_mixer_read(129,function(){var a=0;switch(this.dma_channel_8bit){case SB_DMA0:a|=1;break;case SB_DMA1:a|=2;break;case SB_DMA3:a|=8}switch(this.dma_channel_16bit){case SB_DMA5:a|=32;break;case SB_DMA6:a|=64;break;case SB_DMA7:a|=128}return a}); +register_mixer_write(129,function(a){a&1&&(this.dma_channel_8bit=SB_DMA0);a&2&&(this.dma_channel_8bit=SB_DMA1);a&8&&(this.dma_channel_8bit=SB_DMA3);a&32&&(this.dma_channel_16bit=SB_DMA5);a&64&&(this.dma_channel_16bit=SB_DMA6);a&128&&(this.dma_channel_16bit=SB_DMA7)});register_mixer_read(130,function(){for(var a=32,b=0;16>b;b++)a|=b*this.irq_triggered[b];return a});SB16.prototype.fm_default_write=function(a,b,c){dbg_log("unhandled fm register write. addr:"+b+"|"+h(c)+" data:"+h(a),LOG_SB16)}; +function register_fm_write(a,b){b||(b=SB16.prototype.fm_default_write);for(var c=0;c>2&-4,32),this.dma_bytes_block);this.dma_waiting_transfer=!0;this.dma.channel_mask[this.dma_channel]||this.dma_on_unmask(this.dma_channel)}; +SB16.prototype.dma_on_unmask=function(a){a===this.dma_channel&&this.dma_waiting_transfer&&(this.dma_waiting_transfer=!1,this.dma_bytes_left=this.dma_bytes_count,this.dma_paused=!1,this.bus.send("dac-enable"))}; +SB16.prototype.dma_transfer_next=function(){dbg_log("dma transfering next block",LOG_SB16);var a=Math.min(this.dma_bytes_left,this.dma_bytes_block),b=Math.floor(a/this.bytes_per_sample);this.dma.do_write(this.dma_syncbuffer,0,a,this.dma_channel,c=>{dbg_log("dma block transfer "+(c?"unsuccessful":"successful"),LOG_SB16);c||(this.dma_to_dac(b),this.dma_bytes_left-=a,this.dma_bytes_left||(this.raise_irq(this.dma_irq),this.dma_autoinit&&(this.dma_bytes_left=this.dma_bytes_count)))})}; +SB16.prototype.dma_to_dac=function(a){var b=this.dsp_16bit?32767.5:127.5,c=this.dsp_signed?0:-1,d=this.dsp_stereo?1:2;var e=this.dsp_16bit?this.dsp_signed?this.dma_buffer_int16:this.dma_buffer_uint16:this.dsp_signed?this.dma_buffer_int8:this.dma_buffer_uint8;for(var g=0,f=0;fc)*c+(b<=a&&a<=c)*a};const VIRTIO_PCI_VENDOR_ID=6900,VIRTIO_PCI_CAP_VENDOR=9,VIRTIO_PCI_CAP_LENGTH=16,VIRTIO_PCI_CAP_COMMON_CFG=1,VIRTIO_PCI_CAP_NOTIFY_CFG=2,VIRTIO_PCI_CAP_ISR_CFG=3,VIRTIO_PCI_CAP_DEVICE_CFG=4,VIRTIO_PCI_CAP_PCI_CFG=5,VIRTIO_STATUS_ACKNOWLEDGE=1,VIRTIO_STATUS_DRIVER=2,VIRTIO_STATUS_DRIVER_OK=4,VIRTIO_STATUS_FEATURES_OK=8,VIRTIO_STATUS_DEVICE_NEEDS_RESET=64,VIRTIO_STATUS_FAILED=128,VIRTIO_ISR_QUEUE=1,VIRTIO_ISR_DEVICE_CFG=2,VIRTIO_F_RING_INDIRECT_DESC=28,VIRTIO_F_RING_EVENT_IDX=29,VIRTIO_F_VERSION_1= +32,VIRTQ_DESC_ENTRYSIZE=16,VIRTQ_AVAIL_BASESIZE=6,VIRTQ_AVAIL_ENTRYSIZE=2,VIRTQ_USED_BASESIZE=6,VIRTQ_USED_ENTRYSIZE=8,VIRTQ_IDX_MASK=65535,VIRTQ_DESC_F_NEXT=1,VIRTQ_DESC_F_WRITE=2,VIRTQ_DESC_F_INDIRECT=4,VIRTQ_AVAIL_F_NO_INTERRUPT=1,VIRTQ_USED_F_NO_NOTIFY=1;var VirtIO_CapabilityStruct,VirtIO_CapabilityInfo,VirtQueue_Options,VirtIO_CommonCapabilityOptions,VirtIO_NotificationCapabilityOptions,VirtIO_ISRCapabilityOptions,VirtIO_DeviceSpecificCapabilityOptions,VirtIO_Options; +function VirtIO(a,b){this.cpu=a;this.pci=a.devices.pci;this.device_id=b.device_id;this.pci_space=[VIRTIO_PCI_VENDOR_ID&255,VIRTIO_PCI_VENDOR_ID>>8,b.device_id&255,b.device_id>>8,7,5,16,0,1,0,2,0,0,0,0,0,1,168,0,0,0,16,191,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,VIRTIO_PCI_VENDOR_ID&255,VIRTIO_PCI_VENDOR_ID>>8,b.subsystem_device_id&255,b.subsystem_device_id>>8,0,0,0,0,64,0,0,0,0,0,0,0,0,1,0,0];this.pci_space=this.pci_space.concat(v86util.zeros(256-this.pci_space.length));this.pci_id=b.pci_id;this.pci_bars= +[];this.name=b.name;this.driver_feature_select=this.device_feature_select=0;this.device_feature=new Uint32Array(4);this.driver_feature=new Uint32Array(4);for(var c of b.common.features)dbg_assert(0<=c,"VirtIO device<"+this.name+"> feature bit numbers must be non-negative"),dbg_assert(128>c,"VirtIO device<"+this.name+"> feature bit numbers assumed less than 128 in implementation"),this.device_feature[c>>>5]|=1<<(c&31),this.driver_feature[c>>>5]|=1<<(c&31);dbg_assert(b.common.features.includes(VIRTIO_F_VERSION_1), +"VirtIO device<"+this.name+"> only non-transitional devices are supported");this.features_ok=!0;this.device_status=0;this.config_has_changed=!1;this.config_generation=0;this.queues=[];for(var d of b.common.queues)this.queues.push(new VirtQueue(a,this,d));this.queue_select=0;this.queue_selected=this.queues[0];this.isr_status=0;if(DEBUG){c=new Set;for(var e of this.queues.map(g=>g.notify_offset))d=b.notification.single_handler?0:e,c.add(d),dbg_assert(b.notification.handlers[d],"VirtIO device<"+this.name+ +"> every queue's notifier must exist");for(const [g,f]of b.notification.handlers.entries())dbg_assert(!f||c.has(g),"VirtIO device<"+this.name+"> no defined notify handler should be unused")}e=[];e.push(this.create_common_capability(b.common));e.push(this.create_notification_capability(b.notification));e.push(this.create_isr_capability(b.isr_status));b.device_specific&&e.push(this.create_device_specific_capability(b.device_specific));this.init_capabilities(e);a.devices.pci.register_device(this);this.reset()} +VirtIO.prototype.create_common_capability=function(a){return{type:VIRTIO_PCI_CAP_COMMON_CFG,bar:0,port:a.initial_port,use_mmio:!1,offset:0,extra:new Uint8Array(0),struct:[{bytes:4,name:"device_feature_select",read:()=>this.device_feature_select,write:b=>{this.device_feature_select=b}},{bytes:4,name:"device_feature",read:()=>this.device_feature[this.device_feature_select]||0,write:b=>{}},{bytes:4,name:"driver_feature_select",read:()=>this.driver_feature_select,write:b=>{this.driver_feature_select= +b}},{bytes:4,name:"driver_feature",read:()=>this.driver_feature[this.driver_feature_select]||0,write:b=>{const c=this.device_feature[this.driver_feature_select];this.driver_feature_select{dbg_log("No msi-x capability supported.",LOG_VIRTIO);return 65535},write:b=>{dbg_log("No msi-x capability supported.",LOG_VIRTIO)}},{bytes:2,name:"num_queues", +read:()=>this.queues.length,write:b=>{}},{bytes:1,name:"device_status",read:()=>this.device_status,write:b=>{0===b?(dbg_log("Reset device<"+this.name+">",LOG_VIRTIO),this.reset()):b&VIRTIO_STATUS_FAILED?dbg_log("Warning: Device<"+this.name+"> status failed",LOG_VIRTIO):dbg_log("Device<"+this.name+"> status: "+(b&VIRTIO_STATUS_ACKNOWLEDGE?"ACKNOWLEDGE ":"")+(b&VIRTIO_STATUS_DRIVER?"DRIVER ":"")+(b&VIRTIO_STATUS_DRIVER_OK?"DRIVER_OK":"")+(b&VIRTIO_STATUS_FEATURES_OK?"FEATURES_OK ":"")+(b&VIRTIO_STATUS_DEVICE_NEEDS_RESET? +"DEVICE_NEEDS_RESET":""),LOG_VIRTIO);b&~this.device_status&VIRTIO_STATUS_DRIVER_OK&&this.device_status&VIRTIO_STATUS_DEVICE_NEEDS_RESET&&this.notify_config_changes();this.features_ok||(DEBUG&&b&VIRTIO_STATUS_FEATURES_OK&&dbg_log("Removing FEATURES_OK",LOG_VIRTIO),b&=~VIRTIO_STATUS_FEATURES_OK);this.device_status=b;if(b&~this.device_status&VIRTIO_STATUS_DRIVER_OK)a.on_driver_ok()}},{bytes:1,name:"config_generation",read:()=>this.config_generation,write:b=>{}},{bytes:2,name:"queue_select",read:()=> +this.queue_select,write:b=>{this.queue_select=b;this.queue_selected=this.queue_selectthis.queue_selected?this.queue_selected.size:0,write:b=>{this.queue_selected&&(b&b-1&&(dbg_log("Warning: dev<"+this.name+"> Given queue size was not a power of 2. Rounding up to next power of 2.",LOG_VIRTIO),b=1<this.queue_selected.size_supported&&(dbg_log("Warning: dev<"+this.name+"> Trying to set queue size greater than supported. Clamping to supported size.", +LOG_VIRTIO),b=this.queue_selected.size_supported),this.queue_selected.set_size(b))}},{bytes:2,name:"queue_msix_vector",read:()=>{dbg_log("No msi-x capability supported.",LOG_VIRTIO);return 65535},write:b=>{dbg_log("No msi-x capability supported.",LOG_VIRTIO)}},{bytes:2,name:"queue_enable",read:()=>this.queue_selected?this.queue_selected.enabled|0:0,write:b=>{this.queue_selected&&(1===b?this.queue_selected.is_configured()?this.queue_selected.enable():dbg_log("Driver bug: tried enabling unconfigured queue", +LOG_VIRTIO):0===b&&dbg_log("Driver bug: tried writing 0 to queue_enable",LOG_VIRTIO))}},{bytes:2,name:"queue_notify_off",read:()=>this.queue_selected?this.queue_selected.notify_offset:0,write:b=>{}},{bytes:4,name:"queue_desc (low dword)",read:()=>this.queue_selected?this.queue_selected.desc_addr:0,write:b=>{this.queue_selected&&(this.queue_selected.desc_addr=b)}},{bytes:4,name:"queue_desc (high dword)",read:()=>0,write:b=>{dbg_log("Warning: High dword of 64 bit queue_desc ignored",LOG_VIRTIO)}},{bytes:4, +name:"queue_avail (low dword)",read:()=>this.queue_selected?this.queue_selected.avail_addr:0,write:b=>{this.queue_selected&&(this.queue_selected.avail_addr=b)}},{bytes:4,name:"queue_avail (high dword)",read:()=>0,write:b=>{dbg_log("Warning: High dword of 64 bit queue_avail ignored",LOG_VIRTIO)}},{bytes:4,name:"queue_used (low dword)",read:()=>this.queue_selected?this.queue_selected.used_addr:0,write:b=>{this.queue_selected&&(this.queue_selected.used_addr=b)}},{bytes:4,name:"queue_used (high dword)", +read:()=>0,write:b=>{dbg_log("Warning: High dword of 64 bit queue_used ignored",LOG_VIRTIO)}}]}}; +VirtIO.prototype.create_notification_capability=function(a){const b=[];let c;a.single_handler?(dbg_assert(1===a.handlers.length,"VirtIO device<"+this.name+"> too many notify handlers specified: expected single handler"),c=0):c=2;for(const [d,e]of a.handlers.entries())b.push({bytes:2,name:"notify"+d,read:()=>65535,write:e||(g=>{})});return{type:VIRTIO_PCI_CAP_NOTIFY_CFG,bar:1,port:a.initial_port,use_mmio:!1,offset:0,extra:new Uint8Array([c&255,c>>8&255,c>>16&255,c>>24]),struct:b}}; +VirtIO.prototype.create_isr_capability=function(a){return{type:VIRTIO_PCI_CAP_ISR_CFG,bar:2,port:a.initial_port,use_mmio:!1,offset:0,extra:new Uint8Array(0),struct:[{bytes:1,name:"isr_status",read:()=>{const b=this.isr_status;this.lower_irq();return b},write:b=>{}}]}}; +VirtIO.prototype.create_device_specific_capability=function(a){dbg_assert(~a.offset&3,"VirtIO device<"+this.name+"> device specific cap offset must be 4-byte aligned");return{type:VIRTIO_PCI_CAP_DEVICE_CFG,bar:3,port:a.initial_port,use_mmio:!1,offset:0,extra:new Uint8Array(0),struct:a.struct}}; +VirtIO.prototype.init_capabilities=function(a){let b=this.pci_space[52]=64;var c=b;for(const e of a){a=VIRTIO_PCI_CAP_LENGTH+e.extra.length;c=b;b=c+a;dbg_assert(256>=b,"VirtIO device<"+this.name+"> can't fit all capabilities into 256byte configspace");dbg_assert(0<=e.bar&&6>e.bar,"VirtIO device<"+this.name+"> capability invalid bar number");var d=e.struct.reduce((g,f)=>g+f.bytes,0);d+=e.offset;d=16>d?16:1< capability port should be aligned to pci bar size"); +this.pci_bars[e.bar]={size:d};this.pci_space[c]=VIRTIO_PCI_CAP_VENDOR;this.pci_space[c+1]=b;this.pci_space[c+2]=a;this.pci_space[c+3]=e.type;this.pci_space[c+4]=e.bar;this.pci_space[c+5]=0;this.pci_space[c+6]=0;this.pci_space[c+7]=0;this.pci_space[c+8]=e.offset&255;this.pci_space[c+9]=e.offset>>>8&255;this.pci_space[c+10]=e.offset>>>16&255;this.pci_space[c+11]=e.offset>>>24;this.pci_space[c+12]=d&255;this.pci_space[c+13]=d>>>8&255;this.pci_space[c+14]=d>>>16&255;this.pci_space[c+15]=d>>>24;for(const [g, +f]of e.extra.entries())this.pci_space[c+16+g]=f;c=16+4*e.bar;this.pci_space[c]=e.port&254|!e.use_mmio;this.pci_space[c+1]=e.port>>>8&255;this.pci_space[c+2]=e.port>>>16&255;this.pci_space[c+3]=e.port>>>24&255;c=e.port+e.offset;for(const g of e.struct){let f=g.read;a=g.write;DEBUG&&(f=()=>{const k=g.read();dbg_log("Device<"+this.name+"> cap["+e.type+"] read["+g.name+"] => "+h(k,8*g.bytes),LOG_VIRTIO);return k},a=k=>{dbg_log("Device<"+this.name+"> cap["+e.type+"] write["+g.name+"] <= "+h(k,8*g.bytes), +LOG_VIRTIO);g.write(k)});if(e.use_mmio)dbg_assert(!1,"VirtIO device <"+this.name+"> mmio capability not implemented.");else{d=function(m){dbg_log("Warning: 8-bit read from 16-bit virtio port",LOG_VIRTIO);return f(m&-2)>>((m&1)<<3)&255};const k=function(m){dbg_log("Warning: 8-bit read from 32-bit virtio port",LOG_VIRTIO);return f(m&-4)>>((m&3)<<3)&255};switch(g.bytes){case 4:this.cpu.io.register_read(c,this,k,void 0,f);this.cpu.io.register_write(c,this,void 0,void 0,a);break;case 2:this.cpu.io.register_read(c, +this,d,f);this.cpu.io.register_write(c,this,void 0,a);break;case 1:this.cpu.io.register_read(c,this,f);this.cpu.io.register_write(c,this,a);break;default:dbg_assert(!1,"VirtIO device <"+this.name+"> invalid capability field width of "+g.bytes+" bytes")}}c+=g.bytes}}c=VIRTIO_PCI_CAP_LENGTH+4;dbg_assert(256>=b+c,"VirtIO device<"+this.name+"> can't fit all capabilities into 256byte configspace");this.pci_space[b]=VIRTIO_PCI_CAP_VENDOR;this.pci_space[b+1]=0;this.pci_space[b+2]=c;this.pci_space[b+3]=VIRTIO_PCI_CAP_PCI_CFG; +this.pci_space[b+4]=0;this.pci_space[b+5]=0;this.pci_space[b+6]=0;this.pci_space[b+7]=0;this.pci_space[b+8]=0;this.pci_space[b+9]=0;this.pci_space[b+10]=0;this.pci_space[b+11]=0;this.pci_space[b+12]=0;this.pci_space[b+13]=0;this.pci_space[b+14]=0;this.pci_space[b+15]=0;this.pci_space[b+16]=0;this.pci_space[b+17]=0;this.pci_space[b+18]=0;this.pci_space[b+19]=0}; +VirtIO.prototype.get_state=function(){let a=[];a[0]=this.device_feature_select;a[1]=this.driver_feature_select;a[2]=this.device_feature;a[3]=this.driver_feature;a[4]=this.features_ok;a[5]=this.device_status;a[6]=this.config_has_changed;a[7]=this.config_generation;a[8]=this.isr_status;a[9]=this.queue_select;return a=a.concat(this.queues)}; +VirtIO.prototype.set_state=function(a){this.device_feature_select=a[0];this.driver_feature_select=a[1];this.device_feature=a[2];this.driver_feature=a[3];this.features_ok=a[4];this.device_status=a[5];this.config_has_changed=a[6];this.config_generation=a[7];this.isr_status=a[8];this.queue_select=a[9];let b=0;for(let c of a.slice(10))this.queues[b].set_state(c),b++;this.queue_selected=this.queues[this.queue_select]||null}; +VirtIO.prototype.reset=function(){this.driver_feature_select=this.device_feature_select=0;this.driver_feature.set(this.device_feature);this.features_ok=!0;this.queue_select=this.device_status=0;this.queue_selected=this.queues[0];for(const a of this.queues)a.reset();this.config_has_changed=!1;this.config_generation=0;this.lower_irq()}; +VirtIO.prototype.notify_config_changes=function(){this.config_has_changed=!0;this.device_status&VIRTIO_STATUS_DRIVER_OK?this.raise_irq(VIRTIO_ISR_DEVICE_CFG):dbg_assert(!1,"VirtIO device<"+this.name+"> attempted to notify driver before DRIVER_OK")};VirtIO.prototype.update_config_generation=function(){this.config_has_changed&&(this.config_generation++,this.config_generation&=255,this.config_has_changed=!1)}; +VirtIO.prototype.is_feature_negotiated=function(a){return 0<(this.driver_feature[a>>>5]&1<<(a&31))};VirtIO.prototype.needs_reset=function(){dbg_log("Device<"+this.name+"> experienced error - requires reset",LOG_VIRTIO);this.device_status|=VIRTIO_STATUS_DEVICE_NEEDS_RESET;this.device_status&VIRTIO_STATUS_DRIVER_OK&&this.notify_config_changes()};VirtIO.prototype.raise_irq=function(a){dbg_log("Raise irq "+h(a),LOG_VIRTIO);this.isr_status|=a;this.pci.raise_irq(this.pci_id)}; +VirtIO.prototype.lower_irq=function(){dbg_log("Lower irq ",LOG_VIRTIO);this.isr_status=0;this.pci.lower_irq(this.pci_id)};function VirtQueue(a,b,c){this.cpu=a;this.virtio=b;this.size_supported=this.size=c.size_supported;this.mask=this.size-1;this.enabled=!1;this.notify_offset=c.notify_offset;this.num_staged_replies=this.used_addr=this.avail_last_idx=this.avail_addr=this.desc_addr=0;this.reset()} +VirtQueue.prototype.get_state=function(){const a=[];a[0]=this.size;a[1]=this.size_supported;a[2]=this.enabled;a[3]=this.notify_offset;a[4]=this.desc_addr;a[5]=this.avail_addr;a[6]=this.avail_last_idx;a[7]=this.used_addr;a[8]=this.num_staged_replies;return a}; +VirtQueue.prototype.set_state=function(a){this.size=a[0];this.size_supported=a[1];this.enabled=a[2];this.notify_offset=a[3];this.desc_addr=a[4];this.avail_addr=a[5];this.avail_last_idx=a[6];this.used_addr=a[7];this.num_staged_replies=a[8];this.mask=this.size-1};VirtQueue.prototype.reset=function(){this.enabled=!1;this.num_staged_replies=this.used_addr=this.avail_last_idx=this.avail_addr=this.desc_addr=0;this.set_size(this.size_supported)}; +VirtQueue.prototype.is_configured=function(){return this.desc_addr&&this.avail_addr&&this.used_addr};VirtQueue.prototype.enable=function(){dbg_assert(this.is_configured(),"VirtQueue must be configured before enabled");this.enabled=!0};VirtQueue.prototype.set_size=function(a){dbg_assert(0===(a&a-1),"VirtQueue size must be power of 2 or zero");dbg_assert(a<=this.size_supported,"VirtQueue size must be within supported size");this.size=a;this.mask=a-1}; +VirtQueue.prototype.count_requests=function(){dbg_assert(this.avail_addr,"VirtQueue addresses must be configured before use");return this.avail_get_idx()-this.avail_last_idx&this.mask};VirtQueue.prototype.has_request=function(){dbg_assert(this.avail_addr,"VirtQueue addresses must be configured before use");return(this.avail_get_idx()&this.mask)!==this.avail_last_idx}; +VirtQueue.prototype.pop_request=function(){dbg_assert(this.avail_addr,"VirtQueue addresses must be configured before use");dbg_assert(this.has_request(),"VirtQueue must not pop nonexistent request");var a=this.avail_get_entry(this.avail_last_idx);dbg_log("Pop request: avail_last_idx="+this.avail_last_idx+" desc_idx="+a,LOG_VIRTIO);a=new VirtQueueBufferChain(this,a);this.avail_last_idx=this.avail_last_idx+1&this.mask;return a}; +VirtQueue.prototype.push_reply=function(a){dbg_assert(this.used_addr,"VirtQueue addresses must be configured before use");dbg_assert(this.num_staged_repliese){dbg_log("Driver bug: descriptor chain cycle detected",LOG_VIRTIO);break}if(k.flags&VIRTQ_DESC_F_NEXT)b=k.next;else break}}while(1);dbg_log("Descriptor chain end >>>",LOG_VIRTIO)} +VirtQueueBufferChain.prototype.get_next_blob=function(a){let b=0,c=a.length;for(;c;){if(this.read_buffer_idx===this.read_buffers.length){dbg_log("Device<"+this.virtio.name+"> Read more than device-readable buffers has",LOG_VIRTIO);break}var d=this.read_buffers[this.read_buffer_idx];const e=d.addr_low+this.read_buffer_offset;d=d.len-this.read_buffer_offset;d>c?(d=c,this.read_buffer_offset+=c):(this.read_buffer_idx++,this.read_buffer_offset=0);a.set(this.cpu.read_blob(e,d),b);b+=d;c-=d}return b}; +VirtQueueBufferChain.prototype.set_next_blob=function(a){let b=0,c=a.length;for(;c;){if(this.write_buffer_idx===this.write_buffers.length){dbg_log("Device<"+this.virtio.name+"> Write more than device-writable capacity",LOG_VIRTIO);break}var d=this.write_buffers[this.write_buffer_idx];const e=d.addr_low+this.write_buffer_offset;d=d.len-this.write_buffer_offset;d>c?(d=c,this.write_buffer_offset+=c):(this.write_buffer_idx++,this.write_buffer_offset=0);this.cpu.write_blob(a.subarray(b,b+d),e);b+=d;c-= +d}this.length_written+=b;return b};var Bus={};function BusConnector(){this.listeners={};this.pair=void 0}BusConnector.prototype.register=function(a,b,c){var d=this.listeners[a];void 0===d&&(d=this.listeners[a]=[]);d.push({fn:b,this_value:c})};BusConnector.prototype.unregister=function(a,b){var c=this.listeners[a];void 0!==c&&(this.listeners[a]=c.filter(function(d){return d.fn!==b}))}; +BusConnector.prototype.send=function(a,b,c){if(this.pair&&(a=this.pair.listeners[a],void 0!==a))for(c=0;cc))return;e=new Date;e=v86util.pad0(e.getHours(),2)+":"+v86util.pad0(e.getMinutes(),2)+":"+v86util.pad0(e.getSeconds(),2)+"+"+v86util.pad0(e.getMilliseconds(),3)+" ";c&&(1===c?do_the_log(e+b):do_the_log("Previous message repeated "+c+" times"),c=0);do_the_log(e+d); +b=d}}}();function dbg_trace(a){DEBUG&&dbg_log(Error().stack,a)}function dbg_assert(a,b,c){DEBUG&&(a||dbg_assert_failed(b))}function dbg_assert_failed(a){debugger;console.trace();if(a)throw"Assert failed: "+a;throw"Assert failed";};function CPU(a,b,c){this.next_tick_immediately=c;this.wm=b;this.wasm_patch();this.create_jit_imports();this.wasm_memory=b=this.wm.exports.memory;this.memory_size=v86util.view(Uint32Array,b,812,1);this.mem8=new Uint8Array(0);this.mem32s=new Int32Array(this.mem8.buffer);this.segment_is_null=v86util.view(Uint8Array,b,724,8);this.segment_offsets=v86util.view(Int32Array,b,736,8);this.segment_limits=v86util.view(Uint32Array,b,768,8);this.protected_mode=v86util.view(Int32Array,b,800,1);this.idtr_size=v86util.view(Int32Array, +b,564,1);this.idtr_offset=v86util.view(Int32Array,b,568,1);this.gdtr_size=v86util.view(Int32Array,b,572,1);this.gdtr_offset=v86util.view(Int32Array,b,576,1);this.tss_size_32=v86util.view(Int32Array,b,1128,1);this.page_fault=v86util.view(Uint32Array,b,540,8);this.cr=v86util.view(Int32Array,b,580,8);this.cpl=v86util.view(Uint8Array,b,612,1);this.is_32=v86util.view(Int32Array,b,804,1);this.stack_size_32=v86util.view(Int32Array,b,808,1);this.in_hlt=v86util.view(Uint8Array,b,616,1);this.last_virt_eip= +v86util.view(Int32Array,b,620,1);this.eip_phys=v86util.view(Int32Array,b,624,1);this.sysenter_cs=v86util.view(Int32Array,b,636,1);this.sysenter_esp=v86util.view(Int32Array,b,640,1);this.sysenter_eip=v86util.view(Int32Array,b,644,1);this.prefixes=v86util.view(Int32Array,b,648,1);this.flags=v86util.view(Int32Array,b,120,1);this.flags_changed=v86util.view(Int32Array,b,100,1);this.last_op_size=v86util.view(Int32Array,b,96,1);this.last_op1=v86util.view(Int32Array,b,104,1);this.last_result=v86util.view(Int32Array, +b,112,1);this.current_tsc=v86util.view(Uint32Array,b,960,2);this.devices={};this.instruction_pointer=v86util.view(Int32Array,b,556,1);this.previous_ip=v86util.view(Int32Array,b,560,1);this.apic_enabled=v86util.view(Uint8Array,b,548,1);this.acpi_enabled=v86util.view(Uint8Array,b,552,1);this.memory_map_read8=[];this.memory_map_write8=[];this.memory_map_read32=[];this.memory_map_write32=[];this.bios={main:null,vga:null};this.instruction_counter=v86util.view(Uint32Array,b,664,1);this.reg32=v86util.view(Int32Array, +b,64,8);this.fpu_st=v86util.view(Int32Array,b,1152,32);this.fpu_stack_empty=v86util.view(Uint8Array,b,816,1);this.fpu_stack_empty[0]=255;this.fpu_stack_ptr=v86util.view(Uint8Array,b,1032,1);this.fpu_stack_ptr[0]=0;this.fpu_control_word=v86util.view(Uint16Array,b,1036,1);this.fpu_control_word[0]=895;this.fpu_status_word=v86util.view(Uint16Array,b,1040,1);this.fpu_status_word[0]=0;this.fpu_ip=v86util.view(Int32Array,b,1048,1);this.fpu_ip[0]=0;this.fpu_ip_selector=v86util.view(Int32Array,b,1052,1);this.fpu_ip_selector[0]= +0;this.fpu_opcode=v86util.view(Int32Array,b,1044,1);this.fpu_opcode[0]=0;this.fpu_dp=v86util.view(Int32Array,b,1056,1);this.fpu_dp[0]=0;this.fpu_dp_selector=v86util.view(Int32Array,b,1060,1);this.fpu_dp_selector[0]=0;this.reg_xmm32s=v86util.view(Int32Array,b,832,32);this.mxcsr=v86util.view(Int32Array,b,824,1);this.sreg=v86util.view(Uint16Array,b,668,8);this.dreg=v86util.view(Int32Array,b,684,8);this.reg_pdpte=v86util.view(Int32Array,b,968,8);this.svga_dirty_bitmap_min_offset=v86util.view(Uint32Array, +b,716,1);this.svga_dirty_bitmap_max_offset=v86util.view(Uint32Array,b,720,1);this.fw_value=[];this.fw_pointer=0;this.option_roms=[];this.io=void 0;this.bus=a;this.set_tsc(0,0);this.debug_init();DEBUG&&(this.do_many_cycles_total=this.do_many_cycles_count=0,this.seen_code={},this.seen_code_uncompiled={})}CPU.prototype.clear_opstats=function(){(new Uint8Array(this.wasm_memory.buffer,32768,131072)).fill(0);this.wm.exports.profiler_init()}; +CPU.prototype.create_jit_imports=function(){const a=Object.create(null);a.m=this.wm.exports.memory;for(let b of Object.keys(this.wm.exports))b.startsWith("_")||b.startsWith("zstd")||b.endsWith("_js")||(a[b]=this.wm.exports[b]);this.jit_imports=a}; +CPU.prototype.wasm_patch=function(){const a=c=>this.wm.exports[c],b=c=>{const d=a(c);console.assert(d,"Missing import: "+c);return d};this.reset_cpu=b("reset_cpu");this.getiopl=b("getiopl");this.get_eflags=b("get_eflags");this.get_eflags_no_arith=b("get_eflags_no_arith");this.pic_call_irq=b("pic_call_irq");this.do_many_cycles_native=b("do_many_cycles_native");this.do_many_cycles_native_nojit=b("do_many_cycles_native_nojit");this.read8=b("read8");this.read16=b("read16");this.read32s=b("read32s");this.write8= +b("write8");this.write16=b("write16");this.write32=b("write32");this.in_mapped_range=b("in_mapped_range");this.fpu_load_tag_word=b("fpu_load_tag_word");this.fpu_load_status_word=b("fpu_load_status_word");this.fpu_get_sti_f64=b("fpu_get_sti_f64");this.translate_address_system_read=b("translate_address_system_read_js");this.get_seg_cs=b("get_seg_cs");this.get_real_eip=b("get_real_eip");this.clear_tlb=b("clear_tlb");this.full_clear_tlb=b("full_clear_tlb");this.update_state_flags=b("update_state_flags"); +this.set_tsc=b("set_tsc");this.store_current_tsc=b("store_current_tsc");this.set_cpuid_level=b("set_cpuid_level");DEBUG&&(this.jit_force_generate_unsafe=a("jit_force_generate_unsafe"));this.jit_clear_cache=b("jit_clear_cache_js");this.jit_dirty_cache=b("jit_dirty_cache");this.codegen_finalize_finished=b("codegen_finalize_finished");this.allocate_memory=b("allocate_memory");this.zero_memory=b("zero_memory");this.svga_allocate_memory=b("svga_allocate_memory");this.svga_allocate_dest_buffer=b("svga_allocate_dest_buffer"); +this.svga_fill_pixel_buffer=b("svga_fill_pixel_buffer");this.svga_mark_dirty=b("svga_mark_dirty");this.zstd_create_ctx=b("zstd_create_ctx");this.zstd_get_src_ptr=b("zstd_get_src_ptr");this.zstd_free_ctx=b("zstd_free_ctx");this.zstd_read=b("zstd_read");this.zstd_read_free=b("zstd_read_free")};CPU.prototype.jit_force_generate=function(a){this.jit_force_generate_unsafe?this.jit_force_generate_unsafe(a):dbg_assert(!1,"Not supported in this wasm build: jit_force_generate_unsafe")}; +CPU.prototype.jit_clear_func=function(a){dbg_assert(0<=a&&a>2)};goog.exportProperty(CPU.prototype,"create_memory",CPU.prototype.create_memory); +CPU.prototype.init=function(a,b){"number"===typeof a.log_level&&(LOG_LEVEL=a.log_level);this.create_memory("number"===typeof a.memory_size?a.memory_size:67108864);a.disable_jit&&(this.do_many_cycles_native=this.do_many_cycles_native_nojit);a.cpuid_level&&this.set_cpuid_level(a.cpuid_level);this.acpi_enabled[0]=+a.acpi;this.reset_cpu();var c=new IO(this);this.io=c;this.bios.main=a.bios;this.bios.vga=a.vga_bios;this.load_bios();if(a.bzimage){const {option_rom:e}=load_kernel(this.mem8,a.bzimage,a.initrd, +a.cmdline||"");e&&this.option_roms.push(e)}c.register_read(179,this,function(){dbg_log("port 0xB3 read");return 0});var d=0;c.register_read(146,this,function(){return d});c.register_write(146,this,function(e){d=e});c.register_read(1297,this,function(){if(this.fw_pointer> +8|m<<8&65280}function k(m){return m<<24|m<<8&16711680|m>>8&65280|m>>>24}dbg_log("bios config port, index="+h(e));this.fw_pointer=0;if(e===FW_CFG_SIGNATURE)this.fw_value=g(FW_CFG_SIGNATURE_QEMU);else if(e===FW_CFG_ID)this.fw_value=g(0);else if(e===FW_CFG_RAM_SIZE)this.fw_value=g(this.memory_size[0]);else if(e===FW_CFG_NB_CPUS)this.fw_value=g(1);else if(e===FW_CFG_MAX_CPUS)this.fw_value=g(1);else if(e===FW_CFG_NUMA)this.fw_value=new Uint8Array(16);else if(e===FW_CFG_FILE_DIR){e=new Int32Array(4+64* +this.option_roms.length);const m=new Uint8Array(e.buffer);e[0]=k(this.option_roms.length);for(let l=0;lFW_CFG_FILE_START+l);e[r+0>>2]=k(p.length);e[r+4>>2]=f(FW_CFG_FILE_START+l);dbg_assert(56>n.length);for(let q=0;q=FW_CFG_CUSTOM_START&&e=FW_CFG_FILE_START&&e-FW_CFG_FILE_STARTa.byteLength){var b=new Int32Array(2048);(new Uint8Array(b.buffer)).set(new Uint8Array(a))}else b=new Int32Array(a,0,2048);for(var c=0;8192>c;c+=4)if(464367618===b[c>>2]){var d=b[c+4>>2];if(464367618+d+b[c+8>>2]|0)dbg_log("Multiboot checksum check failed",LOG_CPU);else{dbg_log("Multiboot magic found, flags: "+h(d>>>0,8),LOG_CPU);dbg_assert(0===(d&-65537),"TODO");this.reg32[REG_EAX]= +732803074;this.reg32[REG_EBX]=31744;this.write32(31744,0);this.cr[0]=1;this.protected_mode[0]=1;this.flags[0]=FLAGS_DEFAULT;this.is_32[0]=1;this.stack_size_32[0]=1;for(var e=0;6>e;e++)this.segment_is_null[e]=0,this.segment_offsets[e]=0,this.segment_limits[e]=4294967295,this.sreg[e]=45058;if(d&65536){dbg_log("Multiboot specifies its own address table",LOG_CPU);e=b[c+12>>2];var g=b[c+16>>2];d=b[c+20>>2];var f=b[c+24>>2];b=b[c+28>>2];dbg_log("header="+h(e,8)+" load="+h(g,8)+" load_end="+h(d,8)+" bss_end="+ +h(f,8)+" entry="+h(b,8));dbg_assert(g<=e);c-=e-g;0===d?d=void 0:(dbg_assert(d>=g),d-=g);a=new Uint8Array(a,c,d);this.write_blob(a,g);this.instruction_pointer[0]=this.get_seg_cs()+b|0}else if(1179403647===b[0]){dbg_log("Multiboot image is in elf format",LOG_CPU);c=read_elf(a);this.instruction_pointer[0]=this.get_seg_cs()+c.header.entry|0;for(g of c.program_headers)0!==g.type&&(1===g.type?(dbg_assert(g.paddr===g.vaddr),dbg_assert(g.filesz<=g.memsz),g.paddr+g.memsz=k;k++){function m(l){dbg_log("kvm-unit-test: Set irq "+h(k)+" to "+h(l,2));l?this.device_raise_irq(k):this.device_lower_irq(k)}this.io.register_write(8192+k,this,m,m,m)}this.update_state_flags();dbg_log("Starting multiboot kernel at:",LOG_CPU);this.debug.dump_state();this.debug.dump_regs();break}}}; +CPU.prototype.fill_cmos=function(a,b){var c=b.boot_order||BOOT_ORDER_CD_FIRST;a.cmos_write(CMOS_BIOS_BOOTFLAG1,1|c>>4&240);a.cmos_write(CMOS_BIOS_BOOTFLAG2,c&255);a.cmos_write(CMOS_MEM_BASE_LOW,128);a.cmos_write(CMOS_MEM_BASE_HIGH,2);c=0;1048576<=this.memory_size[0]&&(c=this.memory_size[0]-1048576>>10,c=Math.min(c,65535));a.cmos_write(CMOS_MEM_OLD_EXT_LOW,c&255);a.cmos_write(CMOS_MEM_OLD_EXT_HIGH,c>>8&255);a.cmos_write(CMOS_MEM_EXTMEM_LOW,c&255);a.cmos_write(CMOS_MEM_EXTMEM_HIGH,c>>8&255);c=0;16777216<= +this.memory_size[0]&&(c=this.memory_size[0]-16777216>>16,c=Math.min(c,65535));a.cmos_write(CMOS_MEM_EXTMEM2_LOW,c&255);a.cmos_write(CMOS_MEM_EXTMEM2_HIGH,c>>8&255);a.cmos_write(CMOS_MEM_HIGHMEM_LOW,0);a.cmos_write(CMOS_MEM_HIGHMEM_MID,0);a.cmos_write(CMOS_MEM_HIGHMEM_HIGH,0);a.cmos_write(CMOS_EQUIPMENT_INFO,47);a.cmos_write(CMOS_BIOS_SMP_COUNT,0);b.fastboot&&a.cmos_write(63,1)}; +CPU.prototype.load_bios=function(){var a=this.bios.main,b=this.bios.vga;if(a){var c=new Uint8Array(a);this.write_blob(c,1048576-a.byteLength);if(b){var d=new Uint8Array(b);this.write_blob(d,786432);this.io.mmap_register(4272947200,1048576,function(e){e=e-4272947200|0;return e>>=0;e>>>=0;dbg_assert(0<=a&&a{this.wm.wasm_table.set(a+WASM_TABLE_OFFSET,f.instance.exports.f);this.codegen_finalize_finished(a,b,c); +this.test_hook_did_finalize_wasm&&this.test_hook_did_finalize_wasm(g)});DEBUG&&d.catch(f=>{console.log(f);debugger;throw f;})}; +CPU.prototype.log_uncompiled_code=function(a,b){if(DEBUG&&DUMP_UNCOMPILED_ASSEMBLY&&100>(this.seen_code_uncompiled[a]||0)){this.seen_code_uncompiled[a]=(this.seen_code_uncompiled[a]||0)+1;b+=8;(a^b)&-4096&&(dbg_log("truncated disassembly start="+h(a>>>0)+" end="+h(b>>>0)),b=(a|4095)+1);b=a);const c=new Uint8Array(b-a);for(let d=a;d>2)+7*g;const f=c[e+0],k=c[e+1];e=c[e+6]&65280;const m=new Uint8Array(k-f);for(let l=f;l>>0,8),v=h(e.sreg[REG_SS],4)+":"+h(e.reg32[REG_ES]>>>0,8),u=e.is_32[0]?"32":"16",w=e.flags[0]&FLAG_INTERRUPT?1:0,z={[FLAG_CARRY]:"c",[FLAG_PARITY]:"p",[FLAG_ADJUST]:"a",[FLAG_ZERO]:"z",[FLAG_SIGN]:"s",[FLAG_TRAP]:"t",[FLAG_INTERRUPT]:"i",[FLAG_DIRECTION]:"d",[FLAG_OVERFLOW]:"o"},C="",D=0;16>D;D++)z[1<q;q++)p+=n[q]+ +"="+h(e.reg32[l[n[q]]]>>>0,8)+" ",r+=n[q+4]+"="+h(e.reg32[l[n[q+4]]]>>>0,8)+" ";p+=" ds="+h(e.sreg[REG_DS],4)+" es="+h(e.sreg[REG_ES],4)+" fs="+h(e.sreg[REG_FS],4);r+=" gs="+h(e.sreg[REG_GS],4)+" cs="+h(e.sreg[REG_CS],4)+" ss="+h(e.sreg[REG_SS],4);return[p,r]}}function c(l,n,p){if(DEBUG){if(!(l&1))return!1;var r=128===(l&128);return{size:r,global:256===(l&256),accessed:32===(l&32),dirty:64===(l&64),cache_disable:16===(l&16),user:4===(l&4),read_write:2===(l&2),address:(r&&!p?l&(n?4292870144:4290772992): +l&4294963200)>>>0}}}function d(l,n,p){if(DEBUG)for(var r=n?512:1024,q=n?8:4,t=n?21:22,v=0;v>>0,8)+" -> "+h(w.address>>>0,8)+" | "+u);else{dbg_log("=== "+h(p+(v<>>0,8)+" | "+u);for(var z=0;z>>0,8)+" -> "+h(D.address,8)+" | "+u+" (at "+h(C,8)+")"))}}}}var e=this,g={};this.debug=g;g.init=function(){function l(p){10===p?(dbg_log(n,LOG_BIOS),n=""):n+=String.fromCharCode(p)}if(DEBUG&&e.io){var n="";e.io.register_write(1026,this,l);e.io.register_write(1280,this,l)}};g.get_regs_short=b;g.dump_regs=function(){if(DEBUG){var l=b();dbg_log(l[0], +LOG_CPU);dbg_log(l[1],LOG_CPU)}};g.get_state=a;g.dump_state=function(l){DEBUG&&dbg_log(a(l),LOG_CPU)};g.dump_stack=function(l,n){if(DEBUG){var p=e.reg32[REG_ESP];dbg_log("========= STACK ==========");if(n>=l||void 0===n)l=5,n=-5;for(;l>n;l--){var r=" ";l||(r="=> ");r+=h(l,2)+" | ";dbg_log(r+h(p+4*l,8)+" | "+h(e.read32s(p+4*l)>>>0))}}};g.dump_page_structures=function(){if(e.cr[4]&CR4_PAE){dbg_log("PAE enabled");for(var l=0;4>l;l++){var n=e.read32s(e.cr[3]+8*l);n&1&&d(n&4294963200,!0,l<<30)}}else dbg_log("PAE disabled"), +d(e.cr[3],!1,0)};g.dump_gdt_ldt=function(){function l(n,p){for(var r=0;r>4,w="",z=v>>5&3;w=v&128?w+" P ":w+"NP ";v&16?(w=u&4?w+"32b ":w+"16b ",v&8?(w+="X ",v&4&&(w+="C ")):w+="R ",w+="RW "):w+="sys: "+h(v&15);u&8&&(t=t<<12|4095);dbg_log(h(r&-8,4)+" "+h(q>>>0,8)+" ("+h(t>>>0,8)+" bytes) "+w+"; dpl = "+z+", a = "+v.toString(2)+", f = "+u.toString(2))}}DEBUG&&(dbg_log("gdt: (len = "+ +h(e.gdtr_size[0])+")"),l(e.translate_address_system_read(e.gdtr_offset[0]),e.gdtr_size[0]),dbg_log("\nldt: (len = "+h(e.segment_limits[REG_LDTR])+")"),l(e.translate_address_system_read(e.segment_offsets[REG_LDTR]),e.segment_limits[REG_LDTR]))};g.dump_idt=function(){if(DEBUG)for(var l=0;l>5&3;var t=5===(n&31)?"task gate ":14===(n&31)?"intr gate ":15=== +(n&31)?"trap gate ":"invalid ";t=n&128?t+" P":t+"NP";dbg_log(h(l>>3,4)+" "+h(p>>>0,8)+", "+h(r,4)+"; "+t+"; dpl = "+q+", t = "+n.toString(2))}};g.get_memory_dump=function(l,n){if(DEBUG)return void 0===l?(l=0,n=e.memory_size[0]):void 0===n&&(n=l,l=0),e.mem8.slice(l,l+n).buffer};g.memory_hex_dump=function(l,n){if(DEBUG){n=n||64;for(var p,r,q=0;q>4;q++){p=h(l+(q<<4),5)+" ";for(var t=0;16>t;t++)r=e.read8(l+(q<<4)+t),p+=h(r,2)+" ";p+=" ";for(t=0;16>t;t++)r=e.read8(l+(q<<4)+t),p+=33>r||126p;p++){n=h(128*p*l,8)+" | ";for(var r=0;128>r;r++)n+=0>>0)+": "+v86util.pads(r.bytes.map(q=>h(q,2).slice(-2)).join(" "),20)+" "+r.mnemonic+" "+r.op_str)}),dbg_log("")}catch(r){dbg_log("Could not disassemble: "+Array.from(n).map(q=>h(q,2)).join(" "))}};let m;g.dump_wasm=function(l){if(void 0===m&&(m="function"===typeof require?require("./libwabt.js"):new window.WabtModule,void 0===m)){dbg_log("Warning: Missing libwabt, wasm dump not available"); +return}l=l.slice();try{var n=m.readWasm(l,{readDebugNames:!1});n.generateNames();n.applyNames();const q=n.toText({foldExprs:!0,inlineExport:!0});dbg_log(q)}catch(q){var p=new Blob([l]),r=document.createElement("a");r.download="failed.wasm";r.href=window.URL.createObjectURL(p);r.dataset.downloadurl=["application/octet-stream",r.download,r.href].join(":");r.click();window.URL.revokeObjectURL(r.src);console.log(q.toString())}finally{n&&n.destroy()}}};const ELF_MAGIC=1179403647; +let types=DataView.prototype,U8={size:1,get:types.getUint8,set:types.setUint8},U16={size:2,get:types.getUint16,set:types.setUint16},U32={size:4,get:types.getUint32,set:types.setUint32},pad=function(a){return{size:a,get:b=>-1}},Header=create_struct([{magic:U32},{class:U8},{data:U8},{version0:U8},{osabi:U8},{abiversion:U8},{pad0:pad(7)},{type:U16},{machine:U16},{version1:U32},{entry:U32},{phoff:U32},{shoff:U32},{flags:U32},{ehsize:U16},{phentsize:U16},{phnum:U16},{shentsize:U16},{shnum:U16},{shstrndx:U16}]); +console.assert(52===Header.reduce((a,b)=>a+b.size,0));let ProgramHeader=create_struct([{type:U32},{offset:U32},{vaddr:U32},{paddr:U32},{filesz:U32},{memsz:U32},{flags:U32},{align:U32}]);console.assert(32===ProgramHeader.reduce((a,b)=>a+b.size,0));let SectionHeader=create_struct([{name:U32},{type:U32},{flags:U32},{addr:U32},{offset:U32},{size:U32},{link:U32},{info:U32},{addralign:U32},{entsize:U32}]);console.assert(40===SectionHeader.reduce((a,b)=>a+b.size,0)); +function create_struct(a){return a.map(function(b){var c=Object.keys(b);console.assert(1===c.length);c=c[0];b=b[c];console.assert(0>>0));console.assert(b.magic===ELF_MAGIC,"Bad magic");console.assert(1===b.class,"Unimplemented: 64 bit elf");console.assert(1===b.data,"Unimplemented: big endian");console.assert(1===b.version0,"Bad version0");console.assert(2===b.type,"Unimplemented type");console.assert(1===b.version1,"Bad version1");console.assert(52===b.ehsize, +"Bad header size");console.assert(32===b.phentsize,"Bad program header size");console.assert(40===b.shentsize,"Bad section header size");[d]=read_structs(view_slice(a,b.phoff,b.phentsize*b.phnum),ProgramHeader,b.phnum);[a]=read_structs(view_slice(a,b.shoff,b.shentsize*b.shnum),SectionHeader,b.shnum);if(DEBUG&&LOG_LEVEL){console.log("%d program headers:",d.length);for(let e of d)console.log("type=%s offset=%s vaddr=%s paddr=%s filesz=%s memsz=%s flags=%s align=%s",e.type.toString(16),e.offset.toString(16), +e.vaddr.toString(16),e.paddr.toString(16),e.filesz.toString(16),e.memsz.toString(16),e.flags.toString(16),e.align.toString(16));console.log("%d program headers:",a.length);for(let e of a)console.log("name=%s type=%s flags=%s addr=%s offset=%s size=%s link=%s info=%s addralign=%s entsize=%s",e.name.toString(16),e.type.toString(16),e.flags.toString(16),e.addr.toString(16),e.offset.toString(16),e.size.toString(16),e.link.toString(16),e.info.toString(16),e.addralign.toString(16),e.entsize.toString(16))}return{header:b, +program_headers:d,sections_headers:a}}function read_struct(a,b){let c={},d=0;for(let e of b)b=e.get.call(a,d,!0),console.assert(void 0===c[e.name]),c[e.name]=b,d+=e.size;return[c,d]}function read_structs(a,b,c){let d=[],e=0;for(var g=0;g>1];if(m!==LINUX_BOOT_HDR_CHECKSUM1)dbg_log("Bad checksum1: "+h(m));else if(m=g[LINUX_BOOT_HDR_HEADER>>1]|g[LINUX_BOOT_HDR_HEADER+2>>1]<<16,m!==LINUX_BOOT_HDR_CHECKSUM2)dbg_log("Bad checksum2: "+h(m));else{m=g[LINUX_BOOT_HDR_VERSION>>1];dbg_assert(514<=m);var l=e[LINUX_BOOT_HDR_LOADFLAGS];dbg_assert(l& +LINUX_BOOT_HDR_LOADFLAGS_LOADED_HIGH);var n=g[LINUX_BOOT_HDR_XLOADFLAGS>>1],p=f[LINUX_BOOT_HDR_INITRD_ADDR_MAX>>2],r=f[LINUX_BOOT_HDR_KERNEL_ALIGNMENT>>2],q=e[LINUX_BOOT_HDR_RELOCATABLE_KERNEL],t=e[LINUX_BOOT_HDR_MIN_ALIGNMENT],v=f[LINUX_BOOT_HDR_CMDLINE_SIZE>>2],u=f[LINUX_BOOT_HDR_PAYLOAD_OFFSET>>2],w=f[LINUX_BOOT_HDR_PAYLOAD_LENGTH>>2],z=f[LINUX_BOOT_HDR_PREF_ADDRESS>>2],C=f[LINUX_BOOT_HDR_PREF_ADDRESS+4>>2],D=f[LINUX_BOOT_HDR_INIT_SIZE>>2];dbg_log("kernel boot protocol version: "+h(m));dbg_log("flags="+ +h(l)+" xflags="+h(n));dbg_log("code32_start="+h(f[LINUX_BOOT_HDR_CODE32_START>>2]));dbg_log("initrd_addr_max="+h(p));dbg_log("kernel_alignment="+h(r));dbg_log("relocatable="+q);dbg_log("min_alignment="+h(t));dbg_log("cmdline max="+h(v));dbg_log("payload offset="+h(u)+" size="+h(w));dbg_log("pref_address="+h(C)+":"+h(z));dbg_log("init_size="+h(D));e[LINUX_BOOT_HDR_TYPE_OF_LOADER]=LINUX_BOOT_HDR_TYPE_OF_LOADER_NOT_ASSIGNED;e[LINUX_BOOT_HDR_LOADFLAGS]=l&~LINUX_BOOT_HDR_LOADFLAGS_QUIET_FLAG&~LINUX_BOOT_HDR_LOADFLAGS_KEEP_SEGMENTS| +LINUX_BOOT_HDR_LOADFLAGS_CAN_USE_HEAPS;g[LINUX_BOOT_HDR_HEAP_END_PTR>>1]=56832;g[LINUX_BOOT_HDR_VIDMODE>>1]=65535;dbg_log("heap_end_ptr="+h(56832));d+="\x00";dbg_assert(d.length>2]=581632;for(e=0;e>2]=k;f[LINUX_BOOT_HDR_RAMDISK_SIZE>>2]=e;dbg_assert(655360>524288+d.length);a.set(d,524288);a.set(b,1048576);return{option_rom:{name:"genroms/kernel.bin",data:make_linux_boot_rom(32768,57344)}}}} +function make_linux_boot_rom(a,b){const c=new Uint8Array(256);(new Uint16Array(c.buffer))[0]=43605;c[2]=1;var d=3;c[d++]=250;c[d++]=184;c[d++]=a>>0;c[d++]=a>>8;c[d++]=142;c[d++]=192;c[d++]=142;c[d++]=216;c[d++]=142;c[d++]=224;c[d++]=142;c[d++]=232;c[d++]=142;c[d++]=208;c[d++]=188;c[d++]=b>>0;c[d++]=b>>8;c[d++]=234;c[d++]=0;c[d++]=0;c[d++]=a+32>>0;c[d++]=a+32>>8;dbg_assert(512>d);a=d;b=c[a]=0;for(d=0;d keyCode not found: ",t,q)}};function MouseAdapter(a,b){function c(u){if(!v.enabled||!v.emu_enabled)return!1;var w=b||document.body,z;if(!(z=document.pointerLockElement))a:{for(u=u.target;u.parentNode;){if(u===w){z=!0;break a}u=u.parentNode}z=!1}return z}function d(u){c(u)&&(u=u.changedTouches)&&u.length&&(u=u[u.length-1],q=u.clientX,t=u.clientY)}function e(u){if(n||r||p)v.bus.send("mouse-click",[!1,!1,!1]),n=r=p=!1}function g(u){if(v.bus&&c(u)&&v.is_running){var w=0,z=0,C=u.changedTouches;C?C.length&&(C=C[C.length-1],w=C.clientX- +q,z=C.clientY-t,q=C.clientX,t=C.clientY,u.preventDefault()):"number"===typeof u.movementX?(w=u.movementX,z=u.movementY):"number"===typeof u.webkitMovementX?(w=u.webkitMovementX,z=u.webkitMovementY):"number"===typeof u.mozMovementX?(w=u.mozMovementX,z=u.mozMovementY):(w=u.clientX-q,z=u.clientY-t,q=u.clientX,t=u.clientY);v.bus.send("mouse-delta",[.15*w,-(.15*z)]);b&&v.bus.send("mouse-absolute",[u.pageX-b.offsetLeft,u.pageY-b.offsetTop,b.offsetWidth,b.offsetHeight])}}function f(u){c(u)&&m(u,!0)}function k(u){c(u)&& +m(u,!1)}function m(u,w){v.bus&&(1===u.which?n=w:2===u.which?r=w:3===u.which?p=w:dbg_log("Unknown event.which: "+u.which),v.bus.send("mouse-click",[n,r,p]),u.preventDefault())}function l(u){if(c(u)){var w=u.wheelDelta||-u.detail;0>w?w=-1:0{switch(n.data.type){case "queue":l.queue_push(n.data.value);break;case "sampling-rate":l.source_samples_per_destination=n.data.value/sampleRate}};return l}var m=[new Float32Array(256),new Float32Array(256)];Reflect.setPrototypeOf(k.prototype,AudioWorkletProcessor.prototype);Reflect.setPrototypeOf(k,AudioWorkletProcessor);k.prototype.process=k.prototype.process=function(l,n,p){for(l=0;ll?(l+=this.source_buffer_previous[0].length,this.source_buffer_previous[n][l]):this.source_buffer_current[n][l]};k.prototype.ensure_enough_data=function(l){var n=this.source_buffer_current[0].length;n-this.source_block_startthis.queued_samples&&this.queue_length&&this.dbg_log("Not enough samples - should not happen during midway of playback");this.source_buffer_previous=this.source_buffer_current;this.source_buffer_current=this.queue_shift();var l=this.source_buffer_current[0].length;if(256>l){for(var n=this.queue_start,p=0;256>l&&pthis.queued_samples/this.source_samples_per_destination&&this.port.postMessage({type:"pump"})};k.prototype.queue_push=function(l){this.queue_length{URL.revokeObjectURL(g);this.node_processor=new AudioWorkletNode(this.audio_context,"dac-processor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2],parameterData:{},processorOptions:{}});this.node_processor.port.postMessage({type:"sampling-rate",value:this.sampling_rate}); +this.node_processor.port.onmessage=f=>{switch(f.data.type){case "pump":this.pump();break;case "debug-log":dbg_log("SpeakerWorkletDAC - Worklet: "+f.data.value)}};this.node_processor.connect(this.node_output)});this.mixer_connection=c.add_source(this.node_output,MIXER_SRC_DAC);this.mixer_connection.set_gain_hidden(3);a.register("dac-send-data",function(f){this.queue(f)},this);a.register("dac-enable",function(f){this.enabled=!0},this);a.register("dac-disable",function(){this.enabled=!1},this);a.register("dac-tell-sampling-rate", +function(f){dbg_assert(0this.pump(),1E3*b);a.start(this.buffered_time);this.buffered_time+= +c;setTimeout(()=>this.pump(),0)};SpeakerBufferSourceDAC.prototype.pump=function(){this.enabled&&(this.buffered_time-this.audio_context.currentTime>DAC_QUEUE_RESERVE||this.bus.send("dac-request-data"))}; +function SpeakerDACDebugger(a,b){this.audio_context=a;this.node_source=b;this.node_processor=null;this.node_gain=this.audio_context.createGain();this.node_gain.gain.setValueAtTime(0,this.audio_context.currentTime);this.node_gain.connect(this.audio_context.destination);this.is_active=!1;this.queued_history=[];this.output_history=[];this.queued=[[],[]];this.output=[[],[]]} +SpeakerDACDebugger.prototype.start=function(a){this.is_active=!0;this.queued=[[],[]];this.output=[[],[]];this.queued_history.push(this.queued);this.output_history.push(this.output);this.node_processor=this.audio_context.createScriptProcessor(1024,2,2);this.node_processor.onaudioprocess=b=>{this.output[0].push(b.inputBuffer.getChannelData(0).slice());this.output[1].push(b.inputBuffer.getChannelData(1).slice())};this.node_source.connect(this.node_processor);this.node_processor.connect(this.node_gain); +setTimeout(()=>{this.stop()},a)};SpeakerDACDebugger.prototype.stop=function(){this.is_active=!1;this.node_source.disconnect(this.node_processor);this.node_processor.disconnect();this.node_processor=null};SpeakerDACDebugger.prototype.push_queued_data=function(a){this.is_active&&(this.queued[0].push(a[0].slice()),this.queued[1].push(a[1].slice()))};SpeakerDACDebugger.prototype.download_txt=function(a,b){a=this.output_history[a][b].map(c=>c.join(" ")).join(" ");dump_file(a,"dacdata.txt")}; +SpeakerDACDebugger.prototype.download_csv=function(a){a=this.output_history[a];for(var b=[],c=0;cm?void 0===this.update_timer&&(this.update_timer=setTimeout(()=>{this.update_timer=void 0;var l=Date.now();dbg_assert(15<=l-this.last_update);this.last_update=l;this.render()},16-m)):(void 0!==this.update_timer&&(clearTimeout(this.update_timer),this.update_timer=void 0),this.last_update=k,this.render())};this.render=function(){a.value= +this.text;this.text_new_line&&(this.text_new_line=!1,a.scrollTop=1E9)};this.send_char=function(k){f.bus&&f.bus.send("serial0-input",k)}}function SerialRecordingAdapter(a){this.text="";a.register("serial0-output-byte",function(b){b=String.fromCharCode(b);this.text+=b},this)} +function SerialAdapterXtermJS(a,b){this.element=a;if(window.Terminal){var c=this.term=new window.Terminal({logLevel:"off"});c.write("This is the serial console. Whatever you type or paste here will be sent to COM1");var d=c.onData(function(e){for(let g=0;ga||(this.last_connect_attempt=Date.now(),this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onopen=this.handle_open.bind(this),this.socket.onmessage=this.handle_message.bind(this),this.socket.onclose=this.handle_close.bind(this),this.socket.onerror=this.handle_error.bind(this))}}; +NetworkAdapter.prototype.send=function(a){this.socket&&1===this.socket.readyState?this.socket.send(a):(this.send_queue.push(a),this.send_queue.length>2*this.send_queue_limit&&(this.send_queue=this.send_queue.slice(-this.send_queue_limit)),this.connect())};NetworkAdapter.prototype.change_proxy=function(a){this.url=a;this.socket&&(this.socket.onclose=function(){},this.socket.onerror=function(){},this.socket.close(),this.socket=void 0)};function V86(a){this.cpu_is_running=!1;var b=Bus.create();this.bus=b[0];this.emulator_bus=b[1];var c,d;const e=new WebAssembly.Table({element:"anyfunc",initial:WASM_TABLE_SIZE+WASM_TABLE_OFFSET});b={cpu_exception_hook:f=>this.cpu_exception_hook&&this.cpu_exception_hook(f),hlt_op:function(){return c.hlt_op()},abort:function(){dbg_assert(!1)},microtick:v86.microtick,get_rand_int:function(){return v86util.get_rand_int()},pic_acknowledge:function(){c.pic_acknowledge()},io_port_read8:function(f){return c.io.port_read8(f)}, +io_port_read16:function(f){return c.io.port_read16(f)},io_port_read32:function(f){return c.io.port_read32(f)},io_port_write8:function(f,k){c.io.port_write8(f,k)},io_port_write16:function(f,k){c.io.port_write16(f,k)},io_port_write32:function(f,k){c.io.port_write32(f,k)},mmap_read8:function(f){return c.mmap_read8(f)},mmap_read16:function(f){return c.mmap_read16(f)},mmap_read32:function(f){return c.mmap_read32(f)},mmap_write8:function(f,k){c.mmap_write8(f,k)},mmap_write16:function(f,k){c.mmap_write16(f, +k)},mmap_write32:function(f,k){c.mmap_write32(f,k)},mmap_write64:function(f,k,m){c.mmap_write64(f,k,m)},mmap_write128:function(f,k,m,l,n){c.mmap_write128(f,k,m,l,n)},log_from_wasm:function(f,k){f=v86util.read_sized_string_from_mem(d,f,k);dbg_log(f,LOG_CPU)},console_log_from_wasm:function(f,k){f=v86util.read_sized_string_from_mem(d,f,k);console.error(f)},dbg_trace_from_wasm:function(){dbg_trace(LOG_CPU)},codegen_finalize:(f,k,m,l,n)=>{c.codegen_finalize(f,k,m,l,n)},jit_clear_func:f=>c.jit_clear_func(f), +jit_clear_all_funcs:()=>c.jit_clear_all_funcs(),__indirect_function_table:e};let g=a.wasm_fn;g||(g=f=>new Promise(k=>{let m=DEBUG?"v86-debug.wasm":"v86.wasm",l="v86-fallback.wasm";if(a.wasm_path){m=a.wasm_path;const n=m.lastIndexOf("/");l=(-1===n?"":m.substr(0,n))+"/"+l}else"undefined"===typeof window&&"string"===typeof __dirname?(m=__dirname+"/"+m,l=__dirname+"/"+l):(m="build/"+m,l="build/"+l);v86util.load_file(m,{done:async n=>{try{const {instance:p}=await WebAssembly.instantiate(n,f);this.wasm_source= +n;k(p.exports)}catch(p){v86util.load_file(l,{done:async r=>{const {instance:q}=await WebAssembly.instantiate(r,f);this.wasm_source=r;k(q.exports)}})}},progress:n=>{this.emulator_bus.send("download-progress",{file_index:0,file_count:1,file_name:m,lengthComputable:n.lengthComputable,total:n.total,loaded:n.loaded})}})}));g({env:b}).then(f=>{d=f.memory;f.rust_init();f=this.v86=new v86(this.emulator_bus,{exports:f,wasm_table:e});c=f.cpu;this.continue_init(f,a)});this.zstd_worker=null;this.zstd_worker_request_id= +0} +V86.prototype.continue_init=async function(a,b){function c(q,t){switch(q){case "hda":e.hda=this.disk_images.hda=t;break;case "hdb":e.hdb=this.disk_images.hdb=t;break;case "cdrom":e.cdrom=this.disk_images.cdrom=t;break;case "fda":e.fda=this.disk_images.fda=t;break;case "fdb":e.fdb=this.disk_images.fdb=t;break;case "multiboot":e.multiboot=this.disk_images.multiboot=t.buffer;break;case "bzimage":e.bzimage=this.disk_images.bzimage=t.buffer;break;case "initrd":e.initrd=this.disk_images.initrd=t.buffer;break; +case "bios":e.bios=t.buffer;break;case "vga_bios":e.vga_bios=t.buffer;break;case "initial_state":e.initial_state=t.buffer;break;case "fs9p_json":e.fs9p_json=t;break;default:dbg_assert(!1,q)}}async function d(){if(e.fs9p&&e.fs9p_json){if(e.initial_state?dbg_log("Filesystem basefs ignored: Overridden by state image"):e.fs9p.load_from_json(e.fs9p_json),b.bzimage_initrd_from_filesystem){const {bzimage_path:q,initrd_path:t}=this.get_bzimage_initrd_from_filesystem(e.fs9p);dbg_log("Found bzimage: "+q+" and initrd: "+ +t);const [v,u]=await Promise.all([e.fs9p.read_file(t),e.fs9p.read_file(q)]);c.call(this,"initrd",new v86util.SyncBuffer(v.buffer));c.call(this,"bzimage",new v86util.SyncBuffer(u.buffer))}}else dbg_assert(!b.bzimage_initrd_from_filesystem,"bzimage_initrd_from_filesystem: Requires a filesystem");this.serial_adapter&&this.serial_adapter.show&&this.serial_adapter.show();this.bus.send("cpu-init",e);e.initial_state&&(a.restore_state(e.initial_state),e.initial_state=void 0);b.autostart&&this.bus.send("cpu-run"); +this.emulator_bus.send("emulator-loaded")}this.bus.register("emulator-stopped",function(){this.cpu_is_running=!1},this);this.bus.register("emulator-started",function(){this.cpu_is_running=!0},this);var e={};this.disk_images={fda:void 0,fdb:void 0,hda:void 0,hdb:void 0,cdrom:void 0};var g=b.boot_order?b.boot_order:b.fda?BOOT_ORDER_FD_FIRST:b.hda?BOOT_ORDER_HD_FIRST:BOOT_ORDER_CD_FIRST;e.acpi=b.acpi;e.disable_jit=b.disable_jit;e.load_devices=!0;e.log_level=b.log_level;e.memory_size=b.memory_size||67108864; +e.vga_memory_size=b.vga_memory_size||8388608;e.boot_order=g;e.fastboot=b.fastboot||!1;e.fda=void 0;e.fdb=void 0;e.uart1=b.uart1;e.uart2=b.uart2;e.uart3=b.uart3;e.cmdline=b.cmdline;e.preserve_mac_from_state_image=b.preserve_mac_from_state_image;e.mac_address_translation=b.mac_address_translation;e.cpuid_level=b.cpuid_level;b.network_adapter?this.network_adapter=b.network_adapter(this.bus):b.network_relay_url&&(this.network_adapter=new NetworkAdapter(b.network_relay_url,this.bus));e.enable_ne2k=!0; +b.disable_keyboard||(this.keyboard_adapter=new KeyboardAdapter(this.bus));b.disable_mouse||(this.mouse_adapter=new MouseAdapter(this.bus,b.screen_container));b.screen_container?this.screen_adapter=new ScreenAdapter(b.screen_container,this.bus):b.screen_dummy&&(this.screen_adapter=new DummyScreenAdapter(this.bus));b.serial_container&&(this.serial_adapter=new SerialAdapter(b.serial_container,this.bus));b.serial_container_xtermjs&&(this.serial_adapter=new SerialAdapterXtermJS(b.serial_container_xtermjs, +this.bus));b.disable_speaker||(this.speaker_adapter=new SpeakerAdapter(this.bus));var f=[];g=(q,t)=>{if(t)if(t.get&&t.set&&t.load)f.push({name:q,loadable:t});else{if("bios"===q||"vga_bios"===q||"initial_state"===q||"multiboot"===q||"bzimage"===q||"initrd"===q)t.async=!1;t.url&&!t.async?f.push({name:q,url:t.url,size:t.size}):f.push({name:q,loadable:v86util.buffer_from_object(t,this.zstd_decompress_worker.bind(this))})}};b.state&&console.warn("Warning: Unknown option 'state'. Did you mean 'initial_state'?"); +for(var k="bios vga_bios cdrom hda hdb fda fdb initial_state multiboot bzimage initrd".split(" "),m=0;m +[p,()=>console.error("zstd worker unexpectedly called "+p)])),m.__indirect_function_table=new WebAssembly.Table({element:"anyfunc",initial:1024}),m.abort=()=>{throw Error("zstd worker aborted");},m.log_from_wasm=m.console_log_from_wasm=(p,r)=>{console.log(String.fromCharCode(...(new Uint8Array(d.exports.memory.buffer,p,r))))},m.dbg_trace_from_wasm=()=>console.trace(),d=new WebAssembly.Instance(new WebAssembly.Module(e.data),{env:m})}}.toString()+")()"],{type:"text/javascript"}));this.zstd_worker= +new Worker(c);URL.revokeObjectURL(c);this.zstd_worker.postMessage(this.wasm_source,[this.wasm_source])}return new Promise(c=>{const d=this.zstd_worker_request_id++,e=async g=>{g.data.id===d&&(this.zstd_worker.removeEventListener("message",e),dbg_assert(a===g.data.result.byteLength),c(g.data.result))};this.zstd_worker.addEventListener("message",e);this.zstd_worker.postMessage({src:b,decompressed_size:a,id:d},[b.buffer])})}; +V86.prototype.get_bzimage_initrd_from_filesystem=function(a){const b=(a.read_dir("/")||[]).map(e=>"/"+e);a=(a.read_dir("/boot/")||[]).map(e=>"/boot/"+e);let c,d;for(let e of[].concat(b,a)){const g=/old/i.test(e)||/fallback/i.test(e),f=/vmlinuz/i.test(e)||/bzimage/i.test(e),k=/initrd/i.test(e)||/initramfs/i.test(e);!f||d&&g||(d=e);!k||c&&g||(c=e)}c&&d||(console.log("Failed to find bzimage or initrd in filesystem. Files:"),console.log(b.join(" ")),console.log(a.join(" ")));return{initrd_path:c,bzimage_path:d}}; +V86.prototype.run=async function(){this.bus.send("cpu-run")};goog.exportProperty(V86.prototype,"run",V86.prototype.run);V86.prototype.stop=async function(){this.cpu_is_running&&await new Promise(a=>{const b=()=>{this.remove_listener("emulator-stopped",b);a()};this.add_listener("emulator-stopped",b);this.bus.send("cpu-stop")})};goog.exportProperty(V86.prototype,"stop",V86.prototype.stop); +V86.prototype.destroy=async function(){await this.stop();this.v86.destroy();this.keyboard_adapter&&this.keyboard_adapter.destroy();this.network_adapter&&this.network_adapter.destroy();this.mouse_adapter&&this.mouse_adapter.destroy();this.screen_adapter&&this.screen_adapter.destroy();this.serial_adapter&&this.serial_adapter.destroy();this.speaker_adapter&&this.speaker_adapter.destroy()};goog.exportProperty(V86.prototype,"destroy",V86.prototype.destroy);V86.prototype.restart=function(){this.bus.send("cpu-restart")}; +goog.exportProperty(V86.prototype,"restart",V86.prototype.restart);V86.prototype.add_listener=function(a,b){this.bus.register(a,b,this)};goog.exportProperty(V86.prototype,"add_listener",V86.prototype.add_listener);V86.prototype.remove_listener=function(a,b){this.bus.unregister(a,b)};goog.exportProperty(V86.prototype,"remove_listener",V86.prototype.remove_listener);V86.prototype.restore_state=async function(a){dbg_assert(1===arguments.length);this.v86.restore_state(a)}; +goog.exportProperty(V86.prototype,"restore_state",V86.prototype.restore_state);V86.prototype.save_state=async function(){dbg_assert(0===arguments.length);return this.v86.save_state()};goog.exportProperty(V86.prototype,"save_state",V86.prototype.save_state); +V86.prototype.get_statistics=function(){console.warn("V86.prototype.get_statistics is deprecated. Use events instead.");var a={cpu:{instruction_counter:this.get_instruction_counter()}};if(!this.v86)return a;var b=this.v86.cpu.devices;b.hda&&(a.hda=b.hda.stats);b.cdrom&&(a.cdrom=b.cdrom.stats);b.ps2&&(a.mouse={enabled:b.ps2.use_mouse});b.vga&&(a.vga={is_graphical:b.vga.stats.is_graphical});return a};goog.exportProperty(V86.prototype,"get_statistics",V86.prototype.get_statistics); +V86.prototype.get_instruction_counter=function(){return this.v86?this.v86.cpu.instruction_counter[0]>>>0:0};goog.exportProperty(V86.prototype,"get_instruction_counter",V86.prototype.get_instruction_counter);V86.prototype.is_running=function(){return this.cpu_is_running};goog.exportProperty(V86.prototype,"is_running",V86.prototype.is_running); +V86.prototype.set_fda=async function(a){if(a.url&&!a.async)v86util.load_file(a.url,{done:b=>{this.v86.cpu.devices.fdc.set_fda(new v86util.SyncBuffer(b))}});else{const b=v86util.buffer_from_object(a,this.zstd_decompress_worker.bind(this));b.onload=()=>{this.v86.cpu.devices.fdc.set_fda(b)};await b.load()}};goog.exportProperty(V86.prototype,"set_fda",V86.prototype.set_fda);V86.prototype.eject_fda=function(){this.v86.cpu.devices.fdc.eject_fda()};goog.exportProperty(V86.prototype,"eject_fda",V86.prototype.eject_fda); +V86.prototype.keyboard_send_scancodes=function(a){for(var b=0;b{const k=this.fs9p.Mount(a,g);d&&(k===-ENOENT?d(new FileNotFoundError):k===-EEXIST?d(new FileExistsError):0>k?(dbg_assert(!1,"Unexpected error code: "+-k),d(Error("Failed to mount. Error number: "+-k))):d(null))};b?(dbg_assert("object"===typeof c,"Filesystem: basefs must be a JSON object"),g.load_from_json(c,()=>f())):f()}; +goog.exportProperty(V86.prototype,"mount_fs",V86.prototype.mount_fs);V86.prototype.create_file=async function(a,b){dbg_assert(2===arguments.length);var c=this.fs9p;if(c){var d=a.split("/");d=d[d.length-1];var e=c.SearchPath(a).parentid;if(""!==d&&-1!==e)await c.CreateBinaryFile(d,e,b);else return Promise.reject(new FileNotFoundError)}};goog.exportProperty(V86.prototype,"create_file",V86.prototype.create_file); +V86.prototype.read_file=async function(a){dbg_assert(1===arguments.length);var b=this.fs9p;if(b)return(b=await b.read_file(a))?b:Promise.reject(new FileNotFoundError)};goog.exportProperty(V86.prototype,"read_file",V86.prototype.read_file); +V86.prototype.automatically=function(a){const b=c=>{const d=c[0];if(d){var e=c.slice(1);if(d.sleep)setTimeout(()=>b(e),1E3*d.sleep);else if(d.vga_text){const g=this.screen_adapter.get_text_screen();for(let f of g)if(f.includes(d.vga_text)){b(e);return}setTimeout(()=>b(c),1E3)}else d.keyboard_send?(d.keyboard_send instanceof Array?this.keyboard_send_scancodes(d.keyboard_send):(dbg_assert("string"===typeof d.keyboard_send),this.keyboard_send_text(d.keyboard_send)),b(e)):d.call?(d.call(),b(e)):dbg_assert(!1, +d)}};b(a)};V86.prototype.read_memory=function(a,b){return this.v86.cpu.read_blob(a,b)};V86.prototype.write_memory=function(a,b){this.v86.cpu.write_blob(a,b)};function FileExistsError(a){this.message=a||"File already exists"}FileExistsError.prototype=Error.prototype;function FileNotFoundError(a){this.message=a||"File not found"}FileNotFoundError.prototype=Error.prototype; +"undefined"!==typeof window?(window.V86Starter=V86,window.V86=V86):"undefined"!==typeof module&&"undefined"!==typeof module.exports?(module.exports.V86Starter=V86,module.exports.V86=V86):"function"===typeof importScripts&&(self.V86Starter=V86,self.V86=V86);var WorkerBus={Connector:function(a){this.listeners={};this.pair=a;a.addEventListener("message",function(b){b=b.data;for(var c=this.listeners[b[0]],d=0;d>20)+"m\n";b=b+"Config:\nMAX_PAGES="+(a.wm.exports.get_jit_config(0)+"\n");b+="JIT_USE_LOOP_SAFETY="+!!a.wm.exports.get_jit_config(1)+"\n";return b+="MAX_EXTRA_BASIC_BLOCKS="+a.wm.exports.get_jit_config(2)+"\n"},print_instruction_counts:function(a){return[print_stats.print_instruction_counts_offset(a, +!1,!1,!1,!1),print_stats.print_instruction_counts_offset(a,!0,!1,!1,!1),print_stats.print_instruction_counts_offset(a,!1,!0,!1,!1),print_stats.print_instruction_counts_offset(a,!1,!1,!0,!1),print_stats.print_instruction_counts_offset(a,!1,!1,!1,!0)].join("\n\n")},print_instruction_counts_offset:function(a,b,c,d,e){let g="";var f=[],k=b?"compiled":c?"jit exit":d?"unguarded register":e?"wasm size":"executed";for(let n=0;256>n;n++)for(let p=0;8>p;p++)for(let r of[!1,!0]){var m=a.wm.exports.get_opstats_buffer(b, +c,d,e,n,!1,r,p);f.push({opcode:n,count:m,is_mem:r,fixed_g:p});m=a.wm.exports.get_opstats_buffer(b,c,d,e,n,!0,r,p);f.push({opcode:3840|n,count:m,is_mem:r,fixed_g:p})}a=0;b=new Set([38,46,54,62,100,101,102,103,240,242,243]);for(let {count:n,opcode:p}of f)b.has(p)||(a+=n);if(0===a)return"";c=new Uint32Array(256);b=new Uint32Array(256);for(let {opcode:n,count:p}of f)3840==(n&65280)?b[n&255]+=p:c[n&255]+=p;g=g+"------------------\nTotal: "+(a+"\n");const l=1E7 +Math.round(n/l)));d=String(d).length;g+=`Instruction counts ${k} (in ${l}):\n`;for(e=0;256>e;e++)g+=e.toString(16).padStart(2,"0")+":"+v86util.pads(Math.round(c[e]/l),d),g=15==e%16?g+"\n":g+" ";g=g+"\n"+`Instruction counts ${k} (0f, in ${l}):\n`;for(k=0;256>k;k++)g+=(k&255).toString(16).padStart(2,"0")+":"+v86util.pads(Math.round(b[k]/l),d),g=15==k%16?g+"\n":g+" ";g+="\n";f=f.filter(({count:n})=>n).sort(({count:n},{count:p})=>p-n);for(let {opcode:n,is_mem:p,fixed_g:r,count:q}of f.slice(0,200))f=n.toString(16)+ +"_"+r+(p?"_m":"_r"),g+=f+":"+(q/a*100).toFixed(2)+" ";return g+"\n"}};"undefined"!==typeof module&&"undefined"!==typeof module.exports&&(module.exports.print_stats=print_stats);function FileStorageInterface(){}FileStorageInterface.prototype.read=function(a,b,c){};FileStorageInterface.prototype.cache=function(a,b){};FileStorageInterface.prototype.uncache=function(a){};function MemoryFileStorage(){this.filedata=new Map}MemoryFileStorage.prototype.read=async function(a,b,c){dbg_assert(a,"MemoryFileStorage read: sha256sum should be a non-empty string");return(a=this.filedata.get(a))?a.subarray(b,b+c):null}; +MemoryFileStorage.prototype.cache=async function(a,b){dbg_assert(a,"MemoryFileStorage cache: sha256sum should be a non-empty string");this.filedata.set(a,b)};MemoryFileStorage.prototype.uncache=function(a){this.filedata.delete(a)};function ServerFileStorageWrapper(a,b){dbg_assert(b,"ServerMemoryFileStorage: baseurl should not be empty");this.storage=a;this.baseurl=b} +ServerFileStorageWrapper.prototype.load_from_server=function(a){return new Promise((b,c)=>{v86util.load_file(this.baseurl+a,{done:async d=>{d=new Uint8Array(d);await this.cache(a,d);b(d)}})})};ServerFileStorageWrapper.prototype.read=async function(a,b,c){const d=await this.storage.read(a,b,c);return d?d:(await this.load_from_server(a)).subarray(b,b+c)};ServerFileStorageWrapper.prototype.cache=async function(a,b){return await this.storage.cache(a,b)};ServerFileStorageWrapper.prototype.uncache=function(a){this.storage.uncache(a)}; +"undefined"!==typeof window?(window.MemoryFileStorage=MemoryFileStorage,window.ServerFileStorageWrapper=ServerFileStorageWrapper):"undefined"!==typeof module&&"undefined"!==typeof module.exports?(module.exports.MemoryFileStorage=MemoryFileStorage,module.exports.ServerFileStorageWrapper=ServerFileStorageWrapper):"function"===typeof importScripts&&(self.MemoryFileStorage=MemoryFileStorage,self.ServerFileStorageWrapper=ServerFileStorageWrapper);var S_IRWXUGO=511,S_IFMT=61440,S_IFSOCK=49152,S_IFLNK=40960,S_IFREG=32768,S_IFBLK=24576,S_IFDIR=16384,S_IFCHR=8192,O_RDONLY=0,O_WRONLY=1,O_RDWR=2,O_ACCMODE=3,STATUS_INVALID=-1,STATUS_OK=0,STATUS_ON_STORAGE=2,STATUS_UNLINKED=4,STATUS_FORWARDING=5,JSONFS_VERSION=3,JSONFS_IDX_NAME=0,JSONFS_IDX_SIZE=1,JSONFS_IDX_MTIME=2,JSONFS_IDX_MODE=3,JSONFS_IDX_UID=4,JSONFS_IDX_GID=5,JSONFS_IDX_TARGET=6,JSONFS_IDX_SHA256=6; +function FS(a,b){this.inodes=[];this.events=[];this.storage=a;this.qidcounter=b||{last_qidnumber:0};this.inodedata={};this.total_size=274877906944;this.used_size=0;this.mounts=[];this.CreateDirectory("",-1)}FS.prototype.get_state=function(){let a=[];a[0]=this.inodes;a[1]=this.qidcounter.last_qidnumber;a[2]=[];for(const [b,c]of Object.entries(this.inodedata))0===(this.inodes[b].mode&S_IFDIR)&&a[2].push([b,c]);a[3]=this.total_size;a[4]=this.used_size;return a=a.concat(this.mounts)}; +FS.prototype.set_state=function(a){this.inodes=a[0].map(b=>{const c=new Inode(0);c.set_state(b);return c});this.qidcounter.last_qidnumber=a[1];this.inodedata={};for(let [b,c]of a[2])c.buffer.byteLength!==c.byteLength&&(c=c.slice()),this.inodedata[b]=c;this.total_size=a[3];this.used_size=a[4];this.mounts=a.slice(5)}; +FS.prototype.AddEvent=function(a,b){var c=this.inodes[a];c.status==STATUS_OK||c.status==STATUS_ON_STORAGE?b():this.is_forwarder(c)?this.follow_fs(c).AddEvent(c.foreign_id,b):this.events.push({id:a,OnEvent:b})};FS.prototype.HandleEvent=function(a){var b=this.inodes[a];this.is_forwarder(b)&&this.follow_fs(b).HandleEvent(b.foreign_id);b=[];for(var c=0;c>8;this.qid.version=a[11];this.qid.path=a[12];this.nlinks=a[13]}; +FS.prototype.divert=function(a,b){const c=this.Search(a,b),d=this.inodes[c],e=new Inode(-1);dbg_assert(d,"Filesystem divert: name ("+b+") not found");dbg_assert(this.IsDirectory(c)||1>=d.nlinks,"Filesystem: can't divert hardlinked file '"+b+"' with nlinks="+d.nlinks);Object.assign(e,d);const g=this.inodes.length;this.inodes.push(e);e.fid=g;this.is_forwarder(d)&&this.mounts[d.mount_id].backtrack.set(d.foreign_id,g);this.should_be_linked(d)&&(this.unlink_from_dir(a,b),this.link_under_dir(a,g,b));if(this.IsDirectory(c)&& +!this.is_forwarder(d))for(const [f,k]of e.direntries)"."!==f&&".."!==f&&this.IsDirectory(k)&&this.inodes[k].direntries.set("..",g);this.inodedata[g]=this.inodedata[c];delete this.inodedata[c];d.direntries=new Map;d.nlinks=0;return g};FS.prototype.copy_inode=function(a,b){Object.assign(b,a,{fid:b.fid,direntries:b.direntries,nlinks:b.nlinks})};FS.prototype.CreateInode=function(){const a=Math.round(Date.now()/1E3),b=new Inode(++this.qidcounter.last_qidnumber);b.atime=b.ctime=b.mtime=a;return b}; +FS.prototype.CreateDirectory=function(a,b){var c=this.inodes[b];if(0<=b&&this.is_forwarder(c))return b=c.foreign_id,a=this.follow_fs(c).CreateDirectory(a,b),this.create_forwarder(c.mount_id,a);c=this.CreateInode();c.mode=511|S_IFDIR;0<=b&&(c.uid=this.inodes[b].uid,c.gid=this.inodes[b].gid,c.mode=this.inodes[b].mode&511|S_IFDIR);c.qid.type=S_IFDIR>>8;this.PushInode(c,b,a);this.NotifyListeners(this.inodes.length-1,"newdir");return this.inodes.length-1}; +FS.prototype.CreateFile=function(a,b){var c=this.inodes[b];if(this.is_forwarder(c))return b=c.foreign_id,a=this.follow_fs(c).CreateFile(a,b),this.create_forwarder(c.mount_id,a);c=this.CreateInode();c.uid=this.inodes[b].uid;c.gid=this.inodes[b].gid;c.qid.type=S_IFREG>>8;c.mode=this.inodes[b].mode&438|S_IFREG;this.PushInode(c,b,a);this.NotifyListeners(this.inodes.length-1,"newfile");return this.inodes.length-1}; +FS.prototype.CreateNode=function(a,b,c,d){var e=this.inodes[b];if(this.is_forwarder(e))return b=e.foreign_id,a=this.follow_fs(e).CreateNode(a,b,c,d),this.create_forwarder(e.mount_id,a);e=this.CreateInode();e.major=c;e.minor=d;e.uid=this.inodes[b].uid;e.gid=this.inodes[b].gid;e.qid.type=S_IFSOCK>>8;e.mode=this.inodes[b].mode&438;this.PushInode(e,b,a);return this.inodes.length-1}; +FS.prototype.CreateSymlink=function(a,b,c){var d=this.inodes[b];if(this.is_forwarder(d))return b=d.foreign_id,a=this.follow_fs(d).CreateSymlink(a,b,c),this.create_forwarder(d.mount_id,a);d=this.CreateInode();d.uid=this.inodes[b].uid;d.gid=this.inodes[b].gid;d.qid.type=S_IFLNK>>8;d.symlink=c;d.mode=S_IFLNK;this.PushInode(d,b,a);return this.inodes.length-1}; +FS.prototype.CreateTextFile=async function(a,b,c){var d=this.inodes[b];if(this.is_forwarder(d))return b=d.foreign_id,c=await this.follow_fs(d).CreateTextFile(a,b,c),this.create_forwarder(d.mount_id,c);d=this.CreateFile(a,b);b=this.inodes[d];a=new Uint8Array(c.length);b.size=c.length;for(b=0;bf)return f}var k=this.inodes[e],m=this.inodes[a];f=this.inodes[c];if(this.is_forwarder(m)||this.is_forwarder(f))if(this.is_forwarder(m)&&m.mount_id===f.mount_id){if(a=await this.follow_fs(m).Rename(m.foreign_id,b,f.foreign_id,d),0>a)return a}else{if(this.is_a_root(e))return dbg_log("XXX: Attempted to move mountpoint ("+ +b+") - skipped",LOG_9P),-EPERM;if(!this.IsDirectory(e)&&1f)return f;await this.DeleteData(m);a=this.Unlink(a,b);if(0>a)return a}else this.unlink_from_dir(a,b),this.link_under_dir(c,e,d),k.qid.version++;this.NotifyListeners(e,"rename",{oldpath:g});return 0}; +FS.prototype.Write=async function(a,b,c,d){this.NotifyListeners(a,"write");var e=this.inodes[a];if(this.is_forwarder(e))a=e.foreign_id,await this.follow_fs(e).Write(a,b,c,d);else{var g=await this.get_buffer(a);!g||g.lengthb.nlinks&&message.Debug("Error in filesystem: negative nlinks="+b.nlinks+" at id ="+a);if(this.IsDirectory(a)){b=this.GetInode(a);this.IsDirectory(a)&&0>this.GetParent(a)&&message.Debug("Error in filesystem: negative parent id "+a);for(const [c,d]of b.direntries){0===c.length&&message.Debug("Error in filesystem: inode with no name and id "+d);for(const e of c)32>e&& +message.Debug("Error in filesystem: Unallowed char in filename")}}}};FS.prototype.FillDirectory=function(a){var b=this.inodes[a];if(this.is_forwarder(b))this.follow_fs(b).FillDirectory(b.foreign_id);else{var c=0;for(const d of b.direntries.keys())c+=24+UTF8.UTF8Length(d);a=this.inodedata[a]=new Uint8Array(c);b.size=c;c=0;for(const [d,e]of b.direntries)b=this.GetInode(e),c+=marshall.Marshall(["Q","d","b","s"],[b.qid,c+13+8+1+2+UTF8.UTF8Length(d),b.mode>>12,d],a,c)}}; +FS.prototype.RoundToDirentry=function(a,b){const c=this.inodedata[a];dbg_assert(c,`FS directory data for dirid=${a} should be generated`);dbg_assert(c.length,"FS directory should have at least an entry");if(b>=c.length)return c.length;for(a=0;;){const d=marshall.Unmarshall(["Q","d"],c,{offset:a})[1];if(d>b)break;a=d}return a};FS.prototype.IsDirectory=function(a){a=this.inodes[a];return this.is_forwarder(a)?this.follow_fs(a).IsDirectory(a.foreign_id):(a.mode&S_IFMT)===S_IFDIR}; +FS.prototype.IsEmpty=function(a){a=this.inodes[a];if(this.is_forwarder(a))return this.follow_fs(a).IsDirectory(a.foreign_id);for(const b of a.direntries.keys())if("."!==b&&".."!==b)return!1;return!0};FS.prototype.GetChildren=function(a){dbg_assert(this.IsDirectory(a),"Filesystem: cannot get children of non-directory inode");a=this.inodes[a];if(this.is_forwarder(a))return this.follow_fs(a).GetChildren(a.foreign_id);const b=[];for(const c of a.direntries.keys())"."!==c&&".."!==c&&b.push(c);return b}; +FS.prototype.GetParent=function(a){dbg_assert(this.IsDirectory(a),"Filesystem: cannot get parent of non-directory inode");a=this.inodes[a];if(this.should_be_linked(a))return a.direntries.get("..");const b=this.follow_fs(a).GetParent(a.foreign_id);dbg_assert(-1!==b,"Filesystem: should not have invalid parent ids");return this.get_forwarder(a.mount_id,b)}; +FS.prototype.PrepareCAPs=function(a){a=this.GetInode(a);if(a.caps)return a.caps.length;a.caps=new Uint8Array(20);a.caps[0]=0;a.caps[1]=0;a.caps[2]=0;a.caps[3]=2;a.caps[4]=255;a.caps[5]=255;a.caps[6]=255;a.caps[7]=255;a.caps[8]=255;a.caps[9]=255;a.caps[10]=255;a.caps[11]=255;a.caps[12]=63;a.caps[13]=0;a.caps[14]=0;a.caps[15]=0;a.caps[16]=63;a.caps[17]=0;a.caps[18]=0;a.caps[19]=0;return a.caps.length};function FSMountInfo(a){this.fs=a;this.backtrack=new Map} +FSMountInfo.prototype.get_state=function(){const a=[];a[0]=this.fs;a[1]=[...this.backtrack];return a};FSMountInfo.prototype.set_state=function(a){this.fs=a[0];this.backtrack=new Map(a[1])}; +FS.prototype.set_forwarder=function(a,b,c){const d=this.inodes[a];dbg_assert(0===d.nlinks,"Filesystem: attempted to convert an inode into forwarder before unlinking the inode");this.is_forwarder(d)&&this.mounts[d.mount_id].backtrack.delete(d.foreign_id);d.status=STATUS_FORWARDING;d.mount_id=b;d.foreign_id=c;this.mounts[b].backtrack.set(c,a)};FS.prototype.create_forwarder=function(a,b){const c=this.CreateInode(),d=this.inodes.length;this.inodes.push(c);c.fid=d;this.set_forwarder(d,a,b);return d}; +FS.prototype.is_forwarder=function(a){return a.status===STATUS_FORWARDING};FS.prototype.is_a_root=function(a){return 0===this.GetInode(a).fid};FS.prototype.get_forwarder=function(a,b){var c=this.mounts[a];dbg_assert(0<=b,"Filesystem get_forwarder: invalid foreign_id: "+b);dbg_assert(c,"Filesystem get_forwarder: invalid mount number: "+a);c=c.backtrack.get(b);return void 0===c?this.create_forwarder(a,b):c}; +FS.prototype.delete_forwarder=function(a){dbg_assert(this.is_forwarder(a),"Filesystem delete_forwarder: expected forwarder");a.status=STATUS_INVALID;this.mounts[a.mount_id].backtrack.delete(a.foreign_id)};FS.prototype.follow_fs=function(a){const b=this.mounts[a.mount_id];dbg_assert(this.is_forwarder(a),"Filesystem follow_fs: inode should be a forwarding inode");dbg_assert(b,"Filesystem follow_fs: inode should point to valid mounted FS");return b.fs}; +FS.prototype.Mount=function(a,b){dbg_assert(b.qidcounter===this.qidcounter,"Cannot mount filesystem whose qid numbers aren't synchronised with current filesystem.");var c=this.SearchPath(a);if(-1===c.parentid)return dbg_log("Mount failed: parent for path not found: "+a,LOG_9P),-ENOENT;if(-1!==c.id)return dbg_log("Mount failed: file already exists at path: "+a,LOG_9P),-EEXIST;if(c.forward_path)return a=this.inodes[c.parentid],c=this.follow_fs(a).Mount(c.forward_path,b),0>c?c:this.get_forwarder(a.mount_id, +c);a=this.mounts.length;this.mounts.push(new FSMountInfo(b));b=this.create_forwarder(a,0);this.link_under_dir(c.parentid,b,c.name);return b};function FSLockRegion(){this.type=P9_LOCK_TYPE_UNLCK;this.start=0;this.length=Infinity;this.proc_id=-1;this.client_id=""}FSLockRegion.prototype.get_state=function(){const a=[];a[0]=this.type;a[1]=this.start;a[2]=Infinity===this.length?0:this.length;a[3]=this.proc_id;a[4]=this.client_id;return a}; +FSLockRegion.prototype.set_state=function(a){this.type=a[0];this.start=a[1];this.length=0===a[2]?Infinity:a[2];this.proc_id=a[3];this.client_id=a[4]};FSLockRegion.prototype.clone=function(){const a=new FSLockRegion;a.set_state(this.get_state());return a}; +FSLockRegion.prototype.conflicts_with=function(a){return this.proc_id===a.proc_id&&this.client_id===a.client_id||this.type===P9_LOCK_TYPE_UNLCK||a.type===P9_LOCK_TYPE_UNLCK||this.type!==P9_LOCK_TYPE_WRLCK&&a.type!==P9_LOCK_TYPE_WRLCK||this.start+this.length<=a.start||a.start+a.length<=this.start?!1:!0};FSLockRegion.prototype.is_alike=function(a){return a.proc_id===this.proc_id&&a.client_id===this.client_id&&a.type===this.type}; +FSLockRegion.prototype.may_merge_after=function(a){return this.is_alike(a)&&a.start+a.length===this.start};FS.prototype.DescribeLock=function(a,b,c,d,e){dbg_assert(a===P9_LOCK_TYPE_RDLCK||a===P9_LOCK_TYPE_WRLCK||a===P9_LOCK_TYPE_UNLCK,"Filesystem: Invalid lock type: "+a);dbg_assert(0<=b,"Filesystem: Invalid negative lock starting offset: "+b);dbg_assert(0=g&&0=g&&(d.locks.splice(c,1),c--)}if(b.type!==P9_LOCK_TYPE_UNLCK){c=b;a=!1;for(e=0;e"."!==b&&".."!==b)};FS.prototype.read_file=function(a){a=this.SearchPath(a);if(-1===a.id)return Promise.resolve(null);const b=this.GetInode(a.id);return this.Read(a.id,0,b.size)};var VIRTIO_MAGIC_REG=0,VIRTIO_VERSION_REG=4,VIRTIO_DEVICE_REG=8,VIRTIO_VENDOR_REG=12,VIRTIO_HOSTFEATURES_REG=16,VIRTIO_HOSTFEATURESSEL_REG=20,VIRTIO_GUESTFEATURES_REG=32,VIRTIO_GUESTFEATURESSEL_REG=36,VIRTIO_GUEST_PAGE_SIZE_REG=40,VIRTIO_QUEUESEL_REG=48,VIRTIO_QUEUENUMMAX_REG=52,VIRTIO_QUEUENUM_REG=56,VIRTIO_QUEUEALIGN_REG=60,VIRTIO_QUEUEPFN_REG=64,VIRTIO_QUEUENOTIFY_REG=80,VIRTIO_INTERRUPTSTATUS_REG=96,VIRTIO_INTERRUPTACK_REG=100,VIRTIO_STATUS_REG=112,VRING_DESC_F_NEXT=1,VRING_DESC_F_WRITE=2,VRING_DESC_F_INDIRECT= +4;function hex8(a){return h(a)}var message={Debug:function(a){dbg_log([].slice.apply(arguments).join(" "),LOG_9P)},Abort:function(){if(DEBUG)throw Error("message.Abort()");}},LoadBinaryResource; +LoadBinaryResource="undefined"!==typeof XMLHttpRequest?function(a,b,c){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onreadystatechange=function(){if(4==d.readyState)if(200!=d.status&&0!=d.status)c("Error: Could not load file "+a);else{var e=d.response;e?b(e):c("Error: No data received from: "+a)}};d.send(null)}:function(a,b,c){require("fs").readFile(a,function(d,e){d?c(d):b(e.buffer)})};var marshall={Marshall:function(a,b,c,d){for(var e,g=0,f=0;f>8&255;c[d++]=e>>16&255;c[d++]=e>>24&255;g+=4;break;case "d":c[d++]=e&255;c[d++]=e>>8&255;c[d++]=e>>16&255;c[d++]=e>>24&255;c[d++]=0;c[d++]=0;c[d++]=0;c[d++]=0;g+=8;break;case "h":c[d++]=e&255;c[d++]=e>>8;g+=2;break;case "b":c[d++]=e;g+=1;break;case "s":var k=d,m=0;c[d++]=0;c[d++]=0;g+=2;for(var l of e)UnicodeToUTF8Stream(l.charCodeAt(0)).forEach(function(n){c[d++]=n;g+=1;m++}); +c[k+0]=m&255;c[k+1]=m>>8&255;break;case "Q":marshall.Marshall(["b","w","d"],[e.type,e.version,e.path],c,d);d+=13;g+=13;break;default:message.Debug("Marshall: Unknown type="+a[f])}return g},Unmarshall:function(a,b,c){let d=c.offset;for(var e=[],g=0;g>>0;e.push(f);break;case "d":f=b[d++];f+=b[d++]<<8;f+=b[d++]<<16;f+=b[d++]<<24>>>0;d+=4;e.push(f);break;case "h":f=b[d++];e.push(f+(b[d++]<<8));break;case "b":e.push(b[d++]); +break;case "s":f=b[d++];f+=b[d++]<<8;for(var k="",m=new UTF8StreamToUnicode,l=0;l