public static void Main() { try { ApplicationRuntime.Init(); //var result = MessageManager.Send(SysCallTarget.ServiceFunc1, 55); SysCalls.WriteDebugChar('='); SysCalls.WriteDebugChar('/'); SysCalls.WriteDebugChar('*'); var conStream = File.Open("/dev/console"); var con = new ConsoleClient(conStream); con.Reset(); con.SetForegroundColor(7); con.SetBackgroundColor(0); con.ApplyDefaultColor(); con.Clear(); con.SetCursor(0, 0); con.Write("kl\n"); //for (int i = 0; i < ApplicationRuntime.ElfSections.Count; i++) // con.WriteLine(ApplicationRuntime.ElfSections[i].Name); var cmdProcId_CreateFifo = SysCalls.GetProcessIDForCommand(SysCallTarget.CreateFifo); var buf3 = SysCalls.RequestMessageBuffer(4096, cmdProcId_CreateFifo); SysCalls.CreateFifo(buf3, "/tmp/tmp_fifo"); #pragma warning disable CA2000 // Dispose objects before losing scope var kbStream2 = File.Open("/tmp/tmp_fifo"); #pragma warning restore CA2000 // Dispose objects before losing scope using (var kbStream = File.Open("/dev/keyboard")) { while (true) { SysCalls.ThreadSleep(0); var num = kbStream.ReadByte(); if (num >= 0) { var key = (byte)num; // F8 if (key == 0x42) { StartProc("CHELLO.BIN"); continue; } // F9 if (key == 0x43) { StartProc("DSPSRV.BIN"); continue; } // F10 if (key == 0x44) { StartProc("GUIDEMO.BIN"); continue; } var s = key.ToString("x"); //for (var i = 0; i < s.Length; i++) // SysCalls.WriteDebugChar(s[i]); //SysCalls.WriteDebugChar(' '); for (var i = 0; i < s.Length; i++) { con.Write(s[i]); kbStream2.WriteByte(64); } con.Write(' '); } //SysCalls.WriteDebugChar('?'); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static unsafe void Main() { ApplicationRuntime.Init(); //var result = MessageManager.Send(SysCallTarget.ServiceFunc1, 55); SysCalls.WriteDebugChar('='); SysCalls.WriteDebugChar('/'); SysCalls.WriteDebugChar('*'); var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile); var buf = SysCalls.RequestMessageBuffer(4096, targetProcessId); var kb = SysCalls.OpenFile(buf, "/dev/keyboard"); var con = new ConsoleClient(); con.Init(); //con.Write("\x001B[37;42m\x001B[8]"); //con.Write("abc\x001B[2Jgh\x001B[37;42mjk"); con.Reset(); con.SetForegroundColor(7); con.SetBackgroundColor(0); con.ApplyDefaultColor(); con.Clear(); con.SetCursor(0, 0); con.Write("kl\n"); for (uint i = 0; i < ApplicationRuntime.ElfSections.SectionHeaderCount; i++) { var section = ApplicationRuntime.ElfSections.GetSectionHeader(i); var name = ApplicationRuntime.ElfSections.GeSectionName(section); con.WriteLine(name); } while (true) { SysCalls.ThreadSleep(0); //SysCalls.WriteDebugChar('~'); var gotBytes = SysCalls.ReadFile(kb, buf); if (gotBytes > 0) { for (var byteIdx = 0; byteIdx < gotBytes; byteIdx++) { var bufPtr = (byte *)buf.Start; var key = bufPtr[byteIdx]; var s = key.ToString("x"); //for (var i = 0; i < s.Length; i++) // SysCalls.WriteDebugChar(s[i]); //SysCalls.WriteDebugChar(' '); for (var i = 0; i < s.Length; i++) { con.Write(s[i]); } con.Write(' '); } } //SysCalls.WriteDebugChar('?'); } }