Cleanup/Refactoring.
git-svn-id: https://spexeah.com:8443/svn/Asuro@14 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
d6460dcf61
commit
81363a9c57
14 files changed
+130
-126
No files matched your search
Binary file not shown.
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.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
unit bda;
|
unit BIOS_DATA_AREA;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@@ -25,6 +25,9 @@ type
|
|||||||
end;
|
end;
|
||||||
PBDA = ^TBDA;
|
PBDA = ^TBDA;
|
||||||
|
|
||||||
|
const
|
||||||
|
BDA : PBDA = PBDA($0400);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+84
-83
File diff suppressed because it is too large.
Load diff
+24
-33
@@ -4,49 +4,40 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
multiboot,
|
multiboot,
|
||||||
|
util,
|
||||||
console,
|
console,
|
||||||
bda;
|
BIOS_DATA_AREA;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
||||||
var
|
|
||||||
_bda : PBDA;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
_bda:= PBDA($0400);
|
console.init();
|
||||||
console_init();
|
console.writestringln('Booting Asuro...');
|
||||||
console_writestringln('Booting Asuro...');
|
|
||||||
if (mbmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
if (mbmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||||
console_setdefaultattribute(console_combinecolors(Red, Black));
|
console.setdefaultattribute(console.combinecolors(Red, Black));
|
||||||
console_writestringln('Multiboot Compliant Boot-Loader Needed!');
|
console.writestringln('Multiboot Compliant Boot-Loader Needed!');
|
||||||
console_writestringln('HALTING');
|
console.writestringln('HALTING');
|
||||||
asm
|
util.halt_and_catch_fire;
|
||||||
cli
|
|
||||||
hlt
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
console_clear();
|
|
||||||
console_setdefaultattribute(console_combinecolors(Green, Black));
|
|
||||||
console_writestringln('Asuro Booted Correctly!');
|
|
||||||
console_writestringln('');
|
|
||||||
console_setdefaultattribute(console_combinecolors(White, Black));
|
|
||||||
console_writestring('Lower Memory = ');
|
|
||||||
console_writeint(mbinfo^.mem_lower);
|
|
||||||
console_writestringln('KB');
|
|
||||||
console_writestring('Higher Memory = ');
|
|
||||||
console_writeint(mbinfo^.mem_upper);
|
|
||||||
console_writestringln('KB');
|
|
||||||
console_writestring('Total Memory = ');
|
|
||||||
console_writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
|
|
||||||
console_writestringln('MB');
|
|
||||||
console_setdefaultattribute(console_combinecolors(lYellow, Black));
|
|
||||||
asm
|
|
||||||
cli
|
|
||||||
hlt
|
|
||||||
end;
|
end;
|
||||||
|
console.clear();
|
||||||
|
console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||||
|
console.writestringln('Asuro Booted Correctly!');
|
||||||
|
console.writestringln('');
|
||||||
|
console.setdefaultattribute(console.combinecolors(White, Black));
|
||||||
|
console.writestring('Lower Memory = ');
|
||||||
|
console.writeint(mbinfo^.mem_lower);
|
||||||
|
console.writestringln('KB');
|
||||||
|
console.writestring('Higher Memory = ');
|
||||||
|
console.writeint(mbinfo^.mem_upper);
|
||||||
|
console.writestringln('KB');
|
||||||
|
console.writestring('Total Memory = ');
|
||||||
|
console.writeint(((mbinfo^.mem_upper + 1000) div 1024) +1);
|
||||||
|
console.writestringln('MB');
|
||||||
|
console.setdefaultattribute(console.combinecolors(lYellow, Black));
|
||||||
|
util.halt_and_catch_fire;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+18
-9
@@ -4,28 +4,29 @@ unit util;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
function util_hi(b : byte) : byte;
|
function hi(b : byte) : byte;
|
||||||
function util_lo(b : byte) : byte;
|
function lo(b : byte) : byte;
|
||||||
function util_switchendian(b : byte) : byte;
|
function switchendian(b : byte) : byte;
|
||||||
procedure outb(port : word; val : byte);
|
procedure outb(port : word; val : byte);
|
||||||
procedure outw(port : word; val : word);
|
procedure outw(port : word; val : word);
|
||||||
procedure outl(port : word; val : longword);
|
procedure outl(port : word; val : longword);
|
||||||
|
procedure halt_and_catch_fire();
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function util_hi(b : byte) : byte; [public, alias: 'util_hi'];
|
function hi(b : byte) : byte; [public, alias: 'util_hi'];
|
||||||
begin
|
begin
|
||||||
util_hi:= (b AND $F0) SHR 4;
|
hi:= (b AND $F0) SHR 4;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function util_lo(b : byte) : byte; [public, alias: 'util_lo'];
|
function lo(b : byte) : byte; [public, alias: 'util_lo'];
|
||||||
begin
|
begin
|
||||||
util_lo:= b AND $0F;
|
lo:= b AND $0F;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function util_switchendian(b : byte) : byte; [public, alias: 'util_switchendian'];
|
function switchendian(b : byte) : byte; [public, alias: 'util_switchendian'];
|
||||||
begin
|
begin
|
||||||
util_switchendian:= (util_lo(b) SHL 4) OR util_hi(b);
|
switchendian:= (lo(b) SHL 4) OR hi(b);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure outl(port : word; val : longword); [public, alias: 'outl'];
|
procedure outl(port : word; val : longword); [public, alias: 'outl'];
|
||||||
@@ -67,4 +68,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure halt_and_catch_fire(); [public, alias: 'halt_and_catch_fire'];
|
||||||
|
begin
|
||||||
|
asm
|
||||||
|
cli
|
||||||
|
hlt
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Reference in new issue
Block a user