Hashmap added.
git-svn-id: https://spexeah.com:8443/svn/Asuro@1235 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
3c5d75e77e
commit
a7ee8c6d34
135
src/console.pas
135
src/console.pas
@ -45,8 +45,16 @@ type
|
|||||||
EVENT_FOCUS,
|
EVENT_FOCUS,
|
||||||
EVENT_LOSE_FOCUS );
|
EVENT_LOSE_FOCUS );
|
||||||
|
|
||||||
|
{ Properties pertaining to the raw screen matrix. }
|
||||||
|
TConsoleProperties = record
|
||||||
|
Default_Attribute : uint32; //< Attribute (Colors) to use when no override defined.
|
||||||
|
Width : uint32;
|
||||||
|
Height : uint32;
|
||||||
|
BitsPerPixel : uint8;
|
||||||
|
MAX_CELL_X : uint32;
|
||||||
|
MAX_CELL_Y : uint32;
|
||||||
|
end;
|
||||||
|
PConsoleProperties = ^TConsoleProperties;
|
||||||
|
|
||||||
{! Default Buffer Specific }
|
{! Default Buffer Specific }
|
||||||
|
|
||||||
@ -808,20 +816,20 @@ procedure setWindowColors(colors : uint32);
|
|||||||
}
|
}
|
||||||
function getWindowColorPtr : puint32;
|
function getWindowColorPtr : puint32;
|
||||||
|
|
||||||
|
function getMaxCellW : uint32;
|
||||||
|
function getMaxCellH : uint32;
|
||||||
|
function getConsoleProperties : PConsoleProperties;
|
||||||
|
|
||||||
const
|
const
|
||||||
MAX_WINDOWS = 255; //< Maximum number of Windows open.
|
MAX_WINDOWS = 255; //< Maximum number of Windows open.
|
||||||
DefaultWND = 0; //< The Window assigned for output when no Window is specified. (Default).
|
DefaultWND = 0; //< The Window assigned for output when no Window is specified. (Default).
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
lmemorymanager, strings, keyboard, serial, terminal;
|
lmemorymanager, strings, keyboard, serial, terminal;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ Properties pertaining to the raw screen matrix. }
|
|
||||||
TConsoleProperties = record
|
|
||||||
Default_Attribute : uint32; //< Attribute (Colors) to use when no override defined.
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ Unrasterized representation of a character. }
|
{ Unrasterized representation of a character. }
|
||||||
TCharacter = bitpacked record
|
TCharacter = bitpacked record
|
||||||
Character : Char; //< ASCII Character
|
Character : Char; //< ASCII Character
|
||||||
@ -844,7 +852,6 @@ type
|
|||||||
{ Pointer to 2D Unrasterized Matrix }
|
{ Pointer to 2D Unrasterized Matrix }
|
||||||
P2DVideoMemory = ^T2DVideoMemory;
|
P2DVideoMemory = ^T2DVideoMemory;
|
||||||
|
|
||||||
|
|
||||||
TMouseCoord = record
|
TMouseCoord = record
|
||||||
X : sint32;
|
X : sint32;
|
||||||
Y : sint32;
|
Y : sint32;
|
||||||
@ -937,6 +944,21 @@ var
|
|||||||
MouseCursorEnabled : Boolean = true;
|
MouseCursorEnabled : Boolean = true;
|
||||||
OpenTerminal : Boolean = false;
|
OpenTerminal : Boolean = false;
|
||||||
|
|
||||||
|
function getMaxCellW : uint32;
|
||||||
|
begin
|
||||||
|
getMaxCellW:= Console_Properties.MAX_CELL_X;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getMaxCellH : uint32;
|
||||||
|
begin
|
||||||
|
getMaxCellH:= Console_Properties.MAX_CELL_Y;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getConsoleProperties : PConsoleProperties;
|
||||||
|
begin
|
||||||
|
getConsoleProperties:= PConsoleProperties(@Console_Properties);
|
||||||
|
end;
|
||||||
|
|
||||||
function getWindowColorPtr : puint32;
|
function getWindowColorPtr : puint32;
|
||||||
begin
|
begin
|
||||||
getWindowColorPtr:= @Window_Border.Attributes;
|
getWindowColorPtr:= @Window_Border.Attributes;
|
||||||
@ -1092,8 +1114,8 @@ var
|
|||||||
begin
|
begin
|
||||||
Window:= WindowManager.Windows[WND];
|
Window:= WindowManager.Windows[WND];
|
||||||
if Window <> nil then begin
|
if Window <> nil then begin
|
||||||
while x > 159 do dec(x);
|
while x > Console_Properties.MAX_CELL_X-1 do dec(x);
|
||||||
while y > 63 do dec(y);
|
while y > Console_Properties.MAX_CELL_Y-1 do dec(y);
|
||||||
Window^.Cursor.x:= x;
|
Window^.Cursor.x:= x;
|
||||||
Window^.Cursor.y:= y;
|
Window^.Cursor.y:= y;
|
||||||
end;
|
end;
|
||||||
@ -1112,19 +1134,19 @@ begin
|
|||||||
if Window^.Border then begin
|
if Window^.Border then begin
|
||||||
if nx < 2 then nx:= 2;
|
if nx < 2 then nx:= 2;
|
||||||
if ny < 1 then ny:= 1;
|
if ny < 1 then ny:= 1;
|
||||||
while (nx + Window^.WND_W + 2) > 159 do begin
|
while (nx + Window^.WND_W + 2) > Console_Properties.MAX_CELL_X do begin
|
||||||
dec(nx);
|
dec(nx);
|
||||||
end;
|
end;
|
||||||
while (ny + Window^.WND_H + 1) > 63 do begin
|
while (ny + Window^.WND_H + 1) > Console_Properties.MAX_CELL_Y do begin
|
||||||
dec(ny);
|
dec(ny);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
if nx < 0 then nx:= 0;
|
if nx < 0 then nx:= 0;
|
||||||
if ny < 0 then ny:= 0;
|
if ny < 0 then ny:= 0;
|
||||||
while (nx + Window^.WND_W) > 159 do begin
|
while (nx + Window^.WND_W) > Console_Properties.MAX_CELL_X do begin
|
||||||
dec(nx);
|
dec(nx);
|
||||||
end;
|
end;
|
||||||
while (ny + Window^.WND_H) > 63 do begin
|
while (ny + Window^.WND_H) > Console_Properties.MAX_CELL_Y do begin
|
||||||
dec(ny);
|
dec(ny);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1198,6 +1220,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//If Packet.x_sign then Packet.x_movement:= sint16(Packet.x_movement OR $FF00);
|
||||||
|
//If Packet.y_sign then Packet.y_movement:= sint16(Packet.y_movement OR $FF00);
|
||||||
|
|
||||||
procedure forceQuitAll;
|
procedure forceQuitAll;
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
@ -1288,8 +1313,8 @@ begin
|
|||||||
mouse_dirt.BottomRight.y:= (MY div 16) + 2;
|
mouse_dirt.BottomRight.y:= (MY div 16) + 2;
|
||||||
if mouse_dirt.TopLeft.x < 0 then mouse_dirt.TopLeft.x:= 0;
|
if mouse_dirt.TopLeft.x < 0 then mouse_dirt.TopLeft.x:= 0;
|
||||||
if mouse_dirt.TopLeft.y < 0 then mouse_dirt.TopLeft.y:= 0;
|
if mouse_dirt.TopLeft.y < 0 then mouse_dirt.TopLeft.y:= 0;
|
||||||
if mouse_dirt.BottomRight.x > 159 then mouse_dirt.BottomRight.x:= 159;
|
if mouse_dirt.BottomRight.x > Console_Properties.MAX_CELL_X then mouse_dirt.BottomRight.x:= Console_Properties.MAX_CELL_X;
|
||||||
if mouse_dirt.BottomRight.y > 63 then mouse_dirt.BottomRight.y:= 63;
|
if mouse_dirt.BottomRight.y > Console_Properties.MAX_CELL_Y then mouse_dirt.BottomRight.y:= Console_Properties.MAX_CELL_Y;
|
||||||
MouseDrawActive:= false;
|
MouseDrawActive:= false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1306,8 +1331,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
drawMouse;
|
drawMouse;
|
||||||
end;
|
end;
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||||
if (Console_Matrix[y][x].character <> Console_Real[y][x].character) or (Console_Matrix[y][x].attributes <> Console_Real[y][x].attributes) then begin
|
if (Console_Matrix[y][x].character <> Console_Real[y][x].character) or (Console_Matrix[y][x].attributes <> Console_Real[y][x].attributes) then begin
|
||||||
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);
|
||||||
Console_Real[y][x]:= Console_Matrix[y][x];
|
Console_Real[y][x]:= Console_Matrix[y][x];
|
||||||
@ -1341,8 +1366,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Clear the Console_Matrix }
|
{ Clear the Console_Matrix }
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||||
Console_Matrix[y][x]:= Default_Char;
|
Console_Matrix[y][x]:= Default_Char;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1392,9 +1417,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
for y:=WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y to WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y + WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_H do begin
|
for y:=WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y to WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y + WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_H do begin
|
||||||
if y > 63 then break;
|
if y > Console_Properties.MAX_CELL_Y then break;
|
||||||
for x:=WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X to WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X + WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_W do begin
|
for x:=WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X to WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X + WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_W do begin
|
||||||
if x > 159 then break;
|
if x > Console_Properties.MAX_CELL_X then break;
|
||||||
Console_Matrix[y][x]:= WindowManager.Windows[WindowManager.Z_Order[w]]^.buffer[y - WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y][x - WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X];
|
Console_Matrix[y][x]:= WindowManager.Windows[WindowManager.Z_Order[w]]^.buffer[y - WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_Y][x - WindowManager.Windows[WindowManager.Z_Order[w]]^.WND_X];
|
||||||
WindowTitleMask[y][x]:= 0;
|
WindowTitleMask[y][x]:= 0;
|
||||||
WindowMask[y][x]:= WindowManager.Z_Order[w];
|
WindowMask[y][x]:= WindowManager.Z_Order[w];
|
||||||
@ -1537,8 +1562,8 @@ begin
|
|||||||
WND^.WND_NAME:= 'Asuro';
|
WND^.WND_NAME:= 'Asuro';
|
||||||
WND^.WND_X:= 0;
|
WND^.WND_X:= 0;
|
||||||
WND^.WND_Y:= 0;
|
WND^.WND_Y:= 0;
|
||||||
WND^.WND_W:= 159;
|
WND^.WND_W:= Console_Properties.MAX_CELL_X;
|
||||||
WND^.WND_H:= 63;
|
WND^.WND_H:= Console_Properties.MAX_CELL_Y;
|
||||||
WND^.Cursor.x:= 0;
|
WND^.Cursor.x:= 0;
|
||||||
WND^.Cursor.y:= 0;
|
WND^.Cursor.y:= 0;
|
||||||
WND^.visible:= true;
|
WND^.visible:= true;
|
||||||
@ -1567,7 +1592,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
getPixel:= dest^;
|
getPixel:= dest^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1578,7 +1603,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest^:= color;
|
dest^:= color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1590,7 +1615,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest32:= puint32(dest);
|
dest32:= puint32(dest);
|
||||||
getPixel32:= dest32[0];
|
getPixel32:= dest32[0];
|
||||||
end;
|
end;
|
||||||
@ -1603,7 +1628,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest32:= puint32(dest);
|
dest32:= puint32(dest);
|
||||||
dest32[0]:= pixel;
|
dest32[0]:= pixel;
|
||||||
end;
|
end;
|
||||||
@ -1616,7 +1641,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest64:= puint64(dest);
|
dest64:= puint64(dest);
|
||||||
getPixel64:= dest64^;
|
getPixel64:= dest64^;
|
||||||
end;
|
end;
|
||||||
@ -1629,7 +1654,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if not ready then exit;
|
if not ready then exit;
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest64:= puint64(dest);
|
dest64:= puint64(dest);
|
||||||
dest64^:= pixel;
|
dest64^:= pixel;
|
||||||
end;
|
end;
|
||||||
@ -1648,13 +1673,13 @@ begin
|
|||||||
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
//dest:= puint16(windowmanager.getBuffer(0));
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
dest:= dest + (y * 1280) + x;
|
dest:= dest + (y * Console_Properties.Width) + x;
|
||||||
dest32:= puint32(dest);
|
dest32:= puint32(dest);
|
||||||
for i:=0 to 15 do begin
|
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*(Console_Properties.Width div 2))+0]:= (dest32[(i*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+1]:= (dest32[(i*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+2]:= (dest32[(i*(Console_Properties.Width div 2))+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]);
|
dest32[(i*(Console_Properties.Width div 2))+3]:= (dest32[(i*(Console_Properties.Width div 2))+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
end;
|
end;
|
||||||
//windowmanager.redraw;
|
//windowmanager.redraw;
|
||||||
end;
|
end;
|
||||||
@ -1673,13 +1698,13 @@ begin
|
|||||||
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
//dest:= puint16(windowmanager.getBuffer(0));
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
dest:= dest + (y*(1280 * 16)) + (x * 8);
|
dest:= dest + (y*(Console_Properties.Width * 16)) + (x * 8);
|
||||||
dest32:= puint32(dest);
|
dest32:= puint32(dest);
|
||||||
for i:=0 to 15 do begin
|
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*(Console_Properties.Width div 2))+0]:= (dest32[(i*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+1]:= (dest32[(i*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+2]:= (dest32[(i*(Console_Properties.Width div 2))+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]);
|
dest32[(i*(Console_Properties.Width div 2))+3]:= (dest32[(i*(Console_Properties.Width div 2))+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
end;
|
end;
|
||||||
//windowmanager.redraw;
|
//windowmanager.redraw;
|
||||||
end;
|
end;
|
||||||
@ -1699,13 +1724,13 @@ begin
|
|||||||
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
|
||||||
dest:= puint16(multibootinfo^.framebuffer_addr);
|
dest:= puint16(multibootinfo^.framebuffer_addr);
|
||||||
//dest:= puint16(windowmanager.getBuffer(0));
|
//dest:= puint16(windowmanager.getBuffer(0));
|
||||||
dest:= dest + (y*(1280 * 16)) + (x * 8);
|
dest:= dest + (y*(Console_Properties.Width * 16)) + (x * 8);
|
||||||
dest32:= puint32(dest);
|
dest32:= puint32(dest);
|
||||||
for i:=0 to 15 do begin
|
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*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+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*(Console_Properties.Width div 2))+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]);
|
dest32[(i*(Console_Properties.Width div 2))+3]:= (bgcolor32 AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
|
||||||
end;
|
end;
|
||||||
//windowmanager.redraw;
|
//windowmanager.redraw;
|
||||||
end;
|
end;
|
||||||
@ -1738,6 +1763,14 @@ var
|
|||||||
|
|
||||||
Begin
|
Begin
|
||||||
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
||||||
|
Console_Properties.Width:= multibootinfo^.framebuffer_width;
|
||||||
|
Console_Properties.Height:= multibootinfo^.framebuffer_height;
|
||||||
|
Console_Properties.BitsPerPixel:= multibootinfo^.framebuffer_bpp;
|
||||||
|
Console_Properties.MAX_CELL_X:= (Console_Properties.Width div 8) - 1;
|
||||||
|
Console_Properties.MAX_CELL_Y:= (Console_Properties.Height div 16) - 1;
|
||||||
|
If Console_Properties.BitsPerPixel <> 16 then while true do begin
|
||||||
|
|
||||||
|
end;
|
||||||
kpalloc(uint32(fb));
|
kpalloc(uint32(fb));
|
||||||
keyboard.hook(@keyhook);
|
keyboard.hook(@keyhook);
|
||||||
initWindows;
|
initWindows;
|
||||||
@ -1754,8 +1787,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||||
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Character:= ' ';
|
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Character:= ' ';
|
||||||
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
WindowManager.Windows[DefaultWND]^.row_dirty[y]:= true;
|
WindowManager.Windows[DefaultWND]^.row_dirty[y]:= true;
|
||||||
@ -2211,8 +2244,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if WindowManager.Windows[WND] <> nil then begin
|
if WindowManager.Windows[WND] <> nil then begin
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||||
WindowManager.Windows[WND]^.Buffer[y][x].Character:= ' ';
|
WindowManager.Windows[WND]^.Buffer[y][x].Character:= ' ';
|
||||||
WindowManager.Windows[WND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
WindowManager.Windows[WND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||||
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
||||||
@ -2235,8 +2268,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if WindowManager.Windows[WND] <> nil then begin
|
if WindowManager.Windows[WND] <> nil then begin
|
||||||
for y:=0 to 63 do begin
|
for y:=0 to Console_Properties.MAX_CELL_Y do begin
|
||||||
for x:=0 to 159 do begin
|
for x:=0 to Console_Properties.MAX_CELL_X do begin
|
||||||
WindowManager.Windows[WND]^.Buffer[y][x].Character:= ' ';
|
WindowManager.Windows[WND]^.Buffer[y][x].Character:= ' ';
|
||||||
WindowManager.Windows[WND]^.Buffer[y][x].Attributes:= attributes;
|
WindowManager.Windows[WND]^.Buffer[y][x].Attributes:= attributes;
|
||||||
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
||||||
|
@ -147,15 +147,17 @@ begin
|
|||||||
Packet.LMB_Down:= (f AND %00000001) = %00000001;
|
Packet.LMB_Down:= (f AND %00000001) = %00000001;
|
||||||
Packet.x_overflow:= (f AND $40) = $40;
|
Packet.x_overflow:= (f AND $40) = $40;
|
||||||
Packet.y_overflow:= (f AND $80) = $80;
|
Packet.y_overflow:= (f AND $80) = $80;
|
||||||
Packet.x_movement:= Mouse_Byte[1] - ((f SHL 4) AND $100);
|
Packet.x_movement:= Mouse_Byte[1];// - ((f SHL 4) AND $100);
|
||||||
Packet.y_movement:= Mouse_Byte[2] - ((f SHL 3) AND $100);
|
Packet.y_movement:= Mouse_Byte[2];// - ((f SHL 3) AND $100);
|
||||||
|
If Packet.x_sign then Packet.x_movement:= sint16(Packet.x_movement OR $FF00);
|
||||||
|
If Packet.y_sign then Packet.y_movement:= sint16(Packet.y_movement OR $FF00);
|
||||||
if not(Packet.x_overflow) and not(Packet.y_overflow) then begin
|
if not(Packet.x_overflow) and not(Packet.y_overflow) then begin
|
||||||
Current.x:= Current.x + Packet.x_movement;
|
Current.x:= Current.x + Packet.x_movement;
|
||||||
Current.y:= Current.y - Packet.y_movement;
|
Current.y:= Current.y - Packet.y_movement;
|
||||||
if Current.x < 0 then Current.x:= 0;
|
if Current.x < 0 then Current.x:= 0;
|
||||||
if Current.y < 0 then Current.y:= 0;
|
if Current.y < 0 then Current.y:= 0;
|
||||||
if Current.x > 1272 then Current.x:= 1272;
|
if Current.x > (Console.getConsoleProperties^.Width-8) then Current.x:= (Console.getConsoleProperties^.Width-8);
|
||||||
if Current.y > 1015 then Current.y:= 1015;
|
if Current.y > (Console.getConsoleProperties^.Height-8) then Current.y:= (Console.getConsoleProperties^.Height-8);
|
||||||
end;
|
end;
|
||||||
Cycle:= 0;
|
Cycle:= 0;
|
||||||
if Packet.LMB_Down then begin
|
if Packet.LMB_Down then begin
|
||||||
|
212
src/include/hashmap.pas
Normal file
212
src/include/hashmap.pas
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
unit hashmap;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
md5, util, strings, lmemorymanager, console;
|
||||||
|
|
||||||
|
type
|
||||||
|
DPHashItem = ^PHashItem;
|
||||||
|
PHashItem = ^THashItem;
|
||||||
|
THashItem = record
|
||||||
|
Next : PHashItem;
|
||||||
|
Key : pchar;
|
||||||
|
Data : void;
|
||||||
|
end;
|
||||||
|
PHashMap = ^THashMap;
|
||||||
|
THashMap = record
|
||||||
|
Size : uint32;
|
||||||
|
Table : DPHashItem;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function new(size : uint32) : PHashMap;
|
||||||
|
procedure add(map : PHashMap; key : pchar; value : void);
|
||||||
|
function get(map : PHashMap; key : pchar) : void;
|
||||||
|
procedure delete(map : PHashMap; key : pchar);
|
||||||
|
procedure deleteAndFree(map : PHashMap; key : pchar);
|
||||||
|
procedure printMap(map : PHashMap);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function hashIndex(size : uint32; key : pchar) : uint32;
|
||||||
|
var
|
||||||
|
KeyLength : uint32;
|
||||||
|
Hash : PMD5Digest;
|
||||||
|
Hash128 : puint128;
|
||||||
|
Hash32 : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
KeyLength:= StringSize(key);
|
||||||
|
Hash:= MD5Buffer(puint8(key), KeyLength);
|
||||||
|
Hash128:= puint128(Hash);
|
||||||
|
Hash32:= MD5To32(Hash128);
|
||||||
|
hashIndex:= Hash32 mod size;
|
||||||
|
kfree(void(Hash));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function newItem : PHashItem;
|
||||||
|
begin
|
||||||
|
newItem:= PHashItem(kalloc(sizeof(THashItem)));
|
||||||
|
newItem^.Next:= nil;
|
||||||
|
newItem^.Key:= nil;
|
||||||
|
newItem^.Data:= nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure add(map : PHashMap; key : pchar; value : void);
|
||||||
|
var
|
||||||
|
Idx : uint32;
|
||||||
|
Item : PHashItem;
|
||||||
|
nItem : PHashItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if (map <> nil) and (key <> nil) then begin
|
||||||
|
Idx:= hashIndex(map^.size, key);
|
||||||
|
if map^.Table[Idx] = nil then begin
|
||||||
|
Item:= newItem;
|
||||||
|
Item^.Next:= nil;
|
||||||
|
map^.Table[Idx]:= Item;
|
||||||
|
end else begin
|
||||||
|
//Collision
|
||||||
|
Item:= map^.Table[Idx];
|
||||||
|
while not StringEquals(Item^.key, key) do begin
|
||||||
|
if Item^.Next <> nil then begin
|
||||||
|
Item:= Item^.Next;
|
||||||
|
end else begin
|
||||||
|
nItem:= newItem();
|
||||||
|
Item^.Next:= nItem;
|
||||||
|
Item:= nItem;
|
||||||
|
Item^.Next:= nil;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if Item^.Key = nil then Item^.Key:= stringCopy(key);
|
||||||
|
Item^.Data:= value;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function get(map : PHashMap; key : pchar) : void;
|
||||||
|
var
|
||||||
|
Idx : uint32;
|
||||||
|
Item : PHashItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
get:= nil;
|
||||||
|
if (map <> nil) and (key <> nil) then begin
|
||||||
|
Idx:= hashIndex(map^.size, key);
|
||||||
|
Item:= map^.table[Idx];
|
||||||
|
if Item = nil then exit;
|
||||||
|
while not StringEquals(Item^.key, key) do begin
|
||||||
|
Item:= Item^.Next;
|
||||||
|
if Item = nil then break;
|
||||||
|
end;
|
||||||
|
if Item <> nil then get:= Item^.Data;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function new(size : uint32) : PHashMap;
|
||||||
|
var
|
||||||
|
Map : PHashMap;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Map:= PHashMap(kalloc(sizeof(THashMap)));
|
||||||
|
Map^.size:= size;
|
||||||
|
Map^.Table:= DPHashItem(Kalloc(sizeof(PHashItem) * Size));
|
||||||
|
for i:=0 to size-1 do begin
|
||||||
|
Map^.Table[i]:= nil;
|
||||||
|
end;
|
||||||
|
new:= Map;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure deleteAndFree(map : PHashMap; key : pchar);
|
||||||
|
var
|
||||||
|
Idx : uint32;
|
||||||
|
Item : PHashItem;
|
||||||
|
Prev : PHashItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Prev:= nil;
|
||||||
|
if (map <> nil) and (key <> nil) then begin
|
||||||
|
Idx:= hashIndex(map^.size, key);
|
||||||
|
Item:= map^.table[Idx];
|
||||||
|
while not StringEquals(Item^.key, key) do begin
|
||||||
|
Prev:= Item;
|
||||||
|
Item:= Item^.Next;
|
||||||
|
if Item = nil then break;
|
||||||
|
end;
|
||||||
|
if Item <> nil then begin
|
||||||
|
If Prev <> nil then Prev^.Next:= Item^.Next;
|
||||||
|
If Prev = nil then begin
|
||||||
|
if Item^.Next <> nil then
|
||||||
|
map^.table[Idx]:= Item^.Next
|
||||||
|
else
|
||||||
|
map^.table[Idx]:= nil;
|
||||||
|
end;
|
||||||
|
kfree(void(Item^.Key));
|
||||||
|
kfree(void(Item^.Data));
|
||||||
|
kfree(void(Item));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure delete(map : PHashMap; key : pchar);
|
||||||
|
var
|
||||||
|
Idx : uint32;
|
||||||
|
Item : PHashItem;
|
||||||
|
Prev : PHashItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Prev:= nil;
|
||||||
|
if (map <> nil) and (key <> nil) then begin
|
||||||
|
Idx:= hashIndex(map^.size, key);
|
||||||
|
Item:= map^.table[Idx];
|
||||||
|
while not StringEquals(Item^.key, key) do begin
|
||||||
|
Prev:= Item;
|
||||||
|
Item:= Item^.Next;
|
||||||
|
if Item = nil then break;
|
||||||
|
end;
|
||||||
|
if Item <> nil then begin
|
||||||
|
If Prev <> nil then Prev^.Next:= Item^.Next;
|
||||||
|
If Prev = nil then begin
|
||||||
|
if Item^.Next <> nil then
|
||||||
|
map^.table[Idx]:= Item^.Next
|
||||||
|
else
|
||||||
|
map^.table[Idx]:= nil;
|
||||||
|
end;
|
||||||
|
kfree(void(Item^.Key));
|
||||||
|
kfree(void(Item));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure printMap(map : PHashMap);
|
||||||
|
var
|
||||||
|
i,c : uint32;
|
||||||
|
item : PHashItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for i:=0 to map^.Size-1 do begin
|
||||||
|
if map^.table[i] <> nil then begin
|
||||||
|
writestring('Map[');
|
||||||
|
writeint(i);
|
||||||
|
writestring(']->(0)="');
|
||||||
|
writestring(map^.table[i]^.key);
|
||||||
|
writestring('"');
|
||||||
|
item:= map^.table[i]^.next;
|
||||||
|
c:=1;
|
||||||
|
while item <> nil do begin
|
||||||
|
writestring('->(');
|
||||||
|
writeint(c);
|
||||||
|
writestring(')="');
|
||||||
|
writestring(item^.key);
|
||||||
|
writestring('"');
|
||||||
|
inc(c);
|
||||||
|
item:= item^.next;
|
||||||
|
end;
|
||||||
|
writestringln(' ');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -39,6 +39,8 @@ procedure MD5Update(context : PMD5Context; buffer : PuInt8; bufferLen : uInt32);
|
|||||||
function MD5Final(context : PMD5Context) : PMD5Digest;
|
function MD5Final(context : PMD5Context) : PMD5Digest;
|
||||||
function MD5Buffer(buffer : PuInt8; bufferLen : uInt32) : PMD5Digest;
|
function MD5Buffer(buffer : PuInt8; bufferLen : uInt32) : PMD5Digest;
|
||||||
|
|
||||||
|
function MD5To32(Input : PuInt128) : uint32;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure Invert(Source : PuInt8; Dest : PuInt32; Count : uInt32);
|
procedure Invert(Source : PuInt8; Dest : PuInt32; Count : uInt32);
|
||||||
@ -234,4 +236,13 @@ begin
|
|||||||
kfree(void(context));
|
kfree(void(context));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function MD5To32(Input : PuInt128) : uint32;
|
||||||
|
var
|
||||||
|
MD5To64 : uint64;
|
||||||
|
i : uint8;
|
||||||
|
|
||||||
|
begin
|
||||||
|
MD5To32:= Input^.DWords[0] xor Input^.DWords[1] xor Input^.DWords[2] xor Input^.DWords[3];
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
@ -28,6 +28,22 @@ type
|
|||||||
uInt16 = WORD;
|
uInt16 = WORD;
|
||||||
uInt32 = DWORD;
|
uInt32 = DWORD;
|
||||||
uInt64 = QWORD;
|
uInt64 = QWORD;
|
||||||
|
uint128 = packed record
|
||||||
|
case Integer of
|
||||||
|
0: (
|
||||||
|
Hi : uint64;
|
||||||
|
Lo : uint64;
|
||||||
|
);
|
||||||
|
1: (
|
||||||
|
DWords : array [0..3] of uint32;
|
||||||
|
);
|
||||||
|
2: (
|
||||||
|
Words : array [0..7] of uint16;
|
||||||
|
);
|
||||||
|
3: (
|
||||||
|
Bytes : array [0..15] of uint8;
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
sInt8 = shortint;
|
sInt8 = shortint;
|
||||||
sInt16 = smallint;
|
sInt16 = smallint;
|
||||||
@ -42,6 +58,7 @@ type
|
|||||||
PuInt16 = ^uInt16;
|
PuInt16 = ^uInt16;
|
||||||
PuInt32 = ^uInt32;
|
PuInt32 = ^uInt32;
|
||||||
PuInt64 = ^uInt64;
|
PuInt64 = ^uInt64;
|
||||||
|
PuInt128 = ^uint128;
|
||||||
|
|
||||||
PsInt8 = ^sInt8;
|
PsInt8 = ^sInt8;
|
||||||
PsInt16 = ^sInt16;
|
PsInt16 = ^sInt16;
|
||||||
|
@ -40,7 +40,8 @@ uses
|
|||||||
md5,
|
md5,
|
||||||
base64,
|
base64,
|
||||||
rand,
|
rand,
|
||||||
terminal;
|
terminal,
|
||||||
|
hashmap;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@ -77,6 +78,20 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure myUserLandFunction;
|
||||||
|
var
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
i:=0;
|
||||||
|
while true do begin
|
||||||
|
i:=i+1;
|
||||||
|
asm
|
||||||
|
MOV EAX, i
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
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;
|
||||||
@ -92,6 +107,9 @@ var
|
|||||||
test : puint8;
|
test : puint8;
|
||||||
fb : puint16;
|
fb : puint16;
|
||||||
l : PLinkedListBase;
|
l : PLinkedListBase;
|
||||||
|
ulf : pointer;
|
||||||
|
|
||||||
|
HM : PHashMap;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Serial Init }
|
{ Serial Init }
|
||||||
@ -223,6 +241,67 @@ begin
|
|||||||
rand.srand((getDateTime.Seconds SHR 24) OR (getDateTime.Minutes SHR 16) OR (getDateTime.Hours SHR 8) OR (getDateTime.Day));
|
rand.srand((getDateTime.Seconds SHR 24) OR (getDateTime.Minutes SHR 16) OR (getDateTime.Hours SHR 8) OR (getDateTime.Day));
|
||||||
|
|
||||||
tracer.push_trace('kmain.TICK');
|
tracer.push_trace('kmain.TICK');
|
||||||
|
|
||||||
|
|
||||||
|
HM:= hashmap.new(10000);
|
||||||
|
hashmap.add(HM, 'testificate', void(1));
|
||||||
|
hashmap.add(HM, 'asuro', void(10));
|
||||||
|
hashmap.add(HM, 'myfirstos', void(100));
|
||||||
|
hashmap.add(HM, 'potato', void(1000));
|
||||||
|
hashmap.add(HM, 'cellary', void(10000));
|
||||||
|
hashmap.add(HM, 'gigglewiggle', void(100000));
|
||||||
|
hashmap.add(HM, 'cuntwank', void(20));
|
||||||
|
hashmap.add(HM, 'topkekness', void(200));
|
||||||
|
hashmap.add(HM, 'fluffybanana', void(2000));
|
||||||
|
hashmap.add(HM, 'ilikecheese', void(20000));
|
||||||
|
hashmap.add(HM, 'Tracer', void(200000));
|
||||||
|
hashmap.add(HM, 'Genji', void(2000000));
|
||||||
|
hashmap.add(HM, 'Winston', void(30));
|
||||||
|
hashmap.add(HM, 'D.Va', void(300));
|
||||||
|
hashmap.add(HM, 'Soldier76', void(3000));
|
||||||
|
hashmap.add(HM, 'Brigitte', void(3000));
|
||||||
|
hashmap.add(HM, 'Pharah', void(30000));
|
||||||
|
hashmap.add(HM, 'Reinhardt', void(300000));
|
||||||
|
hashmap.add(HM, 'Orisa', void(30000000));
|
||||||
|
hashmap.add(HM, 'Mercy', void(3000000000));
|
||||||
|
hashmap.add(HM, 'Hamster', void(40));
|
||||||
|
hashmap.add(HM, 'Ana', void(400));
|
||||||
|
hashmap.add(HM, 'Lucio', void(4000));
|
||||||
|
hashmap.add(HM, 'Mei', void(40000));
|
||||||
|
hashmap.add(HM, 'Teemo', void(400000));
|
||||||
|
hashmap.add(HM, 'Vayne', void(4000000));
|
||||||
|
hashmap.add(HM, 'Munzo', void(40000000));
|
||||||
|
hashmap.add(HM, 'fasafafsdfsd', void(50));
|
||||||
|
hashmap.add(HM, 'Zarfdasafdsfadsfdsafadsfdasya', void(500));
|
||||||
|
hashmap.add(HM, 'Zafadfadsfadsfadsfdsarya', void(5000));
|
||||||
|
hashmap.add(HM, 'afdsafdadfsfda', void(500000));
|
||||||
|
hashmap.add(HM, '4rrelkjhrewrewkoy', void(5000000));
|
||||||
|
hashmap.add(HM, 'Laptop', void(50000000));
|
||||||
|
hashmap.add(HM, 'Salmon', void(500000000));
|
||||||
|
hashmap.add(HM, 'OnionBurger', void(60));
|
||||||
|
|
||||||
|
hashmap.printmap(HM);
|
||||||
|
|
||||||
|
writeintln(uint32(hashmap.get(HM, 'Ana')));
|
||||||
|
|
||||||
|
// Testing getting into userspace
|
||||||
|
// ulf:= Pointer(@myUserLandFunction);
|
||||||
|
// asm
|
||||||
|
// MOV AX, $23
|
||||||
|
// MOV DS, AX
|
||||||
|
// MOV ES, AX
|
||||||
|
// MOV FS, AX
|
||||||
|
// MOV GS, AX
|
||||||
|
|
||||||
|
// MOV EAX, ESP
|
||||||
|
// PUSH $23
|
||||||
|
// PUSH EAX
|
||||||
|
// PUSHF
|
||||||
|
// PUSH $1B
|
||||||
|
// PUSH ulf;
|
||||||
|
// iret;
|
||||||
|
// end;
|
||||||
|
|
||||||
while true do begin
|
while true do begin
|
||||||
tracer.push_trace('kmain.RedrawWindows');
|
tracer.push_trace('kmain.RedrawWindows');
|
||||||
console.redrawWindows;
|
console.redrawWindows;
|
||||||
|
@ -20,6 +20,11 @@ var
|
|||||||
wordlen : uint32;
|
wordlen : uint32;
|
||||||
MD5_Hash : PMD5Digest;
|
MD5_Hash : PMD5Digest;
|
||||||
i : uint32;
|
i : uint32;
|
||||||
|
MD5_128 : puint128;
|
||||||
|
Result : uint64;
|
||||||
|
Result32 : uint32;
|
||||||
|
Modulo : uint64;
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
md5word:= getParam(0, Params);
|
md5word:= getParam(0, Params);
|
||||||
|
@ -63,7 +63,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
console.setCursorPosWND(150, 0, TaskBarHandle);
|
console.setCursorPosWND(Console.getMaxCellW() - 9, 0, TaskBarHandle);
|
||||||
if DateTime.Hours < 10 then writeIntExWND(0, Takbar_Colors, TaskBarHandle);
|
if DateTime.Hours < 10 then writeIntExWND(0, Takbar_Colors, TaskBarHandle);
|
||||||
writeIntExWND(DateTime.Hours, Takbar_Colors, TaskBarHandle);
|
writeIntExWND(DateTime.Hours, Takbar_Colors, TaskBarHandle);
|
||||||
writeStringExWND(':', Takbar_Colors, TaskBarHandle);
|
writeStringExWND(':', Takbar_Colors, TaskBarHandle);
|
||||||
@ -96,32 +96,32 @@ begin
|
|||||||
clearWNDEx(DesktopHandle, Desktop_Colors);
|
clearWNDEx(DesktopHandle, Desktop_Colors);
|
||||||
if not(StringEquals(asuro.RELEASE, 'r')) then begin
|
if not(StringEquals(asuro.RELEASE, 'r')) then begin
|
||||||
versionSize:= StringSize(asuro.VERSION) + StringSize('Asuro v');
|
versionSize:= StringSize(asuro.VERSION) + StringSize('Asuro v');
|
||||||
versionDrawX:= 157 - versionSize;
|
versionDrawX:= Console.getMaxCellW() - 2 - versionSize;
|
||||||
setCursorPosWND(versionDrawX, 60, DesktopHandle);
|
setCursorPosWND(versionDrawX, Console.getMaxCellH() - 4, DesktopHandle);
|
||||||
writestringExWND('ASURO v', Desktop_Colors, DesktopHandle);
|
writestringExWND('ASURO v', Desktop_Colors, DesktopHandle);
|
||||||
writestringExWND(asuro.VERSION, Desktop_Colors, DesktopHandle);
|
writestringExWND(asuro.VERSION, Desktop_Colors, DesktopHandle);
|
||||||
if StringEquals(asuro.RELEASE, 'rc') then begin
|
if StringEquals(asuro.RELEASE, 'rc') then begin
|
||||||
releaseSize:= StringSize('RELEASE CANDIDATE');
|
releaseSize:= StringSize('RELEASE CANDIDATE');
|
||||||
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
|
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
|
||||||
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
|
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
|
||||||
writeStringExWND('RELEASE CANDIDATE', Desktop_Colors, DesktopHandle);
|
writeStringExWND('RELEASE CANDIDATE', Desktop_Colors, DesktopHandle);
|
||||||
end;
|
end;
|
||||||
if StringEquals(asuro.RELEASE, 'ia') then begin
|
if StringEquals(asuro.RELEASE, 'ia') then begin
|
||||||
releaseSize:= StringSize('INTERNAL ALPHA');
|
releaseSize:= StringSize('INTERNAL ALPHA');
|
||||||
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
|
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
|
||||||
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
|
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
|
||||||
writeStringExWND('INTERNAL ALPHA', Desktop_Colors, DesktopHandle);
|
writeStringExWND('INTERNAL ALPHA', Desktop_Colors, DesktopHandle);
|
||||||
end;
|
end;
|
||||||
if StringEquals(asuro.RELEASE, 'a') then begin
|
if StringEquals(asuro.RELEASE, 'a') then begin
|
||||||
releaseSize:= StringSize('ALPHA');
|
releaseSize:= StringSize('ALPHA');
|
||||||
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
|
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
|
||||||
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
|
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
|
||||||
writeStringExWND('ALPHA', Desktop_Colors, DesktopHandle);
|
writeStringExWND('ALPHA', Desktop_Colors, DesktopHandle);
|
||||||
end;
|
end;
|
||||||
if StringEquals(asuro.RELEASE, 'b') then begin
|
if StringEquals(asuro.RELEASE, 'b') then begin
|
||||||
releaseSize:= StringSize('BETA');
|
releaseSize:= StringSize('BETA');
|
||||||
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
|
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
|
||||||
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
|
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
|
||||||
writeStringExWND('BETA', Desktop_Colors, DesktopHandle);
|
writeStringExWND('BETA', Desktop_Colors, DesktopHandle);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -210,9 +210,9 @@ begin
|
|||||||
Desktop_Colors:= console.combinecolors($FFFF, $34DB);
|
Desktop_Colors:= console.combinecolors($FFFF, $34DB);
|
||||||
|
|
||||||
tracer.push_trace('shell.init.4');
|
tracer.push_trace('shell.init.4');
|
||||||
DesktopHandle:= Console.newWindow(0, 0, 159, 63, 'DESKTOP');
|
DesktopHandle:= Console.newWindow(0, 0, Console.getMaxCellW(), Console.getMaxCellH(), 'DESKTOP');
|
||||||
tracer.push_trace('shell.init.5');
|
tracer.push_trace('shell.init.5');
|
||||||
TaskBarHandle:= Console.newWindow(0, 63, 159, 1, 'SHELL');
|
TaskBarHandle:= Console.newWindow(0, Console.getMaxCellH(), Console.getMaxCellW(), 1, 'SHELL');
|
||||||
|
|
||||||
tracer.push_trace('shell.init.6');
|
tracer.push_trace('shell.init.6');
|
||||||
console.bordersEnabled(TaskBarHandle, false);
|
console.bordersEnabled(TaskBarHandle, false);
|
||||||
|
41
src/prog/vbeinfo.pas
Normal file
41
src/prog/vbeinfo.pas
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
Prog->vbeinfo - Print out vbeinfo (VESA VGA).
|
||||||
|
|
||||||
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
|
}
|
||||||
|
unit vbeinfo;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
console, terminal, keyboard, util, strings, tracer, md5;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure run(Params : PParamList);
|
||||||
|
var
|
||||||
|
ConProp : PConsoleProperties;
|
||||||
|
|
||||||
|
begin
|
||||||
|
ConProp:= getConsoleProperties();
|
||||||
|
writestringWND('Pixel Width: ', getTerminalHWND);
|
||||||
|
writeintlnWND(ConProp^.Width, getTerminalHWND);
|
||||||
|
writestringWND('Pixel Height: ', getTerminalHWND);
|
||||||
|
writeintlnWND(ConProp^.Height, getTerminalHWND);
|
||||||
|
writestringWND('Bits Per Pixel: ', getTerminalHWND);
|
||||||
|
writeintlnWND(ConProp^.BitsPerPixel, getTerminalHWND);
|
||||||
|
writestringWND('Cell Width: ', getTerminalHWND);
|
||||||
|
writeintlnWND(ConProp^.MAX_CELL_X, getTerminalHWND);
|
||||||
|
writestringWND('Cell Height: ', getTerminalHWND);
|
||||||
|
writeintlnWND(ConProp^.MAX_CELL_Y, getTerminalHWND);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
begin
|
||||||
|
tracer.push_trace('vbeinfo.init');
|
||||||
|
terminal.registerCommand('VBEINFO', @Run, 'Print out vbeinfo (VESA VGA).');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -7,7 +7,7 @@ uses
|
|||||||
//progs
|
//progs
|
||||||
base64_prog, md5sum, shell, terminal,
|
base64_prog, md5sum, shell, terminal,
|
||||||
edit, vmstate, vmlog, netlog, themer,
|
edit, vmstate, vmlog, netlog, themer,
|
||||||
memview, udpcat, dhclient;
|
memview, udpcat, dhclient, vbeinfo;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ begin
|
|||||||
base64_prog.init();
|
base64_prog.init();
|
||||||
tracer.push_trace('progmanager.dhclient.init');
|
tracer.push_trace('progmanager.dhclient.init');
|
||||||
dhclient.init();
|
dhclient.init();
|
||||||
|
vbeinfo.init();
|
||||||
|
|
||||||
tracer.push_trace('progmanager.terminal.init');
|
tracer.push_trace('progmanager.terminal.init');
|
||||||
terminal.run();
|
terminal.run();
|
||||||
|
@ -63,8 +63,8 @@ dd 0
|
|||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 0
|
dd 0
|
||||||
dd 1280
|
|
||||||
dd 1024
|
dd 1024
|
||||||
|
dd 768
|
||||||
dd 16
|
dd 16
|
||||||
|
|
||||||
;
|
;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user