Standardized to standard types in types.pas
git-svn-id: https://spexeah.com:8443/svn/Asuro@31 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
7da445635c
commit
7a24ea11ba
17 files changed
+186
-161
No files matched your search
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+18
-18
@@ -4,24 +4,24 @@ interface
|
||||
|
||||
type
|
||||
TBDA = bitpacked record
|
||||
COM1 : WORD;
|
||||
COM2 : WORD;
|
||||
COM3 : WORD;
|
||||
COM4 : WORD;
|
||||
LPT1 : WORD;
|
||||
LPT2 : WORD;
|
||||
LPT3 : WORD;
|
||||
EBDA : WORD;
|
||||
Hardware_Flags : WORD;
|
||||
Keyboard_Flags : WORD;
|
||||
Keyboard_Buffer : ARRAY[0..31] OF BYTE;
|
||||
Display_Mode : BYTE;
|
||||
BaseIO : WORD;
|
||||
Ticks : WORD;
|
||||
HDD_Count : BYTE;
|
||||
Keyboard_Start : WORD;
|
||||
Keyboard_End : WORD;
|
||||
Keyboard_State : Byte;
|
||||
COM1 : uint16;
|
||||
COM2 : uint16;
|
||||
COM3 : uint16;
|
||||
COM4 : uint16;
|
||||
LPT1 : uint16;
|
||||
LPT2 : uint16;
|
||||
LPT3 : uint16;
|
||||
EBDA : uint16;
|
||||
Hardware_Flags : uint16;
|
||||
Keyboard_Flags : uint16;
|
||||
Keyboard_Buffer : ARRAY[0..31] OF uint8;
|
||||
Display_Mode : uint8;
|
||||
BaseIO : uint16;
|
||||
Ticks : uint16;
|
||||
HDD_Count : uint8;
|
||||
Keyboard_Start : uint16;
|
||||
Keyboard_End : uint16;
|
||||
Keyboard_State : uint8;
|
||||
end;
|
||||
PBDA = ^TBDA;
|
||||
|
||||
|
||||
+67
-67
File diff suppressed because it is too large.
Load diff
+14
-16
@@ -7,18 +7,18 @@ uses
|
||||
|
||||
type
|
||||
TGDT_Entry = bitpacked record
|
||||
limit_low : int16;
|
||||
base_low : int16;
|
||||
base_middle : int8;
|
||||
access : int8;
|
||||
granularity : int8;
|
||||
base_high : int8;
|
||||
limit_low : uint16;
|
||||
base_low : uint16;
|
||||
base_middle : uint8;
|
||||
access : uint8;
|
||||
granularity : uint8;
|
||||
base_high : uint8;
|
||||
end;
|
||||
PGDT_Entry = ^TGDT_Entry;
|
||||
|
||||
TGDT_Pointer = bitpacked record
|
||||
limit : int16;
|
||||
base : int32;
|
||||
limit : uint16;
|
||||
base : uint32;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -29,7 +29,7 @@ procedure init();
|
||||
|
||||
implementation
|
||||
|
||||
procedure flush_gdt(gdt_pointer : int32); assembler; nostackframe;
|
||||
procedure flush_gdt(gdt_pointer : uint32); assembler; nostackframe;
|
||||
asm
|
||||
MOV EAX, gdt_pointer
|
||||
LGDT [EAX]
|
||||
@@ -40,13 +40,11 @@ asm
|
||||
MOV GS, AX
|
||||
MOV SS, AX
|
||||
db $EA // Bypass stupid inline ASM restrictions-
|
||||
dw @@flush, $08 // by assembling the farjump instruction ourselves.
|
||||
// It's just data, honest gov'.
|
||||
@@flush:
|
||||
RET
|
||||
dw @@flush, $08 // by assembling the farjump instruction ourselves.
|
||||
@@flush: // It's just data, honest gov'.
|
||||
end;
|
||||
|
||||
procedure set_gate(Gate_Number : int32; Base : int32; Limit : int32; Access : int8; Granularity : int8);
|
||||
procedure set_gate(Gate_Number : uint32; Base : uint32; Limit : uint32; Access : uint8; Granularity : uint8);
|
||||
begin
|
||||
gdt_entries[Gate_Number].base_low := (Base AND $FFFF);
|
||||
gdt_entries[Gate_Number].base_middle := (Base SHR 16) AND $FF;
|
||||
@@ -59,13 +57,13 @@ end;
|
||||
procedure init();
|
||||
begin
|
||||
gdt_pointer.limit := (sizeof(TGDT_Entry) * 5) - 1;
|
||||
gdt_pointer.base := int32(@gdt_entries);
|
||||
gdt_pointer.base := uint32(@gdt_entries);
|
||||
set_gate($00, $00, $00, $00, $00);
|
||||
set_gate($01, $00, $FFFFFFFF, $9A, $CF);
|
||||
set_gate($02, $00, $FFFFFFFF, $92, $CF);
|
||||
set_gate($03, $00, $FFFFFFFF, $FA, $CF);
|
||||
set_gate($04, $00, $FFFFFFFF, $F2, $CF);
|
||||
flush_gdt(int32(@gdt_pointer))
|
||||
flush_gdt(uint32(@gdt_pointer))
|
||||
end;
|
||||
|
||||
end.
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
unit idt;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
system,
|
||||
types;
|
||||
|
||||
type
|
||||
TIDT_Entry = bitpacked record
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
+6
-8
@@ -14,12 +14,12 @@ procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall;
|
||||
|
||||
implementation
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
||||
var
|
||||
c : byte;
|
||||
c : uint8;
|
||||
mbi : Pmultiboot_info_t;
|
||||
mbm : DWORD;
|
||||
dds : DWORD;
|
||||
mbm : uint32;
|
||||
dds : uint32;
|
||||
|
||||
begin
|
||||
mbi:= mbinfo;
|
||||
@@ -41,8 +41,6 @@ begin
|
||||
console.setdefaultattribute(console.combinecolors(Red, Black));
|
||||
if dds = $08 then console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||
console.writehexln(dds);
|
||||
util.halt_and_catch_fire;
|
||||
|
||||
console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||
console.writestringln('Asuro Booted Correctly!');
|
||||
console.writestringln('');
|
||||
@@ -57,11 +55,11 @@ begin
|
||||
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
|
||||
console.writestringln('MB');
|
||||
console.setdefaultattribute(console.combinecolors(lYellow, Black));
|
||||
while true do begin
|
||||
{while true do begin
|
||||
c:= keyboard.get_scancode;
|
||||
console.writehexln(c);
|
||||
end;
|
||||
util.halt_and_catch_fire;
|
||||
util.halt_and_catch_fire;}
|
||||
end;
|
||||
|
||||
end.
|
||||
+3
-3
@@ -7,13 +7,13 @@ interface
|
||||
uses
|
||||
util;
|
||||
|
||||
function get_scancode() : byte;
|
||||
function get_scancode() : uint8;
|
||||
|
||||
implementation
|
||||
|
||||
function get_scancode() : byte; [public, alias: 'get_scancode'];
|
||||
function get_scancode() : uint8; [public, alias: 'get_scancode'];
|
||||
var
|
||||
c : byte;
|
||||
c : uint8;
|
||||
|
||||
begin
|
||||
c:= 0;
|
||||
|
||||
+21
-21
@@ -9,40 +9,40 @@ const
|
||||
type
|
||||
Pelf_section_header_table_t = ^elf_section_header_table_t;
|
||||
elf_section_header_table_t = packed record
|
||||
num: DWORD;
|
||||
size: DWORD;
|
||||
addr: DWORD;
|
||||
shndx: DWORD;
|
||||
num: uint32;
|
||||
size: uint32;
|
||||
addr: uint32;
|
||||
shndx: uint32;
|
||||
end;
|
||||
|
||||
Pmultiboot_info_t = ^multiboot_info_t;
|
||||
multiboot_info_t = packed record
|
||||
flags: DWORD;
|
||||
mem_lower: DWORD;
|
||||
mem_upper: DWORD;
|
||||
boot_device: DWORD;
|
||||
cmdline: DWORD;
|
||||
mods_count: DWORD;
|
||||
mods_addr: DWORD;
|
||||
flags: uint32;
|
||||
mem_lower: uint32;
|
||||
mem_upper: uint32;
|
||||
boot_device: uint32;
|
||||
cmdline: uint32;
|
||||
mods_count: uint32;
|
||||
mods_addr: uint32;
|
||||
elf_sec: elf_section_header_table_t;
|
||||
mmap_length: DWORD;
|
||||
mmap_addr: DWORD;
|
||||
mmap_length: uint32;
|
||||
mmap_addr: uint32;
|
||||
end;
|
||||
|
||||
Pmodule_t = ^module_t;
|
||||
module_t = packed record
|
||||
mod_start: DWORD;
|
||||
mod_end: DWORD;
|
||||
name: DWORD;
|
||||
reserved: DWORD;
|
||||
mod_start: uint32;
|
||||
mod_end: uint32;
|
||||
name: uint32;
|
||||
reserved: uint32;
|
||||
end;
|
||||
|
||||
Pmemory_map_t = ^memory_map_t;
|
||||
memory_map_t = packed record
|
||||
size: DWORD;
|
||||
base_addr : QWORD;
|
||||
length : QWORD;
|
||||
mtype: DWORD;
|
||||
size: uint32;
|
||||
base_addr : uint64;
|
||||
length : uint64;
|
||||
mtype: uint32;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
+23
-10
@@ -4,21 +4,34 @@ interface
|
||||
|
||||
type
|
||||
//Standard Types
|
||||
Int8 = BYTE;
|
||||
Int16 = WORD;
|
||||
Int32 = DWORD;
|
||||
Int64 = QWORD;
|
||||
uInt8 = BYTE;
|
||||
uInt16 = WORD;
|
||||
uInt32 = DWORD;
|
||||
uInt64 = QWORD;
|
||||
|
||||
sInt8 = shortint;
|
||||
sInt16 = smallint;
|
||||
sInt32 = integer;
|
||||
sInt64 = longint;
|
||||
|
||||
Float = Single;
|
||||
|
||||
//Pointer Types
|
||||
PByte = ^Byte;
|
||||
PInt8 = PByte;
|
||||
PInt16 = ^Int16;
|
||||
PInt32 = ^Int32;
|
||||
PInt64 = ^Int64;
|
||||
PuByte = ^Byte;
|
||||
PuInt8 = PuByte;
|
||||
PuInt16 = ^uInt16;
|
||||
PuInt32 = ^uInt32;
|
||||
PuInt64 = ^uInt64;
|
||||
|
||||
Void = ^Int32;
|
||||
PsInt8 = ^sInt8;
|
||||
PsInt16 = ^sInt16;
|
||||
PsInt32 = ^sInt32;
|
||||
PsInt64 = ^sInt64;
|
||||
|
||||
PFloat = ^Float;
|
||||
PDouble = ^Double;
|
||||
|
||||
Void = ^uInt32;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
+18
-18
@@ -4,35 +4,35 @@ unit util;
|
||||
|
||||
interface
|
||||
|
||||
function hi(b : byte) : byte;
|
||||
function lo(b : byte) : byte;
|
||||
function switchendian(b : byte) : byte;
|
||||
procedure outb(port : word; val : byte);
|
||||
procedure outw(port : word; val : word);
|
||||
procedure outl(port : word; val : longword);
|
||||
function hi(b : uint8) : uint8;
|
||||
function lo(b : uint8) : uint8;
|
||||
function switchendian(b : 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();
|
||||
function inb(port : word) : byte;
|
||||
function inw(port : word) : word;
|
||||
function inl(port : word) : dword;
|
||||
function inb(port : uint16) : uint8;
|
||||
function inw(port : uint16) : uint16;
|
||||
function inl(port : uint16) : uint32;
|
||||
|
||||
implementation
|
||||
|
||||
function hi(b : byte) : byte; [public, alias: 'util_hi'];
|
||||
function hi(b : uint8) : uint8; [public, alias: 'util_hi'];
|
||||
begin
|
||||
hi:= (b AND $F0) SHR 4;
|
||||
end;
|
||||
|
||||
function lo(b : byte) : byte; [public, alias: 'util_lo'];
|
||||
function lo(b : uint8) : uint8; [public, alias: 'util_lo'];
|
||||
begin
|
||||
lo:= b AND $0F;
|
||||
end;
|
||||
|
||||
function switchendian(b : byte) : byte; [public, alias: 'util_switchendian'];
|
||||
function switchendian(b : uint8) : uint8; [public, alias: 'util_switchendian'];
|
||||
begin
|
||||
switchendian:= (lo(b) SHL 4) OR hi(b);
|
||||
end;
|
||||
|
||||
procedure outl(port : word; val : longword); [public, alias: 'util_outl'];
|
||||
procedure outl(port : uint16; val : uint32); [public, alias: 'util_outl'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
@@ -45,7 +45,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure outw(port : word; val : word); [public, alias: 'util_outw'];
|
||||
procedure outw(port : uint16; val : uint16); [public, alias: 'util_outw'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
@@ -58,7 +58,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure outb(port : word; val : byte); [public, alias: 'util_outb'];
|
||||
procedure outb(port : uint16; val : uint8); [public, alias: 'util_outb'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
@@ -79,7 +79,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function inl(port : word) : dword; [public, alias: 'util_inl'];
|
||||
function inl(port : uint16) : uint32; [public, alias: 'util_inl'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
@@ -92,7 +92,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function inw(port : word) : word; [public, alias: 'util_inw'];
|
||||
function inw(port : uint16) : uint16; [public, alias: 'util_inw'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
@@ -105,7 +105,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function inb(port : word) : byte; [public, alias: 'util_inb'];
|
||||
function inb(port : uint16) : uint8; [public, alias: 'util_inb'];
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
|
||||
Reference in new issue
Block a user