v86 0.5.445 → 0.5.449
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -0
- package/build/libv86-debug.js +484 -450
- package/build/libv86-debug.mjs +484 -450
- package/build/libv86.js +8 -7
- package/build/libv86.mjs +7 -5
- package/package.json +1 -1
package/build/libv86.js
CHANGED
|
@@ -458,14 +458,15 @@ this.mouse_clicks=this.mouse_delta_x=this.mouse_delta_y=0;break;case 245:this.en
|
|
|
458
458
|
0;break;default:y(a)}this.mouse_irq()}}else if(this.read_controller_output_port)this.read_controller_output_port=!1,this.controller_output_port=a;else{y(a);this.mouse_buffer.clear();this.kbd_buffer.clear();this.kbd_buffer.push(250);switch(a){case 237:this.next_read_led=!0;break;case 240:this.next_handle_scan_code_set=!0;break;case 242:this.kbd_buffer.push(171);this.kbd_buffer.push(131);break;case 243:this.next_read_rate=!0;break;case 244:this.enable_keyboard_stream=!0;break;case 245:this.enable_keyboard_stream=
|
|
459
459
|
!1;break;case 246:break;case 255:this.kbd_buffer.clear();this.kbd_buffer.push(250);this.kbd_buffer.push(170);this.kbd_buffer.push(0);break;default:y(a)}this.kbd_irq()}};
|
|
460
460
|
Pc.prototype.port64_write=function(a){y(a);switch(a){case 32:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(this.command_register);this.kbd_irq();break;case 96:this.read_command_register=!0;break;case 208:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(this.controller_output_port);this.kbd_irq();break;case 209:this.read_controller_output_port=!0;break;case 211:this.read_output_register=!0;break;case 212:this.next_is_mouse_command=!0;break;case 167:this.command_register|=
|
|
461
|
-
32;break;case 168:this.command_register&=-33;break;case 169:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 170:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(85);this.kbd_irq();break;case 171:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 173:this.command_register|=16;break;case 174:this.command_register&=-17;break;case 254:this.cpu.reboot_internal();break;default:y(a)}};function Qc(a,b){function c(){}this.cpu=a;this.bus=b;this.absolute=this.enabled=!1;this.queue=[];this.buttons=0;this.last_y=this.last_x=-1;this.
|
|
462
|
-
function(d){
|
|
463
|
-
function(d){this.host_pointer_locked?this.push_relative(0,0,-d[0]|0,!1):this.push_absolute(-d[0]|0,!1)},this);a.io.register_read(22104,this,function(){return 255},function(){return 65535},this.port_read32);a.io.register_write(22104,
|
|
464
|
-
Qc.prototype.push_absolute=function(a,b){!this.enabled||!this.absolute||0>this.last_x||(b&&this.tail_is_move&&4<=this.queue.length&&!(this.queue[this.queue.length-4]&65536)?(this.queue[this.queue.length-3]=this.last_x,this.queue[this.queue.length-2]=this.last_y):this.push_packet(this.buttons,this.last_x,this.last_y,a,b))};
|
|
461
|
+
32;break;case 168:this.command_register&=-33;break;case 169:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 170:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(85);this.kbd_irq();break;case 171:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 173:this.command_register|=16;break;case 174:this.command_register&=-17;break;case 254:this.cpu.reboot_internal();break;default:y(a)}};function Qc(a,b){function c(){}this.cpu=a;this.bus=b;this.absolute=this.enabled=!1;this.queue=[];this.buttons=0;this.last_y=this.last_x=-1;this.tail_is_move=!1;this.clip_out=new Uint8Array(0);this.clip_out_cursor=0;this.clip_out_fresh=!1;this.clip_in=new Uint8Array(0);this.clip_in_cursor=0;this.bus.register("vmware-clipboard-host",function(d){this.clip_out=65536<d.length?d.subarray(0,65536):d;this.clip_out_cursor=0;this.clip_out_fresh=!0},this);this.host_pointer_locked=!1;this.rel_dy=this.rel_dx=
|
|
462
|
+
0;this.bus.register("mouse-absolute",function(d){const e=Math.max(0,Math.min(65535,Math.round(d[0]/d[2]*65535)));d=Math.max(0,Math.min(65535,Math.round(d[1]/d[3]*65535)));if(e!==this.last_x||d!==this.last_y)this.last_x=e,this.last_y=d,this.push_absolute(0,!0)},this);this.bus.register("mouse-delta",function(d){if(this.host_pointer_locked){this.rel_dx+=d[0];this.rel_dy+=d[1];d=this.rel_dx|0;var e=this.rel_dy|0;if(d||e)this.rel_dx-=d,this.rel_dy-=e,this.push_relative(d,e,0,!0)}},this);this.bus.register("mouse-pointer-lock",
|
|
463
|
+
function(d){this.host_pointer_locked=d;this.rel_dy=this.rel_dx=0},this);this.bus.register("mouse-click",function(d){this.buttons=(d[0]?32:0)|(d[1]?8:0)|(d[2]?16:0);this.host_pointer_locked?this.push_relative(0,0,0,!1):this.push_absolute(0,!1)},this);this.bus.register("mouse-wheel",function(d){this.host_pointer_locked?this.push_relative(0,0,-d[0]|0,!1):this.push_absolute(-d[0]|0,!1)},this);a.io.register_read(22104,this,function(){return 255},function(){return 65535},this.port_read32);a.io.register_write(22104,
|
|
464
|
+
this,c,c,c)}Qc.prototype.push_absolute=function(a,b){!this.enabled||!this.absolute||0>this.last_x||(b&&this.tail_is_move&&4<=this.queue.length&&!(this.queue[this.queue.length-4]&65536)?(this.queue[this.queue.length-3]=this.last_x,this.queue[this.queue.length-2]=this.last_y):this.push_packet(this.buttons,this.last_x,this.last_y,a,b))};
|
|
465
465
|
Qc.prototype.push_relative=function(a,b,c,d){this.enabled&&(d&&this.tail_is_move&&4<=this.queue.length&&this.queue[this.queue.length-4]&65536?(this.queue[this.queue.length-3]+=a,this.queue[this.queue.length-2]+=b):this.push_packet(this.buttons|65536,a,b,c,d))};Qc.prototype.push_packet=function(a,b,c,d,e){1024<this.queue.length+4?(this.enabled=!1,this.queue.length=0):(this.queue.push(a,b,c,d),this.tail_is_move=e)};
|
|
466
|
-
Qc.prototype.port_read32=function(){
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
Qc.prototype.port_read32=function(){var a=this.cpu.reg32;if(1447909480!==a[0])return-1;switch(a[1]&65535){case 10:return a[3]=1447909480,6;case 6:if(!this.clip_out_fresh)break;this.clip_out_fresh=!1;this.clip_out_cursor=0;return this.clip_out.length;case 7:var b=this.clip_out;a=this.clip_out_cursor;b=b[a]|0|(b[a+1]|0)<<8|(b[a+2]|0)<<16|(b[a+3]|0)<<24;this.clip_out_cursor=a+4;return b;case 8:return a=Math.min(a[3]>>>0,65536),this.clip_in=new Uint8Array(a),this.clip_in_cursor=0,0===a&&this.bus.send("vmware-clipboard-guest",
|
|
467
|
+
this.clip_in),0;case 9:b=this.clip_in;a=a[3]>>>0;var c=this.clip_in_cursor;c<b.length&&(b[c++]=a);c<b.length&&(b[c++]=a>>>8);c<b.length&&(b[c++]=a>>>16);c<b.length&&(b[c++]=a>>>24);this.clip_in_cursor=c;c>=b.length&&(this.bus.send("vmware-clipboard-guest",b),this.clip_in=new Uint8Array(0),this.clip_in_cursor=0);return 0;case 23:return b=Date.now(),a[3]=b%1E3*1E3,a[1]=1E6,a[2]=-(new Date(b)).getTimezoneOffset(),b/1E3>>>0;case 40:return this.enabled?this.queue.length:-65536;case 39:b=Math.min(a[3]>>>
|
|
468
|
+
0,4,this.queue.length);c=[0,0,0,0];for(let d=0;d<b;d++)c[d]=this.queue.shift();a[3]=c[1];a[1]=c[2];a[2]=c[3];return c[0];case 41:switch(a[3]){case 1161905490:this.enabled=!0;this.queue.length=0;this.tail_is_move=!1;this.queue.push(876762442);break;case 245:this.absolute=this.enabled=!1;this.queue.length=0;this.bus.send("vmware-absolute-mouse",!1);break;case 1396851026:this.absolute=!0;this.bus.send("vmware-absolute-mouse",!0);break;case 1279611474:this.absolute=!1,this.bus.send("vmware-absolute-mouse",
|
|
469
|
+
!1)}return 0}return-1};Qc.prototype.get_state=function(){return[this.enabled,this.absolute]};Qc.prototype.set_state=function(a){this.enabled=a[0];this.absolute=a[1];this.bus.send("vmware-absolute-mouse",this.absolute)};const Rc=DataView.prototype,Sc={size:1,get:Rc.getUint8,set:Rc.setUint8},Tc={size:2,get:Rc.getUint16,set:Rc.setUint16},V={size:4,get:Rc.getUint32,set:Rc.setUint32},Vc=Uc([{magic:V},{class:Sc},{data:Sc},{version0:Sc},{osabi:Sc},{abiversion:Sc},{pad0:function(a){return{size:a,get:()=>-1}}(7)},{type:Tc},{machine:Tc},{version1:V},{entry:V},{phoff:V},{shoff:V},{flags:V},{ehsize:Tc},{phentsize:Tc},{phnum:Tc},{shentsize:Tc},{shnum:Tc},{shstrndx:Tc}]);console.assert(52===Vc.reduce((a,b)=>a+b.size,0));
|
|
469
470
|
const Wc=Uc([{type:V},{offset:V},{vaddr:V},{paddr:V},{filesz:V},{memsz:V},{flags:V},{align:V}]);console.assert(32===Wc.reduce((a,b)=>a+b.size,0));const Xc=Uc([{name:V},{type:V},{flags:V},{addr:V},{offset:V},{size:V},{link:V},{info:V},{addralign:V},{entsize:V}]);console.assert(40===Xc.reduce((a,b)=>a+b.size,0));function Uc(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<b.size);return{name:c,type:b,size:b.size,get:b.get,set:b.set}})}
|
|
470
471
|
function Yc(a,b){const c={};let d=0;for(const 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 Zc(a,b,c){const d=[];let e=0;for(var f=0;f<c;f++){const [g,h]=Yc(new DataView(a.buffer,a.byteOffset+e,void 0),b);d.push(g);e+=h}return[d,e]};const $c={[0]:0,[1]:525,[2]:525,[3]:350,[4]:350,[5]:350};
|
|
471
472
|
function W(a,b,c,d){this.io=a.io;this.cpu=a;this.dma=a.devices.dma;this.cmd_table=this.build_cmd_lookup_table();this.sra=0;this.srb=192;this.dor=12;this.tdr=0;this.msr=128;this.dsr=0;this.cmd_phase=1;this.cmd_flags=this.cmd_code=0;this.cmd_buffer=new Uint8Array(17);this.cmd_remaining=this.cmd_cursor=0;this.response_data=new Uint8Array(15);this.reset_sense_int_count=this.curr_drive_no=this.status1=this.status0=this.response_length=this.response_cursor=0;this.locked=!1;this.head_load_time=this.step_rate_interval=
|
package/build/libv86.mjs
CHANGED
|
@@ -409,11 +409,13 @@ a&&(this.mouse_detect_state=1);break;case 1:this.mouse_detect_state=100===a?2:20
|
|
|
409
409
|
!1,this.controller_output_port=a;else{y(a);this.mouse_buffer.clear();this.kbd_buffer.clear();this.kbd_buffer.push(250);switch(a){case 237:this.next_read_led=!0;break;case 240:this.next_handle_scan_code_set=!0;break;case 242:this.kbd_buffer.push(171);this.kbd_buffer.push(131);break;case 243:this.next_read_rate=!0;break;case 244:this.enable_keyboard_stream=!0;break;case 245:this.enable_keyboard_stream=!1;break;case 246:break;case 255:this.kbd_buffer.clear();this.kbd_buffer.push(250);this.kbd_buffer.push(170);
|
|
410
410
|
this.kbd_buffer.push(0);break;default:y(a)}this.kbd_irq()}};Pc.prototype.port64_write=function(a){y(a);switch(a){case 32:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(this.command_register);this.kbd_irq();break;case 96:this.read_command_register=!0;break;case 208:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(this.controller_output_port);this.kbd_irq();break;case 209:this.read_controller_output_port=!0;break;case 211:this.read_output_register=!0;break;
|
|
411
411
|
case 212:this.next_is_mouse_command=!0;break;case 167:this.command_register|=32;break;case 168:this.command_register&=-33;break;case 169:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 170:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(85);this.kbd_irq();break;case 171:this.kbd_buffer.clear();this.mouse_buffer.clear();this.kbd_buffer.push(0);this.kbd_irq();break;case 173:this.command_register|=16;break;case 174:this.command_register&=
|
|
412
|
-
-17;break;case 254:this.cpu.reboot_internal();break;default:y(a)}};function Qc(a,b){function c(){}this.cpu=a;this.bus=b;this.absolute=this.enabled=!1;this.queue=[];this.buttons=0;this.last_y=this.last_x=-1;this.
|
|
413
|
-
|
|
414
|
-
0,0,!1):this.push_absolute(0,!1)},this);this.bus.register("mouse-wheel",function(d){this.host_pointer_locked?this.push_relative(0,0,-d[0]|0,!1):this.push_absolute(-d[0]|0,!1)},this);a.io.register_read(22104,this,function(){return 255},
|
|
415
|
-
|
|
416
|
-
b,c,d),this.tail_is_move=e)};Qc.prototype.port_read32=function(){
|
|
412
|
+
-17;break;case 254:this.cpu.reboot_internal();break;default:y(a)}};function Qc(a,b){function c(){}this.cpu=a;this.bus=b;this.absolute=this.enabled=!1;this.queue=[];this.buttons=0;this.last_y=this.last_x=-1;this.tail_is_move=!1;this.clip_out=new Uint8Array(0);this.clip_out_cursor=0;this.clip_out_fresh=!1;this.clip_in=new Uint8Array(0);this.clip_in_cursor=0;this.bus.register("vmware-clipboard-host",function(d){this.clip_out=65536<d.length?d.subarray(0,65536):d;this.clip_out_cursor=0;this.clip_out_fresh=
|
|
413
|
+
!0},this);this.host_pointer_locked=!1;this.rel_dy=this.rel_dx=0;this.bus.register("mouse-absolute",function(d){const e=Math.max(0,Math.min(65535,Math.round(d[0]/d[2]*65535)));d=Math.max(0,Math.min(65535,Math.round(d[1]/d[3]*65535)));if(e!==this.last_x||d!==this.last_y)this.last_x=e,this.last_y=d,this.push_absolute(0,!0)},this);this.bus.register("mouse-delta",function(d){if(this.host_pointer_locked){this.rel_dx+=d[0];this.rel_dy+=d[1];d=this.rel_dx|0;var e=this.rel_dy|0;if(d||e)this.rel_dx-=d,this.rel_dy-=
|
|
414
|
+
e,this.push_relative(d,e,0,!0)}},this);this.bus.register("mouse-pointer-lock",function(d){this.host_pointer_locked=d;this.rel_dy=this.rel_dx=0},this);this.bus.register("mouse-click",function(d){this.buttons=(d[0]?32:0)|(d[1]?8:0)|(d[2]?16:0);this.host_pointer_locked?this.push_relative(0,0,0,!1):this.push_absolute(0,!1)},this);this.bus.register("mouse-wheel",function(d){this.host_pointer_locked?this.push_relative(0,0,-d[0]|0,!1):this.push_absolute(-d[0]|0,!1)},this);a.io.register_read(22104,this,function(){return 255},
|
|
415
|
+
function(){return 65535},this.port_read32);a.io.register_write(22104,this,c,c,c)}Qc.prototype.push_absolute=function(a,b){!this.enabled||!this.absolute||0>this.last_x||(b&&this.tail_is_move&&4<=this.queue.length&&!(this.queue[this.queue.length-4]&65536)?(this.queue[this.queue.length-3]=this.last_x,this.queue[this.queue.length-2]=this.last_y):this.push_packet(this.buttons,this.last_x,this.last_y,a,b))};Qc.prototype.push_relative=function(a,b,c,d){this.enabled&&(d&&this.tail_is_move&&4<=this.queue.length&&
|
|
416
|
+
this.queue[this.queue.length-4]&65536?(this.queue[this.queue.length-3]+=a,this.queue[this.queue.length-2]+=b):this.push_packet(this.buttons|65536,a,b,c,d))};Qc.prototype.push_packet=function(a,b,c,d,e){1024<this.queue.length+4?(this.enabled=!1,this.queue.length=0):(this.queue.push(a,b,c,d),this.tail_is_move=e)};Qc.prototype.port_read32=function(){var a=this.cpu.reg32;if(1447909480!==a[0])return-1;switch(a[1]&65535){case 10:return a[3]=1447909480,6;case 6:if(!this.clip_out_fresh)break;this.clip_out_fresh=
|
|
417
|
+
!1;this.clip_out_cursor=0;return this.clip_out.length;case 7:var b=this.clip_out;a=this.clip_out_cursor;b=b[a]|0|(b[a+1]|0)<<8|(b[a+2]|0)<<16|(b[a+3]|0)<<24;this.clip_out_cursor=a+4;return b;case 8:return a=Math.min(a[3]>>>0,65536),this.clip_in=new Uint8Array(a),this.clip_in_cursor=0,0===a&&this.bus.send("vmware-clipboard-guest",this.clip_in),0;case 9:b=this.clip_in;a=a[3]>>>0;var c=this.clip_in_cursor;c<b.length&&(b[c++]=a);c<b.length&&(b[c++]=a>>>8);c<b.length&&(b[c++]=a>>>16);c<b.length&&(b[c++]=
|
|
418
|
+
a>>>24);this.clip_in_cursor=c;c>=b.length&&(this.bus.send("vmware-clipboard-guest",b),this.clip_in=new Uint8Array(0),this.clip_in_cursor=0);return 0;case 23:return b=Date.now(),a[3]=b%1E3*1E3,a[1]=1E6,a[2]=-(new Date(b)).getTimezoneOffset(),b/1E3>>>0;case 40:return this.enabled?this.queue.length:-65536;case 39:b=Math.min(a[3]>>>0,4,this.queue.length);c=[0,0,0,0];for(let d=0;d<b;d++)c[d]=this.queue.shift();a[3]=c[1];a[1]=c[2];a[2]=c[3];return c[0];case 41:switch(a[3]){case 1161905490:this.enabled=
|
|
417
419
|
!0;this.queue.length=0;this.tail_is_move=!1;this.queue.push(876762442);break;case 245:this.absolute=this.enabled=!1;this.queue.length=0;this.bus.send("vmware-absolute-mouse",!1);break;case 1396851026:this.absolute=!0;this.bus.send("vmware-absolute-mouse",!0);break;case 1279611474:this.absolute=!1,this.bus.send("vmware-absolute-mouse",!1)}return 0}return-1};Qc.prototype.get_state=function(){return[this.enabled,this.absolute]};Qc.prototype.set_state=function(a){this.enabled=a[0];this.absolute=a[1];
|
|
418
420
|
this.bus.send("vmware-absolute-mouse",this.absolute)};const Rc=DataView.prototype,Sc={size:1,get:Rc.getUint8,set:Rc.setUint8},Tc={size:2,get:Rc.getUint16,set:Rc.setUint16},V={size:4,get:Rc.getUint32,set:Rc.setUint32},Vc=Uc([{magic:V},{class:Sc},{data:Sc},{version0:Sc},{osabi:Sc},{abiversion:Sc},{pad0:function(a){return{size:a,get:()=>-1}}(7)},{type:Tc},{machine:Tc},{version1:V},{entry:V},{phoff:V},{shoff:V},{flags:V},{ehsize:Tc},{phentsize:Tc},{phnum:Tc},{shentsize:Tc},{shnum:Tc},{shstrndx:Tc}]);
|
|
419
421
|
console.assert(52===Vc.reduce((a,b)=>a+b.size,0));const Wc=Uc([{type:V},{offset:V},{vaddr:V},{paddr:V},{filesz:V},{memsz:V},{flags:V},{align:V}]);console.assert(32===Wc.reduce((a,b)=>a+b.size,0));const Xc=Uc([{name:V},{type:V},{flags:V},{addr:V},{offset:V},{size:V},{link:V},{info:V},{addralign:V},{entsize:V}]);console.assert(40===Xc.reduce((a,b)=>a+b.size,0));function Uc(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<b.size);return{name:c,
|