Cleanup/Refactoring.
git-svn-id: https://spexeah.com:8443/svn/Asuro@14 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
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
|
||||
|
||||
@@ -25,6 +25,9 @@ type
|
||||
end;
|
||||
PBDA = ^TBDA;
|
||||
|
||||
const
|
||||
BDA : PBDA = PBDA($0400);
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
+84
-83
File diff suppressed because it is too large
Load Diff
+27
-36
@@ -3,50 +3,41 @@ unit kernel;
|
||||
interface
|
||||
|
||||
uses
|
||||
multiboot,
|
||||
console,
|
||||
bda;
|
||||
multiboot,
|
||||
util,
|
||||
console,
|
||||
BIOS_DATA_AREA;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall;
|
||||
|
||||
implementation
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
||||
var
|
||||
_bda : PBDA;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: DWORD); stdcall; [public, alias: 'kmain'];
|
||||
begin
|
||||
_bda:= PBDA($0400);
|
||||
console_init();
|
||||
console_writestringln('Booting Asuro...');
|
||||
console.init();
|
||||
console.writestringln('Booting Asuro...');
|
||||
if (mbmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||
console_setdefaultattribute(console_combinecolors(Red, Black));
|
||||
console_writestringln('Multiboot Compliant Boot-Loader Needed!');
|
||||
console_writestringln('HALTING');
|
||||
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));
|
||||
asm
|
||||
cli
|
||||
hlt
|
||||
console.setdefaultattribute(console.combinecolors(Red, Black));
|
||||
console.writestringln('Multiboot Compliant Boot-Loader Needed!');
|
||||
console.writestringln('HALTING');
|
||||
util.halt_and_catch_fire;
|
||||
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.
|
||||
|
||||
+18
-9
@@ -4,28 +4,29 @@ unit util;
|
||||
|
||||
interface
|
||||
|
||||
function util_hi(b : byte) : byte;
|
||||
function util_lo(b : byte) : byte;
|
||||
function util_switchendian(b : byte) : byte;
|
||||
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);
|
||||
procedure halt_and_catch_fire();
|
||||
|
||||
implementation
|
||||
|
||||
function util_hi(b : byte) : byte; [public, alias: 'util_hi'];
|
||||
function hi(b : byte) : byte; [public, alias: 'util_hi'];
|
||||
begin
|
||||
util_hi:= (b AND $F0) SHR 4;
|
||||
hi:= (b AND $F0) SHR 4;
|
||||
end;
|
||||
|
||||
function util_lo(b : byte) : byte; [public, alias: 'util_lo'];
|
||||
function lo(b : byte) : byte; [public, alias: 'util_lo'];
|
||||
begin
|
||||
util_lo:= b AND $0F;
|
||||
lo:= b AND $0F;
|
||||
end;
|
||||
|
||||
function util_switchendian(b : byte) : byte; [public, alias: 'util_switchendian'];
|
||||
function switchendian(b : byte) : byte; [public, alias: 'util_switchendian'];
|
||||
begin
|
||||
util_switchendian:= (util_lo(b) SHL 4) OR util_hi(b);
|
||||
switchendian:= (lo(b) SHL 4) OR hi(b);
|
||||
end;
|
||||
|
||||
procedure outl(port : word; val : longword); [public, alias: 'outl'];
|
||||
@@ -67,4 +68,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure halt_and_catch_fire(); [public, alias: 'halt_and_catch_fire'];
|
||||
begin
|
||||
asm
|
||||
cli
|
||||
hlt
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user