git-svn-id: https://spexeah.com:8443/svn/Asuro@573 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
8d86e73c1a
commit
aeb9aeecde
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
@ -22,6 +22,8 @@ echo " "
|
|||||||
echo "======================="
|
echo "======================="
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
|
./versioning.sh
|
||||||
|
|
||||||
if [ "$1" = "-d" ]
|
if [ "$1" = "-d" ]
|
||||||
then
|
then
|
||||||
echo "Compiling Debug FPC Sources..."
|
echo "Compiling Debug FPC Sources..."
|
||||||
|
Binary file not shown.
BIN
lib/ACE.ppu
BIN
lib/ACE.ppu
Binary file not shown.
BIN
lib/BPE.ppu
BIN
lib/BPE.ppu
Binary file not shown.
BIN
lib/BTSSE.ppu
BIN
lib/BTSSE.ppu
Binary file not shown.
BIN
lib/CFE.ppu
BIN
lib/CFE.ppu
Binary file not shown.
BIN
lib/CSOE.ppu
BIN
lib/CSOE.ppu
Binary file not shown.
BIN
lib/DBGE.ppu
BIN
lib/DBGE.ppu
Binary file not shown.
BIN
lib/DBZ.ppu
BIN
lib/DBZ.ppu
Binary file not shown.
BIN
lib/DFE.ppu
BIN
lib/DFE.ppu
Binary file not shown.
BIN
lib/E1000.ppu
BIN
lib/E1000.ppu
Binary file not shown.
BIN
lib/GPF.ppu
BIN
lib/GPF.ppu
Binary file not shown.
BIN
lib/IDE.ppu
BIN
lib/IDE.ppu
Binary file not shown.
BIN
lib/IDOE.ppu
BIN
lib/IDOE.ppu
Binary file not shown.
BIN
lib/IOPE.ppu
BIN
lib/IOPE.ppu
Binary file not shown.
BIN
lib/MCE.ppu
BIN
lib/MCE.ppu
Binary file not shown.
BIN
lib/NCE.ppu
BIN
lib/NCE.ppu
Binary file not shown.
BIN
lib/NMIE.ppu
BIN
lib/NMIE.ppu
Binary file not shown.
BIN
lib/OOBE.ppu
BIN
lib/OOBE.ppu
Binary file not shown.
BIN
lib/PCI.ppu
BIN
lib/PCI.ppu
Binary file not shown.
BIN
lib/PF.ppu
BIN
lib/PF.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/RTC.ppu
BIN
lib/RTC.ppu
Binary file not shown.
BIN
lib/SFE.ppu
BIN
lib/SFE.ppu
Binary file not shown.
BIN
lib/SNPE.ppu
BIN
lib/SNPE.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/UIE.ppu
BIN
lib/UIE.ppu
Binary file not shown.
BIN
lib/USB.ppu
BIN
lib/USB.ppu
Binary file not shown.
BIN
lib/arp.ppu
BIN
lib/arp.ppu
Binary file not shown.
BIN
lib/asuro.ppu
Normal file
BIN
lib/asuro.ppu
Normal file
Binary file not shown.
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.
Binary file not shown.
BIN
lib/eth2.ppu
BIN
lib/eth2.ppu
Binary file not shown.
BIN
lib/fat32.ppu
BIN
lib/fat32.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/ipv4.ppu
BIN
lib/ipv4.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/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.
BIN
lib/lists.ppu
BIN
lib/lists.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/mouse.ppu
BIN
lib/mouse.ppu
Binary file not shown.
BIN
lib/net.ppu
BIN
lib/net.ppu
Binary file not shown.
BIN
lib/netutils.ppu
BIN
lib/netutils.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/strings.ppu
BIN
lib/strings.ppu
Binary file not shown.
BIN
lib/terminal.ppu
BIN
lib/terminal.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/tracer.ppu
BIN
lib/tracer.ppu
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.
628
src/console.pas
628
src/console.pas
@ -96,6 +96,64 @@ procedure _safeincrement_y();
|
|||||||
procedure _safeincrement_x();
|
procedure _safeincrement_x();
|
||||||
procedure _newline();
|
procedure _newline();
|
||||||
|
|
||||||
|
{ WND Specific }
|
||||||
|
|
||||||
|
procedure clearWND(WND : uint32);
|
||||||
|
|
||||||
|
procedure writecharWND(character : char; WND : uint32);
|
||||||
|
procedure writecharlnWND(character : char; WND : uint32);
|
||||||
|
procedure writecharexWND(character : char; attributes: uint32; WND : uint32);
|
||||||
|
procedure writecharlnexWND(character : char; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure OutputWND(identifier : PChar; str : PChar; WND : uint32);
|
||||||
|
procedure OutputlnWND(identifier : PChar; str : PChar; WND : uint32);
|
||||||
|
|
||||||
|
procedure writestringWND(str: PChar; WND : uint32);
|
||||||
|
procedure writestringlnWND(str: PChar; WND : uint32);
|
||||||
|
procedure writestringexWND(str: PChar; attributes: uint32; WND : uint32);
|
||||||
|
procedure writestringlnexWND(str: PChar; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writeintWND(i: Integer; WND : uint32);
|
||||||
|
procedure writeintlnWND(i: Integer; WND : uint32);
|
||||||
|
procedure writeintexWND(i: Integer; attributes: uint32; WND : uint32);
|
||||||
|
procedure writeintlnexWND(i: Integer; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writewordWND(i: DWORD; WND : uint32);
|
||||||
|
procedure writewordlnWND(i: DWORD; WND : uint32);
|
||||||
|
procedure writewordexWND(i: DWORD; attributes: uint32; WND : uint32);
|
||||||
|
procedure writewordlnexWND(i: DWORD; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writehexpairWND(b : uint8; WND : uint32);
|
||||||
|
procedure writehexWND(i: DWORD; WND : uint32);
|
||||||
|
procedure writehexlnWND(i: DWORD; WND : uint32);
|
||||||
|
procedure writehexexWND(i : DWORD; attributes: uint32; WND : uint32);
|
||||||
|
procedure writehexlnexWND(i: DWORD; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writebin8WND(b : uint8; WND : uint32);
|
||||||
|
procedure writebin8lnWND(b : uint8; WND : uint32);
|
||||||
|
procedure writebin8exWND(b : uint8; attributes: uint32; WND : uint32);
|
||||||
|
procedure writebin8lnexWND(b : uint8; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writebin16WND(b : uint16; WND : uint32);
|
||||||
|
procedure writebin16lnWND(b : uint16; WND : uint32);
|
||||||
|
procedure writebin16exWND(b : uint16; attributes: uint32; WND : uint32);
|
||||||
|
procedure writebin16lnexWND(b : uint16; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure writebin32WND(b : uint32; WND : uint32);
|
||||||
|
procedure writebin32lnWND(b : uint32; WND : uint32);
|
||||||
|
procedure writebin32exWND(b : uint32; attributes: uint32; WND : uint32);
|
||||||
|
procedure writebin32lnexWND(b : uint32; attributes: uint32; WND : uint32);
|
||||||
|
|
||||||
|
procedure backspaceWND(WND : uint32);
|
||||||
|
|
||||||
|
procedure _increment_x_WND(WND : uint32);
|
||||||
|
procedure _increment_y_WND(WND : uint32);
|
||||||
|
procedure _safeincrement_y_WND(WND : uint32);
|
||||||
|
procedure _safeincrement_x_WND(WND : uint32);
|
||||||
|
procedure _newlineWND(WND : uint32);
|
||||||
|
|
||||||
|
{ Drawing }
|
||||||
|
|
||||||
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
|
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
|
||||||
procedure outputCharToScreenSpace(c : char; x : uint32; y : uint32; fgcolor : uint16);
|
procedure outputCharToScreenSpace(c : char; x : uint32; y : uint32; fgcolor : uint16);
|
||||||
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
|
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
|
||||||
@ -107,9 +165,13 @@ procedure drawPixel32(x : uint32; y : uint32; pixel : uint32);
|
|||||||
function getPixel64(x : uint32; y : uint32) : uint64;
|
function getPixel64(x : uint32; y : uint32) : uint64;
|
||||||
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
|
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
|
||||||
|
|
||||||
procedure setMousePosition(x : uint32; y : uint32);
|
{ Windows Methods }
|
||||||
|
|
||||||
|
procedure setMousePosition(x : uint32; y : uint32);
|
||||||
procedure redrawWindows;
|
procedure redrawWindows;
|
||||||
|
procedure toggleWNDVisible(WND : uint32);
|
||||||
|
procedure setWNDVisible(WND : uint32; visible : boolean);
|
||||||
|
procedure closeAllWindows;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -117,7 +179,8 @@ uses
|
|||||||
lmemorymanager, strings;
|
lmemorymanager, strings;
|
||||||
|
|
||||||
const
|
const
|
||||||
MAX_WINDOWS = 5;
|
MAX_WINDOWS = 10;
|
||||||
|
DefaultWND = 0;
|
||||||
|
|
||||||
type
|
type
|
||||||
TConsoleProperties = record
|
TConsoleProperties = record
|
||||||
@ -179,12 +242,31 @@ var
|
|||||||
Console_Cursor : TCoord; //The text cursor position
|
Console_Cursor : TCoord; //The text cursor position
|
||||||
WindowManager : TWindowManager; //Window Manager
|
WindowManager : TWindowManager; //Window Manager
|
||||||
Ready : Boolean = false; //Is the unit ready for use?
|
Ready : Boolean = false; //Is the unit ready for use?
|
||||||
FocusedWND : uint32 = 0; //The currently focused Window for printing
|
|
||||||
MouseDrawActive : Boolean = false; //Is the Mouse currently being updated?
|
MouseDrawActive : Boolean = false; //Is the Mouse currently being updated?
|
||||||
mouse_dirt : TMouseDirt; //Character Cell(s) the mouse occupies, these need to be rewritten on mouse move.
|
mouse_dirt : TMouseDirt; //Character Cell(s) the mouse occupies, these need to be rewritten on mouse move.
|
||||||
Window_Border : TCharacter;
|
Window_Border : TCharacter;
|
||||||
Default_Char : TCharacter;
|
Default_Char : TCharacter;
|
||||||
|
|
||||||
|
procedure closeAllWindows;
|
||||||
|
var
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for i:=1 to MAX_WINDOWS-1 do begin
|
||||||
|
setWNDVisible(i, false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure setWNDVisible(WND : uint32; visible : boolean);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].visible:= visible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure toggleWNDVisible(WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].visible:= not WindowManager.Windows[WND].visible;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure drawMouse;
|
procedure drawMouse;
|
||||||
var
|
var
|
||||||
x, y : uint32;
|
x, y : uint32;
|
||||||
@ -315,9 +397,7 @@ begin
|
|||||||
WindowManager.Windows[w].visible:= false;
|
WindowManager.Windows[w].visible:= false;
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to 63 do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to 159 do begin
|
||||||
WindowManager.Windows[w].Buffer[y][x].visible:= true;
|
WindowManager.Windows[w].Buffer[y][x]:= Default_Char;
|
||||||
WindowManager.Windows[w].Buffer[y][x].character:= ' ';
|
|
||||||
WindowManager.Windows[w].Buffer[y][x].attributes:= Console_Properties.Default_Attribute;
|
|
||||||
Console_Real[y][x].character:= char(1);
|
Console_Real[y][x].character:= char(1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -328,25 +408,13 @@ begin
|
|||||||
WindowManager.Windows[0].WND_Y:= 0;
|
WindowManager.Windows[0].WND_Y:= 0;
|
||||||
WindowManager.Windows[0].WND_H:= 63;
|
WindowManager.Windows[0].WND_H:= 63;
|
||||||
WindowManager.Windows[0].WND_W:= 159;
|
WindowManager.Windows[0].WND_W:= 159;
|
||||||
for y:=0 to 63 do begin
|
|
||||||
for x:=0 to 159 do begin
|
|
||||||
WindowManager.Windows[0].Buffer[y][x].visible:= true;
|
|
||||||
WindowManager.Windows[0].Buffer[y][x].character:= ' ';
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
WindowManager.Windows[1].visible:= true;
|
WindowManager.Windows[1].visible:= false;
|
||||||
WindowManager.Windows[1].WND_X:= 50;
|
WindowManager.Windows[1].WND_X:= 20;
|
||||||
WindowManager.Windows[1].WND_W:= 50;
|
WindowManager.Windows[1].WND_W:= 90;
|
||||||
WindowManager.Windows[1].WND_Y:= 20;
|
WindowManager.Windows[1].WND_Y:= 10;
|
||||||
WindowManager.Windows[1].WND_H:= 20;
|
WindowManager.Windows[1].WND_H:= 20;
|
||||||
WindowManager.Windows[1].WND_NAME:= 'Test Window';
|
WindowManager.Windows[1].WND_NAME:= 'ASURO TERMINAL';
|
||||||
for y:=0 to 63 do begin
|
|
||||||
for x:=0 to 159 do begin
|
|
||||||
WindowManager.Windows[1].Buffer[y][x].visible:= true;
|
|
||||||
WindowManager.Windows[1].Buffer[y][x].character:= ' ';
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getPixel(x : uint32; y : uint32) : uint16;
|
function getPixel(x : uint32; y : uint32) : uint16;
|
||||||
@ -518,6 +586,8 @@ Begin
|
|||||||
Ready:= True;
|
Ready:= True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Default Console Write Functions }
|
||||||
|
|
||||||
procedure clear(); [public, alias: 'console_clear'];
|
procedure clear(); [public, alias: 'console_clear'];
|
||||||
var
|
var
|
||||||
x,y: Byte;
|
x,y: Byte;
|
||||||
@ -525,16 +595,16 @@ var
|
|||||||
begin
|
begin
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to 63 do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to 159 do begin
|
||||||
WindowManager.Windows[FocusedWND].Buffer[y][x].Character:= ' ';
|
WindowManager.Windows[DefaultWND].Buffer[y][x].Character:= ' ';
|
||||||
WindowManager.Windows[FocusedWND].Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
WindowManager.Windows[DefaultWND].Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
WindowManager.Windows[FocusedWND].row_dirty[y]:= true;
|
WindowManager.Windows[DefaultWND].row_dirty[y]:= true;
|
||||||
//Console_Matrix[y][x].Character:= ' ';
|
//Console_Matrix[y][x].Character:= ' ';
|
||||||
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
WindowManager.Windows[FocusedWND].Cursor.X:= 0;
|
WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||||
WindowManager.Windows[FocusedWND].Cursor.Y:= 0;
|
WindowManager.Windows[DefaultWND].Cursor.Y:= 0;
|
||||||
redrawWindows;
|
redrawWindows;
|
||||||
//Console_Cursor.X:= 0;
|
//Console_Cursor.X:= 0;
|
||||||
//Console_Cursor.Y:= 0;
|
//Console_Cursor.Y:= 0;
|
||||||
@ -675,12 +745,12 @@ end;
|
|||||||
|
|
||||||
procedure writecharex(character: char; attributes: uint32); [public, alias: 'console_writecharex'];
|
procedure writecharex(character: char; attributes: uint32); [public, alias: 'console_writecharex'];
|
||||||
begin
|
begin
|
||||||
WindowManager.Windows[FocusedWND].Buffer[WindowManager.Windows[FocusedWND].Cursor.Y][WindowManager.Windows[FocusedWND].Cursor.X].Character:= character;
|
WindowManager.Windows[DefaultWND].Buffer[WindowManager.Windows[DefaultWND].Cursor.Y][WindowManager.Windows[DefaultWND].Cursor.X].Character:= character;
|
||||||
WindowManager.Windows[FocusedWND].Buffer[WindowManager.Windows[FocusedWND].Cursor.Y][WindowManager.Windows[FocusedWND].Cursor.X].Attributes:= attributes;
|
WindowManager.Windows[DefaultWND].Buffer[WindowManager.Windows[DefaultWND].Cursor.Y][WindowManager.Windows[DefaultWND].Cursor.X].Attributes:= attributes;
|
||||||
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||||
WindowManager.Windows[FocusedWND].row_dirty[WindowManager.Windows[FocusedWND].Cursor.Y]:= true;
|
WindowManager.Windows[DefaultWND].row_dirty[WindowManager.Windows[DefaultWND].Cursor.Y]:= true;
|
||||||
console._safeincrement_x();
|
console._safeincrement_x();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -890,21 +960,21 @@ begin
|
|||||||
//outb($3D4, $0E);
|
//outb($3D4, $0E);
|
||||||
//b:= pos shr 8;
|
//b:= pos shr 8;
|
||||||
//outb($3D5, b);
|
//outb($3D5, b);
|
||||||
redrawWindows;
|
//redrawWindows;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure backspace;
|
procedure backspace;
|
||||||
begin
|
begin
|
||||||
Dec(WindowManager.Windows[FocusedWND].Cursor.X);
|
Dec(WindowManager.Windows[DefaultWND].Cursor.X);
|
||||||
writechar(' ');
|
writechar(' ');
|
||||||
Dec(WindowManager.Windows[FocusedWND].Cursor.X);
|
Dec(WindowManager.Windows[DefaultWND].Cursor.X);
|
||||||
_update_cursor();
|
_update_cursor();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
||||||
begin
|
begin
|
||||||
WindowManager.Windows[FocusedWND].Cursor.X:= WindowManager.Windows[FocusedWND].Cursor.X+1;
|
WindowManager.Windows[DefaultWND].Cursor.X:= WindowManager.Windows[DefaultWND].Cursor.X+1;
|
||||||
If WindowManager.Windows[FocusedWND].Cursor.X > WindowManager.Windows[FocusedWND].WND_W-1 then WindowManager.Windows[FocusedWND].Cursor.X:= 0;
|
If WindowManager.Windows[DefaultWND].Cursor.X > WindowManager.Windows[DefaultWND].WND_W-1 then WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||||
console._update_cursor;
|
console._update_cursor;
|
||||||
//Console_Cursor.X:= Console_Cursor.X+1;
|
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
//If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
//If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
||||||
@ -913,10 +983,10 @@ end;
|
|||||||
|
|
||||||
procedure _increment_y(); [public, alias: '_console_increment_y'];
|
procedure _increment_y(); [public, alias: '_console_increment_y'];
|
||||||
begin
|
begin
|
||||||
WindowManager.Windows[FocusedWND].Cursor.Y:= WindowManager.Windows[FocusedWND].Cursor.Y+1;
|
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].Cursor.Y+1;
|
||||||
If WindowManager.Windows[FocusedWND].Cursor.Y > WindowManager.Windows[FocusedWND].WND_H-1 then begin
|
If WindowManager.Windows[DefaultWND].Cursor.Y > WindowManager.Windows[DefaultWND].WND_H-1 then begin
|
||||||
console._newline();
|
console._newline();
|
||||||
WindowManager.Windows[FocusedWND].Cursor.Y:= WindowManager.Windows[FocusedWND].WND_H-1;
|
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].WND_H-1;
|
||||||
end;
|
end;
|
||||||
console._update_cursor;
|
console._update_cursor;
|
||||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
@ -929,8 +999,8 @@ end;
|
|||||||
|
|
||||||
procedure _safeincrement_x(); [public, alias: '_console_safeincrement_x'];
|
procedure _safeincrement_x(); [public, alias: '_console_safeincrement_x'];
|
||||||
begin
|
begin
|
||||||
WindowManager.Windows[FocusedWND].Cursor.X:= WindowManager.Windows[FocusedWND].Cursor.X+1;
|
WindowManager.Windows[DefaultWND].Cursor.X:= WindowManager.Windows[DefaultWND].Cursor.X+1;
|
||||||
if WindowManager.Windows[FocusedWND].Cursor.X > WindowManager.Windows[FocusedWND].WND_W-1 then begin
|
if WindowManager.Windows[DefaultWND].Cursor.X > WindowManager.Windows[DefaultWND].WND_W-1 then begin
|
||||||
console._safeincrement_y();
|
console._safeincrement_y();
|
||||||
end;
|
end;
|
||||||
console._update_cursor;
|
console._update_cursor;
|
||||||
@ -943,12 +1013,12 @@ end;
|
|||||||
|
|
||||||
procedure _safeincrement_y(); [public, alias: '_console_safeincrement_y'];
|
procedure _safeincrement_y(); [public, alias: '_console_safeincrement_y'];
|
||||||
begin
|
begin
|
||||||
WindowManager.Windows[FocusedWND].Cursor.Y:= WindowManager.Windows[FocusedWND].Cursor.Y+1;
|
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].Cursor.Y+1;
|
||||||
if WindowManager.Windows[FocusedWND].Cursor.Y > WindowManager.Windows[FocusedWND].WND_H-1 then begin
|
if WindowManager.Windows[DefaultWND].Cursor.Y > WindowManager.Windows[DefaultWND].WND_H-1 then begin
|
||||||
console._newline();
|
console._newline();
|
||||||
WindowManager.Windows[FocusedWND].Cursor.Y:= WindowManager.Windows[FocusedWND].WND_H-1;
|
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].WND_H-1;
|
||||||
end;
|
end;
|
||||||
WindowManager.Windows[FocusedWND].Cursor.X:= 0;
|
WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||||
console._update_cursor;
|
console._update_cursor;
|
||||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
//If Console_Cursor.Y > 63 then begin
|
//If Console_Cursor.Y > 63 then begin
|
||||||
@ -964,18 +1034,468 @@ var
|
|||||||
x, y : byte;
|
x, y : byte;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if WindowManager.Windows[FocusedWND].WND_W = 0 then exit;
|
if WindowManager.Windows[DefaultWND].WND_W = 0 then exit;
|
||||||
if WindowManager.Windows[FocusedWND].WND_H = 0 then exit;
|
if WindowManager.Windows[DefaultWND].WND_H = 0 then exit;
|
||||||
for x:=0 to WindowManager.Windows[FocusedWND].WND_W do begin
|
for x:=0 to WindowManager.Windows[DefaultWND].WND_W do begin
|
||||||
for y:=0 to WindowManager.Windows[FocusedWND].WND_H-1 do begin
|
for y:=0 to WindowManager.Windows[DefaultWND].WND_H-1 do begin
|
||||||
WindowManager.Windows[FocusedWND].buffer[y][x]:= WindowManager.Windows[FocusedWND].buffer[y+1][x];
|
WindowManager.Windows[DefaultWND].buffer[y][x]:= WindowManager.Windows[DefaultWND].buffer[y+1][x];
|
||||||
WindowManager.Windows[FocusedWND].row_dirty[y]:= true;
|
WindowManager.Windows[DefaultWND].row_dirty[y]:= true;
|
||||||
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
for x:=0 to WindowManager.Windows[FocusedWND].WND_W do begin
|
for x:=0 to WindowManager.Windows[DefaultWND].WND_W do begin
|
||||||
WindowManager.Windows[FocusedWND].buffer[WindowManager.Windows[FocusedWND].WND_H-1][x].Character:= ' ';
|
WindowManager.Windows[DefaultWND].buffer[WindowManager.Windows[DefaultWND].WND_H-1][x].Character:= ' ';
|
||||||
WindowManager.Windows[FocusedWND].buffer[WindowManager.Windows[FocusedWND].WND_H-1][x].Attributes:= $FFFF0000;
|
WindowManager.Windows[DefaultWND].buffer[WindowManager.Windows[DefaultWND].WND_H-1][x].Attributes:= $FFFF0000;
|
||||||
|
//Console_Matrix[63][x].Character:= ' ';
|
||||||
|
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||||
|
end;
|
||||||
|
//for y:=0 to 63 do begin
|
||||||
|
// for x:=0 to 159 do begin
|
||||||
|
// OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||||
|
// end;
|
||||||
|
//end;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ WND Specific Console Draw Functions }
|
||||||
|
|
||||||
|
procedure clearWND(WND : uint32);
|
||||||
|
var
|
||||||
|
x,y: Byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for y:=0 to 63 do begin
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
WindowManager.Windows[WND].Buffer[y][x].Character:= ' ';
|
||||||
|
WindowManager.Windows[WND].Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
|
WindowManager.Windows[WND].row_dirty[y]:= true;
|
||||||
|
//Console_Matrix[y][x].Character:= ' ';
|
||||||
|
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
|
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
WindowManager.Windows[WND].Cursor.X:= 0;
|
||||||
|
WindowManager.Windows[WND].Cursor.Y:= 0;
|
||||||
|
redrawWindows;
|
||||||
|
//Console_Cursor.X:= 0;
|
||||||
|
//Console_Cursor.Y:= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8exWND(b : uint8; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Mask:= PMask(@b);
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharexWND('1', attributes, WND) else writecharexWND('0', attributes, WND);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16exWND(b : uint16; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i,j : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for j:=1 downto 0 do begin
|
||||||
|
Mask:= PMask(uint32(@b) + (1 * j));
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharexWND('1', attributes, WND) else writecharexWND('0', attributes, WND);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32exWND(b : uint32; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i,j : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for j:=3 downto 0 do begin
|
||||||
|
Mask:= PMask(uint32(@b) + (1 * j));
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharexWND('1', attributes, WND) else writecharexWND('0', attributes, WND);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8WND(b : uint8; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin8exWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16WND(b : uint16; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin16exWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32WND(b : uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin32exWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8lnexWND(b : uint8; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin8exWND(b, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16lnexWND(b : uint16; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin16exWND(b, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32lnexWND(b : uint32; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin32exWND(b, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8lnWND(b : uint8; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin8lnexWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16lnWND(b : uint16; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin16lnexWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32lnWND(b : uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
writebin32lnexWND(b, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{procedure setdefaultattribute(attribute: uint32); [public, alias: 'console_setdefaultattribute'];
|
||||||
|
begin
|
||||||
|
Console_Properties.Default_Attribute:= attribute;
|
||||||
|
end;}
|
||||||
|
|
||||||
|
procedure writecharWND(character: char; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writecharexWND(character, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringWND(str: PChar; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writestringexWND(str, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintWND(i: Integer; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writeintexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordWND(i: DWORD; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writewordexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharlnWND(character: char; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writecharlnexWND(character, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringlnWND(str: PChar; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writestringlnexWND(str, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintlnWND(i: Integer; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writeintlnexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordlnWND(i: DWORD; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writewordlnexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharexWND(character: char; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].Buffer[WindowManager.Windows[WND].Cursor.Y][WindowManager.Windows[WND].Cursor.X].Character:= character;
|
||||||
|
WindowManager.Windows[WND].Buffer[WindowManager.Windows[WND].Cursor.Y][WindowManager.Windows[WND].Cursor.X].Attributes:= attributes;
|
||||||
|
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||||
|
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||||
|
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||||
|
WindowManager.Windows[WND].row_dirty[WindowManager.Windows[WND].Cursor.Y]:= true;
|
||||||
|
console._safeincrement_x_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexpairWND(b : uint8; WND : uint32);
|
||||||
|
var
|
||||||
|
bn : Array[0..1] of uint8;
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
bn[0]:= b SHR 4;
|
||||||
|
bn[1]:= b AND $0F;
|
||||||
|
for i:=0 to 1 do begin
|
||||||
|
case bn[i] of
|
||||||
|
0 :writestringWND('0', WND);
|
||||||
|
1 :writestringWND('1', WND);
|
||||||
|
2 :writestringWND('2', WND);
|
||||||
|
3 :writestringWND('3', WND);
|
||||||
|
4 :writestringWND('4', WND);
|
||||||
|
5 :writestringWND('5', WND);
|
||||||
|
6 :writestringWND('6', WND);
|
||||||
|
7 :writestringWND('7', WND);
|
||||||
|
8 :writestringWND('8', WND);
|
||||||
|
9 :writestringWND('9', WND);
|
||||||
|
10:writestringWND('A', WND);
|
||||||
|
11:writestringWND('B', WND);
|
||||||
|
12:writestringWND('C', WND);
|
||||||
|
13:writestringWND('D', WND);
|
||||||
|
14:writestringWND('E', WND);
|
||||||
|
15:writestringWND('F', WND);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexexWND(i : dword; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
Hex : Array[0..7] of Byte;
|
||||||
|
Res : DWORD;
|
||||||
|
Rem : DWORD;
|
||||||
|
c : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for c:=0 to 7 do begin
|
||||||
|
Hex[c]:= 0;
|
||||||
|
end;
|
||||||
|
c:=0;
|
||||||
|
Res:= i;
|
||||||
|
Rem:= Res mod 16;
|
||||||
|
while Res > 0 do begin
|
||||||
|
Hex[c]:= Rem;
|
||||||
|
Res:= Res div 16;
|
||||||
|
Rem:= Res mod 16;
|
||||||
|
c:=c+1;
|
||||||
|
end;
|
||||||
|
writestringexWND('0x', attributes, WND);
|
||||||
|
for c:=7 downto 0 do begin
|
||||||
|
if Hex[c] <> 255 then begin
|
||||||
|
case Hex[c] of
|
||||||
|
0:writecharexWND('0', attributes, WND);
|
||||||
|
1:writecharexWND('1', attributes, WND);
|
||||||
|
2:writecharexWND('2', attributes, WND);
|
||||||
|
3:writecharexWND('3', attributes, WND);
|
||||||
|
4:writecharexWND('4', attributes, WND);
|
||||||
|
5:writecharexWND('5', attributes, WND);
|
||||||
|
6:writecharexWND('6', attributes, WND);
|
||||||
|
7:writecharexWND('7', attributes, WND);
|
||||||
|
8:writecharexWND('8', attributes, WND);
|
||||||
|
9:writecharexWND('9', attributes, WND);
|
||||||
|
10:writecharexWND('A', attributes, WND);
|
||||||
|
11:writecharexWND('B', attributes, WND);
|
||||||
|
12:writecharexWND('C', attributes, WND);
|
||||||
|
13:writecharexWND('D', attributes, WND);
|
||||||
|
14:writecharexWND('E', attributes, WND);
|
||||||
|
15:writecharexWND('F', attributes, WND);
|
||||||
|
else writecharexWND('?', attributes, WND);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexWND(i : dword; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writehexexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexlnexWND(i : dword; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writehexexWND(i, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexlnWND(i : dword; WND : uint32);
|
||||||
|
begin
|
||||||
|
writehexlnexWND(i, Console_Properties.Default_Attribute, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure OutputWND(identifier : PChar; str : PChar; WND : uint32);
|
||||||
|
begin
|
||||||
|
writestringWND('[', WND);
|
||||||
|
writestringWND(identifier, WND);
|
||||||
|
writestringWND('] ', WND);
|
||||||
|
writestringWND(str, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure OutputlnWND(identifier : PChar; str : PChar; WND : uint32);
|
||||||
|
begin
|
||||||
|
OutputWND(identifier, str, WND);
|
||||||
|
writestringlnWND(' ', WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringexWND(str: PChar; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
i:= 0;
|
||||||
|
while (str[i] <> #0) do begin
|
||||||
|
console.writecharexWND(str[i], attributes, WND);
|
||||||
|
i:=i+1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintexWND(i: Integer; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
buffer: array [0..11] of Char;
|
||||||
|
str: PChar;
|
||||||
|
digit: DWORD;
|
||||||
|
minus: Boolean;
|
||||||
|
begin
|
||||||
|
str := @buffer[11];
|
||||||
|
str^ := #0;
|
||||||
|
if (i < 0) then begin
|
||||||
|
digit := -i;
|
||||||
|
minus := True;
|
||||||
|
end else begin
|
||||||
|
digit := i;
|
||||||
|
minus := False;
|
||||||
|
end;
|
||||||
|
repeat
|
||||||
|
Dec(str);
|
||||||
|
str^ := Char((digit mod 10) + Byte('0'));
|
||||||
|
digit := digit div 10;
|
||||||
|
until (digit = 0);
|
||||||
|
if (minus) then begin
|
||||||
|
Dec(str);
|
||||||
|
str^ := '-';
|
||||||
|
end;
|
||||||
|
console.writestringexWND(str, attributes, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordexWND(i: DWORD; attributes: uint32; WND : uint32);
|
||||||
|
var
|
||||||
|
buffer: array [0..11] of Char;
|
||||||
|
str: PChar;
|
||||||
|
digit: DWORD;
|
||||||
|
begin
|
||||||
|
for digit := 0 to 10 do buffer[digit] := '0';
|
||||||
|
str := @buffer[11];
|
||||||
|
str^ := #0;
|
||||||
|
digit := i;
|
||||||
|
repeat
|
||||||
|
Dec(str);
|
||||||
|
str^ := Char((digit mod 10) + Byte('0'));
|
||||||
|
digit := digit div 10;
|
||||||
|
until (digit = 0);
|
||||||
|
console.writestringexWND(@Buffer[0], attributes, WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharlnexWND(character: char; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writecharexWND(character, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringlnexWND(str: PChar; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writestringexWND(str, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintlnexWND(i: Integer; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writeintexWND(i, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordlnexWND(i: DWORD; attributes: uint32; WND : uint32);
|
||||||
|
begin
|
||||||
|
console.writewordexWND(i, attributes, WND);
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure backspaceWND(WND : uint32);
|
||||||
|
begin
|
||||||
|
Dec(WindowManager.Windows[WND].Cursor.X);
|
||||||
|
writecharWND(' ', WND);
|
||||||
|
Dec(WindowManager.Windows[WND].Cursor.X);
|
||||||
|
_update_cursor();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _increment_x_WND(WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].Cursor.X:= WindowManager.Windows[WND].Cursor.X+1;
|
||||||
|
If WindowManager.Windows[WND].Cursor.X > WindowManager.Windows[WND].WND_W-1 then WindowManager.Windows[WND].Cursor.X:= 0;
|
||||||
|
console._update_cursor;
|
||||||
|
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
|
//If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
||||||
|
//console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _increment_y_WND(WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].Cursor.Y+1;
|
||||||
|
If WindowManager.Windows[WND].Cursor.Y > WindowManager.Windows[WND].WND_H-1 then begin
|
||||||
|
console._newlineWND(WND);
|
||||||
|
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].WND_H-1;
|
||||||
|
end;
|
||||||
|
console._update_cursor;
|
||||||
|
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
|
//If Console_Cursor.Y > 63 then begin
|
||||||
|
// console._newline();
|
||||||
|
// Console_Cursor.Y:= 63;
|
||||||
|
//end;
|
||||||
|
//console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _safeincrement_x_WND(WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].Cursor.X:= WindowManager.Windows[WND].Cursor.X+1;
|
||||||
|
if WindowManager.Windows[WND].Cursor.X > WindowManager.Windows[WND].WND_W-1 then begin
|
||||||
|
console._safeincrement_y_WND(WND);
|
||||||
|
end;
|
||||||
|
console._update_cursor;
|
||||||
|
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
|
//If Console_Cursor.X > 159 then begin
|
||||||
|
// console._safeincrement_y();
|
||||||
|
//end;
|
||||||
|
//console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _safeincrement_y_WND(WND : uint32);
|
||||||
|
begin
|
||||||
|
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].Cursor.Y+1;
|
||||||
|
if WindowManager.Windows[WND].Cursor.Y > WindowManager.Windows[WND].WND_H-1 then begin
|
||||||
|
console._newlineWND(WND);
|
||||||
|
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].WND_H-1;
|
||||||
|
end;
|
||||||
|
WindowManager.Windows[WND].Cursor.X:= 0;
|
||||||
|
console._update_cursor;
|
||||||
|
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
|
//If Console_Cursor.Y > 63 then begin
|
||||||
|
// console._newline();
|
||||||
|
// Console_Cursor.Y:= 63;
|
||||||
|
//end;
|
||||||
|
//Console_Cursor.X:= 0;
|
||||||
|
//console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _newlineWND(WND : uint32);
|
||||||
|
var
|
||||||
|
x, y : byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if WindowManager.Windows[WND].WND_W = 0 then exit;
|
||||||
|
if WindowManager.Windows[WND].WND_H = 0 then exit;
|
||||||
|
for x:=0 to WindowManager.Windows[WND].WND_W do begin
|
||||||
|
for y:=0 to WindowManager.Windows[WND].WND_H-1 do begin
|
||||||
|
WindowManager.Windows[WND].buffer[y][x]:= WindowManager.Windows[WND].buffer[y+1][x];
|
||||||
|
WindowManager.Windows[WND].row_dirty[y]:= true;
|
||||||
|
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
for x:=0 to WindowManager.Windows[WND].WND_W do begin
|
||||||
|
WindowManager.Windows[WND].buffer[WindowManager.Windows[WND].WND_H-1][x].Character:= ' ';
|
||||||
|
WindowManager.Windows[WND].buffer[WindowManager.Windows[WND].WND_H-1][x].Attributes:= $FFFF0000;
|
||||||
//Console_Matrix[63][x].Character:= ' ';
|
//Console_Matrix[63][x].Character:= ' ';
|
||||||
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||||
end;
|
end;
|
||||||
|
795
src/consoleBK.pas
Normal file
795
src/consoleBK.pas
Normal file
@ -0,0 +1,795 @@
|
|||||||
|
{ ************************************************
|
||||||
|
* Asuro
|
||||||
|
* Unit: console
|
||||||
|
* Description: Basic Console Output
|
||||||
|
************************************************
|
||||||
|
* Author: K Morris
|
||||||
|
* Contributors:
|
||||||
|
************************************************ }
|
||||||
|
|
||||||
|
unit console;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
util,
|
||||||
|
bios_data_area,
|
||||||
|
multiboot,
|
||||||
|
fonts,
|
||||||
|
tracer;
|
||||||
|
|
||||||
|
type
|
||||||
|
TColor = ( Black = $0,
|
||||||
|
Blue = $1,
|
||||||
|
Green = $2,
|
||||||
|
Aqua = $3,
|
||||||
|
Red = $4,
|
||||||
|
Purple = $5,
|
||||||
|
Yellow = $6,
|
||||||
|
White = $7,
|
||||||
|
Gray = $8,
|
||||||
|
lBlue = $9,
|
||||||
|
lGreen = $A,
|
||||||
|
lAqua = $B,
|
||||||
|
lRed = $C,
|
||||||
|
lPurple = $D,
|
||||||
|
lYellow = $E,
|
||||||
|
lWhite = $F );
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
procedure clear();
|
||||||
|
procedure setdefaultattribute(attribute : uint32);
|
||||||
|
|
||||||
|
procedure disable_cursor;
|
||||||
|
|
||||||
|
procedure writechar(character : char);
|
||||||
|
procedure writecharln(character : char);
|
||||||
|
procedure writecharex(character : char; attributes: uint32);
|
||||||
|
procedure writecharlnex(character : char; attributes: uint32);
|
||||||
|
|
||||||
|
procedure Output(identifier : PChar; str : PChar);
|
||||||
|
procedure Outputln(identifier : PChar; str : PChar);
|
||||||
|
|
||||||
|
procedure writestring(str: PChar);
|
||||||
|
procedure writestringln(str: PChar);
|
||||||
|
procedure writestringex(str: PChar; attributes: uint32);
|
||||||
|
procedure writestringlnex(str: PChar; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writeint(i: Integer);
|
||||||
|
procedure writeintln(i: Integer);
|
||||||
|
procedure writeintex(i: Integer; attributes: uint32);
|
||||||
|
procedure writeintlnex(i: Integer; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writeword(i: DWORD);
|
||||||
|
procedure writewordln(i: DWORD);
|
||||||
|
procedure writewordex(i: DWORD; attributes: uint32);
|
||||||
|
procedure writewordlnex(i: DWORD; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writehexpair(b : uint8);
|
||||||
|
procedure writehex(i: DWORD);
|
||||||
|
procedure writehexln(i: DWORD);
|
||||||
|
procedure writehexex(i : DWORD; attributes: uint32);
|
||||||
|
procedure writehexlnex(i: DWORD; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writebin8(b : uint8);
|
||||||
|
procedure writebin8ln(b : uint8);
|
||||||
|
procedure writebin8ex(b : uint8; attributes: uint32);
|
||||||
|
procedure writebin8lnex(b : uint8; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writebin16(b : uint16);
|
||||||
|
procedure writebin16ln(b : uint16);
|
||||||
|
procedure writebin16ex(b : uint16; attributes: uint32);
|
||||||
|
procedure writebin16lnex(b : uint16; attributes: uint32);
|
||||||
|
|
||||||
|
procedure writebin32(b : uint32);
|
||||||
|
procedure writebin32ln(b : uint32);
|
||||||
|
procedure writebin32ex(b : uint32; attributes: uint32);
|
||||||
|
procedure writebin32lnex(b : uint32; attributes: uint32);
|
||||||
|
|
||||||
|
procedure backspace;
|
||||||
|
|
||||||
|
function combinecolors(Foreground, Background : uint16) : uint32;
|
||||||
|
|
||||||
|
procedure _increment_x();
|
||||||
|
procedure _increment_y();
|
||||||
|
procedure _safeincrement_y();
|
||||||
|
procedure _safeincrement_x();
|
||||||
|
procedure _newline();
|
||||||
|
|
||||||
|
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
|
||||||
|
procedure outputCharToScreenSpace(c : char; x : uint32; y : uint32; fgcolor : uint16);
|
||||||
|
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
|
||||||
|
|
||||||
|
function getPixel(x : uint32; y : uint32) : uint16;
|
||||||
|
procedure drawPixel(x : uint32; y : uint32; color : uint16);
|
||||||
|
function getPixel32(x : uint32; y : uint32) : uint32;
|
||||||
|
procedure drawPixel32(x : uint32; y : uint32; pixel : uint32);
|
||||||
|
function getPixel64(x : uint32; y : uint32) : uint64;
|
||||||
|
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
lmemorymanager;
|
||||||
|
|
||||||
|
const
|
||||||
|
MAX_WINDOWS = 10;
|
||||||
|
|
||||||
|
type
|
||||||
|
TConsoleProperties = record
|
||||||
|
Default_Attribute : uint32;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCharacter = bitpacked record
|
||||||
|
Character : Char;
|
||||||
|
attributes : uint32;
|
||||||
|
visible : boolean;
|
||||||
|
end;
|
||||||
|
PCharacter = ^TCharacter;
|
||||||
|
|
||||||
|
TVideoMemory = Array[0..1999] of TCharacter;
|
||||||
|
PVideoMemory = ^TVideoMemory;
|
||||||
|
|
||||||
|
T2DVideoMemory = Array[0..63] of Array[0..159] of TCharacter;
|
||||||
|
P2DVideoMemory = ^T2DVideoMemory;
|
||||||
|
|
||||||
|
TCoord = record
|
||||||
|
X : Byte;
|
||||||
|
Y : Byte;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TWindow = record
|
||||||
|
visible : boolean;
|
||||||
|
buffer : T2DVideoMemory;
|
||||||
|
row_dirty : Array[0..63] of Boolean;
|
||||||
|
invalid : boolean;
|
||||||
|
WND_X : uint32;
|
||||||
|
WND_Y : uint32;
|
||||||
|
WND_W : uint32;
|
||||||
|
WND_H : uint32;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TWindows = Array[0..MAX_WINDOWS-1] of TWindow;
|
||||||
|
|
||||||
|
TWindowManager = record
|
||||||
|
Windows : TWindows;
|
||||||
|
MouseX : uint32;
|
||||||
|
MouseY : uint32;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Console_Properties : TConsoleProperties;
|
||||||
|
Console_Matrix : T2DVideoMemory;
|
||||||
|
Console_Cursor : TCoord;
|
||||||
|
WindowManager : TWindowManager;
|
||||||
|
Ready : Boolean = false;
|
||||||
|
|
||||||
|
procedure redrawWindows;
|
||||||
|
var
|
||||||
|
x, y, w : uint32;
|
||||||
|
row_dirty : Arrray[0..63] of Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for w:=0 to 63 do begin
|
||||||
|
row_dirty[w]:= false;
|
||||||
|
end;
|
||||||
|
for y:=0 to 63 do begin
|
||||||
|
for w:=0 to MAX_WINDOWS-1 do begin
|
||||||
|
if WindowManager.Windows[w].row_dirty[y] OR row_dirty[y] then begin
|
||||||
|
row_dirty[y]:= true;
|
||||||
|
if WindowManager.Windows[w].visible then begin
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
if WindowManager.Windows[w].buffer[x][y].visible then begin
|
||||||
|
if Console_Matrix[x][y].Character <> WindowManager.Windows[w].buffer[x][y].character then begin
|
||||||
|
Console_Matrix[x][y].Character:= WindowManager.Windows[w].buffer[x][y].character;
|
||||||
|
Console_Matrix[x][y].attributes:= WindowManager.Windows[w].buffer[x][y].attributes;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getPixel(x : uint32; y : uint32) : uint16;
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
getPixel:= dest^;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure drawPixel(x : uint32; y : uint32; color : uint16);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest^:= color;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getPixel32(x : uint32; y : uint32) : uint32;
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest32 : puint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest32:= puint32(dest);
|
||||||
|
getPixel32:= dest32[0];
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure drawPixel32(x : uint32; y : uint32; pixel : uint32);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest32 : puint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest32:= puint32(dest);
|
||||||
|
dest32[0]:= pixel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getPixel64(x : uint32; y : uint32) : uint64;
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest64 : puint64;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest64:= puint64(dest);
|
||||||
|
getPixel64:= dest64^;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest64 : puint64;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest64:= puint64(dest);
|
||||||
|
dest64^:= pixel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure outputCharToScreenSpace(c : char; x : uint32; y : uint32; fgcolor : uint16);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest32 : puint32;
|
||||||
|
fgcolor32, bgcolor32 : uint32;
|
||||||
|
mask : puint32;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
fgcolor32:= fgcolor OR (fgcolor SHL 16);
|
||||||
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
|
dest:= dest + (y * 1280) + x;
|
||||||
|
dest32:= puint32(dest);
|
||||||
|
for i:=0 to 15 do begin
|
||||||
|
dest32[(i*640)+0]:= (dest32[(i*640)+0] AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
|
||||||
|
dest32[(i*640)+1]:= (dest32[(i*640)+1] AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
|
||||||
|
dest32[(i*640)+2]:= (dest32[(i*640)+2] AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
|
||||||
|
dest32[(i*640)+3]:= (dest32[(i*640)+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
|
end;
|
||||||
|
//windowmanager.redraw;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest32 : puint32;
|
||||||
|
fgcolor32, bgcolor32 : uint32;
|
||||||
|
mask : puint32;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
fgcolor32:= fgcolor OR (fgcolor SHL 16);
|
||||||
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
|
dest:= dest + (y*(1280 * 16)) + (x * 8);
|
||||||
|
dest32:= puint32(dest);
|
||||||
|
for i:=0 to 15 do begin
|
||||||
|
dest32[(i*640)+0]:= (dest32[(i*640)+0] AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
|
||||||
|
dest32[(i*640)+1]:= (dest32[(i*640)+1] AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
|
||||||
|
dest32[(i*640)+2]:= (dest32[(i*640)+2] AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
|
||||||
|
dest32[(i*640)+3]:= (dest32[(i*640)+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
|
end;
|
||||||
|
//windowmanager.redraw;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
|
||||||
|
var
|
||||||
|
dest : puint16;
|
||||||
|
dest32 : puint32;
|
||||||
|
fgcolor32, bgcolor32 : uint32;
|
||||||
|
mask : puint32;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not ready then exit;
|
||||||
|
fgcolor32:= fgcolor OR (fgcolor SHL 16);
|
||||||
|
bgcolor32:= bgcolor OR (bgcolor SHL 16);
|
||||||
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
|
dest:= dest + (y*(1280 * 16)) + (x * 8);
|
||||||
|
dest32:= puint32(dest);
|
||||||
|
for i:=0 to 15 do begin
|
||||||
|
dest32[(i*640)+0]:= (bgcolor32 AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
|
||||||
|
dest32[(i*640)+1]:= (bgcolor32 AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
|
||||||
|
dest32[(i*640)+2]:= (bgcolor32 AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
|
||||||
|
dest32[(i*640)+3]:= (bgcolor32 AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
|
end;
|
||||||
|
//windowmanager.redraw;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure disable_cursor;
|
||||||
|
begin
|
||||||
|
outb($3D4, $0A);
|
||||||
|
outb($3D5, $20);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(); [public, alias: 'console_init'];
|
||||||
|
var
|
||||||
|
fb: puint32;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
||||||
|
kpalloc(uint32(fb));
|
||||||
|
Console_Properties.Default_Attribute:= console.combinecolors($FFFF, $0000);
|
||||||
|
console.clear();
|
||||||
|
Ready:= True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure clear(); [public, alias: 'console_clear'];
|
||||||
|
var
|
||||||
|
x,y: Byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for y:=0 to 63 do begin
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
Console_Matrix[y][x].Character:= ' ';
|
||||||
|
Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
|
OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Console_Cursor.X:= 0;
|
||||||
|
Console_Cursor.Y:= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8ex(b : uint8; attributes: uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Mask:= PMask(@b);
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharex('1', attributes) else writecharex('0', attributes);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16ex(b : uint16; attributes: uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i,j : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for j:=1 downto 0 do begin
|
||||||
|
Mask:= PMask(uint32(@b) + (1 * j));
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharex('1', attributes) else writecharex('0', attributes);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32ex(b : uint32; attributes: uint32);
|
||||||
|
var
|
||||||
|
Mask : PMask;
|
||||||
|
i,j : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for j:=3 downto 0 do begin
|
||||||
|
Mask:= PMask(uint32(@b) + (1 * j));
|
||||||
|
for i:=0 to 7 do begin
|
||||||
|
If Mask^[7-i] then writecharex('1', attributes) else writecharex('0', attributes);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8(b : uint8);
|
||||||
|
begin
|
||||||
|
writebin8ex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16(b : uint16);
|
||||||
|
begin
|
||||||
|
writebin16ex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32(b : uint32);
|
||||||
|
begin
|
||||||
|
writebin32ex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8lnex(b : uint8; attributes: uint32);
|
||||||
|
begin
|
||||||
|
writebin8ex(b, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16lnex(b : uint16; attributes: uint32);
|
||||||
|
begin
|
||||||
|
writebin16ex(b, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32lnex(b : uint32; attributes: uint32);
|
||||||
|
begin
|
||||||
|
writebin32ex(b, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin8ln(b : uint8);
|
||||||
|
begin
|
||||||
|
writebin8lnex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin16ln(b : uint16);
|
||||||
|
begin
|
||||||
|
writebin16lnex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writebin32ln(b : uint32);
|
||||||
|
begin
|
||||||
|
writebin32lnex(b, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure setdefaultattribute(attribute: uint32); [public, alias: 'console_setdefaultattribute'];
|
||||||
|
begin
|
||||||
|
Console_Properties.Default_Attribute:= attribute;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writechar(character: char); [public, alias: 'console_writechar'];
|
||||||
|
begin
|
||||||
|
console.writecharex(character, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestring(str: PChar); [public, alias: 'console_writestring'];
|
||||||
|
begin
|
||||||
|
console.writestringex(str, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeint(i: Integer); [public, alias: 'console_writeint'];
|
||||||
|
begin
|
||||||
|
console.writeintex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeword(i: DWORD); [public, alias: 'console_writeword'];
|
||||||
|
begin
|
||||||
|
console.writewordex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharln(character: char); [public, alias: 'console_writecharln'];
|
||||||
|
begin
|
||||||
|
console.writecharlnex(character, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringln(str: PChar); [public, alias: 'console_writestringln'];
|
||||||
|
begin
|
||||||
|
console.writestringlnex(str, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintln(i: Integer); [public, alias: 'console_writeintln'];
|
||||||
|
begin
|
||||||
|
console.writeintlnex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordln(i: DWORD); [public, alias: 'console_writewordln'];
|
||||||
|
begin
|
||||||
|
console.writewordlnex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharex(character: char; attributes: uint32); [public, alias: 'console_writecharex'];
|
||||||
|
begin
|
||||||
|
outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||||
|
Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||||
|
Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||||
|
console._safeincrement_x();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexpair(b : uint8);
|
||||||
|
var
|
||||||
|
bn : Array[0..1] of uint8;
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
bn[0]:= b SHR 4;
|
||||||
|
bn[1]:= b AND $0F;
|
||||||
|
for i:=0 to 1 do begin
|
||||||
|
case bn[i] of
|
||||||
|
0:writestring('0');
|
||||||
|
1:writestring('1');
|
||||||
|
2:writestring('2');
|
||||||
|
3:writestring('3');
|
||||||
|
4:writestring('4');
|
||||||
|
5:writestring('5');
|
||||||
|
6:writestring('6');
|
||||||
|
7:writestring('7');
|
||||||
|
8:writestring('8');
|
||||||
|
9:writestring('9');
|
||||||
|
10:writestring('A');
|
||||||
|
11:writestring('B');
|
||||||
|
12:writestring('C');
|
||||||
|
13:writestring('D');
|
||||||
|
14:writestring('E');
|
||||||
|
15:writestring('F');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexex(i : dword; attributes: uint32); [public, alias: 'console_writehexex'];
|
||||||
|
var
|
||||||
|
Hex : Array[0..7] of Byte;
|
||||||
|
Res : DWORD;
|
||||||
|
Rem : DWORD;
|
||||||
|
c : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for c:=0 to 7 do begin
|
||||||
|
Hex[c]:= 0;
|
||||||
|
end;
|
||||||
|
c:=0;
|
||||||
|
Res:= i;
|
||||||
|
Rem:= Res mod 16;
|
||||||
|
while Res > 0 do begin
|
||||||
|
Hex[c]:= Rem;
|
||||||
|
Res:= Res div 16;
|
||||||
|
Rem:= Res mod 16;
|
||||||
|
c:=c+1;
|
||||||
|
end;
|
||||||
|
writestringex('0x', attributes);
|
||||||
|
for c:=7 downto 0 do begin
|
||||||
|
if Hex[c] <> 255 then begin
|
||||||
|
case Hex[c] of
|
||||||
|
0:writecharex('0', attributes);
|
||||||
|
1:writecharex('1', attributes);
|
||||||
|
2:writecharex('2', attributes);
|
||||||
|
3:writecharex('3', attributes);
|
||||||
|
4:writecharex('4', attributes);
|
||||||
|
5:writecharex('5', attributes);
|
||||||
|
6:writecharex('6', attributes);
|
||||||
|
7:writecharex('7', attributes);
|
||||||
|
8:writecharex('8', attributes);
|
||||||
|
9:writecharex('9', attributes);
|
||||||
|
10:writecharex('A', attributes);
|
||||||
|
11:writecharex('B', attributes);
|
||||||
|
12:writecharex('C', attributes);
|
||||||
|
13:writecharex('D', attributes);
|
||||||
|
14:writecharex('E', attributes);
|
||||||
|
15:writecharex('F', attributes);
|
||||||
|
else writecharex('?', attributes);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehex(i : dword); [public, alias: 'console_writehex'];
|
||||||
|
begin
|
||||||
|
console.writehexex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexlnex(i : dword; attributes: uint32);
|
||||||
|
begin
|
||||||
|
console.writehexex(i, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writehexln(i : dword);
|
||||||
|
begin
|
||||||
|
writehexlnex(i, Console_Properties.Default_Attribute);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Output(identifier : PChar; str : PChar);
|
||||||
|
begin
|
||||||
|
writestring('[');
|
||||||
|
writestring(identifier);
|
||||||
|
writestring('] ');
|
||||||
|
writestring(str);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Outputln(identifier : PChar; str : PChar);
|
||||||
|
begin
|
||||||
|
Output(identifier, str);
|
||||||
|
writestringln(' ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringex(str: PChar; attributes: uint32); [public, alias: 'console_writestringex'];
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
i:= 0;
|
||||||
|
while (str[i] <> #0) do begin
|
||||||
|
console.writecharex(str[i], attributes);
|
||||||
|
i:=i+1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintex(i: Integer; attributes: uint32); [public, alias: 'console_writeintex'];
|
||||||
|
var
|
||||||
|
buffer: array [0..11] of Char;
|
||||||
|
str: PChar;
|
||||||
|
digit: DWORD;
|
||||||
|
minus: Boolean;
|
||||||
|
begin
|
||||||
|
str := @buffer[11];
|
||||||
|
str^ := #0;
|
||||||
|
if (i < 0) then begin
|
||||||
|
digit := -i;
|
||||||
|
minus := True;
|
||||||
|
end else begin
|
||||||
|
digit := i;
|
||||||
|
minus := False;
|
||||||
|
end;
|
||||||
|
repeat
|
||||||
|
Dec(str);
|
||||||
|
str^ := Char((digit mod 10) + Byte('0'));
|
||||||
|
digit := digit div 10;
|
||||||
|
until (digit = 0);
|
||||||
|
if (minus) then begin
|
||||||
|
Dec(str);
|
||||||
|
str^ := '-';
|
||||||
|
end;
|
||||||
|
console.writestringex(str, attributes);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordex(i: DWORD; attributes: uint32); [public, alias: 'console_writedwordex'];
|
||||||
|
var
|
||||||
|
buffer: array [0..11] of Char;
|
||||||
|
str: PChar;
|
||||||
|
digit: DWORD;
|
||||||
|
begin
|
||||||
|
for digit := 0 to 10 do buffer[digit] := '0';
|
||||||
|
str := @buffer[11];
|
||||||
|
str^ := #0;
|
||||||
|
digit := i;
|
||||||
|
repeat
|
||||||
|
Dec(str);
|
||||||
|
str^ := Char((digit mod 10) + Byte('0'));
|
||||||
|
digit := digit div 10;
|
||||||
|
until (digit = 0);
|
||||||
|
console.writestringex(@Buffer[0], attributes);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writecharlnex(character: char; attributes: uint32); [public, alias: 'console_writecharlnex'];
|
||||||
|
begin
|
||||||
|
console.writecharex(character, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writestringlnex(str: PChar; attributes: uint32); [public, alias: 'console_writestringlnex'];
|
||||||
|
begin
|
||||||
|
console.writestringex(str, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writeintlnex(i: Integer; attributes: uint32); [public, alias: 'console_writeintlnex'];
|
||||||
|
begin
|
||||||
|
console.writeintex(i, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure writewordlnex(i: DWORD; attributes: uint32); [public, alias: 'console_writewordlnex'];
|
||||||
|
begin
|
||||||
|
console.writewordex(i, attributes);
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
|
||||||
|
function combinecolors(Foreground, Background: uint16): uint32;
|
||||||
|
begin
|
||||||
|
combinecolors:= (uint32(Foreground) SHL 16) OR Background;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _update_cursor(); [public, alias: '_console_update_cursor'];
|
||||||
|
var
|
||||||
|
pos : word;
|
||||||
|
b : byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
pos:= (Console_Cursor.Y * 80) + Console_Cursor.X;
|
||||||
|
outb($3D4, $0F);
|
||||||
|
b:= pos and $00FF;
|
||||||
|
outb($3D5, b);
|
||||||
|
outb($3D4, $0E);
|
||||||
|
b:= pos shr 8;
|
||||||
|
outb($3D5, b);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure backspace;
|
||||||
|
begin
|
||||||
|
Dec(Console_Cursor.X);
|
||||||
|
writechar(' ');
|
||||||
|
Dec(Console_Cursor.X);
|
||||||
|
_update_cursor();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
||||||
|
begin
|
||||||
|
Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
|
If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _increment_y(); [public, alias: '_console_increment_y'];
|
||||||
|
begin
|
||||||
|
Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
|
If Console_Cursor.Y > 63 then begin
|
||||||
|
console._newline();
|
||||||
|
Console_Cursor.Y:= 63;
|
||||||
|
end;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _safeincrement_x(); [public, alias: '_console_safeincrement_x'];
|
||||||
|
begin
|
||||||
|
Console_Cursor.X:= Console_Cursor.X+1;
|
||||||
|
If Console_Cursor.X > 159 then begin
|
||||||
|
console._safeincrement_y();
|
||||||
|
end;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _safeincrement_y(); [public, alias: '_console_safeincrement_y'];
|
||||||
|
begin
|
||||||
|
Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||||
|
If Console_Cursor.Y > 63 then begin
|
||||||
|
console._newline();
|
||||||
|
Console_Cursor.Y:= 63;
|
||||||
|
end;
|
||||||
|
Console_Cursor.X:= 0;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _newline(); [public, alias: '_console_newline'];
|
||||||
|
var
|
||||||
|
x, y : byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
for y:=0 to 63 do begin
|
||||||
|
Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
Console_Matrix[63][x].Character:= ' ';
|
||||||
|
Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||||
|
end;
|
||||||
|
for y:=0 to 63 do begin
|
||||||
|
for x:=0 to 159 do begin
|
||||||
|
OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
console._update_cursor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
10
src/include/asuro.pas
Normal file
10
src/include/asuro.pas
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
unit asuro;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
const
|
||||||
|
VERSION = '1.0.0-549a';
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
@ -304,6 +304,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
disable_cursor;
|
disable_cursor;
|
||||||
|
closeAllWindows;
|
||||||
if not BSOD_ENABLE then exit;
|
if not BSOD_ENABLE then exit;
|
||||||
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
|
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
|
||||||
console.clear;
|
console.clear;
|
||||||
@ -355,6 +356,7 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
console.writestringln('Unknown.')
|
console.writestringln('Unknown.')
|
||||||
end;
|
end;
|
||||||
|
console.redrawWindows;
|
||||||
halt_and_catch_fire();
|
halt_and_catch_fire();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -18,7 +18,11 @@ uses
|
|||||||
util,
|
util,
|
||||||
lmemorymanager,
|
lmemorymanager,
|
||||||
strings,
|
strings,
|
||||||
tracer;
|
tracer,
|
||||||
|
asuro;
|
||||||
|
|
||||||
|
const
|
||||||
|
TERMINAL_HWND = 1;
|
||||||
|
|
||||||
type
|
type
|
||||||
PParamList = ^TParamList;
|
PParamList = ^TParamList;
|
||||||
@ -55,9 +59,15 @@ function paramCount(params : PParamList) : uint32;
|
|||||||
function getParam(index : uint32; params : PParamList) : pchar;
|
function getParam(index : uint32; params : PParamList) : pchar;
|
||||||
procedure setWorkingDirectory(str : pchar);
|
procedure setWorkingDirectory(str : pchar);
|
||||||
function getWorkingDirectory : pchar;
|
function getWorkingDirectory : pchar;
|
||||||
|
function getTerminalHWND : uint32;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function getTerminalHWND : uint32;
|
||||||
|
begin
|
||||||
|
getTerminalHWND:= TERMINAL_HWND;
|
||||||
|
end;
|
||||||
|
|
||||||
function getWorkingDirectory : pchar;
|
function getWorkingDirectory : pchar;
|
||||||
begin
|
begin
|
||||||
getWorkingDirectory:= Working_Directory;
|
getWorkingDirectory:= Working_Directory;
|
||||||
@ -164,7 +174,7 @@ end;
|
|||||||
procedure testParams(params : PParamList);
|
procedure testParams(params : PParamList);
|
||||||
begin
|
begin
|
||||||
while params^.Param <> nil do begin
|
while params^.Param <> nil do begin
|
||||||
writestringln(params^.Param);
|
writestringlnWND(params^.Param, TERMINAL_HWND);
|
||||||
params:= params^.next;
|
params:= params^.next;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -176,21 +186,21 @@ var
|
|||||||
begin
|
begin
|
||||||
current:= params^.next;
|
current:= params^.next;
|
||||||
while current^.param <> nil do begin
|
while current^.param <> nil do begin
|
||||||
console.writestring(current^.param);
|
console.writestringWND(current^.param, TERMINAL_HWND);
|
||||||
console.writestring(' ');
|
console.writestringWND(' ', TERMINAL_HWND);
|
||||||
current:= current^.next;
|
current:= current^.next;
|
||||||
end;
|
end;
|
||||||
console.writestringln('');
|
console.writestringlnWND('', TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure clear(params : PParamList);
|
procedure clear(params : PParamList);
|
||||||
begin
|
begin
|
||||||
console.clear();
|
console.clearWND(TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure version(params : PParamList);
|
procedure version(params : PParamList);
|
||||||
begin
|
begin
|
||||||
console.writestringln('Asuro v1.0');
|
console.writestringlnWND(asuro.VERSION, TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure help(params : PParamList);
|
procedure help(params : PParamList);
|
||||||
@ -198,13 +208,13 @@ var
|
|||||||
|
|
||||||
i : uint32;
|
i : uint32;
|
||||||
begin
|
begin
|
||||||
console.writestringln('Registered Commands: ');
|
console.writestringlnWND('Registered Commands: ', TERMINAL_HWND);
|
||||||
for i:=0 to 65534 do begin
|
for i:=0 to 65534 do begin
|
||||||
if Commands[i].Registered then begin
|
if Commands[i].Registered then begin
|
||||||
console.writestring(' ');
|
console.writestringWND(' ', TERMINAL_HWND);
|
||||||
console.writestring(Commands[i].command);
|
console.writestringWND(Commands[i].command, TERMINAL_HWND);
|
||||||
console.writestring(' - ');
|
console.writestringWND(' - ', TERMINAL_HWND);
|
||||||
console.writestringln(Commands[i].description);
|
console.writestringlnWND(Commands[i].description, TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -231,9 +241,9 @@ end;
|
|||||||
procedure test(params : PParamList);
|
procedure test(params : PParamList);
|
||||||
begin
|
begin
|
||||||
if paramCount(params) > 0 then begin
|
if paramCount(params) > 0 then begin
|
||||||
console.writeintln(stringToInt(getParam(0, params)));
|
console.writeintlnWND(stringToInt(getParam(0, params)), TERMINAL_HWND);
|
||||||
end else begin
|
end else begin
|
||||||
console.writestringln('Invalid number of params');
|
console.writestringlnWND('Invalid number of params', TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -262,7 +272,7 @@ begin
|
|||||||
push_trace('terminal.process_command');
|
push_trace('terminal.process_command');
|
||||||
|
|
||||||
{ Start a new line. }
|
{ Start a new line. }
|
||||||
console.writecharln(' ');
|
console.writecharlnWND(' ', TERMINAL_HWND);
|
||||||
|
|
||||||
{ Enable fallthrough/Unrecognized command }
|
{ Enable fallthrough/Unrecognized command }
|
||||||
fallthrough:= true;
|
fallthrough:= true;
|
||||||
@ -289,13 +299,13 @@ begin
|
|||||||
|
|
||||||
{ Display message if command is unknown AKA fallthrough is active }
|
{ Display message if command is unknown AKA fallthrough is active }
|
||||||
if fallthrough then begin
|
if fallthrough then begin
|
||||||
console.writestringln('Unknown Command.');
|
console.writestringlnWND('Unknown Command.', TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Reset the terminal ready for the next command }
|
{ Reset the terminal ready for the next command }
|
||||||
console.writestring('Asuro#');
|
console.writestringWND('Asuro#', TERMINAL_HWND);
|
||||||
console.writestring(Working_Directory);
|
console.writestringWND(Working_Directory, TERMINAL_HWND);
|
||||||
console.writestring('> ');
|
console.writestringWND('> ', TERMINAL_HWND);
|
||||||
bIndex:= 0;
|
bIndex:= 0;
|
||||||
memset(uint32(@buffer[0]), 0, 1024);
|
memset(uint32(@buffer[0]), 0, 1024);
|
||||||
|
|
||||||
@ -308,12 +318,12 @@ 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.writecharWND(char(info.key_code), TERMINAL_HWND);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if info.key_code = 8 then begin //backspace
|
if info.key_code = 8 then begin //backspace
|
||||||
if bIndex > 0 then begin
|
if bIndex > 0 then begin
|
||||||
console.backspace;
|
console.backspaceWND(TERMINAL_HWND);
|
||||||
dec(bIndex);
|
dec(bIndex);
|
||||||
buffer[bIndex]:= 0;
|
buffer[bIndex]:= 0;
|
||||||
end;
|
end;
|
||||||
@ -330,6 +340,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ToggleWND1(Params : PParamList);
|
||||||
|
begin
|
||||||
|
console.toggleWNDVisible(1);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
begin
|
begin
|
||||||
console.writestringln('TERMINAL: INIT BEGIN.');
|
console.writestringln('TERMINAL: INIT BEGIN.');
|
||||||
@ -341,18 +356,20 @@ begin
|
|||||||
registerCommand('ECHO', @echo, 'Echo''s text to the terminal.');
|
registerCommand('ECHO', @echo, 'Echo''s text to the terminal.');
|
||||||
registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.');
|
registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.');
|
||||||
registerCommand('TEST', @test, 'Command for testing.');
|
registerCommand('TEST', @test, 'Command for testing.');
|
||||||
registerCommand('CD', @change_dir, 'Change Directory test');
|
registerCommand('CD', @change_dir, 'Change Directory test.');
|
||||||
registerCommand('COCKWOMBLE', @cockwomble, 'Womblecocks');
|
registerCommand('PATTERN', @cockwomble, 'Print an animated pattern to the screen.');
|
||||||
|
registerCommand('TOGGLEWND1', @ToggleWND1, 'Toggle WND 1 Visibility.');
|
||||||
console.writestringln('TERMINAL: INIT END.');
|
console.writestringln('TERMINAL: INIT END.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure run;
|
procedure run;
|
||||||
begin
|
begin
|
||||||
keyboard.hook(@key_event);
|
keyboard.hook(@key_event);
|
||||||
console.clear();
|
console.clearWND(TERMINAL_HWND);
|
||||||
console.writestring('Asuro#');
|
console.writestringWND('Asuro#', TERMINAL_HWND);
|
||||||
console.writestring(Working_Directory);
|
console.writestringWND(Working_Directory, TERMINAL_HWND);
|
||||||
console.writestring('> ');
|
console.writestringWND('> ', TERMINAL_HWND);
|
||||||
|
console.setWNDVisible(TERMINAL_HWND, true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
21
versioning.sh
Executable file
21
versioning.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
outfile="src/include/asuro.pas"
|
||||||
|
file="version"
|
||||||
|
while IFS=: read -r line;do
|
||||||
|
major=$(echo $line | awk '{print $1}')
|
||||||
|
minor=$(echo $line | awk '{print $2}')
|
||||||
|
sub=$(echo $line | awk '{print $3}')
|
||||||
|
release=$(echo $line | awk '{print $4}')
|
||||||
|
done <"$file"
|
||||||
|
revision=$(svn info | grep Revision | awk '{print $2}')
|
||||||
|
echo $major"."$minor"."$sub"-r"$revision$release
|
||||||
|
echo "unit asuro;" > $outfile
|
||||||
|
echo " " >> $outfile
|
||||||
|
echo "interface" >> $outfile
|
||||||
|
echo " " >> $outfile
|
||||||
|
echo "const" >> $outfile
|
||||||
|
echo " VERSION = '$major.$minor.$sub-$revision$release';" >> $outfile
|
||||||
|
echo " " >> $outfile
|
||||||
|
echo "implementation" >> $outfile
|
||||||
|
echo " " >> $outfile
|
||||||
|
echo "end." >> $outfile
|
Loading…
x
Reference in New Issue
Block a user