v86 0.5.120 → 0.5.142

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.
@@ -454,9 +454,9 @@ d.heads;this.number_of_cylinders=d.tracks;this.fda_image=a;this.dir=128;this.cpu
454
454
  a[17]=this.number_of_heads;a[18]=this.number_of_cylinders;return a};V.prototype.set_state=function(a){this.bytes_expecting=a[0];this.receiving_command=a[1];this.receiving_index=a[2];this.next_command=a[3];this.response_data=a[4];this.response_index=a[5];this.response_length=a[6];this.status_reg0=a[8];this.status_reg1=a[9];this.status_reg2=a[10];this.drive=a[11];this.last_cylinder=a[12];this.last_head=a[13];this.last_sector=a[14];this.dor=a[15];this.sectors_per_track=a[16];this.number_of_heads=a[17];
455
455
  this.number_of_cylinders=a[18]};V.prototype.port3F0_read=function(){C("3F0 read",8192);return 0};V.prototype.port3F4_read=function(){C("3F4 read",8192);var a=128;this.response_index<this.response_length&&(a|=80);0===(this.dor&8)&&(a|=32);return a};V.prototype.port3F7_read=function(){C("3F7 read",8192);return this.dir};V.prototype.port3F5_read=function(){if(this.response_index<this.response_length)return C("3F5 read: "+this.response_data[this.response_index],8192),this.cpu.device_lower_irq(6),this.response_data[this.response_index++];
456
456
  C("3F5 read, empty",8192);return 255};V.prototype.port3F4_write=function(a){C("3F4/data rate write: "+m(a),8192);a&128&&(C("dsr reset",8192),this.status_reg0=192,this.cpu.device_raise_irq(6))};V.prototype.port3F5_write=function(a){C("3F5 write "+m(a),8192);if(0<this.bytes_expecting){if(this.receiving_command[this.receiving_index++]=a,this.bytes_expecting--,0===this.bytes_expecting){a="3F5 command received: ";for(var b=0;b<this.receiving_index;b++)a+=m(this.receiving_command[b])+" ";C(a,8192);this.next_command.call(this,
457
- this.receiving_command)}}else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=function(c){this.do_sector(!0,c)};this.bytes_expecting=8;break;case 6:case 70:case 198:case 230:this.next_command=function(c){this.do_sector(!1,c)};this.bytes_expecting=8;break;case 7:this.next_command=
457
+ this.receiving_command)}}else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:case 20:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=function(c){this.do_sector(!0,c)};this.bytes_expecting=8;break;case 6:case 70:case 198:case 230:this.next_command=function(c){this.do_sector(!1,c)};this.bytes_expecting=8;break;case 7:this.next_command=
458
458
  this.calibrate;this.bytes_expecting=1;break;case 8:this.check_interrupt_status();break;case 74:this.next_command=this.read_sector_id;this.bytes_expecting=1;break;case 15:this.bytes_expecting=2;this.next_command=this.seek;break;case 14:case 16:C(14===a?"dump registers":"determine controller version",8192);this.status_reg0=128;this.response_data[0]=this.status_reg0;this.response_index=0;this.response_length=1;this.bytes_expecting=0;break;default:k(!1,"Unimplemented floppy command call "+m(a))}this.receiving_index=
459
- 0}};V.prototype.port3F2_read=function(){C("read 3F2: DOR",8192);return this.dor};V.prototype.port3F2_write=function(a){4===(a&4)&&0===(this.dor&4)&&(this.status_reg0=192,this.cpu.device_raise_irq(6));C("start motors: "+m(a>>4),8192);C("enable dma/irq: "+!!(a&8),8192);C("reset fdc: "+!!(a&4),8192);C("drive select: "+(a&3),8192);0!==(a&3)&&C("guest: fdb not implemented",8192);C("DOR = "+m(a),8192);this.dor=a};V.prototype.check_drive_status=function(){C("check drive status",8192);this.status_reg1=this.fda_image?
459
+ 0}};V.prototype.port3F2_read=function(){C("read 3F2: DOR",8192);return this.dor};V.prototype.port3F2_write=function(a){!(this.dor&4)&&a&4&&(this.status_reg0=192,a&8&&this.cpu.device_raise_irq(6));C("start motors: "+m(a>>4),8192);C("enable dma/irq: "+!!(a&8),8192);C("reset fdc: "+!(a&4),8192);C("drive select: "+(a&3),8192);0!==(a&3)&&C("guest: fdb not implemented",8192);C("DOR = "+m(a),8192);this.dor=a};V.prototype.check_drive_status=function(){C("check drive status",8192);this.status_reg1=this.fda_image?
460
460
  0:5;this.response_index=0;this.response_length=1;this.response_data[0]=0};V.prototype.seek=function(a){C("seek",8192);if(0!==(a[0]&3))C("seek on fdb",8192);else{var b=a[1];a=a[0]>>2&1;b!==this.last_cylinder&&(this.dir=0);this.status_reg1=this.fda_image?0:5;this.status_reg0=32;this.last_cylinder=b;this.last_head=a}this.raise_irq()};V.prototype.calibrate=function(a){C("floppy calibrate",8192);this.seek([a[0],0])};V.prototype.check_interrupt_status=function(){C("floppy check interrupt status",8192);
461
461
  this.response_index=0;this.response_length=2;this.response_data[0]=this.status_reg0;this.response_data[1]=this.last_cylinder};V.prototype.do_sector=function(a,b){var c=b[2],d=b[1],e=b[3],f=128<<b[4],h=b[5]-b[3]+1,l=((c+this.number_of_heads*d)*this.sectors_per_track+e-1)*f;C("Floppy "+(a?"Write":"Read"),8192);C("from "+m(l)+" length "+m(h*f),8192);C(d+" / "+c+" / "+e,8192);b[4]||C("FDC: sector count is zero, use data length instead",8192);this.fda_image?(this.status_reg1=0,a?this.dma.do_write(this.fda_image,
462
462
  l,h*f,2,this.done.bind(this,b,d,c,e)):this.dma.do_read(this.fda_image,l,h*f,2,this.done.bind(this,b,d,c,e))):this.status_reg1=5};V.prototype.done=function(a,b,c,d,e){e?C("XXX: Unhandled floppy error",8192):(d++,d>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]=
@@ -501,7 +501,7 @@ c-4&255;this.data[6]=8;this.data[10]=3;this.status_reg=88;break;case 81:this.dat
501
501
  this.data_end=this.data_length;this.status_reg=65;this.error_reg=a<<4;this.sector_count_reg=this.sector_count_reg&-8|3;this.atapi_sense_key=a;this.atapi_add_sense=b};W.prototype.do_write=function(){this.status_reg=80;k(this.data_length<=this.data.length);var a=this.data.subarray(0,this.data_length);k(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)};W.prototype.atapi_read=
502
502
  function(a){var b=(a[7]<<8|a[8])*this.sector_size;a=(a[2]<<24|a[3]<<16|a[4]<<8|a[5])*this.sector_size;this.data_length=0;var c=this.lba_high_reg<<8&65280|this.lba_mid_reg&255;this.lba_mid_reg=this.lba_high_reg=0;65535===c&&c--;c>b&&(c=b);this.buffer?a>=this.buffer.byteLength?(k(!1,this.name+": CD read: Outside of disk end="+m(a+b)+" size="+m(this.buffer.byteLength),32768),this.status_reg=255,this.push_irq()):0===b?(this.status_reg=80,this.data_pointer=0):(b=Math.min(b,this.buffer.byteLength-a),this.status_reg=
503
503
  208,this.report_read_start(),this.read_buffer(a,b,d=>{this.data_set(d);this.status_reg=88;this.sector_count_reg=this.sector_count_reg&-8|2;this.push_irq();this.data_end=c&=-4;this.data_end>this.data_length&&(this.data_end=this.data_length);this.lba_mid_reg=this.data_end&255;this.lba_high_reg=this.data_end>>8&255;this.report_read_end(b)})):(k(!1,this.name+": CD read: no buffer",32768),this.status_reg=255,this.error_reg=65,this.push_irq())};W.prototype.atapi_read_dma=function(a){var b=a[2]<<24|a[3]<<
504
- 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;C(this.name+": CD read DMA lba="+m(b)+" lbacount="+m(c)+" bytecount="+m(d)+" flags="+m(a),32768);e>=this.buffer.byteLength?(k(!1,this.name+": CD read: Outside of disk end="+m(e+d)+" size="+m(this.buffer.byteLength),32768),this.status_reg=255,this.push_irq()):(this.status_reg=208,this.report_read_start(),this.read_buffer(e,d,f=>{C(this.name+": atapi_read_dma: Data arrived");this.report_read_end(d);this.status_reg=
504
+ 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;C(this.name+": CD read DMA lba="+m(b)+" lbacount="+m(c)+" bytecount="+m(d)+" flags="+m(a),32768);e>=this.buffer.byteLength?(k(!1,this.name+": CD read: Outside of disk end="+m(e+d)+" size="+m(this.buffer.byteLength),32768),this.status_reg=255,this.push_irq()):(this.status_reg=208,this.report_read_start(),this.read_buffer(e,d,f=>{C(this.name+": atapi_read_dma: Data arrived",32768);this.report_read_end(d);this.status_reg=
505
505
  88;this.sector_count_reg=this.sector_count_reg&-8|2;this.data_set(f);this.do_atapi_dma()}))};W.prototype.do_atapi_dma=function(){if(0===(this.channel.dma_status&1))C(this.name+": do_atapi_dma: Status not set",32768);else if(0===(this.status_reg&8))C(this.name+": do_atapi_dma: DRQ not set",32768);else{var a=this.channel.prdt_addr,b=0,c=this.data;do{var d=this.cpu.read32s(a),e=this.cpu.read16(a+4),f=this.cpu.read8(a+7)&128;e||(e=65536);this.cpu.write_blob(c.subarray(b,Math.min(b+e,this.data_length)),
506
506
  d);b+=e;a+=8;if(b>=this.data_length&&!f)break}while(!f);this.status_reg=80;this.channel.dma_status&=-2;this.sector_count_reg=this.sector_count_reg&-8|3;this.push_irq()}};W.prototype.read_data=function(a){if(this.data_pointer<this.data_end){k(this.data_pointer+a-1<this.data_end);k(0===this.data_pointer%a,m(this.data_pointer)+" "+a);var b=1===a?this.data[this.data_pointer]:2===a?this.data16[this.data_pointer>>>1]:this.data32[this.data_pointer>>>2];this.data_pointer+=a;this.data_pointer>=this.data_end&&
507
507
  this.read_end();return b}this.data_pointer+=a;return 0};W.prototype.read_end=function(){if(160===this.current_command)if(this.data_end===this.data_length)this.status_reg=80,this.sector_count_reg=this.sector_count_reg&-8|3,this.push_irq();else{this.status_reg=88;this.sector_count_reg=this.sector_count_reg&-8|2;this.push_irq();var a=this.lba_high_reg<<8&65280|this.lba_mid_reg&255;this.data_end+a>this.data_length?(this.lba_mid_reg=this.data_length-this.data_end&255,this.lba_high_reg=this.data_length-
package/build/libv86.js CHANGED
@@ -443,9 +443,9 @@ V.prototype.set_fda=function(a){var b={[163840]:{type:1,tracks:40,sectors:8,head
443
443
  V.prototype.get_state=function(){var a=[];a[0]=this.bytes_expecting;a[1]=this.receiving_command;a[2]=this.receiving_index;a[4]=this.response_data;a[5]=this.response_index;a[6]=this.response_length;a[8]=this.status_reg0;a[9]=this.status_reg1;a[10]=this.status_reg2;a[11]=this.drive;a[12]=this.last_cylinder;a[13]=this.last_head;a[14]=this.last_sector;a[15]=this.dor;a[16]=this.sectors_per_track;a[17]=this.number_of_heads;a[18]=this.number_of_cylinders;return a};
444
444
  V.prototype.set_state=function(a){this.bytes_expecting=a[0];this.receiving_command=a[1];this.receiving_index=a[2];this.next_command=a[3];this.response_data=a[4];this.response_index=a[5];this.response_length=a[6];this.status_reg0=a[8];this.status_reg1=a[9];this.status_reg2=a[10];this.drive=a[11];this.last_cylinder=a[12];this.last_head=a[13];this.last_sector=a[14];this.dor=a[15];this.sectors_per_track=a[16];this.number_of_heads=a[17];this.number_of_cylinders=a[18]};V.prototype.port3F0_read=function(){return 0};
445
445
  V.prototype.port3F4_read=function(){var a=128;this.response_index<this.response_length&&(a|=80);0===(this.dor&8)&&(a|=32);return a};V.prototype.port3F7_read=function(){return this.dir};V.prototype.port3F5_read=function(){return this.response_index<this.response_length?(this.cpu.device_lower_irq(6),this.response_data[this.response_index++]):255};V.prototype.port3F4_write=function(a){z(a);a&128&&(this.status_reg0=192,this.cpu.device_raise_irq(6))};
446
- V.prototype.port3F5_write=function(a){ra("3F5 write "+z(a),8192);if(0<this.bytes_expecting)this.receiving_command[this.receiving_index++]=a,this.bytes_expecting--,0===this.bytes_expecting&&this.next_command.call(this,this.receiving_command);else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=
446
+ V.prototype.port3F5_write=function(a){ra("3F5 write "+z(a),8192);if(0<this.bytes_expecting)this.receiving_command[this.receiving_index++]=a,this.bytes_expecting--,0===this.bytes_expecting&&this.next_command.call(this,this.receiving_command);else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:case 20:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=
447
447
  function(b){this.do_sector(!0,b)};this.bytes_expecting=8;break;case 6:case 70:case 198:case 230:this.next_command=function(b){this.do_sector(!1,b)};this.bytes_expecting=8;break;case 7:this.next_command=this.calibrate;this.bytes_expecting=1;break;case 8:this.check_interrupt_status();break;case 74:this.next_command=this.read_sector_id;this.bytes_expecting=1;break;case 15:this.bytes_expecting=2;this.next_command=this.seek;break;case 14:case 16:this.status_reg0=128;this.response_data[0]=this.status_reg0;
448
- this.response_index=0;this.response_length=1;this.bytes_expecting=0;break;default:sa(!1,"Unimplemented floppy command call "+z(a))}this.receiving_index=0}};V.prototype.port3F2_read=function(){return this.dor};V.prototype.port3F2_write=function(a){4===(a&4)&&0===(this.dor&4)&&(this.status_reg0=192,this.cpu.device_raise_irq(6));z(a>>4);z(a);this.dor=a};V.prototype.check_drive_status=function(){this.status_reg1=this.fda_image?0:5;this.response_index=0;this.response_length=1;this.response_data[0]=0};
448
+ this.response_index=0;this.response_length=1;this.bytes_expecting=0;break;default:sa(!1,"Unimplemented floppy command call "+z(a))}this.receiving_index=0}};V.prototype.port3F2_read=function(){return this.dor};V.prototype.port3F2_write=function(a){!(this.dor&4)&&a&4&&(this.status_reg0=192,a&8&&this.cpu.device_raise_irq(6));z(a>>4);z(a);this.dor=a};V.prototype.check_drive_status=function(){this.status_reg1=this.fda_image?0:5;this.response_index=0;this.response_length=1;this.response_data[0]=0};
449
449
  V.prototype.seek=function(a){if(0===(a[0]&3)){var b=a[1];a=a[0]>>2&1;b!==this.last_cylinder&&(this.dir=0);this.status_reg1=this.fda_image?0:5;this.status_reg0=32;this.last_cylinder=b;this.last_head=a}this.raise_irq()};V.prototype.calibrate=function(a){this.seek([a[0],0])};V.prototype.check_interrupt_status=function(){this.response_index=0;this.response_length=2;this.response_data[0]=this.status_reg0;this.response_data[1]=this.last_cylinder};
450
450
  V.prototype.do_sector=function(a,b){var c=b[2],d=b[1],e=b[3],f=128<<b[4],g=b[5]-b[3]+1,h=((c+this.number_of_heads*d)*this.sectors_per_track+e-1)*f;z(h);z(g*f);this.fda_image?(this.status_reg1=0,a?this.dma.do_write(this.fda_image,h,g*f,2,this.done.bind(this,b,d,c,e)):this.dma.do_read(this.fda_image,h,g*f,2,this.done.bind(this,b,d,c,e))):this.status_reg1=5};
451
451
  V.prototype.done=function(a,b,c,d,e){e||(d++,d>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())};
package/build/libv86.mjs CHANGED
@@ -397,17 +397,17 @@ null;this.number_of_cylinders=this.number_of_heads=this.sectors_per_track=0;this
397
397
  4)};V.prototype.get_state=function(){var a=[];a[0]=this.bytes_expecting;a[1]=this.receiving_command;a[2]=this.receiving_index;a[4]=this.response_data;a[5]=this.response_index;a[6]=this.response_length;a[8]=this.status_reg0;a[9]=this.status_reg1;a[10]=this.status_reg2;a[11]=this.drive;a[12]=this.last_cylinder;a[13]=this.last_head;a[14]=this.last_sector;a[15]=this.dor;a[16]=this.sectors_per_track;a[17]=this.number_of_heads;a[18]=this.number_of_cylinders;return a};V.prototype.set_state=function(a){this.bytes_expecting=
398
398
  a[0];this.receiving_command=a[1];this.receiving_index=a[2];this.next_command=a[3];this.response_data=a[4];this.response_index=a[5];this.response_length=a[6];this.status_reg0=a[8];this.status_reg1=a[9];this.status_reg2=a[10];this.drive=a[11];this.last_cylinder=a[12];this.last_head=a[13];this.last_sector=a[14];this.dor=a[15];this.sectors_per_track=a[16];this.number_of_heads=a[17];this.number_of_cylinders=a[18]};V.prototype.port3F0_read=function(){return 0};V.prototype.port3F4_read=function(){var a=
399
399
  128;this.response_index<this.response_length&&(a|=80);0===(this.dor&8)&&(a|=32);return a};V.prototype.port3F7_read=function(){return this.dir};V.prototype.port3F5_read=function(){return this.response_index<this.response_length?(this.cpu.device_lower_irq(6),this.response_data[this.response_index++]):255};V.prototype.port3F4_write=function(a){z(a);a&128&&(this.status_reg0=192,this.cpu.device_raise_irq(6))};V.prototype.port3F5_write=function(a){ra("3F5 write "+z(a),8192);if(0<this.bytes_expecting)this.receiving_command[this.receiving_index++]=
400
- a,this.bytes_expecting--,0===this.bytes_expecting&&this.next_command.call(this,this.receiving_command);else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=function(b){this.do_sector(!0,b)};this.bytes_expecting=8;break;case 6:case 70:case 198:case 230:this.next_command=function(b){this.do_sector(!1,
401
- b)};this.bytes_expecting=8;break;case 7:this.next_command=this.calibrate;this.bytes_expecting=1;break;case 8:this.check_interrupt_status();break;case 74:this.next_command=this.read_sector_id;this.bytes_expecting=1;break;case 15:this.bytes_expecting=2;this.next_command=this.seek;break;case 14:case 16:this.status_reg0=128;this.response_data[0]=this.status_reg0;this.response_index=0;this.response_length=1;this.bytes_expecting=0;break;default:sa(!1,"Unimplemented floppy command call "+z(a))}this.receiving_index=
402
- 0}};V.prototype.port3F2_read=function(){return this.dor};V.prototype.port3F2_write=function(a){4===(a&4)&&0===(this.dor&4)&&(this.status_reg0=192,this.cpu.device_raise_irq(6));z(a>>4);z(a);this.dor=a};V.prototype.check_drive_status=function(){this.status_reg1=this.fda_image?0:5;this.response_index=0;this.response_length=1;this.response_data[0]=0};V.prototype.seek=function(a){if(0===(a[0]&3)){var b=a[1];a=a[0]>>2&1;b!==this.last_cylinder&&(this.dir=0);this.status_reg1=this.fda_image?0:5;this.status_reg0=
403
- 32;this.last_cylinder=b;this.last_head=a}this.raise_irq()};V.prototype.calibrate=function(a){this.seek([a[0],0])};V.prototype.check_interrupt_status=function(){this.response_index=0;this.response_length=2;this.response_data[0]=this.status_reg0;this.response_data[1]=this.last_cylinder};V.prototype.do_sector=function(a,b){var c=b[2],d=b[1],e=b[3],f=128<<b[4],g=b[5]-b[3]+1,h=((c+this.number_of_heads*d)*this.sectors_per_track+e-1)*f;z(h);z(g*f);this.fda_image?(this.status_reg1=0,a?this.dma.do_write(this.fda_image,
404
- h,g*f,2,this.done.bind(this,b,d,c,e)):this.dma.do_read(this.fda_image,h,g*f,2,this.done.bind(this,b,d,c,e))):this.status_reg1=5};V.prototype.done=function(a,b,c,d,e){e||(d++,d>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]=
405
- b,this.response_data[4]=c,this.response_data[5]=d,this.response_data[6]=a[4],this.raise_irq())};V.prototype.fix_drive_data=function(a){a.slice(0,this.bytes_expecting)};V.prototype.configure=function(a){a.slice(0,this.bytes_expecting)};V.prototype.read_sector_id=function(){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()};
406
- V.prototype.raise_irq=function(){this.dor&8&&this.cpu.device_raise_irq(6)};const Mc={[70]:{name:"GET CONFIGURATION",flags:0},[74]:{name:"GET EVENT STATUS NOTIFICATION",flags:0},[18]:{name:"INQUIRY",flags:0},[189]:{name:"MECHANISM STATUS",flags:0},[26]:{name:"MODE SENSE (6)",flags:0},[90]:{name:"MODE SENSE (10)",flags:0},[69]:{name:"PAUSE",flags:1},[30]:{name:"PREVENT ALLOW MEDIUM REMOVAL",flags:0},[40]:{name:"READ",flags:1},[37]:{name:"READ CAPACITY",flags:1},[190]:{name:"READ CD",flags:1},[81]:{name:"READ DISK INFORMATION",
407
- flags:1},[66]:{name:"READ SUBCHANNEL",flags:1},[67]:{name:"READ TOC PMA ATIP",flags:1},[82]:{name:"READ TRACK INFORMATION",flags:1},[3]:{name:"REQUEST SENSE",flags:0},[27]:{name:"START STOP UNIT",flags:0},[0]:{name:"TEST UNIT READY",flags:1}};function Nc(a,b,c){this.cpu=a;this.bus=b;this.secondary=this.primary=void 0;b=c&&c[0][0];const d=c&&c[1][0];if(b||d){b&&(this.primary=new Oc(this,0,c[0],496,1014,14));d&&(this.secondary=new Oc(this,1,c[1],368,886,15));c=b?this.primary.command_base:0;const e=
408
- b?this.primary.control_base:0,f=d?this.secondary.command_base:0,g=d?this.secondary.control_base:0;this.name="ide";this.pci_id=240;this.pci_space=[134,128,16,112,5,0,160,2,0,128,1,1,0,0,0,0,c&255|1,c>>8,0,0,e&255|1,e>>8,0,0,f&255|1,f>>8,0,0,g&255|1,g>>8,0,0,1,180,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,0,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,
409
- 0,0,0,0,0,0,0,0,0,0];this.pci_bars=[b?{size:8}:void 0,b?{size:1}:void 0,d?{size:8}:void 0,d?{size:1}:void 0,{size:16}];a.devices.pci.register_device(this)}Object.seal(this)}Nc.prototype.get_state=function(){const a=[];a[0]=this.primary;a[1]=this.secondary;return a};Nc.prototype.set_state=function(a){this.primary&&this.primary.set_state(a[0]);this.secondary&&this.secondary.set_state(a[1])};function Oc(a,b,c,d,e,f){this.controller=a;this.channel_nr=b;this.cpu=a.cpu;this.bus=a.bus;this.command_base=
410
- d;this.control_base=e;this.irq=f;this.name="ide"+b;d=c?c[0]:void 0;c=c?c[1]:void 0;this.master=new W(this,0,d?.buffer,d?.is_cdrom);this.slave=new W(this,1,c?.buffer,c?.is_cdrom);this.current_interface=this.master;this.device_control_reg=2;this.dma_command=this.dma_status=this.prdt_addr=0;a=a.cpu;a.io.register_read(this.command_base|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)});
400
+ a,this.bytes_expecting--,0===this.bytes_expecting&&this.next_command.call(this,this.receiving_command);else{switch(a){case 3:this.next_command=this.fix_drive_data;this.bytes_expecting=2;break;case 19:this.next_command=this.configure;this.bytes_expecting=3;break;case 4:case 20:this.next_command=this.check_drive_status;this.bytes_expecting=1;break;case 5:case 69:case 197:this.next_command=function(b){this.do_sector(!0,b)};this.bytes_expecting=8;break;case 6:case 70:case 198:case 230:this.next_command=
401
+ function(b){this.do_sector(!1,b)};this.bytes_expecting=8;break;case 7:this.next_command=this.calibrate;this.bytes_expecting=1;break;case 8:this.check_interrupt_status();break;case 74:this.next_command=this.read_sector_id;this.bytes_expecting=1;break;case 15:this.bytes_expecting=2;this.next_command=this.seek;break;case 14:case 16:this.status_reg0=128;this.response_data[0]=this.status_reg0;this.response_index=0;this.response_length=1;this.bytes_expecting=0;break;default:sa(!1,"Unimplemented floppy command call "+
402
+ z(a))}this.receiving_index=0}};V.prototype.port3F2_read=function(){return this.dor};V.prototype.port3F2_write=function(a){!(this.dor&4)&&a&4&&(this.status_reg0=192,a&8&&this.cpu.device_raise_irq(6));z(a>>4);z(a);this.dor=a};V.prototype.check_drive_status=function(){this.status_reg1=this.fda_image?0:5;this.response_index=0;this.response_length=1;this.response_data[0]=0};V.prototype.seek=function(a){if(0===(a[0]&3)){var b=a[1];a=a[0]>>2&1;b!==this.last_cylinder&&(this.dir=0);this.status_reg1=this.fda_image?
403
+ 0:5;this.status_reg0=32;this.last_cylinder=b;this.last_head=a}this.raise_irq()};V.prototype.calibrate=function(a){this.seek([a[0],0])};V.prototype.check_interrupt_status=function(){this.response_index=0;this.response_length=2;this.response_data[0]=this.status_reg0;this.response_data[1]=this.last_cylinder};V.prototype.do_sector=function(a,b){var c=b[2],d=b[1],e=b[3],f=128<<b[4],g=b[5]-b[3]+1,h=((c+this.number_of_heads*d)*this.sectors_per_track+e-1)*f;z(h);z(g*f);this.fda_image?(this.status_reg1=0,
404
+ a?this.dma.do_write(this.fda_image,h,g*f,2,this.done.bind(this,b,d,c,e)):this.dma.do_read(this.fda_image,h,g*f,2,this.done.bind(this,b,d,c,e))):this.status_reg1=5};V.prototype.done=function(a,b,c,d,e){e||(d++,d>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]=
405
+ 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())};V.prototype.fix_drive_data=function(a){a.slice(0,this.bytes_expecting)};V.prototype.configure=function(a){a.slice(0,this.bytes_expecting)};V.prototype.read_sector_id=function(){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]=
406
+ 0;this.raise_irq()};V.prototype.raise_irq=function(){this.dor&8&&this.cpu.device_raise_irq(6)};const Mc={[70]:{name:"GET CONFIGURATION",flags:0},[74]:{name:"GET EVENT STATUS NOTIFICATION",flags:0},[18]:{name:"INQUIRY",flags:0},[189]:{name:"MECHANISM STATUS",flags:0},[26]:{name:"MODE SENSE (6)",flags:0},[90]:{name:"MODE SENSE (10)",flags:0},[69]:{name:"PAUSE",flags:1},[30]:{name:"PREVENT ALLOW MEDIUM REMOVAL",flags:0},[40]:{name:"READ",flags:1},[37]:{name:"READ CAPACITY",flags:1},[190]:{name:"READ CD",
407
+ flags:1},[81]:{name:"READ DISK INFORMATION",flags:1},[66]:{name:"READ SUBCHANNEL",flags:1},[67]:{name:"READ TOC PMA ATIP",flags:1},[82]:{name:"READ TRACK INFORMATION",flags:1},[3]:{name:"REQUEST SENSE",flags:0},[27]:{name:"START STOP UNIT",flags:0},[0]:{name:"TEST UNIT READY",flags:1}};function Nc(a,b,c){this.cpu=a;this.bus=b;this.secondary=this.primary=void 0;b=c&&c[0][0];const d=c&&c[1][0];if(b||d){b&&(this.primary=new Oc(this,0,c[0],496,1014,14));d&&(this.secondary=new Oc(this,1,c[1],368,886,15));
408
+ c=b?this.primary.command_base:0;const e=b?this.primary.control_base:0,f=d?this.secondary.command_base:0,g=d?this.secondary.control_base:0;this.name="ide";this.pci_id=240;this.pci_space=[134,128,16,112,5,0,160,2,0,128,1,1,0,0,0,0,c&255|1,c>>8,0,0,e&255|1,e>>8,0,0,f&255|1,f>>8,0,0,g&255|1,g>>8,0,0,1,180,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,0,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,
409
+ 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=[b?{size:8}:void 0,b?{size:1}:void 0,d?{size:8}:void 0,d?{size:1}:void 0,{size:16}];a.devices.pci.register_device(this)}Object.seal(this)}Nc.prototype.get_state=function(){const a=[];a[0]=this.primary;a[1]=this.secondary;return a};Nc.prototype.set_state=function(a){this.primary&&this.primary.set_state(a[0]);this.secondary&&this.secondary.set_state(a[1])};function Oc(a,b,c,d,e,f){this.controller=a;this.channel_nr=b;this.cpu=
410
+ a.cpu;this.bus=a.bus;this.command_base=d;this.control_base=e;this.irq=f;this.name="ide"+b;d=c?c[0]:void 0;c=c?c[1]:void 0;this.master=new W(this,0,d?.buffer,d?.is_cdrom);this.slave=new W(this,1,c?.buffer,c?.is_cdrom);this.current_interface=this.master;this.device_control_reg=2;this.dma_command=this.dma_status=this.prdt_addr=0;a=a.cpu;a.io.register_read(this.command_base|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)});
411
411
  a.io.register_read(this.command_base|1,this,function(){return this.current_interface.error_reg&255});a.io.register_read(this.command_base|2,this,function(){return this.current_interface.sector_count_reg&255});a.io.register_read(this.command_base|3,this,function(){return this.current_interface.lba_low_reg&255});a.io.register_read(this.command_base|4,this,function(){return this.current_interface.lba_mid_reg&255});a.io.register_read(this.command_base|5,this,function(){return this.current_interface.lba_high_reg&
412
412
  255});a.io.register_read(this.command_base|6,this,function(){return this.current_interface.device_reg&255});a.io.register_read(this.command_base|7,this,function(){const g=this.read_status();this.cpu.device_lower_irq(this.irq);return g});a.io.register_write(this.command_base|0,this,function(g){this.current_interface.write_data_port8(g)},function(g){this.current_interface.write_data_port16(g)},function(g){this.current_interface.write_data_port32(g)});a.io.register_write(this.command_base|1,this,function(g){this.current_interface.features_reg=
413
413
  (this.current_interface.features_reg<<8|g)&65535});a.io.register_write(this.command_base|2,this,function(g){this.current_interface.sector_count_reg=(this.current_interface.sector_count_reg<<8|g)&65535});a.io.register_write(this.command_base|3,this,function(g){this.current_interface.lba_low_reg=(this.current_interface.lba_low_reg<<8|g)&65535});a.io.register_write(this.command_base|4,this,function(g){this.current_interface.lba_mid_reg=(this.current_interface.lba_mid_reg<<8|g)&65535});a.io.register_write(this.command_base|
Binary file
Binary file
package/build/v86.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v86",
3
- "version": "0.5.120+gd603a77",
3
+ "version": "0.5.142+g0eec296",
4
4
  "license": "BSD-2-Clause",
5
5
  "description": "x86 PC emulator and x86-to-wasm JIT, running in the browser",
6
6
  "homepage": "https://copy.sh/v86/",