More terminal changes.
git-svn-id: https://spexeah.com:8443/svn/Asuro@223 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
6fccbddc62
commit
902919fd02
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/PCI.ppu
BIN
lib/PCI.ppu
Binary file not shown.
BIN
lib/console.ppu
BIN
lib/console.ppu
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/libpsystem.a
BIN
lib/libpsystem.a
Binary file not shown.
Binary file not shown.
@ -40,6 +40,19 @@ begin
|
||||
Terminal.run;
|
||||
end;
|
||||
|
||||
procedure terminal_command_meminfo(buffer : TCommandBuffer);
|
||||
begin
|
||||
console.writestring('Lower Memory = ');
|
||||
console.writeint(multibootinfo^.mem_lower);
|
||||
console.writestringln('KB');
|
||||
console.writestring('Higher Memory = ');
|
||||
console.writeint(multibootinfo^.mem_upper);
|
||||
console.writestringln('KB');
|
||||
console.writestring('Total Memory = ');
|
||||
console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1);
|
||||
console.writestringln('MB');
|
||||
end;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
||||
var
|
||||
c : uint8;
|
||||
@ -55,6 +68,9 @@ begin
|
||||
multibootinfo:= mbinfo;
|
||||
multibootmagic:= mbmagic;
|
||||
|
||||
terminal.init();
|
||||
terminal.registerCommand('MEMINFO', @terminal_command_meminfo, 'Print Simple Memory Information.');
|
||||
|
||||
console.init();
|
||||
|
||||
console.writestringln('Booting Asuro...');
|
||||
@ -103,13 +119,13 @@ begin
|
||||
console.writestringln('');
|
||||
console.setdefaultattribute(console.combinecolors(White, Black));
|
||||
console.writestring('Lower Memory = ');
|
||||
console.writeint(mbinfo^.mem_lower);
|
||||
console.writeint(multibootinfo^.mem_lower);
|
||||
console.writestringln('KB');
|
||||
console.writestring('Higher Memory = ');
|
||||
console.writeint(mbinfo^.mem_upper);
|
||||
console.writeint(multibootinfo^.mem_upper);
|
||||
console.writestringln('KB');
|
||||
console.writestring('Total Memory = ');
|
||||
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) + 1);
|
||||
console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1);
|
||||
console.writestringln('MB');
|
||||
console.setdefaultattribute(console.combinecolors(White, Black));
|
||||
console.writestringln('');
|
||||
|
@ -14,7 +14,8 @@ interface
|
||||
uses
|
||||
console,
|
||||
isr32,
|
||||
lmemorymanager;
|
||||
lmemorymanager,
|
||||
terminal;
|
||||
|
||||
const
|
||||
Quantum = 64;
|
||||
@ -79,6 +80,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure terminal_command_tasks(buffer : TCommandBuffer);
|
||||
var
|
||||
list : PScheduler_Entry;
|
||||
|
||||
begin
|
||||
console.writestringln('ThreadID - Priority - Delta');
|
||||
list:= Root_Task;
|
||||
console.writeint(list^.ThreadID);
|
||||
console.writestring(' - ');
|
||||
console.writeint(list^.Priority);
|
||||
console.writestring(' - ');
|
||||
console.writeintln(list^.Delta);
|
||||
list:= PScheduler_Entry(list^.Next);
|
||||
while list <> Root_Task do begin
|
||||
console.writeint(list^.ThreadID);
|
||||
console.writestring(' - ');
|
||||
console.writeint(list^.Priority);
|
||||
console.writestring(' - ');
|
||||
console.writeintln(list^.Delta);
|
||||
list:= PScheduler_Entry(list^.Next);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure init;
|
||||
begin
|
||||
console.writestringln('SCHEDULER: INIT BEGIN.');
|
||||
@ -91,6 +115,7 @@ begin
|
||||
Tick:= 0;
|
||||
Active:= False;
|
||||
isr32.hook(uint32(@delta));
|
||||
terminal.registerCommand('TASKS', @terminal_command_tasks, 'List Active Processes.');
|
||||
console.writestringln('SCHEDULER: INIT END.');
|
||||
end;
|
||||
|
||||
|
@ -11,9 +11,10 @@ type
|
||||
TCommandBuffer = array[0..1023] of byte;
|
||||
TCommandMethod = procedure(buf : TCommandBuffer);
|
||||
TCommand = record
|
||||
registered : boolean;
|
||||
command : pchar;
|
||||
method : TCommandMethod;
|
||||
registered : boolean;
|
||||
command : pchar;
|
||||
method : TCommandMethod;
|
||||
description : pchar;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -22,16 +23,37 @@ var
|
||||
Commands : array[0..65534] of TCommand;
|
||||
|
||||
procedure run;
|
||||
procedure registerCommand(command : pchar; method : TCommandMethod);
|
||||
procedure init;
|
||||
procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar);
|
||||
|
||||
implementation
|
||||
|
||||
procedure version(buffer : TCommandBuffer);
|
||||
procedure clear(buffer : TCommandBuffer);
|
||||
begin
|
||||
writestringln('Asuro v1.0');
|
||||
console.clear();
|
||||
end;
|
||||
|
||||
procedure registerCommand(command : pchar; method : TCommandMethod);
|
||||
procedure version(buffer : TCommandBuffer);
|
||||
begin
|
||||
console.writestringln('Asuro v1.0');
|
||||
end;
|
||||
|
||||
procedure help(buffer : TCommandBuffer);
|
||||
var
|
||||
i : uint32;
|
||||
begin
|
||||
console.writestringln('Registered Commands: ');
|
||||
for i:=0 to 65534 do begin
|
||||
if Commands[i].Registered then begin
|
||||
console.writestring(' ');
|
||||
console.writestring(Commands[i].command);
|
||||
console.writestring(' - ');
|
||||
console.writestringln(Commands[i].description);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar);
|
||||
var
|
||||
index : uint32;
|
||||
|
||||
@ -41,6 +63,7 @@ begin
|
||||
Commands[index].registered:= true;
|
||||
Commands[index].Command:= command;
|
||||
Commands[index].method:= method;
|
||||
Commands[index].description:= description;
|
||||
end;
|
||||
|
||||
procedure upper;
|
||||
@ -63,7 +86,10 @@ var
|
||||
begin
|
||||
isCommand:= true;
|
||||
for i:=0 to bIndex do begin
|
||||
if char(buffer[i]) = ' ' then exit;
|
||||
if char(buffer[i]) = ' ' then begin
|
||||
if i = 0 then isCommand:= false;
|
||||
exit;
|
||||
end;
|
||||
if char(buffer[i]) <> char(command[i]) then begin
|
||||
isCommand:= false;
|
||||
exit;
|
||||
@ -117,11 +143,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure run;
|
||||
procedure init;
|
||||
begin
|
||||
memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand));
|
||||
memset(uint32(@buffer[0]), 0, 1024);
|
||||
registerCommand('VERSION', @version);
|
||||
registerCommand('VERSION', @version, 'Display the running version of Asuro.');
|
||||
registerCommand('CLEAR', @clear, 'Clear the Screen.');
|
||||
registerCommand('HELP', @help, 'Lists all registered commands and their description.')
|
||||
end;
|
||||
|
||||
procedure run;
|
||||
begin
|
||||
keyboard.hook(@key_event);
|
||||
console.clear();
|
||||
console.writestring('Asuro#> ');
|
||||
|
Loading…
x
Reference in New Issue
Block a user