terminal stuff

git-svn-id: https://spexeah.com:8443/svn/Asuro@217 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2017-10-23 08:31:25 +00:00
parent e51e15956a
commit 86ec6074a2
8 changed files with 23 additions and 3 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,27 +4,46 @@ interface
uses uses
console, console,
keyboard; keyboard,
util;
var var
buffer : array[0..1024] of byte; buffer : array[0..1023] of byte;
bIndex : uint32 = 0; bIndex : uint32 = 0;
procedure run; procedure run;
implementation implementation
function isCommand(command : pchar) : boolean;
var
i : uint32;
begin
isCommand:= true;
for i:=0 to bIndex do begin
if char(buffer[i]) = ' ' then exit;
if char(buffer[i]) <> char(command[i]) then begin
isCommand:= false;
exit;
end;
end;
end;
procedure process_command; procedure process_command;
begin begin
console.writecharln(' '); console.writecharln(' ');
//Process Here
if isCommand('version') then console.writestringln('Asuro v1.0');
console.writestring('Asuro#> '); console.writestring('Asuro#> ');
bIndex:= 0; bIndex:= 0;
memset(uint32(@buffer[0]), 0, 1024);
end; end;
procedure key_event(info : TKeyInfo); procedure key_event(info : TKeyInfo);
begin begin
if (info.key_code >= 32) and (info.key_code <= 126) then begin if (info.key_code >= 32) and (info.key_code <= 126) then begin
if bIndex <= 1024 then begin if bIndex < 1024 then begin
buffer[bIndex]:= info.key_code; buffer[bIndex]:= info.key_code;
inc(bIndex); inc(bIndex);
console.writechar(char(info.key_code)); console.writechar(char(info.key_code));
@ -44,6 +63,7 @@ end;
procedure run; procedure run;
begin begin
memset(uint32(@buffer[0]), 0, 1024);
keyboard.hook(@key_event); keyboard.hook(@key_event);
console.clear(); console.clear();
console.writestring('Asuro#> '); console.writestring('Asuro#> ');