Pal/Console.Dos.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Runtime.CompilerServices;
namespace System
{
static class Console
{
static ushort s_consoleAttribute;
static ushort s_cursorX, s_cursorY;
public static unsafe string Title
{
set
{
}
}
public static unsafe bool CursorVisible
{
set
{
}
}
public static ConsoleColor ForegroundColor
{
set
{
s_consoleAttribute = (ushort)value;
}
}
public static unsafe bool KeyAvailable
{
get
{
// mov ah,0Bh
// int 21h
// ret
byte* pCode = stackalloc byte[] { 0xB4, 0x0B, 0xCD, 0x21, 0xC3 };
return ClassConstructorRunner.Call<byte>(new IntPtr(pCode)) != 0;
}
}
public static unsafe ConsoleKeyInfo ReadKey(bool intercept)
{
// mov ah,08h
// int 21h
// ret
byte* pCode = stackalloc byte[] { 0xB4, 0x08, 0xCD, 0x21, 0xC3 };
char c = (char)ClassConstructorRunner.Call<byte>(new IntPtr(pCode));
// Interpret WASD as arrow keys.
ConsoleKey k = default;
if (c == 'w')
k = ConsoleKey.UpArrow;
else if (c == 'd')
k = ConsoleKey.RightArrow;
else if (c == 's')
k = ConsoleKey.DownArrow;
后面还有 53 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
