diff --git a/BuildTime.txt b/BuildTime.txt
index 2263405..458997f 100644
--- a/BuildTime.txt
+++ b/BuildTime.txt
@@ -1 +1 @@
-2026-03-26 21:30:36
\ No newline at end of file
+2026-03-27 21:26:04
\ No newline at end of file
diff --git a/CMLeonOS.csproj b/CMLeonOS.csproj
index b28be86..7ec7fcf 100644
--- a/CMLeonOS.csproj
+++ b/CMLeonOS.csproj
@@ -65,6 +65,7 @@
+
@@ -134,6 +135,7 @@
+
@@ -153,6 +155,7 @@
+
diff --git a/GitCommit.txt b/GitCommit.txt
index e639942..41717d4 100644
--- a/GitCommit.txt
+++ b/GitCommit.txt
@@ -1 +1 @@
-cd6fee6
\ No newline at end of file
+7a7d44e
\ No newline at end of file
diff --git a/Kernel.cs b/Kernel.cs
index c280808..c84bde9 100644
--- a/Kernel.cs
+++ b/Kernel.cs
@@ -29,6 +29,7 @@ using Cosmos.System.Graphics.Fonts;
using Cosmos.System.Network.Config;
using Cosmos.System.Network.IPv4;
using Cosmos.System.Network.IPv4.UDP.DHCP;
+using Cosmos.System.Emulation;
using System;
using System.Collections.Generic;
using System.IO;
@@ -144,6 +145,11 @@ namespace CMLeonOS
UserSystem.Initialize();
userSystem = new UserSystem();
_logger.Success("Kernel", "User system initialized");
+
+ // 初始化指令集
+ _logger.Info("Kernel", "Initializing instruction set");
+ FGMSECInstructionSet.Install();
+ _logger.Success("Kernel", "Instruction set initialized");
// 读取 Git Commit hash
if (gitCommitFile != null && gitCommitFile.Length > 0)
@@ -310,7 +316,7 @@ namespace CMLeonOS
}
else{
Console.Clear();
- Console.BackgroundColor = ConsoleColor.Red;
+ Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;
Console.Clear();
Console.Beep();
diff --git a/docs/cmleonos/docs/.vuepress/config.js b/docs/cmleonos/docs/.vuepress/config.js
index 52800ad..27488b9 100644
--- a/docs/cmleonos/docs/.vuepress/config.js
+++ b/docs/cmleonos/docs/.vuepress/config.js
@@ -10,7 +10,7 @@ export default defineUserConfig({
theme: defaultTheme({
// logo: 'https://vuejs.press/images/hero.png',
- navbar: ['/', '/get-started', '/lua', '/commands'],
+ navbar: ['/', '/get-started', '/lua', '/commands', '/syscall'],
}),
diff --git a/docs/cmleonos/docs/commands.md b/docs/cmleonos/docs/commands.md
index 6a856b6..814027c 100644
--- a/docs/cmleonos/docs/commands.md
+++ b/docs/cmleonos/docs/commands.md
@@ -764,6 +764,24 @@ branswe
branswe script.brs
```
+### runbin
+运行 MSE 二进制程序文件(由 ManagedSoftwareExecution 执行)。
+
+**用法:**
+```bash
+runbin
+```
+
+**示例:**
+```bash
+runbin 0:\apps\demo.bin
+```
+
+**说明:**
+- `runbin` 会读取指定二进制文件并按指令逐条执行
+- 当前内置 3 个系统调用(syscall 0/1/2)
+- 详细 syscall 规范见 [Syscall 文档](/syscall.html)
+
## 实用工具命令
### calc
@@ -856,6 +874,26 @@ exportbackground 0:\mywallpaper.bmp
- 如果不指定输出路径,默认导出到 0:\background.bmp
- 导出的壁纸为BMP格式
+
+### exporttestexe
+导出测试可执行文件到指定路径。
+
+**用法:**
+```bash
+exporttestexe [output_path]
+```
+
+**示例:**
+```bash
+exporttestexe
+exporttestexe 0:\test.exe
+```
+
+**说明:**
+- 如果不指定输出路径,默认导出到 0:\test.exe
+- 导出的可执行文件为MSE格式
+
+
### beep
播放系统提示音。
diff --git a/docs/cmleonos/docs/syscall.md b/docs/cmleonos/docs/syscall.md
new file mode 100644
index 0000000..c71acd9
--- /dev/null
+++ b/docs/cmleonos/docs/syscall.md
@@ -0,0 +1,58 @@
+# MSE Syscall 文档
+
+本文档说明 `runbin` 命令当前支持的系统调用(syscall)约定。
+
+## 前置条件
+
+- 指令集初始化已在内核完成(`FGMSECInstructionSet.Install()`)
+- 使用 `runbin ` 运行二进制程序
+
+## 调用约定
+
+- 当前可用 syscall 数量:`3`
+- 索引范围:`0`、`1`、`2`
+
+## syscall 0:输出字符串
+
+**功能:**
+将内存中的以 `\0` 结尾字符串输出到控制台。
+
+**参数:**
+- `R3`:字符串起始地址
+
+**行为:**
+- 从 `R3` 指向地址开始逐字符读取
+- 遇到 `\0` 终止输出
+- 不自动换行
+
+## syscall 1:读取一行输入
+
+**功能:**
+从控制台读取一行文本,并写入可执行程序内存。
+
+**行为:**
+- 调用 `Console.ReadLine()`
+- 自动在末尾追加 `\0`
+- 将结果写入程序内存
+
+**返回值:**
+- `R3`:写入字符串的起始地址
+
+## syscall 2:清屏
+
+**功能:**
+清空控制台屏幕。
+
+**行为:**
+- 调用 `Console.Clear()`
+
+## 最小流程示例
+
+1. 准备符合 FGMSEC 指令集的二进制文件
+2. 在 Shell 执行 `runbin `
+3. 程序通过 syscall 与控制台交互(输出、输入、清屏)
+
+## 注意事项
+
+- 如果程序调用了未实现的 syscall,会导致运行失败
+- 输入输出行为与控制台一致,建议程序自行处理提示文本与换行
diff --git a/sh.exe b/sh.exe
new file mode 100644
index 0000000..8eab569
Binary files /dev/null and b/sh.exe differ
diff --git a/shell/CommandList.cs b/shell/CommandList.cs
index 9c343e1..332f143 100644
--- a/shell/CommandList.cs
+++ b/shell/CommandList.cs
@@ -239,6 +239,9 @@ namespace CMLeonOS.shell
case "markit":
shell.ProcessMarkit(args);
break;
+ case "runbin":
+ shell.ProcessRunbin(args);
+ break;
case "femboy":
shell.ProcessFemboy();
break;
@@ -257,6 +260,9 @@ namespace CMLeonOS.shell
case "exportbackground":
shell.ProcessExportBackground(args);
break;
+ case "exporttestexe":
+ shell.ProcessExportTestExe(args);
+ break;
default:
shell.ShowError($"Unknown command: {command}");
break;
diff --git a/shell/Commands/ExportTestExeCommand.cs b/shell/Commands/ExportTestExeCommand.cs
new file mode 100644
index 0000000..3d6058f
--- /dev/null
+++ b/shell/Commands/ExportTestExeCommand.cs
@@ -0,0 +1,49 @@
+// The CMLeonOS Project (https://github.com/Leonmmcoset/CMLeonOS)
+// Copyright (C) 2025-present LeonOS 2 Developer Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using System;
+using System.IO;
+using IL2CPU.API.Attribs;
+
+namespace CMLeonOS.Commands
+{
+ public static class ExportTestExeCommand
+ {
+ [ManifestResourceStream(ResourceName = "CMLeonOS.sh.exe")]
+ private static byte[] testExeBytes;
+
+ public static void ExportTestExe(string outputPath)
+ {
+ try
+ {
+ if (testExeBytes == null || testExeBytes.Length == 0)
+ {
+ Console.WriteLine("Error: No test.exe found in embedded resources.");
+ return;
+ }
+
+ string destinationPath = string.IsNullOrEmpty(outputPath) ? @"0:\test.exe" : outputPath;
+
+ File.WriteAllBytes(destinationPath, testExeBytes);
+ Console.WriteLine($"Test.exe exported successfully to: {destinationPath}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error exporting test.exe: {ex.Message}");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/shell/Commands/Help/Help.cs b/shell/Commands/Help/Help.cs
index 73615de..4151f53 100644
--- a/shell/Commands/Help/Help.cs
+++ b/shell/Commands/Help/Help.cs
@@ -86,6 +86,18 @@ namespace CMLeonOS.Commands
Description = "Simple calculator"
},
new CommandInfo
+ {
+ Command = "exporttestexe",
+ Parameters = "