Hashmap added.

git-svn-id: https://spexeah.com:8443/svn/Asuro@1235 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2020-07-15 23:03:32 +00:00
parent 3c5d75e77e
commit a7ee8c6d34
12 changed files with 473 additions and 72 deletions
+84 -51
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -147,15 +147,17 @@ begin
Packet.LMB_Down:= (f AND %00000001) = %00000001;
Packet.x_overflow:= (f AND $40) = $40;
Packet.y_overflow:= (f AND $80) = $80;
Packet.x_movement:= Mouse_Byte[1] - ((f SHL 4) AND $100);
Packet.y_movement:= Mouse_Byte[2] - ((f SHL 3) AND $100);
Packet.x_movement:= Mouse_Byte[1];// - ((f SHL 4) 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
Current.x:= Current.x + Packet.x_movement;
Current.y:= Current.y - Packet.y_movement;
if Current.x < 0 then Current.x:= 0;
if Current.y < 0 then Current.y:= 0;
if Current.x > 1272 then Current.x:= 1272;
if Current.y > 1015 then Current.y:= 1015;
if Current.x > (Console.getConsoleProperties^.Width-8) then Current.x:= (Console.getConsoleProperties^.Width-8);
if Current.y > (Console.getConsoleProperties^.Height-8) then Current.y:= (Console.getConsoleProperties^.Height-8);
end;
Cycle:= 0;
if Packet.LMB_Down then begin
File diff suppressed because it is too large Load Diff
+11
View File
@@ -39,6 +39,8 @@ procedure MD5Update(context : PMD5Context; buffer : PuInt8; bufferLen : uInt32);
function MD5Final(context : PMD5Context) : PMD5Digest;
function MD5Buffer(buffer : PuInt8; bufferLen : uInt32) : PMD5Digest;
function MD5To32(Input : PuInt128) : uint32;
implementation
procedure Invert(Source : PuInt8; Dest : PuInt32; Count : uInt32);
@@ -234,4 +236,13 @@ begin
kfree(void(context));
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.
+1 -1
View File
@@ -43,7 +43,7 @@ type
vbe_interface_seg : uint16;
vbe_interface_off : uint16;
vbe_interface_len : uint16;
framebuffer_addr : uint64;
framebuffer_addr : uint64;
framebuffer_pitch : uint32;
framebuffer_width : uint32;
framebuffer_height: uint32;
+17
View File
@@ -28,6 +28,22 @@ type
uInt16 = WORD;
uInt32 = DWORD;
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;
sInt16 = smallint;
@@ -42,6 +58,7 @@ type
PuInt16 = ^uInt16;
PuInt32 = ^uInt32;
PuInt64 = ^uInt64;
PuInt128 = ^uint128;
PsInt8 = ^sInt8;
PsInt16 = ^sInt16;
+80 -1
View File
@@ -40,7 +40,8 @@ uses
md5,
base64,
rand,
terminal;
terminal,
hashmap;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -77,6 +78,20 @@ begin
pop_trace;
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'];
var
c : uint8;
@@ -92,6 +107,9 @@ var
test : puint8;
fb : puint16;
l : PLinkedListBase;
ulf : pointer;
HM : PHashMap;
begin
{ 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));
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
tracer.push_trace('kmain.RedrawWindows');
console.redrawWindows;
+5
View File
@@ -20,6 +20,11 @@ var
wordlen : uint32;
MD5_Hash : PMD5Digest;
i : uint32;
MD5_128 : puint128;
Result : uint64;
Result32 : uint32;
Modulo : uint64;
begin
md5word:= getParam(0, Params);
+13 -13
View File
@@ -63,7 +63,7 @@ begin
end;
end;
console.setCursorPosWND(150, 0, TaskBarHandle);
console.setCursorPosWND(Console.getMaxCellW() - 9, 0, TaskBarHandle);
if DateTime.Hours < 10 then writeIntExWND(0, Takbar_Colors, TaskBarHandle);
writeIntExWND(DateTime.Hours, Takbar_Colors, TaskBarHandle);
writeStringExWND(':', Takbar_Colors, TaskBarHandle);
@@ -96,32 +96,32 @@ begin
clearWNDEx(DesktopHandle, Desktop_Colors);
if not(StringEquals(asuro.RELEASE, 'r')) then begin
versionSize:= StringSize(asuro.VERSION) + StringSize('Asuro v');
versionDrawX:= 157 - versionSize;
setCursorPosWND(versionDrawX, 60, DesktopHandle);
versionDrawX:= Console.getMaxCellW() - 2 - versionSize;
setCursorPosWND(versionDrawX, Console.getMaxCellH() - 4, DesktopHandle);
writestringExWND('ASURO v', Desktop_Colors, DesktopHandle);
writestringExWND(asuro.VERSION, Desktop_Colors, DesktopHandle);
if StringEquals(asuro.RELEASE, 'rc') then begin
releaseSize:= StringSize('RELEASE CANDIDATE');
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
writeStringExWND('RELEASE CANDIDATE', Desktop_Colors, DesktopHandle);
end;
if StringEquals(asuro.RELEASE, 'ia') then begin
releaseSize:= StringSize('INTERNAL ALPHA');
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
writeStringExWND('INTERNAL ALPHA', Desktop_Colors, DesktopHandle);
end;
if StringEquals(asuro.RELEASE, 'a') then begin
releaseSize:= StringSize('ALPHA');
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
writeStringExWND('ALPHA', Desktop_Colors, DesktopHandle);
end;
if StringEquals(asuro.RELEASE, 'b') then begin
releaseSize:= StringSize('BETA');
releaseDrawX:= 157 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, 61, DesktopHandle);
releaseDrawX:= Console.getMaxCellW() - 2 - (versionSize div 2) - (releaseSize div 2);
setCursorPosWND(releaseDrawX, Console.getMaxCellH() - 3, DesktopHandle);
writeStringExWND('BETA', Desktop_Colors, DesktopHandle);
end;
end;
@@ -210,9 +210,9 @@ begin
Desktop_Colors:= console.combinecolors($FFFF, $34DB);
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');
TaskBarHandle:= Console.newWindow(0, 63, 159, 1, 'SHELL');
TaskBarHandle:= Console.newWindow(0, Console.getMaxCellH(), Console.getMaxCellW(), 1, 'SHELL');
tracer.push_trace('shell.init.6');
console.bordersEnabled(TaskBarHandle, false);
+41
View File
@@ -0,0 +1,41 @@
{
Prog->vbeinfo - Print out vbeinfo (VESA VGA).
@author(Kieron Morris <[email protected]>)
}
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.
+2 -1
View File
@@ -7,7 +7,7 @@ uses
//progs
base64_prog, md5sum, shell, terminal,
edit, vmstate, vmlog, netlog, themer,
memview, udpcat, dhclient;
memview, udpcat, dhclient, vbeinfo;
procedure init();
@@ -37,6 +37,7 @@ begin
base64_prog.init();
tracer.push_trace('progmanager.dhclient.init');
dhclient.init();
vbeinfo.init();
tracer.push_trace('progmanager.terminal.init');
terminal.run();
+1 -1
View File
@@ -63,8 +63,8 @@ dd 0
dd 0
dd 0
dd 0
dd 1280
dd 1024
dd 768
dd 16
;