Useful functions.
git-svn-id: https://spexeah.com:8443/svn/Asuro@264 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
28
src/util.pas
28
src/util.pas
@ -19,19 +19,25 @@ uses
|
||||
procedure CLI();
|
||||
procedure STI();
|
||||
procedure GPF();
|
||||
|
||||
function hi(b : uint8) : uint8;
|
||||
function lo(b : uint8) : uint8;
|
||||
function switchendian(b : uint8) : uint8;
|
||||
function getWord(i : uint32; hi : boolean) : uint16;
|
||||
function getByte(i : uint32; index : uint8) : uint8;
|
||||
|
||||
procedure outb(port : uint16; val : uint8);
|
||||
procedure outw(port : uint16; val : uint16);
|
||||
procedure outl(port : uint16; val : uint32);
|
||||
procedure halt_and_catch_fire();
|
||||
procedure halt_and_dont_catch_fire();
|
||||
function inb(port : uint16) : uint8;
|
||||
function inw(port : uint16) : uint16;
|
||||
function inl(port : uint16) : uint32;
|
||||
|
||||
procedure memset(location : uint32; value : uint8; size : uint32);
|
||||
procedure memcpy(source : uint32; dest : uint32; size : uint32);
|
||||
|
||||
procedure halt_and_catch_fire();
|
||||
procedure halt_and_dont_catch_fire();
|
||||
procedure psleep(t : uint16);
|
||||
|
||||
var
|
||||
@ -203,4 +209,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function getWord(i : uint32; hi : boolean) : uint16;
|
||||
begin
|
||||
if hi then begin
|
||||
getWord:= (i AND $FFFF0000) SHR 16;
|
||||
end else begin
|
||||
getWord:= (i AND $0000FFFF);
|
||||
end;
|
||||
end;
|
||||
|
||||
function getByte(i : uint32; index : uint8) : uint8;
|
||||
var
|
||||
mask : uint32;
|
||||
|
||||
begin
|
||||
mask:= ($FF SHL (8*index));
|
||||
getByte:= (i AND mask) SHR (8*index);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user