v86 0.5.459 → 0.5.461

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.
@@ -2590,26 +2590,39 @@ $PIT$$module$src$pit$$.prototype.set_state = function($state$jscomp$14$$) {
2590
2590
  this.counter_start_time = $state$jscomp$14$$[7];
2591
2591
  this.counter_start_value = $state$jscomp$14$$[8];
2592
2592
  };
2593
- $PIT$$module$src$pit$$.prototype.timer = function($now$jscomp$3$$, $no_irq$$) {
2593
+ $PIT$$module$src$pit$$.prototype.timer = function($now$jscomp$3$$, $diff_no_irq$$) {
2594
2594
  var $time_to_next_interrupt$$ = 100;
2595
- $no_irq$$ || (this.counter_enabled[0] && this.did_rollover(0, $now$jscomp$3$$) ? (this.counter_start_value[0] = this.get_counter_value(0, $now$jscomp$3$$), this.counter_start_time[0] = $now$jscomp$3$$, $dbg_log$$module$src$log$$("pit interrupt. new value: " + this.counter_start_value[0], 512), 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] && ($time_to_next_interrupt$$ =
2596
- (this.counter_start_value[0] - Math.floor(1193.1816666 * ($now$jscomp$3$$ - this.counter_start_time[0]))) / 1193.1816666));
2595
+ if (!$diff_no_irq$$) {
2596
+ if (this.counter_enabled[0] && this.did_rollover(0, $now$jscomp$3$$)) {
2597
+ $diff_no_irq$$ = $now$jscomp$3$$ - this.counter_start_time[0];
2598
+ const $diff_in_ticks$$ = Math.floor(1193.1816666 * $diff_no_irq$$);
2599
+ this.counter_start_value[0] = this.get_counter_value(0, $now$jscomp$3$$);
2600
+ this.counter_start_time[0] = 0 > $diff_no_irq$$ ? $now$jscomp$3$$ : this.counter_start_time[0] + $diff_in_ticks$$ / 1193.1816666;
2601
+ $dbg_log$$module$src$log$$("pit interrupt. new value: " + this.counter_start_value[0], 512);
2602
+ this.cpu.device_lower_irq(0);
2603
+ this.cpu.device_raise_irq(0);
2604
+ 0 === this.counter_mode[0] && (this.counter_enabled[0] = 0);
2605
+ } else {
2606
+ this.cpu.device_lower_irq(0);
2607
+ }
2608
+ this.counter_enabled[0] && ($time_to_next_interrupt$$ = (this.counter_start_value[0] - Math.floor(1193.1816666 * ($now$jscomp$3$$ - this.counter_start_time[0]))) / 1193.1816666);
2609
+ }
2597
2610
  return $time_to_next_interrupt$$;
2598
2611
  };
2599
2612
  $PIT$$module$src$pit$$.prototype.get_counter_value = function($i$jscomp$35$$, $now$jscomp$4_value$jscomp$129$$) {
2600
2613
  if (!this.counter_enabled[$i$jscomp$35$$]) {
2601
2614
  return 0;
2602
2615
  }
2603
- var $diff$jscomp$1_reload$$ = $now$jscomp$4_value$jscomp$129$$ - this.counter_start_time[$i$jscomp$35$$], $diff_in_ticks$jscomp$1$$ = Math.floor(1193.1816666 * $diff$jscomp$1_reload$$);
2604
- $now$jscomp$4_value$jscomp$129$$ = this.counter_start_value[$i$jscomp$35$$] - $diff_in_ticks$jscomp$1$$;
2605
- $dbg_log$$module$src$log$$("diff=" + $diff$jscomp$1_reload$$ + " dticks=" + $diff_in_ticks$jscomp$1$$ + " value=" + $now$jscomp$4_value$jscomp$129$$ + " reload=" + this.counter_reload[$i$jscomp$35$$], 512);
2606
- $diff$jscomp$1_reload$$ = this.counter_reload[$i$jscomp$35$$];
2607
- $now$jscomp$4_value$jscomp$129$$ >= $diff$jscomp$1_reload$$ ? ($dbg_log$$module$src$log$$("Warning: Counter" + $i$jscomp$35$$ + " value " + $now$jscomp$4_value$jscomp$129$$ + " is larger than reload " + $diff$jscomp$1_reload$$, 512), $now$jscomp$4_value$jscomp$129$$ %= $diff$jscomp$1_reload$$) : 0 > $now$jscomp$4_value$jscomp$129$$ && ($now$jscomp$4_value$jscomp$129$$ = $now$jscomp$4_value$jscomp$129$$ % $diff$jscomp$1_reload$$ + $diff$jscomp$1_reload$$);
2616
+ var $diff$jscomp$2_reload$$ = $now$jscomp$4_value$jscomp$129$$ - this.counter_start_time[$i$jscomp$35$$], $diff_in_ticks$jscomp$2$$ = Math.floor(1193.1816666 * $diff$jscomp$2_reload$$);
2617
+ $now$jscomp$4_value$jscomp$129$$ = this.counter_start_value[$i$jscomp$35$$] - $diff_in_ticks$jscomp$2$$;
2618
+ $dbg_log$$module$src$log$$("diff=" + $diff$jscomp$2_reload$$ + " dticks=" + $diff_in_ticks$jscomp$2$$ + " value=" + $now$jscomp$4_value$jscomp$129$$ + " reload=" + this.counter_reload[$i$jscomp$35$$], 512);
2619
+ $diff$jscomp$2_reload$$ = this.counter_reload[$i$jscomp$35$$];
2620
+ $now$jscomp$4_value$jscomp$129$$ >= $diff$jscomp$2_reload$$ ? ($dbg_log$$module$src$log$$("Warning: Counter" + $i$jscomp$35$$ + " value " + $now$jscomp$4_value$jscomp$129$$ + " is larger than reload " + $diff$jscomp$2_reload$$, 512), $now$jscomp$4_value$jscomp$129$$ %= $diff$jscomp$2_reload$$) : 0 > $now$jscomp$4_value$jscomp$129$$ && ($now$jscomp$4_value$jscomp$129$$ = $now$jscomp$4_value$jscomp$129$$ % $diff$jscomp$2_reload$$ + $diff$jscomp$2_reload$$);
2608
2621
  return $now$jscomp$4_value$jscomp$129$$;
2609
2622
  };
2610
- $PIT$$module$src$pit$$.prototype.did_rollover = function($i$jscomp$36$$, $diff$jscomp$2_now$jscomp$5$$) {
2611
- $diff$jscomp$2_now$jscomp$5$$ -= this.counter_start_time[$i$jscomp$36$$];
2612
- return 0 > $diff$jscomp$2_now$jscomp$5$$ ? ($dbg_log$$module$src$log$$("Warning: PIT timer difference is negative, resetting (timer " + $i$jscomp$36$$ + ")"), !0) : this.counter_start_value[$i$jscomp$36$$] < Math.floor(1193.1816666 * $diff$jscomp$2_now$jscomp$5$$);
2623
+ $PIT$$module$src$pit$$.prototype.did_rollover = function($i$jscomp$36$$, $diff$jscomp$3_now$jscomp$5$$) {
2624
+ $diff$jscomp$3_now$jscomp$5$$ -= this.counter_start_time[$i$jscomp$36$$];
2625
+ return 0 > $diff$jscomp$3_now$jscomp$5$$ ? ($dbg_log$$module$src$log$$("Warning: PIT timer difference is negative, resetting (timer " + $i$jscomp$36$$ + ")"), !0) : this.counter_start_value[$i$jscomp$36$$] < Math.floor(1193.1816666 * $diff$jscomp$3_now$jscomp$5$$);
2613
2626
  };
2614
2627
  $PIT$$module$src$pit$$.prototype.counter_read = function($i$jscomp$37_value$jscomp$130$$) {
2615
2628
  var $latch_next_low$$ = this.counter_latch[$i$jscomp$37_value$jscomp$130$$];
@@ -9384,7 +9397,7 @@ $IDEInterface$$module$src$ide$$.prototype.ata_command = function($cmd$jscomp$1$$
9384
9397
  this.push_irq();
9385
9398
  break;
9386
9399
  case 160:
9387
- this.is_atapi ? ($do_dbg_log_result$jscomp$20$$ = !1, this.data_allocate(12), this.data_end = 12, this.sector_count_reg = 1, this.status_reg = 88, this.push_irq()) : this.ata_abort_command();
9400
+ this.is_atapi ? ($do_dbg_log_result$jscomp$20$$ = !1, this.data_allocate(12), this.data_end = 12, this.sector_count_reg = 1, this.status_reg = 88) : this.ata_abort_command();
9388
9401
  break;
9389
9402
  case 161:
9390
9403
  this.is_atapi ? (this.create_identify_packet(), this.status_reg = 88, this.push_irq()) : this.ata_abort_command();
@@ -2589,26 +2589,39 @@ $PIT$$module$src$pit$$.prototype.set_state = function($state$jscomp$14$$) {
2589
2589
  this.counter_start_time = $state$jscomp$14$$[7];
2590
2590
  this.counter_start_value = $state$jscomp$14$$[8];
2591
2591
  };
2592
- $PIT$$module$src$pit$$.prototype.timer = function($now$jscomp$3$$, $no_irq$$) {
2592
+ $PIT$$module$src$pit$$.prototype.timer = function($now$jscomp$3$$, $diff_no_irq$$) {
2593
2593
  var $time_to_next_interrupt$$ = 100;
2594
- $no_irq$$ || (this.counter_enabled[0] && this.did_rollover(0, $now$jscomp$3$$) ? (this.counter_start_value[0] = this.get_counter_value(0, $now$jscomp$3$$), this.counter_start_time[0] = $now$jscomp$3$$, $dbg_log$$module$src$log$$("pit interrupt. new value: " + this.counter_start_value[0], 512), 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] && ($time_to_next_interrupt$$ =
2595
- (this.counter_start_value[0] - Math.floor(1193.1816666 * ($now$jscomp$3$$ - this.counter_start_time[0]))) / 1193.1816666));
2594
+ if (!$diff_no_irq$$) {
2595
+ if (this.counter_enabled[0] && this.did_rollover(0, $now$jscomp$3$$)) {
2596
+ $diff_no_irq$$ = $now$jscomp$3$$ - this.counter_start_time[0];
2597
+ const $diff_in_ticks$$ = Math.floor(1193.1816666 * $diff_no_irq$$);
2598
+ this.counter_start_value[0] = this.get_counter_value(0, $now$jscomp$3$$);
2599
+ this.counter_start_time[0] = 0 > $diff_no_irq$$ ? $now$jscomp$3$$ : this.counter_start_time[0] + $diff_in_ticks$$ / 1193.1816666;
2600
+ $dbg_log$$module$src$log$$("pit interrupt. new value: " + this.counter_start_value[0], 512);
2601
+ this.cpu.device_lower_irq(0);
2602
+ this.cpu.device_raise_irq(0);
2603
+ 0 === this.counter_mode[0] && (this.counter_enabled[0] = 0);
2604
+ } else {
2605
+ this.cpu.device_lower_irq(0);
2606
+ }
2607
+ this.counter_enabled[0] && ($time_to_next_interrupt$$ = (this.counter_start_value[0] - Math.floor(1193.1816666 * ($now$jscomp$3$$ - this.counter_start_time[0]))) / 1193.1816666);
2608
+ }
2596
2609
  return $time_to_next_interrupt$$;
2597
2610
  };
2598
2611
  $PIT$$module$src$pit$$.prototype.get_counter_value = function($i$jscomp$35$$, $now$jscomp$4_value$jscomp$129$$) {
2599
2612
  if (!this.counter_enabled[$i$jscomp$35$$]) {
2600
2613
  return 0;
2601
2614
  }
2602
- var $diff$jscomp$1_reload$$ = $now$jscomp$4_value$jscomp$129$$ - this.counter_start_time[$i$jscomp$35$$], $diff_in_ticks$jscomp$1$$ = Math.floor(1193.1816666 * $diff$jscomp$1_reload$$);
2603
- $now$jscomp$4_value$jscomp$129$$ = this.counter_start_value[$i$jscomp$35$$] - $diff_in_ticks$jscomp$1$$;
2604
- $dbg_log$$module$src$log$$("diff=" + $diff$jscomp$1_reload$$ + " dticks=" + $diff_in_ticks$jscomp$1$$ + " value=" + $now$jscomp$4_value$jscomp$129$$ + " reload=" + this.counter_reload[$i$jscomp$35$$], 512);
2605
- $diff$jscomp$1_reload$$ = this.counter_reload[$i$jscomp$35$$];
2606
- $now$jscomp$4_value$jscomp$129$$ >= $diff$jscomp$1_reload$$ ? ($dbg_log$$module$src$log$$("Warning: Counter" + $i$jscomp$35$$ + " value " + $now$jscomp$4_value$jscomp$129$$ + " is larger than reload " + $diff$jscomp$1_reload$$, 512), $now$jscomp$4_value$jscomp$129$$ %= $diff$jscomp$1_reload$$) : 0 > $now$jscomp$4_value$jscomp$129$$ && ($now$jscomp$4_value$jscomp$129$$ = $now$jscomp$4_value$jscomp$129$$ % $diff$jscomp$1_reload$$ + $diff$jscomp$1_reload$$);
2615
+ var $diff$jscomp$2_reload$$ = $now$jscomp$4_value$jscomp$129$$ - this.counter_start_time[$i$jscomp$35$$], $diff_in_ticks$jscomp$2$$ = Math.floor(1193.1816666 * $diff$jscomp$2_reload$$);
2616
+ $now$jscomp$4_value$jscomp$129$$ = this.counter_start_value[$i$jscomp$35$$] - $diff_in_ticks$jscomp$2$$;
2617
+ $dbg_log$$module$src$log$$("diff=" + $diff$jscomp$2_reload$$ + " dticks=" + $diff_in_ticks$jscomp$2$$ + " value=" + $now$jscomp$4_value$jscomp$129$$ + " reload=" + this.counter_reload[$i$jscomp$35$$], 512);
2618
+ $diff$jscomp$2_reload$$ = this.counter_reload[$i$jscomp$35$$];
2619
+ $now$jscomp$4_value$jscomp$129$$ >= $diff$jscomp$2_reload$$ ? ($dbg_log$$module$src$log$$("Warning: Counter" + $i$jscomp$35$$ + " value " + $now$jscomp$4_value$jscomp$129$$ + " is larger than reload " + $diff$jscomp$2_reload$$, 512), $now$jscomp$4_value$jscomp$129$$ %= $diff$jscomp$2_reload$$) : 0 > $now$jscomp$4_value$jscomp$129$$ && ($now$jscomp$4_value$jscomp$129$$ = $now$jscomp$4_value$jscomp$129$$ % $diff$jscomp$2_reload$$ + $diff$jscomp$2_reload$$);
2607
2620
  return $now$jscomp$4_value$jscomp$129$$;
2608
2621
  };
2609
- $PIT$$module$src$pit$$.prototype.did_rollover = function($i$jscomp$36$$, $diff$jscomp$2_now$jscomp$5$$) {
2610
- $diff$jscomp$2_now$jscomp$5$$ -= this.counter_start_time[$i$jscomp$36$$];
2611
- return 0 > $diff$jscomp$2_now$jscomp$5$$ ? ($dbg_log$$module$src$log$$("Warning: PIT timer difference is negative, resetting (timer " + $i$jscomp$36$$ + ")"), !0) : this.counter_start_value[$i$jscomp$36$$] < Math.floor(1193.1816666 * $diff$jscomp$2_now$jscomp$5$$);
2622
+ $PIT$$module$src$pit$$.prototype.did_rollover = function($i$jscomp$36$$, $diff$jscomp$3_now$jscomp$5$$) {
2623
+ $diff$jscomp$3_now$jscomp$5$$ -= this.counter_start_time[$i$jscomp$36$$];
2624
+ return 0 > $diff$jscomp$3_now$jscomp$5$$ ? ($dbg_log$$module$src$log$$("Warning: PIT timer difference is negative, resetting (timer " + $i$jscomp$36$$ + ")"), !0) : this.counter_start_value[$i$jscomp$36$$] < Math.floor(1193.1816666 * $diff$jscomp$3_now$jscomp$5$$);
2612
2625
  };
2613
2626
  $PIT$$module$src$pit$$.prototype.counter_read = function($i$jscomp$37_value$jscomp$130$$) {
2614
2627
  var $latch_next_low$$ = this.counter_latch[$i$jscomp$37_value$jscomp$130$$];
@@ -9383,7 +9396,7 @@ $IDEInterface$$module$src$ide$$.prototype.ata_command = function($cmd$jscomp$1$$
9383
9396
  this.push_irq();
9384
9397
  break;
9385
9398
  case 160:
9386
- this.is_atapi ? ($do_dbg_log_result$jscomp$20$$ = !1, this.data_allocate(12), this.data_end = 12, this.sector_count_reg = 1, this.status_reg = 88, this.push_irq()) : this.ata_abort_command();
9399
+ this.is_atapi ? ($do_dbg_log_result$jscomp$20$$ = !1, this.data_allocate(12), this.data_end = 12, this.sector_count_reg = 1, this.status_reg = 88) : this.ata_abort_command();
9387
9400
  break;
9388
9401
  case 161:
9389
9402
  this.is_atapi ? (this.create_identify_packet(), this.status_reg = 88, this.push_irq()) : this.ata_abort_command();
package/build/libv86.js CHANGED
@@ -138,8 +138,8 @@ a.getUTCDate(),d,c,b))}this.cmos_b&16&&(this.update_interrupt_time=Date.now());y
138
138
  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,
139
139
  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)}ib.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};
140
140
  ib.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]};
141
- ib.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,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(1193.1816666*(a-this.counter_start_time[0])))/1193.1816666));return c};
142
- ib.prototype.get_counter_value=function(a,b){if(!this.counter_enabled[a])return 0;b=this.counter_start_value[a]-Math.floor(1193.1816666*(b-this.counter_start_time[a]));a=this.counter_reload[a];b>=a?b%=a:0>b&&(b=b%a+a);return b};ib.prototype.did_rollover=function(a,b){b-=this.counter_start_time[a];return 0>b?!0:this.counter_start_value[a]<Math.floor(1193.1816666*b)};
141
+ ib.prototype.timer=function(a,b){var c=100;if(!b){if(this.counter_enabled[0]&&this.did_rollover(0,a)){b=a-this.counter_start_time[0];const d=Math.floor(1193.1816666*b);this.counter_start_value[0]=this.get_counter_value(0,a);this.counter_start_time[0]=0>b?a:this.counter_start_time[0]+d/1193.1816666;this.cpu.device_lower_irq(0);this.cpu.device_raise_irq(0);0===this.counter_mode[0]&&(this.counter_enabled[0]=0)}else this.cpu.device_lower_irq(0);this.counter_enabled[0]&&(c=(this.counter_start_value[0]-
142
+ Math.floor(1193.1816666*(a-this.counter_start_time[0])))/1193.1816666)}return c};ib.prototype.get_counter_value=function(a,b){if(!this.counter_enabled[a])return 0;b=this.counter_start_value[a]-Math.floor(1193.1816666*(b-this.counter_start_time[a]));a=this.counter_reload[a];b>=a?b%=a:0>b&&(b=b%a+a);return b};ib.prototype.did_rollover=function(a,b){b-=this.counter_start_time[a];return 0>b?!0:this.counter_start_value[a]<Math.floor(1193.1816666*b)};
143
143
  ib.prototype.counter_read=function(a){var b=this.counter_latch[a];if(b)return this.counter_latch[a]--,2===b?this.counter_latch_value[a]&255:this.counter_latch_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,G.microtick());return b?a&255:a>>8};
144
144
  ib.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]=G.microtick(),y(this.counter_reload[a]));3===this.counter_read_mode[a]&&(this.counter_next_low[a]^=1)};
145
145
  ib.prototype.port43_write=function(a){var b=a>>1&7,c=a>>6&3;a=a>>4&3;3!==c&&(0===a?(this.counter_latch[c]=2,b=this.get_counter_value(c,G.microtick()),this.counter_latch_value[c]=b?b-1:0):(6<=b&&(b&=-5),this.counter_next_low[c]=1===a?1:2===a?0:1,0===c&&this.cpu.device_lower_irq(0),0!==b&&3!==b&&2!==b&&y(b),this.counter_mode[c]=b,this.counter_read_mode[c]=a,2===c&&this.bus.send("pcspeaker-update",[this.counter_mode[2],this.counter_reload[2]])))};ib.prototype.dump=function(){};function jb(a){if("undefined"!==typeof window)if(window.AudioContext||window.webkitAudioContext){var b=window.AudioWorklet?kb:lb;this.bus=a;this.audio_context=window.AudioContext?new AudioContext:new webkitAudioContext;this.mixer=new mb(a,this.audio_context);this.pcspeaker=new nb(a,this.audio_context,this.mixer);this.dac=new b(a,this.audio_context,this.mixer);this.pcspeaker.start();a.register("emulator-stopped",function(){this.audio_context.suspend()},this);a.register("emulator-started",function(){this.audio_context.resume()},
@@ -539,7 +539,7 @@ X.prototype.device_reset=function(){this.is_atapi?(this.status_reg=0,this.lba_lo
539
539
  X.prototype.capture_regs=function(){return`ST=${y(this.status_reg&255)} ER=${y(this.error_reg&255)} `+`SC=${y(this.sector_count_reg&255)} LL=${y(this.lba_low_reg&255)} `+`LM=${y(this.lba_mid_reg&255)} LH=${y(this.lba_high_reg&255)} `+`FE=${y(this.features_reg&255)}`};
540
540
  X.prototype.ata_command=function(a){if(this.drive_connected||144===a)switch(this.current_command=a,this.error_reg=0,a){case 8:this.data_length=this.data_end=this.data_pointer=0;this.device_reset();this.push_irq();break;case 16:this.lba_mid_reg=0;this.status_reg=80;this.push_irq();break;case 248:a=this.sector_count-1;this.lba_low_reg=a&255;this.lba_mid_reg=a>>8&255;this.lba_high_reg=a>>16&255;this.device_reg=this.device_reg&240|a>>24&15;this.status_reg=80;this.push_irq();break;case 39:a=this.sector_count-
541
541
  1;this.lba_low_reg=a&255;this.lba_mid_reg=a>>8&255;this.lba_high_reg=a>>16&255;this.lba_low_reg|=a>>24<<8&65280;this.status_reg=80;this.push_irq();break;case 32:this.is_atapi?(this.lba_mid_reg=20,this.lba_high_reg=235,this.ata_abort_command()):this.ata_read_sectors(a);break;case 36:case 41:case 196:this.is_atapi?this.ata_abort_command():this.ata_read_sectors(a);break;case 48:case 52:case 57:case 197:this.is_atapi?this.ata_abort_command():this.ata_write_sectors(a);break;case 144:this.channel.master.status_reg=
542
- 80;this.channel.master.error_reg=1;this.channel.master.push_irq();this.channel.slave.drive_connected&&(this.channel.slave.status_reg=80,this.channel.slave.error_reg=1,this.channel.slave.push_irq());break;case 145:this.status_reg=80;this.push_irq();break;case 160:this.is_atapi?(this.data_allocate(12),this.data_end=12,this.sector_count_reg=1,this.status_reg=88,this.push_irq()):this.ata_abort_command();break;case 161:this.is_atapi?(this.create_identify_packet(),this.status_reg=88,this.push_irq()):this.ata_abort_command();
542
+ 80;this.channel.master.error_reg=1;this.channel.master.push_irq();this.channel.slave.drive_connected&&(this.channel.slave.status_reg=80,this.channel.slave.error_reg=1,this.channel.slave.push_irq());break;case 145:this.status_reg=80;this.push_irq();break;case 160:this.is_atapi?(this.data_allocate(12),this.data_end=12,this.sector_count_reg=1,this.status_reg=88):this.ata_abort_command();break;case 161:this.is_atapi?(this.create_identify_packet(),this.status_reg=88,this.push_irq()):this.ata_abort_command();
543
543
  break;case 198:y(this.sector_count_reg&255);this.sectors_per_drq=this.sector_count_reg&255;this.status_reg=80;this.push_irq();break;case 200:case 37:this.ata_read_sectors_dma(a);break;case 202:case 53:this.ata_write_sectors_dma(a);break;case 64:this.status_reg=80;this.push_irq();break;case 218:this.is_atapi&&(this.buffer||(this.error_reg|=2),this.medium_changed&&(this.error_reg|=32,this.medium_changed=0),this.error_reg|=64);this.status_reg=80;this.push_irq();break;case 224:this.status_reg=80;this.push_irq();
544
544
  break;case 225:this.status_reg=80;this.push_irq();break;case 231:this.status_reg=80;this.push_irq();break;case 234:this.status_reg=80;this.push_irq();break;case 236:this.is_atapi?(this.lba_mid_reg=20,this.lba_high_reg=235,this.ata_abort_command()):(this.create_identify_packet(),this.status_reg=88,this.push_irq());break;case 239:this.status_reg=80;this.push_irq();break;case 222:this.status_reg=64;this.push_irq();break;case 245:this.status_reg=80;this.push_irq();break;case 249:this.ata_abort_command();
545
545
  break;case 0:this.ata_abort_command();break;case 240:y(a);this.capture_regs();this.ata_abort_command();break;default:y(a),this.capture_regs(),this.ata_abort_command()}else y(a)};