Terminal
git-svn-id: https://spexeah.com:8443/svn/Asuro@214 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
9d27e6cb0f
commit
0478535819
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.o
BIN
lib/console.o
Binary file not shown.
BIN
lib/console.ppu
BIN
lib/console.ppu
Binary file not shown.
BIN
lib/gdt.ppu
BIN
lib/gdt.ppu
Binary file not shown.
BIN
lib/idt.ppu
BIN
lib/idt.ppu
Binary file not shown.
BIN
lib/irq.ppu
BIN
lib/irq.ppu
Binary file not shown.
BIN
lib/isr.ppu
BIN
lib/isr.ppu
Binary file not shown.
BIN
lib/isr0.ppu
BIN
lib/isr0.ppu
Binary file not shown.
BIN
lib/isr1.ppu
BIN
lib/isr1.ppu
Binary file not shown.
BIN
lib/isr10.ppu
BIN
lib/isr10.ppu
Binary file not shown.
BIN
lib/isr11.ppu
BIN
lib/isr11.ppu
Binary file not shown.
BIN
lib/isr12.ppu
BIN
lib/isr12.ppu
Binary file not shown.
BIN
lib/isr13.ppu
BIN
lib/isr13.ppu
Binary file not shown.
BIN
lib/isr14.ppu
BIN
lib/isr14.ppu
Binary file not shown.
BIN
lib/isr15.ppu
BIN
lib/isr15.ppu
Binary file not shown.
BIN
lib/isr16.ppu
BIN
lib/isr16.ppu
Binary file not shown.
BIN
lib/isr17.ppu
BIN
lib/isr17.ppu
Binary file not shown.
BIN
lib/isr18.ppu
BIN
lib/isr18.ppu
Binary file not shown.
BIN
lib/isr2.ppu
BIN
lib/isr2.ppu
Binary file not shown.
BIN
lib/isr3.ppu
BIN
lib/isr3.ppu
Binary file not shown.
BIN
lib/isr32.ppu
BIN
lib/isr32.ppu
Binary file not shown.
BIN
lib/isr33.ppu
BIN
lib/isr33.ppu
Binary file not shown.
BIN
lib/isr4.ppu
BIN
lib/isr4.ppu
Binary file not shown.
BIN
lib/isr40.ppu
BIN
lib/isr40.ppu
Binary file not shown.
BIN
lib/isr5.ppu
BIN
lib/isr5.ppu
Binary file not shown.
BIN
lib/isr6.ppu
BIN
lib/isr6.ppu
Binary file not shown.
BIN
lib/isr7.ppu
BIN
lib/isr7.ppu
Binary file not shown.
BIN
lib/isr8.ppu
BIN
lib/isr8.ppu
Binary file not shown.
BIN
lib/isr9.ppu
BIN
lib/isr9.ppu
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
BIN
lib/keyboard.ppu
BIN
lib/keyboard.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.
BIN
lib/mouse.ppu
Normal file
BIN
lib/mouse.ppu
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/tss.ppu
BIN
lib/tss.ppu
Binary file not shown.
BIN
lib/util.ppu
BIN
lib/util.ppu
Binary file not shown.
Binary file not shown.
@ -77,6 +77,8 @@ procedure writebin32ln(b : uint32);
|
|||||||
procedure writebin32ex(b : uint32; attributes : char);
|
procedure writebin32ex(b : uint32; attributes : char);
|
||||||
procedure writebin32lnex(b : uint32; attributes : char);
|
procedure writebin32lnex(b : uint32; attributes : char);
|
||||||
|
|
||||||
|
procedure backspace;
|
||||||
|
|
||||||
function combinecolors(Foreground, Background : TColor) : char;
|
function combinecolors(Foreground, Background : TColor) : char;
|
||||||
|
|
||||||
procedure _increment_x();
|
procedure _increment_x();
|
||||||
@ -440,6 +442,14 @@ begin
|
|||||||
outb($3D5, b);
|
outb($3D5, b);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure backspace;
|
||||||
|
begin
|
||||||
|
Dec(Console_Cursor.X);
|
||||||
|
writechar(' ');
|
||||||
|
Dec(Console_Cursor.X);
|
||||||
|
_update_cursor();
|
||||||
|
end;
|
||||||
|
|
||||||
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
||||||
begin
|
begin
|
||||||
Console_Cursor.X:= Console_Cursor.X+1;
|
Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
|
@ -28,22 +28,28 @@ uses
|
|||||||
lmemorymanager,
|
lmemorymanager,
|
||||||
tss,
|
tss,
|
||||||
scheduler,
|
scheduler,
|
||||||
PCI;
|
PCI,
|
||||||
|
Terminal;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
procedure temphook(ignored : TKeyInfo);
|
||||||
|
begin
|
||||||
|
Terminal.run;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
||||||
var
|
var
|
||||||
c : uint8;
|
c : uint8;
|
||||||
z : uint32;
|
z : uint32;
|
||||||
dds : uint32;
|
dds : uint32;
|
||||||
pint : puint32;
|
pint : puint32;
|
||||||
pint2 : puint32;
|
pint2 : puint32;
|
||||||
keyboard_layout : array [0..1] of TKeyInfo;
|
keyboard_layout : array [0..1] of TKeyInfo;
|
||||||
i : uint32;
|
i : uint32;
|
||||||
cEIP : uint32;
|
cEIP : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
multibootinfo:= mbinfo;
|
multibootinfo:= mbinfo;
|
||||||
@ -105,7 +111,10 @@ begin
|
|||||||
console.writestring('Total Memory = ');
|
console.writestring('Total Memory = ');
|
||||||
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) + 1);
|
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) + 1);
|
||||||
console.writestringln('MB');
|
console.writestringln('MB');
|
||||||
console.setdefaultattribute(console.combinecolors(lYellow, Black));
|
console.setdefaultattribute(console.combinecolors(White, Black));
|
||||||
|
console.writestringln('');
|
||||||
|
console.writestringln('Press any key to boot in to Asuro Terminal...');
|
||||||
|
keyboard.hook(@temphook);
|
||||||
util.halt_and_dont_catch_fire;
|
util.halt_and_dont_catch_fire;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
52
src/terminal.pas
Normal file
52
src/terminal.pas
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
unit terminal;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
console,
|
||||||
|
keyboard;
|
||||||
|
|
||||||
|
var
|
||||||
|
buffer : array[0..1024] of byte;
|
||||||
|
bIndex : uint32 = 0;
|
||||||
|
|
||||||
|
procedure run;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure process_command;
|
||||||
|
begin
|
||||||
|
console.writecharln(' ');
|
||||||
|
console.writestring('Asuro#> ');
|
||||||
|
bIndex:= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure key_event(info : TKeyInfo);
|
||||||
|
begin
|
||||||
|
if (info.key_code >= 32) and (info.key_code <= 126) then begin
|
||||||
|
if bIndex <= 1024 then begin
|
||||||
|
buffer[bIndex]:= info.key_code;
|
||||||
|
inc(bIndex);
|
||||||
|
console.writechar(char(info.key_code));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if info.key_code = 8 then begin //backspace
|
||||||
|
if bIndex > 0 then begin
|
||||||
|
console.backspace;
|
||||||
|
dec(bIndex);
|
||||||
|
buffer[bIndex]:= 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if info.key_code = 13 then begin //return
|
||||||
|
process_command;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure run;
|
||||||
|
begin
|
||||||
|
keyboard.hook(@key_event);
|
||||||
|
console.clear();
|
||||||
|
console.writestring('Asuro#> ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
x
Reference in New Issue
Block a user