v86 0.5.299 → 0.5.301
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/build/libv86-debug.js +13 -4
- package/build/libv86-debug.mjs +13 -4
- package/build/libv86.js +31 -30
- package/build/libv86.mjs +211 -211
- package/package.json +1 -1
package/build/libv86-debug.js
CHANGED
|
@@ -2138,7 +2138,7 @@ function $audio_clip$$module$src$sb16$$($value$jscomp$125$$, $low$$, $high$$) {
|
|
|
2138
2138
|
this.message = $msg$jscomp$2$$;
|
|
2139
2139
|
}
|
|
2140
2140
|
$StateLoadError$$module$src$state$$.prototype = Error();
|
|
2141
|
-
const $CONSTRUCTOR_TABLE$$module$src$state$$ = {Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, };
|
|
2141
|
+
const $CONSTRUCTOR_TABLE$$module$src$state$$ = {Map, Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, };
|
|
2142
2142
|
function $save_object$$module$src$state$$($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$, $saved_buffers$$) {
|
|
2143
2143
|
if ("object" !== typeof $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$ || null === $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$) {
|
|
2144
2144
|
return $dbg_assert$$module$src$log$$("function" !== typeof $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$), $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$;
|
|
@@ -2146,6 +2146,9 @@ function $save_object$$module$src$state$$($constructor$jscomp$1_obj$jscomp$27_re
|
|
|
2146
2146
|
if (Array.isArray($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$)) {
|
|
2147
2147
|
return $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.map($x$jscomp$98$$ => $save_object$$module$src$state$$($x$jscomp$98$$, $saved_buffers$$));
|
|
2148
2148
|
}
|
|
2149
|
+
if ($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$ instanceof Map) {
|
|
2150
|
+
return {__state_type__:"Map", args:Array.from($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.entries()).map(([$k$$, $v$$]) => [$save_object$$module$src$state$$($k$$, $saved_buffers$$), $save_object$$module$src$state$$($v$$, $saved_buffers$$), ]), };
|
|
2151
|
+
}
|
|
2149
2152
|
$constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.constructor === Object && (console.log($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$), $dbg_assert$$module$src$log$$($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.constructor !== Object, "Expected non-object"));
|
|
2150
2153
|
if ($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.BYTES_PER_ELEMENT) {
|
|
2151
2154
|
var $buffer$jscomp$28_state$jscomp$7$$ = new Uint8Array($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.buffer, $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.byteOffset, $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.length * $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.BYTES_PER_ELEMENT);
|
|
@@ -2177,7 +2180,7 @@ function $restore_buffers$$module$src$state$$($obj$jscomp$28$$, $buffers$jscomp$
|
|
|
2177
2180
|
$dbg_assert$$module$src$log$$(void 0 !== $i$jscomp$28_type$jscomp$150$$);
|
|
2178
2181
|
const $constructor$jscomp$2$$ = $CONSTRUCTOR_TABLE$$module$src$state$$[$i$jscomp$28_type$jscomp$150$$];
|
|
2179
2182
|
$dbg_assert$$module$src$log$$($constructor$jscomp$2$$, "Unkown type: " + $i$jscomp$28_type$jscomp$150$$);
|
|
2180
|
-
return new $constructor$jscomp$2$$($buffers$jscomp$2$$[$obj$jscomp$28$$.buffer_id]);
|
|
2183
|
+
return void 0 !== $obj$jscomp$28$$.args ? new $constructor$jscomp$2$$($obj$jscomp$28$$.args) : new $constructor$jscomp$2$$($buffers$jscomp$2$$[$obj$jscomp$28$$.buffer_id]);
|
|
2181
2184
|
}
|
|
2182
2185
|
function $restore_state$$module$src$state$$($cpu$jscomp$5$$, $state$jscomp$9$$) {
|
|
2183
2186
|
function $read_state_header$$($header_block$jscomp$1_state$jscomp$10$$, $check_length$$) {
|
|
@@ -3056,7 +3059,7 @@ $SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.push_queued_data = f
|
|
|
3056
3059
|
this.is_active && (this.queued[0].push($data$jscomp$114$$[0].slice()), this.queued[1].push($data$jscomp$114$$[1].slice()));
|
|
3057
3060
|
};
|
|
3058
3061
|
$SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.download_txt = function($history_id_txt$$, $channel$jscomp$30$$) {
|
|
3059
|
-
$history_id_txt$$ = this.output_history[$history_id_txt$$][$channel$jscomp$30$$].map($v$$ => $v$$.join(" ")).join(" ");
|
|
3062
|
+
$history_id_txt$$ = this.output_history[$history_id_txt$$][$channel$jscomp$30$$].map($v$jscomp$1$$ => $v$jscomp$1$$.join(" ")).join(" ");
|
|
3060
3063
|
$dump_file$$module$src$lib$$($history_id_txt$$, "dacdata.txt");
|
|
3061
3064
|
};
|
|
3062
3065
|
$SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.download_csv = function($buffers$jscomp$5_history_id$jscomp$1$$) {
|
|
@@ -9196,7 +9199,7 @@ function $VirtioNet$$module$src$virtio_net$$($cpu$jscomp$23$$, $bus$jscomp$23_qu
|
|
|
9196
9199
|
}
|
|
9197
9200
|
}
|
|
9198
9201
|
}
|
|
9199
|
-
}, ], }, isr_status:{initial_port:50944, }, device_specific:{initial_port:50688, struct:[0, 1, 2, 3, 4, 5].map(($v$jscomp$
|
|
9202
|
+
}, ], }, isr_status:{initial_port:50944, }, device_specific:{initial_port:50688, struct:[0, 1, 2, 3, 4, 5].map(($v$jscomp$2$$, $k$jscomp$1$$) => ({bytes:1, name:"mac_" + $k$jscomp$1$$, read:() => this.mac[$k$jscomp$1$$], write:() => {
|
|
9200
9203
|
}, })).concat([{bytes:2, name:"status", read:() => this.status, write:() => {
|
|
9201
9204
|
}, }, {bytes:2, name:"max_pairs", read:() => this.pairs, write:() => {
|
|
9202
9205
|
}, }, {bytes:2, name:"mtu", read:() => $mtu$jscomp$1$$, write:() => {
|
|
@@ -10828,6 +10831,9 @@ $CPU$$module$src$cpu$$.prototype.get_state = function() {
|
|
|
10828
10831
|
$state$jscomp$56$$[82] = this.devices.virtio_console;
|
|
10829
10832
|
$state$jscomp$56$$[83] = this.devices.virtio_net;
|
|
10830
10833
|
$state$jscomp$56$$[84] = this.devices.virtio_balloon;
|
|
10834
|
+
$state$jscomp$56$$[86] = this.last_result;
|
|
10835
|
+
$state$jscomp$56$$[87] = this.fpu_status_word;
|
|
10836
|
+
$state$jscomp$56$$[88] = this.mxcsr;
|
|
10831
10837
|
return $state$jscomp$56$$;
|
|
10832
10838
|
};
|
|
10833
10839
|
$CPU$$module$src$cpu$$.prototype.get_state_pic = function() {
|
|
@@ -10935,6 +10941,9 @@ $CPU$$module$src$cpu$$.prototype.set_state = function($state$jscomp$58$$) {
|
|
|
10935
10941
|
this.fpu_dp[0] = $state$jscomp$58$$[73];
|
|
10936
10942
|
this.fpu_dp_selector[0] = $state$jscomp$58$$[74];
|
|
10937
10943
|
this.fpu_opcode[0] = $state$jscomp$58$$[75];
|
|
10944
|
+
void 0 !== $state$jscomp$58$$[86] && (this.last_result = $state$jscomp$58$$[86]);
|
|
10945
|
+
void 0 !== $state$jscomp$58$$[87] && (this.fpu_status_word = $state$jscomp$58$$[87]);
|
|
10946
|
+
void 0 !== $state$jscomp$58$$[88] && (this.mxcsr = $state$jscomp$58$$[88]);
|
|
10938
10947
|
var $bitmap$jscomp$2_ide_config$jscomp$1$$ = new $Bitmap$$module$src$lib$$($state$jscomp$58$$[78].buffer);
|
|
10939
10948
|
this.unpack_memory($bitmap$jscomp$2_ide_config$jscomp$1$$, $state$jscomp$58$$[77]);
|
|
10940
10949
|
this.update_state_flags();
|
package/build/libv86-debug.mjs
CHANGED
|
@@ -2137,7 +2137,7 @@ function $StateLoadError$$module$src$state$$($msg$jscomp$2$$) {
|
|
|
2137
2137
|
this.message = $msg$jscomp$2$$;
|
|
2138
2138
|
}
|
|
2139
2139
|
$StateLoadError$$module$src$state$$.prototype = Error();
|
|
2140
|
-
const $CONSTRUCTOR_TABLE$$module$src$state$$ = {Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, };
|
|
2140
|
+
const $CONSTRUCTOR_TABLE$$module$src$state$$ = {Map, Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, };
|
|
2141
2141
|
function $save_object$$module$src$state$$($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$, $saved_buffers$$) {
|
|
2142
2142
|
if ("object" !== typeof $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$ || null === $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$) {
|
|
2143
2143
|
return $dbg_assert$$module$src$log$$("function" !== typeof $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$), $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$;
|
|
@@ -2145,6 +2145,9 @@ function $save_object$$module$src$state$$($constructor$jscomp$1_obj$jscomp$27_re
|
|
|
2145
2145
|
if (Array.isArray($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$)) {
|
|
2146
2146
|
return $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.map($x$jscomp$98$$ => $save_object$$module$src$state$$($x$jscomp$98$$, $saved_buffers$$));
|
|
2147
2147
|
}
|
|
2148
|
+
if ($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$ instanceof Map) {
|
|
2149
|
+
return {__state_type__:"Map", args:Array.from($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.entries()).map(([$k$$, $v$$]) => [$save_object$$module$src$state$$($k$$, $saved_buffers$$), $save_object$$module$src$state$$($v$$, $saved_buffers$$), ]), };
|
|
2150
|
+
}
|
|
2148
2151
|
$constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.constructor === Object && (console.log($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$), $dbg_assert$$module$src$log$$($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.constructor !== Object, "Expected non-object"));
|
|
2149
2152
|
if ($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.BYTES_PER_ELEMENT) {
|
|
2150
2153
|
var $buffer$jscomp$28_state$jscomp$7$$ = new Uint8Array($constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.buffer, $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.byteOffset, $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.length * $constructor$jscomp$1_obj$jscomp$27_result$jscomp$5$$.BYTES_PER_ELEMENT);
|
|
@@ -2176,7 +2179,7 @@ function $restore_buffers$$module$src$state$$($obj$jscomp$28$$, $buffers$jscomp$
|
|
|
2176
2179
|
$dbg_assert$$module$src$log$$(void 0 !== $i$jscomp$28_type$jscomp$150$$);
|
|
2177
2180
|
const $constructor$jscomp$2$$ = $CONSTRUCTOR_TABLE$$module$src$state$$[$i$jscomp$28_type$jscomp$150$$];
|
|
2178
2181
|
$dbg_assert$$module$src$log$$($constructor$jscomp$2$$, "Unkown type: " + $i$jscomp$28_type$jscomp$150$$);
|
|
2179
|
-
return new $constructor$jscomp$2$$($buffers$jscomp$2$$[$obj$jscomp$28$$.buffer_id]);
|
|
2182
|
+
return void 0 !== $obj$jscomp$28$$.args ? new $constructor$jscomp$2$$($obj$jscomp$28$$.args) : new $constructor$jscomp$2$$($buffers$jscomp$2$$[$obj$jscomp$28$$.buffer_id]);
|
|
2180
2183
|
}
|
|
2181
2184
|
function $restore_state$$module$src$state$$($cpu$jscomp$5$$, $state$jscomp$9$$) {
|
|
2182
2185
|
function $read_state_header$$($header_block$jscomp$1_state$jscomp$10$$, $check_length$$) {
|
|
@@ -3055,7 +3058,7 @@ $SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.push_queued_data = f
|
|
|
3055
3058
|
this.is_active && (this.queued[0].push($data$jscomp$114$$[0].slice()), this.queued[1].push($data$jscomp$114$$[1].slice()));
|
|
3056
3059
|
};
|
|
3057
3060
|
$SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.download_txt = function($history_id_txt$$, $channel$jscomp$30$$) {
|
|
3058
|
-
$history_id_txt$$ = this.output_history[$history_id_txt$$][$channel$jscomp$30$$].map($v$$ => $v$$.join(" ")).join(" ");
|
|
3061
|
+
$history_id_txt$$ = this.output_history[$history_id_txt$$][$channel$jscomp$30$$].map($v$jscomp$1$$ => $v$jscomp$1$$.join(" ")).join(" ");
|
|
3059
3062
|
$dump_file$$module$src$lib$$($history_id_txt$$, "dacdata.txt");
|
|
3060
3063
|
};
|
|
3061
3064
|
$SpeakerDACDebugger$$module$src$browser$speaker$$.prototype.download_csv = function($buffers$jscomp$5_history_id$jscomp$1$$) {
|
|
@@ -9195,7 +9198,7 @@ function $VirtioNet$$module$src$virtio_net$$($cpu$jscomp$23$$, $bus$jscomp$23_qu
|
|
|
9195
9198
|
}
|
|
9196
9199
|
}
|
|
9197
9200
|
}
|
|
9198
|
-
}, ], }, isr_status:{initial_port:50944, }, device_specific:{initial_port:50688, struct:[0, 1, 2, 3, 4, 5].map(($v$jscomp$
|
|
9201
|
+
}, ], }, isr_status:{initial_port:50944, }, device_specific:{initial_port:50688, struct:[0, 1, 2, 3, 4, 5].map(($v$jscomp$2$$, $k$jscomp$1$$) => ({bytes:1, name:"mac_" + $k$jscomp$1$$, read:() => this.mac[$k$jscomp$1$$], write:() => {
|
|
9199
9202
|
}, })).concat([{bytes:2, name:"status", read:() => this.status, write:() => {
|
|
9200
9203
|
}, }, {bytes:2, name:"max_pairs", read:() => this.pairs, write:() => {
|
|
9201
9204
|
}, }, {bytes:2, name:"mtu", read:() => $mtu$jscomp$1$$, write:() => {
|
|
@@ -10827,6 +10830,9 @@ $CPU$$module$src$cpu$$.prototype.get_state = function() {
|
|
|
10827
10830
|
$state$jscomp$56$$[82] = this.devices.virtio_console;
|
|
10828
10831
|
$state$jscomp$56$$[83] = this.devices.virtio_net;
|
|
10829
10832
|
$state$jscomp$56$$[84] = this.devices.virtio_balloon;
|
|
10833
|
+
$state$jscomp$56$$[86] = this.last_result;
|
|
10834
|
+
$state$jscomp$56$$[87] = this.fpu_status_word;
|
|
10835
|
+
$state$jscomp$56$$[88] = this.mxcsr;
|
|
10830
10836
|
return $state$jscomp$56$$;
|
|
10831
10837
|
};
|
|
10832
10838
|
$CPU$$module$src$cpu$$.prototype.get_state_pic = function() {
|
|
@@ -10934,6 +10940,9 @@ $CPU$$module$src$cpu$$.prototype.set_state = function($state$jscomp$58$$) {
|
|
|
10934
10940
|
this.fpu_dp[0] = $state$jscomp$58$$[73];
|
|
10935
10941
|
this.fpu_dp_selector[0] = $state$jscomp$58$$[74];
|
|
10936
10942
|
this.fpu_opcode[0] = $state$jscomp$58$$[75];
|
|
10943
|
+
void 0 !== $state$jscomp$58$$[86] && (this.last_result = $state$jscomp$58$$[86]);
|
|
10944
|
+
void 0 !== $state$jscomp$58$$[87] && (this.fpu_status_word = $state$jscomp$58$$[87]);
|
|
10945
|
+
void 0 !== $state$jscomp$58$$[88] && (this.mxcsr = $state$jscomp$58$$[88]);
|
|
10937
10946
|
var $bitmap$jscomp$2_ide_config$jscomp$1$$ = new $Bitmap$$module$src$lib$$($state$jscomp$58$$[78].buffer);
|
|
10938
10947
|
this.unpack_memory($bitmap$jscomp$2_ide_config$jscomp$1$$, $state$jscomp$58$$[77]);
|
|
10939
10948
|
this.update_state_flags();
|
package/build/libv86.js
CHANGED
|
@@ -11,21 +11,21 @@ if("undefined"===typeof XMLHttpRequest||"undefined"!==typeof process&&process.ve
|
|
|
11
11
|
{filename:a,enc:l})}b.done&&b.done(e.response,e)}};e.onerror=function(l){console.error("Loading the image "+a+" failed",l);d()};b.progress&&(e.onprogress=function(l){b.progress(l)});e.send(null)},pa=async function(a){return new Promise((b,c)=>{oa(a,{done:(d,e)=>{d=e.getResponseHeader("Content-Range")||"";(e=d.match(/\/(\d+)\s*$/))?b(+e[1]):c(Error("`Range: bytes=...` header not supported (Got `"+d+"`)"))},headers:{Range:"bytes=0-0","X-Accept-Encoding":"identity"}})})};
|
|
12
12
|
function qa(a,b,c){return String.fromCharCode(...(new Uint8Array(a.buffer,b>>>0,c>>>0)))}
|
|
13
13
|
const ra={cp437:" \u263a\u263b\u2665\u2666\u2663\u2660\u2022\u25d8\u25cb\u25d9\u2642\u2640\u266a\u266b\u263c\u25ba\u25c4\u2195\u203c\u00b6\u00a7\u25ac\u21a8\u2191\u2193\u2192\u2190\u221f\u2194\u25b2\u25bc !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00a2\u00a3\u00a5\u20a7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u2310\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u00df\u0393\u03c0\u03a3\u03c3\u00b5\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0 ",cp858:"\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u00f0\u00d0\u00ca\u00cb\u00c8\u20ac\u00cd\u00ce\u00cf\u2518\u250c\u2588\u2584\u00a6\u00cc\u2580\u00d3\u00df\u00d4\u00d2\u00f5\u00d5\u00b5\u00fe\u00de\u00da\u00db\u00d9\u00fd\u00dd\u00af\u00b4\u00ad\u00b1\u2017\u00be\u00b6\u00a7\u00f7\u00b8\u00b0\u00a8\u00b7\u00b9\u00b3\u00b2\u25a0 "};
|
|
14
|
-
ra.cp858=ra.cp437.slice(0,128)+ra.cp858;ra.ascii=ra.cp437.split("").map((a,b)=>31<b&&128>b?a:".").join("");function sa(a){return a&&ra[a]?ra[a]:ra.cp437};function ua(){}function va(){};function wa(a,b){function c(w){w=w.toString(16);return"#"+"0".repeat(6-w.length)+w}function d(w){var t=256*na,H=8*R,K=Ta?Ta.canvas:null;K&&K.width===t&&K.height===H||(K?(K.width=t,K.height=H):(K=new OffscreenCanvas(t,H),Ta=K.getContext("2d")),
|
|
15
|
-
ja);S=!1;for(let La=0;La<R;++La,++Ea,P+=fa){const Ma=w[Ea];for(let ta=128;0<ta;ta>>=1)H(Ma&ta?255:0);
|
|
14
|
+
ra.cp858=ra.cp437.slice(0,128)+ra.cp858;ra.ascii=ra.cp437.split("").map((a,b)=>31<b&&128>b?a:".").join("");function sa(a){return a&&ra[a]?ra[a]:ra.cp437};function ua(){}function va(){};function wa(a,b){function c(w){w=w.toString(16);return"#"+"0".repeat(6-w.length)+w}function d(w){var t=256*na,H=8*R,K=Ta?Ta.canvas:null;K&&K.width===t&&K.height===H||(K?(K.width=t,K.height=H):(K=new OffscreenCanvas(t,H),Ta=K.getContext("2d")),Db=Ta.createImageData(t,H));const Q=Db.data;let P=0,S;H=Eb?function(Z){S=S||Z;Q[P+3]=Z;Q[P+7]=Z;P+=8}:function(Z){S=S||Z;Q[P+3]=Z;P+=4};K=32-R;const ja=t*(R-1)*4;t=4*(na-t*R);const fa=1020*na;for(let Z=0,Ea=0;2048>Z;++Z,Ea+=K,P+=t){const Fa=Z%256;Z&&!Fa&&(P+=
|
|
15
|
+
ja);S=!1;for(let La=0;La<R;++La,++Ea,P+=fa){const Ma=w[Ea];for(let ta=128;0<ta;ta>>=1)H(Ma&ta?255:0);Fb&&H(Gb&&192<=Fa&&223>=Fa&&Ma&1?255:0)}ac[Z]=S?1:0}Ta.putImageData(Db,0,0)}function e(w,t,H,K){if(t&&H){w.style.width="";w.style.height="";K&&(w.style.transform="");var Q=w.getBoundingClientRect();K?w.style.transform=(1===t?"":" scaleX("+t+")")+(1===H?"":" scaleY("+H+")"):(0===t%1&&0===H%1?(g.style.imageRendering="crisp-edges",g.style.imageRendering="pixelated",g.style["-ms-interpolation-mode"]="nearest-neighbor"):
|
|
16
16
|
(g.style.imageRendering="",g.style["-ms-interpolation-mode"]=""),K=window.devicePixelRatio||1,0!==K%1&&(t/=K,H/=K));1!==t&&(w.style.width=Q.width*t+"px");1!==H&&(w.style.height=Q.height*H+"px")}}const f=a.container;this.screen_fill_buffer=b;console.assert(f,"options.container must be provided");this.FLAG_BLINKING=1;this.FLAG_FONT_PAGE_B=2;var g=f.getElementsByTagName("canvas")[0],h=g.getContext("2d",{alpha:!1}),l=f.getElementsByTagName("div")[0],m=document.createElement("div"),n,p,q=void 0!==a.scale?
|
|
17
|
-
a.scale:1,r=void 0!==a.scale?a.scale:1,x=1,y,u,G,N,v,L,T,Ta,
|
|
18
|
-
u)w.src=g.toDataURL("image/png");else{const t=[9,16],H=document.createElement("canvas");H.width=N*t[0];H.height=v*t[1];const K=H.getContext("2d");K.imageSmoothingEnabled=!1;K.font=window.getComputedStyle(l).font;K.textBaseline="top";for(let Q=0;Q<v;Q++)for(let P=0;P<N;P++){const S=4*(Q*N+P),ja=G[S+0],fa=G[S+3];K.fillStyle=c(G[S+2]);K.fillRect(P*t[0],Q*t[1],t[0],t[1]);K.fillStyle=c(fa);K.fillText(
|
|
19
|
-
t[0],n*t[1]+parseInt(m.style.marginTop,10),parseInt(m.style.width,10),parseInt(m.style.height,10)));w.src=H.toDataURL("image/png")}return w};this.put_char=function(w,t,H,K,Q,P){t=4*(w*N+t);G[t+0]=H;G[t+1]=K;G[t+2]=Q;G[t+3]=P;y[w]=1};this.timer=function(){
|
|
20
|
-
y[w]=0)};this.update_graphical=function(){this.screen_fill_buffer()};this.update_graphical_text=function(){if(L){var w=performance.now();if(266<w-bc){
|
|
21
|
-
var K=G[Z+1];const dc=G[Z+2],ec=G[Z+3],fc=K&2?Hb
|
|
22
|
-
0,0,Q,R,0,fa,Q,R)}S&&(
|
|
23
|
-
u&&y&&y.fill(1))};this.set_font_bitmap=function(w,t,H,K,Q,P){const S=H?16:t?9:8;if(R!==w||na!==S||
|
|
17
|
+
a.scale:1,r=void 0!==a.scale?a.scale:1,x=1,y,u,G,N,v,L,T,Ta,Db,ac=new Int8Array(2048),R,na,Fb,Eb,Gb,Hb=0,Ib=0,ob,bc=0,pb,Jb,qb,Kb=sa(a.encoding),rb=0,Lb=!1;this.init=function(){m.classList.add("cursor");m.style.position="absolute";m.style.backgroundColor="#ccc";m.style.width="7px";m.style.display="inline-block";this.set_mode(!1);this.set_size_text(80,25);2===u&&this.set_size_graphical(720,400,720,400);this.set_scale(q,r);this.timer()};this.make_screenshot=function(){const w=new Image;if(1===u||2===
|
|
18
|
+
u)w.src=g.toDataURL("image/png");else{const t=[9,16],H=document.createElement("canvas");H.width=N*t[0];H.height=v*t[1];const K=H.getContext("2d");K.imageSmoothingEnabled=!1;K.font=window.getComputedStyle(l).font;K.textBaseline="top";for(let Q=0;Q<v;Q++)for(let P=0;P<N;P++){const S=4*(Q*N+P),ja=G[S+0],fa=G[S+3];K.fillStyle=c(G[S+2]);K.fillRect(P*t[0],Q*t[1],t[0],t[1]);K.fillStyle=c(fa);K.fillText(Kb[ja],P*t[0],Q*t[1])}"none"!==m.style.display&&n<v&&p<N&&(K.fillStyle=m.style.backgroundColor,K.fillRect(p*
|
|
19
|
+
t[0],n*t[1]+parseInt(m.style.marginTop,10),parseInt(m.style.width,10),parseInt(m.style.height,10)));w.src=H.toDataURL("image/png")}return w};this.put_char=function(w,t,H,K,Q,P){t=4*(w*N+t);G[t+0]=H;G[t+1]=K;G[t+2]=Q;G[t+3]=P;y[w]=1};this.timer=function(){rb=requestAnimationFrame(()=>this.update_screen())};this.update_screen=function(){Lb||(0===u?this.update_text():1===u?this.update_graphical():this.update_graphical_text());this.timer()};this.update_text=function(){for(var w=0;w<v;w++)y[w]&&(this.text_update_row(w),
|
|
20
|
+
y[w]=0)};this.update_graphical=function(){this.screen_fill_buffer()};this.update_graphical_text=function(){if(L){var w=performance.now();if(266<w-bc){ob=!ob;qb&&(y[n]=1);var t=4*N;for(let ja=0,fa=0;ja<v;++ja)if(y[ja])fa+=t;else for(var H=0;H<N;++H,fa+=4)if(G[fa+1]&1){y[ja]=1;fa+=t-4*H;break}bc=w}w=Ta.canvas;t=T.canvas;H=4*N;const Q=N*na,P=R;let S=0;for(let ja=0,fa=0,Z=0;ja<v;++ja,fa+=R){if(!y[ja]){Z+=H;continue}++S;T.clearRect(0,P,Q,R);let Ea,Fa,La,Ma;for(let ta=0;ta<Q;ta+=na,Z+=4){const cc=G[Z+0];
|
|
21
|
+
var K=G[Z+1];const dc=G[Z+2],ec=G[Z+3],fc=K&2?Ib:Hb;K=(!(K&1)||ob)&&ac[(fc<<8)+cc];La!==dc&&(void 0!==La&&(L.fillStyle=c(La),L.fillRect(Ma,fa,ta-Ma,R)),La=dc,Ma=ta);Ea!==ec&&(void 0!==Ea&&(T.fillStyle=c(Ea),T.fillRect(Fa,0,ta-Fa,R)),Ea=ec,Fa=ta);K&&T.drawImage(w,cc*na,fc*R,na,R,ta,P,na,R)}T.fillStyle=c(Ea);T.fillRect(Fa,0,Q-Fa,R);T.globalCompositeOperation="destination-in";T.drawImage(t,0,P,Q,R,0,0,Q,R);T.globalCompositeOperation="source-over";L.fillStyle=c(La);L.fillRect(Ma,fa,Q-Ma,R);L.drawImage(t,
|
|
22
|
+
0,0,Q,R,0,fa,Q,R)}S&&(ob&&qb&&y[n]&&(L.fillStyle=c(G[4*(n*N+p)+3]),L.fillRect(p*na,n*R+pb,na,Jb-pb+1)),y.fill(0));S&&h.drawImage(L.canvas,0,0)}};this.destroy=function(){rb&&(cancelAnimationFrame(rb),rb=0)};this.pause=function(){Lb=!0;m.classList.remove("blinking-cursor")};this.continue=function(){Lb=!1;m.classList.add("blinking-cursor")};this.set_mode=function(w){u=w?1:a.use_graphical_text?2:0;0===u?(l.style.display="block",g.style.display="none"):(l.style.display="none",g.style.display="block",2===
|
|
23
|
+
u&&y&&y.fill(1))};this.set_font_bitmap=function(w,t,H,K,Q,P){const S=H?16:t?9:8;if(R!==w||na!==S||Fb!==t||Eb!==H||Gb!==K||P)P=na!==S||R!==w,R=w,na=S,Fb=t,Eb=H,Gb=K,2===u&&(d(Q),y.fill(1),P&&this.set_size_graphical_text())};this.set_font_page=function(w,t){if(Hb!==w||Ib!==t)Hb=w,Ib=t,y.fill(1)};this.clear_screen=function(){h.fillStyle="#000";h.fillRect(0,0,g.width,g.height)};this.set_size_graphical_text=function(){if(Ta){var w=na*N,t=R*v,H=2*R;L&&L.canvas.width===w&&L.canvas.height===t&&T.canvas.height===
|
|
24
24
|
H||(L?(L.canvas.width=w,L.canvas.height=t,T.canvas.width=w,T.canvas.height=H):(L=(new OffscreenCanvas(w,t)).getContext("2d",{alpha:!1}),T=(new OffscreenCanvas(w,H)).getContext("2d")),this.set_size_graphical(w,t,w,t),y.fill(1))}};this.set_size_text=function(w,t){if(w!==N||t!==v)if(y=new Int8Array(t),G=new Int32Array(w*t*4),N=w,v=t,0===u){for(;l.childNodes.length>t;)l.removeChild(l.firstChild);for(;l.childNodes.length<t;)l.appendChild(document.createElement("div"));for(w=0;w<t;w++)this.text_update_row(w);
|
|
25
|
-
e(l,q,r,!0)}else 2===u&&this.set_size_graphical_text()};this.set_size_graphical=function(w,t){g.style.display="block";g.width=w;g.height=t;h.imageSmoothingEnabled=!1;x=640>=w&&2*w<window.innerWidth*window.devicePixelRatio&&2*t<window.innerHeight*window.devicePixelRatio?2:1;e(g,q*x,r*x,!1)};this.set_scale=function(w,t){q=w;r=t;e(l,q,r,!0);e(g,q*x,r*x,!1)};this.update_cursor_scanline=function(w,t,H){if(w!==
|
|
26
|
-
w+"px"):m.style.display="none":2===u&&n<v&&(y[n]=1),
|
|
25
|
+
e(l,q,r,!0)}else 2===u&&this.set_size_graphical_text()};this.set_size_graphical=function(w,t){g.style.display="block";g.width=w;g.height=t;h.imageSmoothingEnabled=!1;x=640>=w&&2*w<window.innerWidth*window.devicePixelRatio&&2*t<window.innerHeight*window.devicePixelRatio?2:1;e(g,q*x,r*x,!1)};this.set_scale=function(w,t){q=w;r=t;e(l,q,r,!0);e(g,q*x,r*x,!1)};this.update_cursor_scanline=function(w,t,H){if(w!==pb||t!==Jb||H!==qb)0===u?H?(m.style.display="inline",m.style.height=t-w+"px",m.style.marginTop=
|
|
26
|
+
w+"px"):m.style.display="none":2===u&&n<v&&(y[n]=1),pb=w,Jb=t,qb=H};this.update_cursor=function(w,t){if(w!==n||t!==p)w<v&&(y[w]=1),n<v&&(y[n]=1),n=w,p=t};this.text_update_row=function(w){var t=4*w*N,H;var K=l.childNodes[w];var Q=document.createElement("div");for(var P=0;P<N;){var S=document.createElement("span");var ja=G[t+1]&1;var fa=G[t+2];var Z=G[t+3];ja&&S.classList.add("blink");S.style.backgroundColor=c(fa);S.style.color=c(Z);for(H="";P<N&&(G[t+1]&1)===ja&&G[t+2]===fa&&G[t+3]===Z;)if(H+=Kb[G[t+
|
|
27
27
|
0]],P++,t+=4,w===n)if(P===p)break;else if(P===p+1){m.style.backgroundColor=S.style.color;Q.appendChild(m);break}S.textContent=H;Q.appendChild(S)}K.parentNode.replaceChild(Q,K)};this.update_buffer=function(w){for(const t of w)h.putImageData(t.image_data,t.screen_x-t.buffer_x,t.screen_y-t.buffer_y,t.buffer_x,t.buffer_y,t.buffer_width,t.buffer_height)};this.get_text_screen=function(){for(var w=[],t=0;t<v;t++)w.push(this.get_text_row(t));return w};this.get_text_row=function(w){var t=w*N*4;w=t+4*N;let H=
|
|
28
|
-
"";for(;t<w;t+=4)H+=
|
|
28
|
+
"";for(;t<w;t+=4)H+=Kb[G[t]];return H};this.init()};function A(a){this.buffer=a;this.byteLength=a.byteLength;this.onprogress=this.onload=void 0}A.prototype.load=function(){this.onload&&this.onload({buffer:this.buffer})};A.prototype.get=function(a,b,c){c(new Uint8Array(this.buffer,a,b))};A.prototype.set=function(a,b,c){(new Uint8Array(this.buffer,a,b.byteLength)).set(b);c()};A.prototype.get_buffer=function(a){a(this.buffer)};A.prototype.get_state=function(){const a=[];a[0]=this.byteLength;a[1]=new Uint8Array(this.buffer);return a};
|
|
29
29
|
A.prototype.set_state=function(a){this.byteLength=a[0];this.buffer=a[1].slice().buffer};function xa(a,b,c){this.filename=a;this.byteLength=b;this.block_cache=new Map;this.block_cache_is_write=new Set;this.fixed_chunk_size=c;this.cache_reads=!!c;this.onprogress=this.onload=void 0}xa.prototype.load=async function(){void 0===this.byteLength&&(this.byteLength=await pa(this.filename));this.onload&&this.onload(Object.create(null))};
|
|
30
30
|
xa.prototype.get_from_cache=function(a,b){var c=b/256;a/=256;for(var d=0;d<c;d++)if(!this.block_cache.get(a+d))return;if(1===c)return this.block_cache.get(a);b=new Uint8Array(b);for(d=0;d<c;d++)b.set(this.block_cache.get(a+d),256*d);return b};
|
|
31
31
|
xa.prototype.get=function(a,b,c){var d=this.get_from_cache(a,b);if(d)c(d);else{var e=a,f=b;this.fixed_chunk_size&&(e=a-a%this.fixed_chunk_size,f=Math.ceil((a-e+b)/this.fixed_chunk_size)*this.fixed_chunk_size);oa(this.filename,{done:function(g){g=new Uint8Array(g);this.handle_read(e,f,g);e===a&&f===b?c(g):c(g.subarray(a-e,a-e+b))}.bind(this),range:{start:e,length:f}})}};
|
|
@@ -114,9 +114,9 @@ C.prototype.dma_transfer_start=function(){this.bytes_per_sample=1;this.dsp_16bit
|
|
|
114
114
|
C.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"))};
|
|
115
115
|
C.prototype.dma_transfer_next=function(){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=>{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)))})};
|
|
116
116
|
C.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 f=0,g=0;g<a;g++)for(var h=Ra(e[g]/b+c,-1,1),l=0;l<d;l++)this.dac_buffers[f].push(h),f^=1;this.dac_send()};C.prototype.dac_handle_request=function(){!this.dma_bytes_left||this.dma_paused?this.dac_send():this.dma_transfer_next()};
|
|
117
|
-
C.prototype.dac_send=function(){if(this.dac_buffers[0].length){var a=this.dac_buffers[0].shift_block(this.dac_buffers[0].length),b=this.dac_buffers[1].shift_block(this.dac_buffers[1].length);this.bus.send("dac-send-data",[a,b],[a.buffer,b.buffer])}};C.prototype.raise_irq=function(a){this.irq_triggered[a]=1;this.cpu.device_raise_irq(this.irq)};C.prototype.lower_irq=function(a){this.irq_triggered[a]=0;this.cpu.device_lower_irq(this.irq)};function Ra(a,b,c){return(a<b)*b+(a>c)*c+(b<=a&&a<=c)*a};function ab(a){this.message=a}ab.prototype=Error();const bb={Uint8Array,Int8Array,Uint16Array,Int16Array,Uint32Array,Int32Array,Float32Array,Float64Array};
|
|
118
|
-
function cb(a,b){if("object"!==typeof a||null===a)return a;if(Array.isArray(a))return a.map(e=>cb(e,b));a.constructor===Object&&console.log(a);if(a.BYTES_PER_ELEMENT){var c=new Uint8Array(a.buffer,a.byteOffset,a.length*a.BYTES_PER_ELEMENT);return{__state_type__:a.constructor.name.replace("bound ",""),buffer_id:b.push(c)-1}}a=a.get_state();c=[];for(var d=0;d<a.length;d++)c[d]=cb(a[d],b);return c}
|
|
119
|
-
function db(a,b){if("object"!==typeof a||null===a)return a;if(Array.isArray(a)){for(
|
|
117
|
+
C.prototype.dac_send=function(){if(this.dac_buffers[0].length){var a=this.dac_buffers[0].shift_block(this.dac_buffers[0].length),b=this.dac_buffers[1].shift_block(this.dac_buffers[1].length);this.bus.send("dac-send-data",[a,b],[a.buffer,b.buffer])}};C.prototype.raise_irq=function(a){this.irq_triggered[a]=1;this.cpu.device_raise_irq(this.irq)};C.prototype.lower_irq=function(a){this.irq_triggered[a]=0;this.cpu.device_lower_irq(this.irq)};function Ra(a,b,c){return(a<b)*b+(a>c)*c+(b<=a&&a<=c)*a};function ab(a){this.message=a}ab.prototype=Error();const bb={Map,Uint8Array,Int8Array,Uint16Array,Int16Array,Uint32Array,Int32Array,Float32Array,Float64Array};
|
|
118
|
+
function cb(a,b){if("object"!==typeof a||null===a)return a;if(Array.isArray(a))return a.map(e=>cb(e,b));if(a instanceof Map)return{__state_type__:"Map",args:Array.from(a.entries()).map(([e,f])=>[cb(e,b),cb(f,b)])};a.constructor===Object&&console.log(a);if(a.BYTES_PER_ELEMENT){var c=new Uint8Array(a.buffer,a.byteOffset,a.length*a.BYTES_PER_ELEMENT);return{__state_type__:a.constructor.name.replace("bound ",""),buffer_id:b.push(c)-1}}a=a.get_state();c=[];for(var d=0;d<a.length;d++)c[d]=cb(a[d],b);return c}
|
|
119
|
+
function db(a,b){if("object"!==typeof a||null===a)return a;if(Array.isArray(a)){for(var c=0;c<a.length;c++)a[c]=db(a[c],b);return a}c=bb[a.__state_type__];return void 0!==a.args?new c(a.args):new c(b[a.buffer_id])}
|
|
120
120
|
function eb(a,b){function c(q,r){const x=q.length;if(16>x)throw new ab("Invalid length: "+x);q=new Int32Array(q.buffer,q.byteOffset,4);if(-2039052682!==q[0])throw new ab("Invalid header: "+z(q[0]>>>0));if(6!==q[1])throw new ab("Version mismatch: dump="+q[1]+" we=6");if(r&&q[2]!==x)throw new ab("Length doesn't match header: real="+x+" header="+q[2]);return q[3]}function d(q){q=(new TextDecoder).decode(q);return JSON.parse(q)}b=new Uint8Array(b);if(4247762216===(new Uint32Array(b.buffer,0,1))[0]){var e=
|
|
121
121
|
a.zstd_create_ctx(b.length);(new Uint8Array(a.wasm_memory.buffer,a.zstd_get_src_ptr(e)>>>0,b.length)).set(b);var f=a.zstd_read(e,16),g=new Uint8Array(a.wasm_memory.buffer,f>>>0,16),h=c(g,!1);a.zstd_read_free(f,16);f=a.zstd_read(e,h);g=new Uint8Array(a.wasm_memory.buffer,f>>>0,h);g=d(g);a.zstd_read_free(f,h);f=g.state;var l=g.buffer_infos;g=[];h=16+h;for(var m of l){l=(h+3&-4)-h;if(1048576<m.length){var n=a.zstd_read(e,l)>>>0;a.zstd_read_free(n,l);n=new Uint8Array(m.length);g.push(n.buffer);for(var p=
|
|
122
122
|
0;p<m.length;){const q=Math.min(m.length-p,1048576),r=a.zstd_read(e,q);n.set(new Uint8Array(a.wasm_memory.buffer,r>>>0,q),p);a.zstd_read_free(r,q);p+=q}}else n=a.zstd_read(e,l+m.length),p=(n>>>0)+l,g.push(a.wasm_memory.buffer.slice(p,p+m.length)),a.zstd_read_free(n,l+m.length);h+=l+m.length}f=db(f,g);a.set_state(f);a.zstd_free_ctx(e)}else{e=c(b,!0);if(0>e||e+12>=b.length)throw new ab("Invalid info block length: "+e);m=b.subarray(16,16+e);f=d(m);m=f.state;f=f.buffer_infos;let q=16+e;q=q+3&-4;e=f.map(r=>
|
|
@@ -146,12 +146,12 @@ function lb(a,b){function c(d){return function(e){d.gain.setValueAtTime(e,this.a
|
|
|
146
146
|
this.node_treble_right.frequency.setValueAtTime(2E3,this.audio_context.currentTime);this.node_bass_left=this.audio_context.createBiquadFilter();this.node_bass_right=this.audio_context.createBiquadFilter();this.node_bass_left.type="lowshelf";this.node_bass_right.type="lowshelf";this.node_bass_left.frequency.setValueAtTime(200,this.audio_context.currentTime);this.node_bass_right.frequency.setValueAtTime(200,this.audio_context.currentTime);this.node_gain_left=this.audio_context.createGain();this.node_gain_right=
|
|
147
147
|
this.audio_context.createGain();this.node_merger=this.audio_context.createChannelMerger(2);this.input_left=this.node_treble_left;this.input_right=this.node_treble_right;this.node_treble_left.connect(this.node_bass_left);this.node_bass_left.connect(this.node_gain_left);this.node_gain_left.connect(this.node_merger,0,0);this.node_treble_right.connect(this.node_bass_right);this.node_bass_right.connect(this.node_gain_right);this.node_gain_right.connect(this.node_merger,0,1);this.node_merger.connect(this.audio_context.destination);
|
|
148
148
|
a.register("mixer-connect",function(d){this.connect_source(d[0],d[1])},this);a.register("mixer-disconnect",function(d){this.disconnect_source(d[0],d[1])},this);a.register("mixer-volume",function(d){var e=d[0],f=d[1];d=Math.pow(10,d[2]/20);e=0===e?this:this.sources.get(e);void 0===e||e.set_volume(d,f)},this);a.register("mixer-gain-left",function(d){this.gain_left=Math.pow(10,d/20);this.update()},this);a.register("mixer-gain-right",function(d){this.gain_right=Math.pow(10,d/20);this.update()},this);
|
|
149
|
-
a.register("mixer-treble-left",c(this.node_treble_left),this);a.register("mixer-treble-right",c(this.node_treble_right),this);a.register("mixer-bass-left",c(this.node_bass_left),this);a.register("mixer-bass-right",c(this.node_bass_right),this)}lb.prototype.add_source=function(a,b){a=new
|
|
149
|
+
a.register("mixer-treble-left",c(this.node_treble_left),this);a.register("mixer-treble-right",c(this.node_treble_right),this);a.register("mixer-bass-left",c(this.node_bass_left),this);a.register("mixer-bass-right",c(this.node_bass_right),this)}lb.prototype.add_source=function(a,b){a=new nb(this.audio_context,a,this.input_left,this.input_right);this.sources.has(b);this.sources.set(b,a);return a};lb.prototype.connect_source=function(a,b){a=this.sources.get(a);void 0===a||a.connect(b)};
|
|
150
150
|
lb.prototype.disconnect_source=function(a,b){a=this.sources.get(a);void 0===a||a.disconnect(b)};lb.prototype.set_volume=function(a,b){void 0===b&&(b=2);switch(b){case 0:this.volume_left=a;break;case 1:this.volume_right=a;break;case 2:this.volume_both=a;break;default:return}this.update()};
|
|
151
151
|
lb.prototype.update=function(){var a=this.volume_both*this.volume_right*this.gain_right;this.node_gain_left.gain.setValueAtTime(this.volume_both*this.volume_left*this.gain_left,this.audio_context.currentTime);this.node_gain_right.gain.setValueAtTime(a,this.audio_context.currentTime)};
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
function nb(a,b,c,d){this.audio_context=a;this.connected_right=this.connected_left=!0;this.volume_right=this.volume_left=this.volume_both=this.gain_hidden=1;this.node_splitter=a.createChannelSplitter(2);this.node_gain_left=a.createGain();this.node_gain_right=a.createGain();b.connect(this.node_splitter);this.node_splitter.connect(this.node_gain_left,0);this.node_gain_left.connect(c);this.node_splitter.connect(this.node_gain_right,1);this.node_gain_right.connect(d)}
|
|
153
|
+
nb.prototype.update=function(){var a=this.connected_right*this.gain_hidden*this.volume_both*this.volume_right;this.node_gain_left.gain.setValueAtTime(this.connected_left*this.gain_hidden*this.volume_both*this.volume_left,this.audio_context.currentTime);this.node_gain_right.gain.setValueAtTime(a,this.audio_context.currentTime)};nb.prototype.connect=function(a){var b=!a||2===a;if(b||0===a)this.connected_left=!0;if(b||1===a)this.connected_right=!0;this.update()};
|
|
154
|
+
nb.prototype.disconnect=function(a){var b=!a||2===a;if(b||0===a)this.connected_left=!1;if(b||1===a)this.connected_right=!1;this.update()};nb.prototype.set_volume=function(a,b){void 0===b&&(b=2);switch(b){case 0:this.volume_left=a;break;case 1:this.volume_right=a;break;case 2:this.volume_both=a;break;default:return}this.update()};nb.prototype.set_gain_hidden=function(a){this.gain_hidden=a};
|
|
155
155
|
function mb(a,b,c){this.node_oscillator=b.createOscillator();this.node_oscillator.type="square";this.node_oscillator.frequency.setValueAtTime(440,b.currentTime);this.mixer_connection=c.add_source(this.node_oscillator,1);this.mixer_connection.disconnect();a.register("pcspeaker-enable",function(){c.connect_source(1)},this);a.register("pcspeaker-disable",function(){c.disconnect_source(1)},this);a.register("pcspeaker-update",function(d){var e=d[1],f=0;3===d[0]&&(f=Math.min(1193181.6665999999/e,this.node_oscillator.frequency.maxValue),
|
|
156
156
|
f=Math.max(f,0));this.node_oscillator.frequency.setValueAtTime(f,b.currentTime)},this)}mb.prototype.start=function(){this.node_oscillator.start()};
|
|
157
157
|
function jb(a,b,c){this.bus=a;this.audio_context=b;this.enabled=!1;this.sampling_rate=48E3;b=function(){function g(m){if(0===m)return 1;m*=Math.PI;return Math.sin(m)/m}function h(){var m=Reflect.construct(AudioWorkletProcessor,[],h);m.kernel_size=3;m.queue_data=Array(1024);m.queue_start=0;m.queue_end=0;m.queue_length=0;m.queue_size=m.queue_data.length;m.queued_samples=0;m.source_buffer_previous=l;m.source_buffer_current=l;m.source_samples_per_destination=1;m.source_block_start=0;m.source_time=0;m.source_offset=
|
|
@@ -173,16 +173,16 @@ sb.prototype.connect=function(){if("undefined"!==typeof WebSocket){if(this.socke
|
|
|
173
173
|
this.socket.onerror=this.handle_error.bind(this)}}};sb.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())};sb.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)};const tb=(new Date("1970-01-01T00:00:00Z")).getTime(),ub=(new Date("1900-01-01T00:00:00Z")).getTime(),vb=tb-ub,wb=Math.pow(2,32),xb=[118,56,54];function yb(a){return[0,1,2,3,4,5].map(b=>a[b].toString(16)).map(b=>1===b.length?"0"+b:b).join(":")}function zb(a){return a[0]<<24|a[1]<<16|a[2]<<8|a[3]}
|
|
174
174
|
class Ab{constructor(a,b){a=Math.min(a,16);this.maximum_capacity=b?Math.max(b,a):0;this.length=this.head=this.tail=0;this.buffer=new Uint8Array(a)}write(a){const b=a.length;var c=this.length+b;let d=this.buffer.length;if(d<c){for(;d<c;)d*=2;if(this.maximum_capacity&&d>this.maximum_capacity)throw Error("stream capacity overflow in GrowableRingbuffer.write(), package dropped");c=new Uint8Array(d);this.peek(c);this.tail=0;this.head=this.length;this.buffer=c}c=this.buffer;const e=this.head+b;if(e>d){const f=
|
|
175
175
|
d-this.head;c.set(a.subarray(0,f),this.head);c.set(a.subarray(f))}else c.set(a,this.head);this.head=e%d;this.length+=b}peek(a){const b=Math.min(this.length,a.length);if(b){const e=this.buffer;var c=e.length,d=this.tail+b;d>c?(d%=c,c-=this.tail,a.set(e.subarray(this.tail)),a.set(e.subarray(0,d),c)):a.set(e.subarray(this.tail,d))}return b}remove(a){a>this.length&&(a=this.length);a&&(this.tail=(this.tail+a)%this.buffer.length,this.length-=a);return a}}
|
|
176
|
-
function Bb(a=1500){const b=a-20,c=b-8,d=new Uint8Array(14+a+4),e=d.buffer,f=d.byteOffset;return{eth_frame:d,eth_frame_view:new DataView(e),eth_payload_view:new DataView(e,f+14,a),ipv4_payload_view:new DataView(e,f+34,b),udp_payload_view:new DataView(e,f+42,c),text_encoder:new TextEncoder}}function
|
|
176
|
+
function Bb(a=1500){const b=a-20,c=b-8,d=new Uint8Array(14+a+4),e=d.buffer,f=d.byteOffset;return{eth_frame:d,eth_frame_view:new DataView(e),eth_payload_view:new DataView(e,f+14,a),ipv4_payload_view:new DataView(e,f+34,b),udp_payload_view:new DataView(e,f+42,c),text_encoder:new TextEncoder}}function Cb(a,b,c,d){d.eth_frame.set(b,c.byteOffset+a);return b.length}
|
|
177
177
|
function Mb(a,b,c,d){const e=c.byteOffset+(a&-2);d=d.eth_frame;for(c=c.byteOffset;c<e;c+=2)b+=d[c]<<8|d[c+1];for(a&1&&(b+=d[e]<<8);b>>>16;)b=(b&65535)+(b>>>16);return~b&65535}
|
|
178
|
-
function Nb(a,b){a.eth_frame.fill(0);var c=a.eth_frame,d=c.subarray,e=a.eth_frame_view;
|
|
179
|
-
h.setUint8(0,b.icmp.type);h.setUint8(1,b.icmp.code);h.setUint16(2,0);var l=4+
|
|
180
|
-
b.dhcp.giaddr);
|
|
181
|
-
r.type);x+=2;m.setUint16(x,r.class);x+=2}for(q=0;q<b.dns.answers.length;++q){n=b.dns.answers[q];for(l of n.name)r=a.text_encoder.encodeInto(l,a.eth_frame.subarray(m.byteOffset+(x+1))).written,m.setUint8(x,r),x+=1+r;m.setUint16(x,n.type);x+=2;m.setUint16(x,n.class);x+=2;m.setUint32(x,n.ttl);x+=4;m.setUint16(x,n.data.length);x+=2;x+=
|
|
182
|
-
n.setUint32(4,b.ntp.root_delay),n.setUint32(8,b.ntp.root_disp),n.setUint32(12,b.ntp.ref_id),n.setUint32(16,b.ntp.ref_ts_i),n.setUint32(20,b.ntp.ref_ts_f),n.setUint32(24,b.ntp.ori_ts_i),n.setUint32(28,b.ntp.ori_ts_f),n.setUint32(32,b.ntp.rec_ts_i),n.setUint32(36,b.ntp.rec_ts_f),n.setUint32(40,b.ntp.trans_ts_i),n.setUint32(44,b.ntp.trans_ts_f),l+=48):l=m+
|
|
178
|
+
function Nb(a,b){a.eth_frame.fill(0);var c=a.eth_frame,d=c.subarray,e=a.eth_frame_view;Cb(0,b.eth.dest,e,a);Cb(6,b.eth.src,e,a);e.setUint16(12,b.eth.ethertype);e=14;if(b.arp){var f=a.eth_payload_view;f.setUint16(0,b.arp.htype);f.setUint16(2,b.arp.ptype);f.setUint8(4,b.arp.sha.length);f.setUint8(5,b.arp.spa.length);f.setUint16(6,b.arp.oper);Cb(8,b.arp.sha,f,a);Cb(14,b.arp.spa,f,a);Cb(18,b.arp.tha,f,a);Cb(24,b.arp.tpa,f,a);e+=28}else if(b.ipv4){f=a.eth_payload_view;var g=20;if(b.icmp){var h=a.ipv4_payload_view;
|
|
179
|
+
h.setUint8(0,b.icmp.type);h.setUint8(1,b.icmp.code);h.setUint16(2,0);var l=4+Cb(4,b.icmp.data,h,a);h.setUint16(2,Mb(l,0,h,a));g+=l}else if(b.udp){h=a.ipv4_payload_view;var m=8;if(b.dhcp){l=m;var n=a.udp_payload_view;n.setUint8(0,b.dhcp.op);n.setUint8(1,b.dhcp.htype);n.setUint8(2,b.dhcp.hlen);n.setUint8(3,b.dhcp.hops);n.setUint32(4,b.dhcp.xid);n.setUint16(8,b.dhcp.secs);n.setUint16(10,b.dhcp.flags);n.setUint32(12,b.dhcp.ciaddr);n.setUint32(16,b.dhcp.yiaddr);n.setUint32(20,b.dhcp.siaddr);n.setUint32(24,
|
|
180
|
+
b.dhcp.giaddr);Cb(28,b.dhcp.chaddr,n,a);n.setUint32(236,1669485411);m=240;for(var p of b.dhcp.options)m+=Cb(m,p,n,a);l+=m}else if(b.dns){p=m;m=a.udp_payload_view;m.setUint16(0,b.dns.id);m.setUint16(2,b.dns.flags);m.setUint16(4,b.dns.questions.length);m.setUint16(6,b.dns.answers.length);let x=12;for(var q=0;q<b.dns.questions.length;++q){var r=b.dns.questions[q];for(n of r.name){const y=a.text_encoder.encodeInto(n,a.eth_frame.subarray(m.byteOffset+(x+1))).written;m.setUint8(x,y);x+=1+y}m.setUint16(x,
|
|
181
|
+
r.type);x+=2;m.setUint16(x,r.class);x+=2}for(q=0;q<b.dns.answers.length;++q){n=b.dns.answers[q];for(l of n.name)r=a.text_encoder.encodeInto(l,a.eth_frame.subarray(m.byteOffset+(x+1))).written,m.setUint8(x,r),x+=1+r;m.setUint16(x,n.type);x+=2;m.setUint16(x,n.class);x+=2;m.setUint32(x,n.ttl);x+=4;m.setUint16(x,n.data.length);x+=2;x+=Cb(x,n.data,m,a)}l=p+x}else b.ntp?(l=m,n=a.udp_payload_view,n.setUint8(0,b.ntp.flags),n.setUint8(1,b.ntp.stratum),n.setUint8(2,b.ntp.poll),n.setUint8(3,b.ntp.precision),
|
|
182
|
+
n.setUint32(4,b.ntp.root_delay),n.setUint32(8,b.ntp.root_disp),n.setUint32(12,b.ntp.ref_id),n.setUint32(16,b.ntp.ref_ts_i),n.setUint32(20,b.ntp.ref_ts_f),n.setUint32(24,b.ntp.ori_ts_i),n.setUint32(28,b.ntp.ori_ts_f),n.setUint32(32,b.ntp.rec_ts_i),n.setUint32(36,b.ntp.rec_ts_f),n.setUint32(40,b.ntp.trans_ts_i),n.setUint32(44,b.ntp.trans_ts_f),l+=48):l=m+Cb(0,b.udp.data,a.udp_payload_view,a);m=l;h.setUint16(0,b.udp.sport);h.setUint16(2,b.udp.dport);h.setUint16(4,m);h.setUint16(6,0);h.setUint16(6,Mb(m,
|
|
183
183
|
(b.ipv4.src[0]<<8|b.ipv4.src[1])+(b.ipv4.src[2]<<8|b.ipv4.src[3])+(b.ipv4.dest[0]<<8|b.ipv4.dest[1])+(b.ipv4.dest[2]<<8|b.ipv4.dest[3])+17+m,h,a));g+=m}else b.tcp&&(h=a.ipv4_payload_view,l=0,n=b.tcp,n.fin&&(l|=1),n.syn&&(l|=2),n.rst&&(l|=4),n.psh&&(l|=8),n.ack&&(l|=16),n.urg&&(l|=32),n.ece&&(l|=64),n.cwr&&(l|=128),p=20,n.options&&n.options.mss&&(h.setUint8(p,2),h.setUint8(p+1,4),h.setUint16(p+2,n.options.mss),p+=4),m=4*Math.ceil(p/4),n.options&&0<m-p&&a.eth_frame.fill(0,h.byteOffset+p,h.byteOffset+
|
|
184
|
-
p+(m-p)),h.setUint16(0,n.sport),h.setUint16(2,n.dport),h.setUint32(4,n.seq),h.setUint32(8,n.ackn),h.setUint8(12,m>>2<<4),h.setUint8(13,l),h.setUint16(14,n.winsize),h.setUint16(16,0),h.setUint16(18,n.urgent||0),b.tcp_data&&(m+=
|
|
185
|
-
0);f.setUint8(6,64);f.setUint8(8,b.ipv4.ttl||32);f.setUint8(9,b.ipv4.proto);f.setUint16(10,0);
|
|
184
|
+
p+(m-p)),h.setUint16(0,n.sport),h.setUint16(2,n.dport),h.setUint32(4,n.seq),h.setUint32(8,n.ackn),h.setUint8(12,m>>2<<4),h.setUint8(13,l),h.setUint16(14,n.winsize),h.setUint16(16,0),h.setUint16(18,n.urgent||0),b.tcp_data&&(m+=Cb(20,b.tcp_data,h,a)),h.setUint16(16,Mb(m,(b.ipv4.src[0]<<8|b.ipv4.src[1])+(b.ipv4.src[2]<<8|b.ipv4.src[3])+(b.ipv4.dest[0]<<8|b.ipv4.dest[1])+(b.ipv4.dest[2]<<8|b.ipv4.dest[3])+6+m,h,a)),g+=m);f.setUint8(0,69);f.setUint8(1,b.ipv4.tos||0);f.setUint16(2,g);f.setUint16(4,b.ipv4.id||
|
|
185
|
+
0);f.setUint8(6,64);f.setUint8(8,b.ipv4.ttl||32);f.setUint8(9,b.ipv4.proto);f.setUint16(10,0);Cb(12,b.ipv4.src,f,a);Cb(16,b.ipv4.dest,f,a);f.setUint16(10,Mb(20,0,f,a));e+=g}return d.call(c,0,e)}
|
|
186
186
|
function Ob(a,b){fetch(`https://${b.doh_server||"cloudflare-dns.com"}/dns-query`,{method:"POST",headers:[["content-type","application/dns-message"]],body:a.udp.data}).then(async c=>{c={eth:{ethertype:2048,src:b.router_mac,dest:a.eth.src},ipv4:{proto:17,src:b.router_ip,dest:a.ipv4.src},udp:{sport:53,dport:a.udp.sport,data:new Uint8Array(await c.arrayBuffer())}};b.receive(Nb(b.eth_encoder_buf,c))});return!0}
|
|
187
187
|
function Pb(a,b){let c={};c.eth={ethertype:2048,src:b.router_mac,dest:a.eth.src};c.ipv4={proto:17,src:b.router_ip,dest:b.vm_ip};c.udp={sport:67,dport:68};c.dhcp={htype:1,hlen:6,hops:0,xid:a.dhcp.xid,secs:0,flags:0,ciaddr:0,yiaddr:zb(b.vm_ip),siaddr:zb(b.router_ip),giaddr:zb(b.router_ip),chaddr:a.dhcp.chaddr};let d=[],e=a.dhcp.options.find(function(f){return 53===f[0]});e&&3===e[2]&&(a.dhcp.op=3);1===a.dhcp.op&&(c.dhcp.op=2,d.push(new Uint8Array([53,1,2])));3===a.dhcp.op&&(c.dhcp.op=2,d.push(new Uint8Array([53,
|
|
188
188
|
1,5])),d.push(new Uint8Array([51,4,8,0,0,0])));a=[b.router_ip[0],b.router_ip[1],b.router_ip[2],b.router_ip[3]];d.push(new Uint8Array([1,4,255,255,255,0]));b.masquerade&&(d.push(new Uint8Array([3,4].concat(a))),d.push(new Uint8Array([6,4].concat(a))));d.push(new Uint8Array([54,4].concat(a)));d.push(new Uint8Array([60,3].concat(xb)));d.push(new Uint8Array([255,0]));c.dhcp.options=d;b.receive(Nb(b.eth_encoder_buf,c))}
|
|
@@ -637,7 +637,7 @@ O.prototype.jit_force_generate=function(a){this.jit_force_generate_unsafe&&this.
|
|
|
637
637
|
O.prototype.get_state=function(){var a=[];a[0]=this.memory_size[0];a[1]=new Uint8Array([...this.segment_is_null,...this.segment_access_bytes]);a[2]=this.segment_offsets;a[3]=this.segment_limits;a[4]=this.protected_mode[0];a[5]=this.idtr_offset[0];a[6]=this.idtr_size[0];a[7]=this.gdtr_offset[0];a[8]=this.gdtr_size[0];a[9]=this.page_fault[0];a[10]=this.cr;a[11]=this.cpl[0];a[13]=this.is_32[0];a[16]=this.stack_size_32[0];a[17]=this.in_hlt[0];a[18]=this.last_virt_eip[0];a[19]=this.eip_phys[0];a[22]=this.sysenter_cs[0];
|
|
638
638
|
a[23]=this.sysenter_eip[0];a[24]=this.sysenter_esp[0];a[25]=this.prefixes[0];a[26]=this.flags[0];a[27]=this.flags_changed[0];a[28]=this.last_op1[0];a[30]=this.last_op_size[0];a[37]=this.instruction_pointer[0];a[38]=this.previous_ip[0];a[39]=this.reg32;a[40]=this.sreg;a[41]=this.dreg;a[42]=this.reg_pdpte;this.store_current_tsc();a[43]=this.current_tsc;a[45]=this.devices.virtio_9p;a[46]=this.get_state_apic();a[47]=this.devices.rtc;a[48]=this.devices.pci;a[49]=this.devices.dma;a[50]=this.devices.acpi;
|
|
639
639
|
a[52]=this.devices.vga;a[53]=this.devices.ps2;a[54]=this.devices.uart0;a[55]=this.devices.fdc;this.devices.ide.secondary?a[85]=this.devices.ide:this.devices.ide.primary?.master.is_atapi?a[56]=this.devices.ide.primary:a[57]=this.devices.ide.primary;a[58]=this.devices.pit;a[59]=this.devices.net;a[60]=this.get_state_pic();a[61]=this.devices.sb16;a[62]=this.fw_value;a[63]=this.get_state_ioapic();a[64]=this.tss_size_32[0];a[66]=this.reg_xmm32s;a[67]=this.fpu_st;a[68]=this.fpu_stack_empty[0];a[69]=this.fpu_stack_ptr[0];
|
|
640
|
-
a[70]=this.fpu_control_word[0];a[71]=this.fpu_ip[0];a[72]=this.fpu_ip_selector[0];a[73]=this.fpu_dp[0];a[74]=this.fpu_dp_selector[0];a[75]=this.fpu_opcode[0];const {packed_memory:b,bitmap:c}=this.pack_memory();a[77]=b;a[78]=new Uint8Array(c.get_buffer());a[79]=this.devices.uart1;a[80]=this.devices.uart2;a[81]=this.devices.uart3;a[82]=this.devices.virtio_console;a[83]=this.devices.virtio_net;a[84]=this.devices.virtio_balloon;return a};
|
|
640
|
+
a[70]=this.fpu_control_word[0];a[71]=this.fpu_ip[0];a[72]=this.fpu_ip_selector[0];a[73]=this.fpu_dp[0];a[74]=this.fpu_dp_selector[0];a[75]=this.fpu_opcode[0];const {packed_memory:b,bitmap:c}=this.pack_memory();a[77]=b;a[78]=new Uint8Array(c.get_buffer());a[79]=this.devices.uart1;a[80]=this.devices.uart2;a[81]=this.devices.uart3;a[82]=this.devices.virtio_console;a[83]=this.devices.virtio_net;a[84]=this.devices.virtio_balloon;a[86]=this.last_result;a[87]=this.fpu_status_word;a[88]=this.mxcsr;return a};
|
|
641
641
|
O.prototype.get_state_pic=function(){const a=new Uint8Array(this.wasm_memory.buffer,this.get_pic_addr_master(),13),b=new Uint8Array(this.wasm_memory.buffer,this.get_pic_addr_slave(),13),c=[],d=[];c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=d;c[6]=a[6];c[7]=a[7];c[8]=a[8];c[9]=a[9];c[10]=a[10];c[11]=a[11];c[12]=a[12];d[0]=b[0];d[1]=b[1];d[2]=b[2];d[3]=b[3];d[4]=b[4];d[5]=null;d[6]=b[6];d[7]=b[7];d[8]=b[8];d[9]=b[9];d[10]=b[10];d[11]=b[11];d[12]=b[12];return c};
|
|
642
642
|
O.prototype.get_state_apic=function(){return new Uint8Array(this.wasm_memory.buffer,this.get_apic_addr(),184)};O.prototype.get_state_ioapic=function(){return new Uint8Array(this.wasm_memory.buffer,this.get_ioapic_addr(),208)};
|
|
643
643
|
O.prototype.set_state=function(a){this.memory_size[0]=a[0];this.mem8.length!==this.memory_size[0]&&console.warn("Note: Memory size mismatch. we="+this.mem8.length+" state="+this.memory_size[0]);8===a[1].length?(this.segment_is_null.set(a[1]),this.segment_access_bytes.fill(242),this.segment_access_bytes[1]=250):16===a[1].length&&(this.segment_is_null.set(a[1].subarray(0,8)),this.segment_access_bytes.set(a[1].subarray(8,16)));this.segment_offsets.set(a[2]);this.segment_limits.set(a[3]);this.protected_mode[0]=
|
|
@@ -645,8 +645,9 @@ a[4];this.idtr_offset[0]=a[5];this.idtr_size[0]=a[6];this.gdtr_offset[0]=a[7];th
|
|
|
645
645
|
a[37];this.previous_ip[0]=a[38];this.reg32.set(a[39]);this.sreg.set(a[40]);this.dreg.set(a[41]);a[42]&&this.reg_pdpte.set(a[42]);this.set_tsc(a[43][0],a[43][1]);this.devices.virtio_9p&&this.devices.virtio_9p.set_state(a[45]);a[46]&&this.set_state_apic(a[46]);this.devices.rtc&&this.devices.rtc.set_state(a[47]);this.devices.dma&&this.devices.dma.set_state(a[49]);this.devices.acpi&&this.devices.acpi.set_state(a[50]);this.devices.vga&&this.devices.vga.set_state(a[52]);this.devices.ps2&&this.devices.ps2.set_state(a[53]);
|
|
646
646
|
this.devices.uart0&&this.devices.uart0.set_state(a[54]);this.devices.fdc&&this.devices.fdc.set_state(a[55]);if(a[56]||a[57]){var b=[[void 0,void 0],[void 0,void 0]];b[0][0]=a[56]?{is_cdrom:!0,buffer:this.devices.cdrom.buffer}:{is_cdrom:!1,buffer:this.devices.ide.primary.master.buffer};this.devices.ide=new Pc(this,this.devices.ide.bus,b);this.devices.cdrom=a[56]?this.devices.ide.primary.master:void 0;this.devices.ide.primary.set_state(a[56]||a[57])}else a[85]&&this.devices.ide.set_state(a[85]);this.devices.pci&&
|
|
647
647
|
this.devices.pci.set_state(a[48]);this.devices.pit&&this.devices.pit.set_state(a[58]);this.devices.net&&this.devices.net.set_state(a[59]);this.set_state_pic(a[60]);this.devices.sb16&&this.devices.sb16.set_state(a[61]);this.devices.uart1&&this.devices.uart1.set_state(a[79]);this.devices.uart2&&this.devices.uart2.set_state(a[80]);this.devices.uart3&&this.devices.uart3.set_state(a[81]);this.devices.virtio_console&&this.devices.virtio_console.set_state(a[82]);this.devices.virtio_net&&this.devices.virtio_net.set_state(a[83]);
|
|
648
|
-
this.devices.virtio_balloon&&this.devices.virtio_balloon.set_state(a[84]);this.fw_value=a[62];a[63]&&this.set_state_ioapic(a[63]);this.tss_size_32[0]=a[64];this.reg_xmm32s.set(a[66]);this.fpu_st.set(a[67]);this.fpu_stack_empty[0]=a[68];this.fpu_stack_ptr[0]=a[69];this.fpu_control_word[0]=a[70];this.fpu_ip[0]=a[71];this.fpu_ip_selector[0]=a[72];this.fpu_dp[0]=a[73];this.fpu_dp_selector[0]=a[74];this.fpu_opcode[0]=a[75];
|
|
649
|
-
|
|
648
|
+
this.devices.virtio_balloon&&this.devices.virtio_balloon.set_state(a[84]);this.fw_value=a[62];a[63]&&this.set_state_ioapic(a[63]);this.tss_size_32[0]=a[64];this.reg_xmm32s.set(a[66]);this.fpu_st.set(a[67]);this.fpu_stack_empty[0]=a[68];this.fpu_stack_ptr[0]=a[69];this.fpu_control_word[0]=a[70];this.fpu_ip[0]=a[71];this.fpu_ip_selector[0]=a[72];this.fpu_dp[0]=a[73];this.fpu_dp_selector[0]=a[74];this.fpu_opcode[0]=a[75];void 0!==a[86]&&(this.last_result=a[86]);void 0!==a[87]&&(this.fpu_status_word=
|
|
649
|
+
a[87]);void 0!==a[88]&&(this.mxcsr=a[88]);b=new ma(a[78].buffer);this.unpack_memory(b,a[77]);this.update_state_flags();this.full_clear_tlb();this.jit_clear_cache()};
|
|
650
|
+
O.prototype.set_state_pic=function(a){const b=new Uint8Array(this.wasm_memory.buffer,this.get_pic_addr_master(),13),c=new Uint8Array(this.wasm_memory.buffer,this.get_pic_addr_slave(),13);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];const d=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12]};
|
|
650
651
|
O.prototype.set_state_apic=function(a){if(a instanceof Array){const b=new Int32Array(this.wasm_memory.buffer,this.get_apic_addr(),46);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[8]=a[6];b[9]=a[7];b[10]=a[8];b[11]=a[9];b[12]=a[10];b[13]=a[11];b[14]=a[12];b[15]=a[13];b.set(a[15],16);b.set(a[15],24);b.set(a[16],32);b[40]=a[17];b[41]=a[18];b[42]=a[19];b[43]=a[20];b[44]=a[21];b[45]=a[22]||65536}else(new Uint8Array(this.wasm_memory.buffer,this.get_apic_addr(),184)).set(a)};
|
|
651
652
|
O.prototype.set_state_ioapic=function(a){if(a instanceof Array){const b=new Int32Array(this.wasm_memory.buffer,this.get_ioapic_addr(),52);b.set(a[0],0);b.set(a[1],24);b[48]=a[2];b[49]=a[3];b[50]=a[4];b[51]=a[5]}else(new Uint8Array(this.wasm_memory.buffer,this.get_ioapic_addr(),208)).set(a)};
|
|
652
653
|
O.prototype.pack_memory=function(){var a=this.mem8.length>>12,b=[];for(var c=0;c<a;c++)this.is_memory_zeroed(c<<12,4096)||b.push(c);a=new ma(a);c=new Uint8Array(b.length<<12);for(const [d,e]of b.entries())a.set(e,1),b=e<<12,b=this.mem8.subarray(b,b+4096),c.set(b,d<<12);return{bitmap:a,packed_memory:c}};
|