git-svn-id: https://spexeah.com:8443/svn/Asuro@654 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
a5bae52f09
commit
6ae51ac70d
67 files changed
+341
-17
No files matched your search
+257
File diff suppressed because it is too large.
Load diff
@@ -21,6 +21,9 @@ type
|
||||
TKeyInfo = packed record
|
||||
key_code : byte;
|
||||
is_down_code : boolean; //true when pressing down, false when releasing
|
||||
SHIFT_DOWN : boolean;
|
||||
CTRL_DOWN : boolean;
|
||||
ALT_DOWN : boolean;
|
||||
end;
|
||||
|
||||
PKeyInfo = ^TKeyInfo;
|
||||
@@ -31,7 +34,9 @@ var
|
||||
key_matrix : array [1..256] of TKeyInfo;
|
||||
key_matrix_shift : array [1..256] of TKeyInfo;
|
||||
captin_hook : pp_hook_method = nil;
|
||||
is_shift : boolean = false;
|
||||
is_shift : boolean = false;
|
||||
is_ctrl : boolean = false;
|
||||
is_alt : boolean = false;
|
||||
|
||||
procedure init(keyboard_layout : array of TKeyInfo);
|
||||
procedure hook(proc : pp_hook_method);
|
||||
@@ -43,20 +48,36 @@ uses
|
||||
drivermanagement;
|
||||
|
||||
procedure callback(scan_code : void);
|
||||
var
|
||||
info : TKeyInfo;
|
||||
|
||||
begin
|
||||
//console.writehex(uint8(scan_code));
|
||||
//console.writestring('[Keyboard] Scancode: ');
|
||||
//console.writeintln(uint32(scan_code));
|
||||
info.SHIFT_DOWN:= is_shift;
|
||||
info.CTRL_DOWN:= is_ctrl;
|
||||
info.ALT_DOWN:= is_alt;
|
||||
if is_shift then begin
|
||||
if key_matrix_shift[uint8(scan_code)].key_code <> 0 then begin
|
||||
if captin_hook <> nil then captin_hook(key_matrix_shift[uint8(scan_code)]);
|
||||
if captin_hook <> nil then begin
|
||||
info.key_code:= key_matrix_shift[uint8(scan_code)].key_code;
|
||||
captin_hook(info);
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
if key_matrix[uint8(scan_code)].key_code <> 0 then begin
|
||||
if captin_hook <> nil then captin_hook(key_matrix[uint8(scan_code)]);
|
||||
if captin_hook <> nil then begin
|
||||
info.key_code:= key_matrix[uint8(scan_code)].key_code;
|
||||
captin_hook(info);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if uint8(scan_code) = 42 then is_shift := true;
|
||||
if uint8(scan_code) = 170 then is_shift := false;
|
||||
if uint8(scan_code) = 29 then is_ctrl := true;
|
||||
if uint8(scan_code) = 157 then is_ctrl := false;
|
||||
if uint8(scan_code) = 56 then is_alt := true;
|
||||
if uint8(scan_code) = 184 then is_alt := false;
|
||||
end;
|
||||
|
||||
function load(ptr : void) : boolean;
|
||||
|
||||
@@ -3,11 +3,11 @@ unit asuro;
|
||||
interface
|
||||
|
||||
const
|
||||
VERSION = '1.0.0-651a';
|
||||
VERSION = '1.0.0-653a';
|
||||
VERSION_MAJOR = '1';
|
||||
VERSION_MINOR = '0';
|
||||
VERSION_SUB = '0';
|
||||
REVISION = '651';
|
||||
REVISION = '653';
|
||||
RELEASE = 'a';
|
||||
|
||||
implementation
|
||||
|
||||
@@ -49,9 +49,18 @@ type
|
||||
end;
|
||||
PMCFG = ^TMCFG;
|
||||
|
||||
TCounters = record
|
||||
c16 : uint16;
|
||||
c32 : uint32;
|
||||
c64 : uint64;
|
||||
end;
|
||||
|
||||
const
|
||||
BDA : PBDA = PBDA($C0000400);
|
||||
|
||||
var
|
||||
Counters : TCounters;
|
||||
|
||||
procedure tick_update(data : void);
|
||||
|
||||
implementation
|
||||
@@ -61,7 +70,11 @@ uses
|
||||
|
||||
procedure tick_update(data : void);
|
||||
begin
|
||||
BDA^.Ticks:= BDA^.Ticks + 1;
|
||||
//BDA^.Ticks:= BDA^.Ticks + 1;
|
||||
inc(BDA^.Ticks);
|
||||
inc(Counters.c16);
|
||||
inc(Counters.c32);
|
||||
inc(Counters.c64);
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -46,6 +46,10 @@ procedure BSOD(fault : pchar; info : pchar);
|
||||
procedure psleep(t : uint16);
|
||||
procedure sleep(seconds : uint32);
|
||||
|
||||
function get16bitcounter : uint16;
|
||||
function get32bitcounter : uint32;
|
||||
function get64bitcounter : uint64;
|
||||
|
||||
function BCDToUint8(bcd : uint8) : uint8;
|
||||
|
||||
procedure resetSystem();
|
||||
@@ -339,6 +343,21 @@ begin
|
||||
halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
function get16bitcounter : uint16;
|
||||
begin
|
||||
get16bitcounter:= bios_data_area.Counters.c16;
|
||||
end;
|
||||
|
||||
function get32bitcounter : uint32;
|
||||
begin
|
||||
get32bitcounter:= bios_data_area.Counters.c32;
|
||||
end;
|
||||
|
||||
function get64bitcounter : uint64;
|
||||
begin
|
||||
get64bitcounter:= bios_data_area.Counters.c64;
|
||||
end;
|
||||
|
||||
procedure BSOD(fault : pchar; info : pchar);
|
||||
var
|
||||
trace : pchar;
|
||||
|
||||
+5
-1
@@ -40,7 +40,8 @@ uses
|
||||
serial,
|
||||
shell,
|
||||
memview,
|
||||
splash;
|
||||
splash,
|
||||
cpu;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||
|
||||
@@ -144,6 +145,9 @@ begin
|
||||
{ Console Init }
|
||||
console.init();
|
||||
|
||||
{ CPUID }
|
||||
cpu.init();
|
||||
|
||||
{ Serial Init }
|
||||
serial.init();
|
||||
|
||||
|
||||
+18
-8
@@ -117,19 +117,29 @@ begin
|
||||
tmHex:printmemoryashex(MEM_LOC, 176, 16, ' ', true);
|
||||
tmChar:printmemoryaschar(MEM_LOC, 176, 16, ' ', true);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure OnKeyPressed(info : TKeyInfo);
|
||||
begin
|
||||
if info.key_code = 16 then begin
|
||||
dec(MEM_LOC, 16);
|
||||
NEW_LOC:= true;
|
||||
end;
|
||||
if info.key_code = 18 then begin
|
||||
inc(MEM_LOC, 16);
|
||||
NEW_LOC:= true;
|
||||
if info.CTRL_DOWN then begin
|
||||
if info.key_code = 16 then begin
|
||||
dec(MEM_LOC, 176);
|
||||
NEW_LOC:= true;
|
||||
end;
|
||||
if info.key_code = 18 then begin
|
||||
inc(MEM_LOC, 176);
|
||||
NEW_LOC:= true;
|
||||
end;
|
||||
end else begin
|
||||
if info.key_code = 16 then begin
|
||||
dec(MEM_LOC, 16);
|
||||
NEW_LOC:= true;
|
||||
end;
|
||||
if info.key_code = 18 then begin
|
||||
inc(MEM_LOC, 16);
|
||||
NEW_LOC:= true;
|
||||
end;
|
||||
end;
|
||||
if info.key_code = uint8('c') then begin
|
||||
Mode:= tmChar;
|
||||
|
||||
Reference in new issue
Block a user