diff --git a/Asuro.iso b/Asuro.iso index 49533de2..7b1699fc 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index fb8c698b..cbf04a18 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index ad5bbfd1..cbf04a18 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/PCI.ppu b/lib/PCI.ppu index e7cab79d..e30a7590 100644 Binary files a/lib/PCI.ppu and b/lib/PCI.ppu differ diff --git a/lib/isr33.ppu b/lib/isr33.ppu index cc7d9695..9f617c1d 100644 Binary files a/lib/isr33.ppu and b/lib/isr33.ppu differ diff --git a/lib/isr40.ppu b/lib/isr40.ppu index 66b82e4e..cd156e47 100644 Binary files a/lib/isr40.ppu and b/lib/isr40.ppu differ diff --git a/lib/isr44.ppu b/lib/isr44.ppu index 0b7ab532..7e7fa250 100644 Binary files a/lib/isr44.ppu and b/lib/isr44.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index cc6b4da4..fb9fd3b4 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index bf710698..869cafe9 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index f4ef9c3e..0f3cd046 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index de826d0d..4ab7be23 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/mouse.ppu b/lib/mouse.ppu index 0135a859..7fa14782 100644 Binary files a/lib/mouse.ppu and b/lib/mouse.ppu differ diff --git a/lib/scheduler.ppu b/lib/scheduler.ppu index 2bd592bb..9410de76 100644 Binary files a/lib/scheduler.ppu and b/lib/scheduler.ppu differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index 94184629..8311e057 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/src/driver/PCI.pas b/src/driver/PCI.pas index b76856e2..207c390d 100644 --- a/src/driver/PCI.pas +++ b/src/driver/PCI.pas @@ -410,6 +410,11 @@ begin if tmp.class_code = 3 then begin console.writestringln('-Device is DISPLAY_CONTROLLER '); end; + if tmp.class_code = $0C then begin + if tmp.subclass_class = $03 then begin + console.writestringln('-Device is USB Controller'); + end; + end; end; //psleep(300); diff --git a/src/driver/mouse.pas b/src/driver/mouse.pas index b079317c..0313ddb0 100644 --- a/src/driver/mouse.pas +++ b/src/driver/mouse.pas @@ -14,16 +14,93 @@ interface uses console, util, - isr44; + isr44, + lmemorymanager, + strings; + +type + PMousePacket = ^TMousePacket; + TMousePacket = record + x_movement : byte; + y_movement : byte; + y_overflow : boolean; + x_overflow : boolean; + y_sign : boolean; + x_sign : boolean; + MMB_Down : Boolean; + RMB_Down : Boolean; + LMB_Down : Boolean; + end; procedure init(); implementation -procedure callback(packet : void); +procedure callback(raw : void); +var + packet : PMousePacket; + x, y, f : byte; + r : pchar; + begin + packet:= PMousePacket(kalloc(sizeof(TMousePacket))); + f:= (uint32(raw) AND $FF000000) SHR 24; + x:= (uint32(raw) AND $00FF0000) SHR 16; + y:= (uint32(raw) AND $0000FF00) SHR 8; + packet^.x_movement:= x; + packet^.y_movement:= y; + packet^.y_overflow:= (f AND $80) = $80; + packet^.x_overflow:= (f AND $40) = $40; + packet^.y_sign:= (f AND $20) = $20; + packet^.x_sign:= (f AND $10) = $10; + packet^.MMB_Down:= (f AND $4) = $4; + packet^.RMB_Down:= (f AND $2) = $2; + packet^.LMB_Down:= (f AND $1) = $1; + //Do Hook here + // console.writestring('X Movement: '); + // console.writeintln(packet^.x_movement); + + // console.writestring('Y Movement: '); + // console.writeintln(packet^.y_movement); + + // console.writestring('Y Overflow: '); + // r:= boolToString(packet^.y_overflow, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('X Overflow: '); + // r:= boolToString(packet^.x_overflow, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('Y Sign: '); + // r:= boolToString(packet^.y_sign, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('X Sign: '); + // r:= boolToString(packet^.x_sign, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('Middle Button Down: '); + // r:= boolToString(packet^.MMB_Down, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('Right Button Down: '); + // r:= boolToString(packet^.RMB_Down, true); + // console.writestringln(r); + // kfree(void(r)); + + // console.writestring('Left Button Down: '); + // r:= boolToString(packet^.LMB_Down, true); + // console.writestringln(r); + // kfree(void(r)); + + kfree(void(packet)); //console.writestring('Mouse Packet: '); - //console.writehexln(DWORD(packet)); + //console.writehexln(DWORD(raw)); end; procedure init(); diff --git a/src/isr/isr33.pas b/src/isr/isr33.pas index c0b62994..7e961d0c 100644 --- a/src/isr/isr33.pas +++ b/src/isr/isr33.pas @@ -34,6 +34,7 @@ var begin //writechar('!'); // Bug traces all the way back to here - when the keyboard randomly doesn't work, this inturrupt isn't even called... // This needs further investigation... Is there something that can go wrong when setting up the PIC? + CLI; b:= inb($60); //console.writehexln(b); for i:=0 to MAX_HOOKS-1 do begin diff --git a/src/isr/isr44.pas b/src/isr/isr44.pas index abc4af2a..1a3451a3 100644 --- a/src/isr/isr44.pas +++ b/src/isr/isr44.pas @@ -25,7 +25,7 @@ implementation var Hooks : Array[1..MAX_HOOKS] of pp_hook_method; - Cycle : uint8 = 0; + Cycle : uint32 = 0; Mouse_Byte : Array[0..2] of uint8; Packet : uint32; @@ -65,12 +65,27 @@ end; procedure Main(); interrupt; var i : integer; + b : byte; begin - Mouse_Byte[Cycle]:= mouse_read; - inc(Cycle); + b:= mouse_read; + if Cycle = 0 then begin + if (b AND $08) = $08 then begin + Mouse_Byte[Cycle]:= b; + inc(Cycle); + end; + end else begin + Mouse_Byte[Cycle]:= b; + inc(Cycle); + end; if Cycle > 2 then begin Cycle:= 0; + // console.writestring('Packet[0]: '); + // console.writeintln(Mouse_Byte[0]); + // console.writestring('Packet[1]: '); + // console.writeintln(Mouse_Byte[1]); + // console.writestring('Packet[2]: '); + // console.writeintln(Mouse_Byte[2]); Packet:= (Mouse_Byte[0] SHL 24) OR (Mouse_Byte[1] SHL 16) OR (Mouse_Byte[2] SHL 8) OR ($FF); for i:=0 to MAX_HOOKS-1 do begin if uint32(Hooks[i]) <> 0 then Hooks[i](void(Packet)); diff --git a/src/strings.pas b/src/strings.pas index f7da64ec..d25135ca 100644 --- a/src/strings.pas +++ b/src/strings.pas @@ -25,6 +25,7 @@ function stringConcat(str1, str2 : pchar) : pchar; function stringContains(str : pchar; sub : pchar) : boolean; function stringToInt(str : pchar) : uint32; function intToString(i : uint32) : pchar; +function boolToString(b : boolean; ext : boolean) : pchar; implementation @@ -150,4 +151,26 @@ begin intToString:= ' '; end; +function boolToString(b : boolean; ext : boolean) : pchar; +var + t : pchar; + f : pchar; + +begin + if ext then begin + t:= stringCopy('true'); + f:= stringCopy('false'); + end else begin + t:= stringCopy('1'); + f:= stringCopy('0'); + end; + if b then begin + kfree(void(f)); + boolToString:= t; + end else begin + kfree(void(t)); + boolToString:= f; + end; +end; + end. \ No newline at end of file diff --git a/src/terminal.pas b/src/terminal.pas index 336615ae..74228339 100644 --- a/src/terminal.pas +++ b/src/terminal.pas @@ -106,6 +106,7 @@ function getParam(index : uint32; params : PParamList) : pchar; var result : pchar; search : PParamList; + i : uint32; begin result:= nil; @@ -182,7 +183,7 @@ end; procedure test(params : PParamList); begin if paramCount(params) > 0 then begin - console.writeintln(stringToInt(params^.next^.param)); + console.writeintln(stringToInt(getParam(0, params))); end else begin console.writestringln('Invalid number of params'); end;