rk86 2.0.4 → 2.0.6
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/package.json +9 -2
- package/rk86.js +17 -27
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rk86",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Эмулятор Радио-86РК (Intel 8080) для терминала",
|
|
5
5
|
"bin": {
|
|
6
6
|
"rk86": "rk86.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"keywords": [
|
|
9
|
+
"keywords": [
|
|
10
|
+
"rk86",
|
|
11
|
+
"radio-86rk",
|
|
12
|
+
"emulator",
|
|
13
|
+
"intel-8080",
|
|
14
|
+
"i8080",
|
|
15
|
+
"retro"
|
|
16
|
+
],
|
|
10
17
|
"author": "Alexander Demin",
|
|
11
18
|
"license": "MIT",
|
|
12
19
|
"repository": {
|
package/rk86.js
CHANGED
|
@@ -1588,6 +1588,10 @@ var init_catalog_data = __esm(() => {
|
|
|
1588
1588
|
];
|
|
1589
1589
|
});
|
|
1590
1590
|
|
|
1591
|
+
// src/lib/rk86_terminal.ts
|
|
1592
|
+
import { existsSync } from "fs";
|
|
1593
|
+
import { readFile } from "fs/promises";
|
|
1594
|
+
|
|
1591
1595
|
// src/lib/hex.ts
|
|
1592
1596
|
function hex(v, prefix) {
|
|
1593
1597
|
return v.toString(16).toUpperCase();
|
|
@@ -3701,12 +3705,12 @@ function decodeMon32() {
|
|
|
3701
3705
|
return Array.from(new Uint8Array(Uint8Array.from(atob(MON32_B64), (c) => c.charCodeAt(0))));
|
|
3702
3706
|
}
|
|
3703
3707
|
async function fetchFile(name) {
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
} catch {
|
|
3708
|
-
console.error(`\u043E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0444\u0430\u0439\u043B\u0430: ${name}`);
|
|
3708
|
+
if (!existsSync(name)) {
|
|
3709
|
+
console.error(`\u0444\u0430\u0439\u043B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${name}`);
|
|
3710
|
+
process.exit(1);
|
|
3709
3711
|
}
|
|
3712
|
+
const data = await readFile(name);
|
|
3713
|
+
return Array.from(data);
|
|
3710
3714
|
}
|
|
3711
3715
|
function printHelp() {
|
|
3712
3716
|
console.log(`\u042D\u043C\u0443\u043B\u044F\u0442\u043E\u0440 \u0420\u0430\u0434\u0438\u043E-86\u0420\u041A (\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B)
|
|
@@ -3716,15 +3720,15 @@ function printHelp() {
|
|
|
3716
3720
|
\u041E\u043F\u0446\u0438\u0438:
|
|
3717
3721
|
-h \u0441\u043F\u0440\u0430\u0432\u043A\u0430
|
|
3718
3722
|
-l \u0441\u043F\u0438\u0441\u043E\u043A \u0444\u0430\u0439\u043B\u043E\u0432 \u0438\u0437 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430
|
|
3719
|
-
-m <\u0444\u0430\u0439\u043B>
|
|
3723
|
+
-m <\u0444\u0430\u0439\u043B> \u043C\u043E\u043D\u0438\u0442\u043E\u0440 (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E: \u0432\u0441\u0442\u0440\u043E\u0435\u043D\u043D\u044B\u0439 mon32.bin)
|
|
3720
3724
|
-p \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B \u0431\u0435\u0437 \u0437\u0430\u043F\u0443\u0441\u043A\u0430
|
|
3721
3725
|
|
|
3722
3726
|
\u041F\u0440\u0438\u043C\u0435\u0440\u044B:
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3727
|
+
bunx rk86 \u0437\u0430\u043F\u0443\u0441\u043A \u043C\u043E\u043D\u0438\u0442\u043E\u0440\u0430
|
|
3728
|
+
bunx rk86 CHESS.GAM \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0444\u0430\u0439\u043B
|
|
3729
|
+
bunx rk86 -p CHESS.GAM \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B (\u0431\u0435\u0437 \u0437\u0430\u043F\u0443\u0441\u043A\u0430)
|
|
3730
|
+
bunx rk86 -m mon16.bin \u0437\u0430\u043F\u0443\u0441\u043A \u0441 \u0434\u0440\u0443\u0433\u0438\u043C \u043C\u043E\u043D\u0438\u0442\u043E\u0440\u043E\u043C
|
|
3731
|
+
bunx rk86 -l \u0441\u043F\u0438\u0441\u043E\u043A \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0444\u0430\u0439\u043B\u043E\u0432
|
|
3728
3732
|
|
|
3729
3733
|
\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435:
|
|
3730
3734
|
Ctrl+C \u0432\u044B\u0445\u043E\u0434`);
|
|
@@ -3753,7 +3757,7 @@ async function main() {
|
|
|
3753
3757
|
const loadOnly = args.includes("-p");
|
|
3754
3758
|
const monitorIdx = args.indexOf("-m");
|
|
3755
3759
|
const monitorFile_ = monitorIdx >= 0 ? args[monitorIdx + 1] : undefined;
|
|
3756
|
-
const positional = args.filter((a, i) => !a.startsWith("-") && i !== monitorIdx + 1);
|
|
3760
|
+
const positional = args.filter((a, i) => !a.startsWith("-") && (monitorIdx < 0 || i !== monitorIdx + 1));
|
|
3757
3761
|
const programFile = positional[0];
|
|
3758
3762
|
const keyboard = new Keyboard;
|
|
3759
3763
|
const io = new IO;
|
|
@@ -3770,26 +3774,12 @@ async function main() {
|
|
|
3770
3774
|
machine.tape = new Tape(machine);
|
|
3771
3775
|
machine.runner = new Runner(machine);
|
|
3772
3776
|
machine.memory.update_ruslat = machine.ui.update_ruslat;
|
|
3773
|
-
|
|
3774
|
-
if (monitorFile_) {
|
|
3775
|
-
const content = await fetchFile(monitorFile_);
|
|
3776
|
-
if (!content) {
|
|
3777
|
-
console.error(`\u043C\u043E\u043D\u0438\u0442\u043E\u0440 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${monitorFile_}`);
|
|
3778
|
-
process.exit(1);
|
|
3779
|
-
}
|
|
3780
|
-
monitorContent = content;
|
|
3781
|
-
} else {
|
|
3782
|
-
monitorContent = decodeMon32();
|
|
3783
|
-
}
|
|
3777
|
+
const monitorContent = monitorFile_ ? await fetchFile(monitorFile_) : decodeMon32();
|
|
3784
3778
|
const monitorFile = parse_rk86_binary(monitorFile_ || "mon32.bin", monitorContent);
|
|
3785
3779
|
machine.memory.load_file(monitorFile);
|
|
3786
3780
|
let entryPoint;
|
|
3787
3781
|
if (programFile) {
|
|
3788
3782
|
const content = await fetchFile(programFile);
|
|
3789
|
-
if (!content) {
|
|
3790
|
-
console.error(`\u0444\u0430\u0439\u043B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${programFile}`);
|
|
3791
|
-
process.exit(1);
|
|
3792
|
-
}
|
|
3793
3783
|
const file = parse_rk86_binary(programFile, content);
|
|
3794
3784
|
machine.memory.load_file(file);
|
|
3795
3785
|
entryPoint = file.entry;
|