Terminal command registration.
git-svn-id: https://spexeah.com:8443/svn/Asuro@221 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
30877e5d94
commit
9daebbf49b
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
@ -97,13 +97,13 @@ procedure force_alloc_block(block : uint16; caller : uint32);
|
|||||||
begin
|
begin
|
||||||
PhysicalMemory[block].Allocated:= True;
|
PhysicalMemory[block].Allocated:= True;
|
||||||
PhysicalMemory[block].MappedTo:= caller;
|
PhysicalMemory[block].MappedTo:= caller;
|
||||||
console.writestring('PMM: 4MiB Block Force Allocated @ ');
|
// console.writestring('PMM: 4MiB Block Force Allocated @ ');
|
||||||
console.writeword(block);
|
// console.writeword(block);
|
||||||
console.writestring(' [');
|
// console.writestring(' [');
|
||||||
console.writehex(block SHL 22);
|
// console.writehex(block SHL 22);
|
||||||
console.writestring(' - ');
|
// console.writestring(' - ');
|
||||||
console.writehex(((block+1) SHL 22));
|
// console.writehex(((block+1) SHL 22));
|
||||||
console.writestringln(']');
|
// console.writestringln(']');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
@ -128,13 +128,13 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
PhysicalMemory[block].Allocated:= True;
|
PhysicalMemory[block].Allocated:= True;
|
||||||
PhysicalMemory[block].MappedTo:= caller;
|
PhysicalMemory[block].MappedTo:= caller;
|
||||||
console.writestring('PMM: 4MiB Block Allocated @ ');
|
// console.writestring('PMM: 4MiB Block Allocated @ ');
|
||||||
console.writeword(block);
|
// console.writeword(block);
|
||||||
console.writestring(' [');
|
// console.writestring(' [');
|
||||||
console.writehex(block SHL 22);
|
// console.writehex(block SHL 22);
|
||||||
console.writestring(' - ');
|
// console.writestring(' - ');
|
||||||
console.writehex(((block+1) SHL 22));
|
// console.writehex(((block+1) SHL 22));
|
||||||
console.writestringln(']');
|
// console.writestringln(']');
|
||||||
alloc_block:= true;
|
alloc_block:= true;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
|
@ -7,14 +7,55 @@ uses
|
|||||||
keyboard,
|
keyboard,
|
||||||
util;
|
util;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCommandBuffer = array[0..1023] of byte;
|
||||||
|
TCommandMethod = procedure(buf : TCommandBuffer);
|
||||||
|
TCommand = record
|
||||||
|
registered : boolean;
|
||||||
|
command : pchar;
|
||||||
|
method : TCommandMethod;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
buffer : array[0..1023] of byte;
|
buffer : TCommandBuffer;
|
||||||
bIndex : uint32 = 0;
|
bIndex : uint32 = 0;
|
||||||
|
Commands : array[0..65534] of TCommand;
|
||||||
|
|
||||||
procedure run;
|
procedure run;
|
||||||
|
procedure registerCommand(command : pchar; method : TCommandMethod);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
procedure version(buffer : TCommandBuffer);
|
||||||
|
begin
|
||||||
|
writestringln('Asuro v1.0');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure registerCommand(command : pchar; method : TCommandMethod);
|
||||||
|
var
|
||||||
|
index : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
index:= 0;
|
||||||
|
while Commands[index].registered = true do inc(index);
|
||||||
|
Commands[index].registered:= true;
|
||||||
|
Commands[index].Command:= command;
|
||||||
|
Commands[index].method:= method;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure upper;
|
||||||
|
var
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for i:=0 to bIndex do begin
|
||||||
|
if char(buffer[i]) = ' ' then exit;
|
||||||
|
if (buffer[i] >= 97) and (buffer[i] <= 122) then begin
|
||||||
|
buffer[i]:= buffer[i] - 32;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function isCommand(command : pchar) : boolean;
|
function isCommand(command : pchar) : boolean;
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
@ -33,18 +74,19 @@ end;
|
|||||||
procedure process_command;
|
procedure process_command;
|
||||||
var
|
var
|
||||||
fallthrough : boolean;
|
fallthrough : boolean;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
console.writecharln(' ');
|
console.writecharln(' ');
|
||||||
//Process Here
|
|
||||||
fallthrough:= true;
|
fallthrough:= true;
|
||||||
if isCommand('version') then begin
|
upper;
|
||||||
console.writestringln('Asuro v1.0');
|
for i:=0 to 65534 do begin
|
||||||
fallthrough:= false;
|
if Commands[i].registered then begin
|
||||||
end;
|
if isCommand(Commands[i].command) then begin
|
||||||
if isCommand('clear') then begin
|
Commands[i].method(buffer);
|
||||||
console.clear();
|
fallthrough:= false;
|
||||||
fallthrough:= false;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if fallthrough then begin
|
if fallthrough then begin
|
||||||
console.writestringln('Unknown Command.');
|
console.writestringln('Unknown Command.');
|
||||||
@ -77,7 +119,9 @@ end;
|
|||||||
|
|
||||||
procedure run;
|
procedure run;
|
||||||
begin
|
begin
|
||||||
|
memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand));
|
||||||
memset(uint32(@buffer[0]), 0, 1024);
|
memset(uint32(@buffer[0]), 0, 1024);
|
||||||
|
registerCommand('VERSION', @version);
|
||||||
keyboard.hook(@key_event);
|
keyboard.hook(@key_event);
|
||||||
console.clear();
|
console.clear();
|
||||||
console.writestring('Asuro#> ');
|
console.writestring('Asuro#> ');
|
||||||
|
@ -112,22 +112,22 @@ begin
|
|||||||
PD^[page_number].PageSize:= true;
|
PD^[page_number].PageSize:= true;
|
||||||
PD^[page_number].Writable:= true;
|
PD^[page_number].Writable:= true;
|
||||||
|
|
||||||
console.writestringln('VMM: New Page Added:');
|
//console.writestringln('VMM: New Page Added:');
|
||||||
|
|
||||||
console.writestring('VMM: - P:');
|
//console.writestring('VMM: - P:');
|
||||||
console.writehex(page_number);
|
//console.writehex(page_number);
|
||||||
console.writestring('-->B:');
|
// console.writestring('-->B:');
|
||||||
console.writehexln(block);
|
// console.writehexln(block);
|
||||||
|
|
||||||
console.writestring('VMM: - P:[');
|
// console.writestring('VMM: - P:[');
|
||||||
console.writehex(page_number SHL 22);
|
// console.writehex(page_number SHL 22);
|
||||||
console.writestring(' - ');
|
// console.writestring(' - ');
|
||||||
console.writehex(((page_number+1) SHL 22));
|
// console.writehex(((page_number+1) SHL 22));
|
||||||
console.writestring(']-->B:[');
|
// console.writestring(']-->B:[');
|
||||||
console.writehex(block SHL 22);
|
// console.writehex(block SHL 22);
|
||||||
console.writestring(' - ');
|
// console.writestring(' - ');
|
||||||
console.writehex(((block+1) SHL 22));
|
// console.writehex(((block+1) SHL 22));
|
||||||
console.writestringln(']');
|
// console.writestringln(']');
|
||||||
map_page_ex:= true;
|
map_page_ex:= true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user