git-svn-id: https://spexeah.com:8443/svn/Asuro@519 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-04-14 00:36:08 +00:00
parent 86d52e722b
commit 691466b7ad
65 changed files with 8385 additions and 109 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/IDE.ppu Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/fonts.ppu Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,9 @@ interface
uses
util,
bios_data_area;
bios_data_area,
multiboot,
fonts;
type
TColor = ( Black = $0,
@ -35,57 +37,57 @@ type
procedure init();
procedure clear();
procedure setdefaultattribute(attribute : char);
procedure setdefaultattribute(attribute : uint32);
procedure disable_cursor;
procedure writechar(character : char);
procedure writecharln(character : char);
procedure writecharex(character : char; attributes : char);
procedure writecharlnex(character : char; attributes : char);
procedure writecharex(character : char; attributes: uint32);
procedure writecharlnex(character : char; attributes: uint32);
procedure Output(identifier : PChar; str : PChar);
procedure Outputln(identifier : PChar; str : PChar);
procedure writestring(str: PChar);
procedure writestringln(str: PChar);
procedure writestringex(str: PChar; attributes : char);
procedure writestringlnex(str: PChar; attributes : char);
procedure writestringex(str: PChar; attributes: uint32);
procedure writestringlnex(str: PChar; attributes: uint32);
procedure writeint(i: Integer);
procedure writeintln(i: Integer);
procedure writeintex(i: Integer; attributes : char);
procedure writeintlnex(i: Integer; attributes : char);
procedure writeintex(i: Integer; attributes: uint32);
procedure writeintlnex(i: Integer; attributes: uint32);
procedure writeword(i: DWORD);
procedure writewordln(i: DWORD);
procedure writewordex(i: DWORD; attributes : char);
procedure writewordlnex(i: DWORD; attributes : char);
procedure writewordex(i: DWORD; attributes: uint32);
procedure writewordlnex(i: DWORD; attributes: uint32);
procedure writehexpair(b : uint8);
procedure writehex(i: DWORD);
procedure writehexln(i: DWORD);
procedure writehexex(i : DWORD; attributes : char);
procedure writehexlnex(i: DWORD; attributes : char);
procedure writehexex(i : DWORD; attributes: uint32);
procedure writehexlnex(i: DWORD; attributes: uint32);
procedure writebin8(b : uint8);
procedure writebin8ln(b : uint8);
procedure writebin8ex(b : uint8; attributes : char);
procedure writebin8lnex(b : uint8; attributes : char);
procedure writebin8ex(b : uint8; attributes: uint32);
procedure writebin8lnex(b : uint8; attributes: uint32);
procedure writebin16(b : uint16);
procedure writebin16ln(b : uint16);
procedure writebin16ex(b : uint16; attributes : char);
procedure writebin16lnex(b : uint16; attributes : char);
procedure writebin16ex(b : uint16; attributes: uint32);
procedure writebin16lnex(b : uint16; attributes: uint32);
procedure writebin32(b : uint32);
procedure writebin32ln(b : uint32);
procedure writebin32ex(b : uint32; attributes : char);
procedure writebin32lnex(b : uint32; attributes : char);
procedure writebin32ex(b : uint32; attributes: uint32);
procedure writebin32lnex(b : uint32; attributes: uint32);
procedure backspace;
function combinecolors(Foreground, Background : TColor) : char;
function combinecolors(Foreground, Background : uint16) : uint32;
procedure _increment_x();
procedure _increment_y();
@ -95,21 +97,24 @@ procedure _newline();
implementation
uses
lmemorymanager;
type
TConsoleProperties = record
Default_Attribute : Char;
Default_Attribute : uint32;
end;
TCharacter = bitpacked record
Character : Char;
Attributes : Char;
attributes: uint32;
end;
PCharacter = ^TCharacter;
TVideoMemory = Array[0..1999] of TCharacter;
PVideoMemory = ^TVideoMemory;
T2DVideoMemory = Array[0..24] of Array[0..79] of TCharacter;
T2DVideoMemory = Array[0..63] of Array[0..159] of TCharacter;
P2DVideoMemory = ^T2DVideoMemory;
TCoord = record
@ -119,9 +124,34 @@ type
var
Console_Properties : TConsoleProperties;
Console_Memory : PVideoMemory = PVideoMemory($C00b8000);
Console_Matrix : P2DVideoMemory = P2DVideoMemory($C00b8000);
//Console_Memory : PVideoMemory = PVideoMemory($C00b8000);
Console_Matrix : T2DVideoMemory;//P2DVideoMemory = P2DVideoMemory($C00b8000);
Console_Cursor : TCoord;
Ready : Boolean = false;
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
var
dest : puint16;
dest32 : puint32;
fgcolor32, bgcolor32 : uint32;
mask : puint32;
i : uint32;
begin
if not ready then exit;
fgcolor32:= fgcolor OR (fgcolor SHL 8) OR (fgcolor SHL 16) OR (fgcolor SHL 24);
bgcolor32:= bgcolor OR (bgcolor SHL 8) OR (bgcolor SHL 16) OR (bgcolor SHL 24);
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y*(1280 * 16)) + (x * 8);
dest32:= puint32(dest);
for i:=0 to 15 do begin
dest32[(i*640)+0]:= (bgcolor32 AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
dest32[(i*640)+1]:= (bgcolor32 AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
dest32[(i*640)+2]:= (bgcolor32 AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
dest32[(i*640)+3]:= (bgcolor32 AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
end;
end;
procedure disable_cursor;
begin
@ -130,9 +160,15 @@ begin
end;
procedure init(); [public, alias: 'console_init'];
var
fb: puint32;
Begin
Console_Properties.Default_Attribute:= console.combinecolors(White, Black);
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
kpalloc(uint32(fb));
Console_Properties.Default_Attribute:= console.combinecolors($FFFF, $0000);
console.clear();
Ready:= True;
end;
procedure clear(); [public, alias: 'console_clear'];
@ -140,17 +176,18 @@ var
x,y: Byte;
begin
for x:=0 to 79 do begin
for y:=0 to 24 do begin
Console_Matrix^[y][x].Character:= #0;
Console_Matrix^[y][x].Attributes:= Console_Properties.Default_Attribute;
for x:=0 to 159 do begin
for y:=0 to 63 do begin
Console_Matrix[y][x].Character:= ' ';
Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
end;
end;
Console_Cursor.X:= 0;
Console_Cursor.Y:= 0;
end;
procedure writebin8ex(b : uint8; attributes : char);
procedure writebin8ex(b : uint8; attributes: uint32);
var
Mask : PMask;
i : uint8;
@ -162,7 +199,7 @@ begin
end;
end;
procedure writebin16ex(b : uint16; attributes : char);
procedure writebin16ex(b : uint16; attributes: uint32);
var
Mask : PMask;
i,j : uint8;
@ -176,7 +213,7 @@ begin
end;
end;
procedure writebin32ex(b : uint32; attributes : char);
procedure writebin32ex(b : uint32; attributes: uint32);
var
Mask : PMask;
i,j : uint8;
@ -205,19 +242,19 @@ begin
writebin32ex(b, Console_Properties.Default_Attribute);
end;
procedure writebin8lnex(b : uint8; attributes : char);
procedure writebin8lnex(b : uint8; attributes: uint32);
begin
writebin8ex(b, attributes);
console._safeincrement_y();
end;
procedure writebin16lnex(b : uint16; attributes : char);
procedure writebin16lnex(b : uint16; attributes: uint32);
begin
writebin16ex(b, attributes);
console._safeincrement_y();
end;
procedure writebin32lnex(b : uint32; attributes : char);
procedure writebin32lnex(b : uint32; attributes: uint32);
begin
writebin32ex(b, attributes);
console._safeincrement_y();
@ -238,7 +275,7 @@ begin
writebin32lnex(b, Console_Properties.Default_Attribute);
end;
procedure setdefaultattribute(attribute: char); [public, alias: 'console_setdefaultattribute'];
procedure setdefaultattribute(attribute: uint32); [public, alias: 'console_setdefaultattribute'];
begin
Console_Properties.Default_Attribute:= attribute;
end;
@ -283,10 +320,11 @@ begin
console.writewordlnex(i, Console_Properties.Default_Attribute);
end;
procedure writecharex(character: char; attributes: char); [public, alias: 'console_writecharex'];
procedure writecharex(character: char; attributes: uint32); [public, alias: 'console_writecharex'];
begin
Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Character:= character;
Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
console._safeincrement_x();
end;
@ -320,7 +358,7 @@ begin
end;
end;
procedure writehexex(i : dword; attributes: char); [public, alias: 'console_writehexex'];
procedure writehexex(i : dword; attributes: uint32); [public, alias: 'console_writehexex'];
var
Hex : Array[0..7] of Byte;
Res : DWORD;
@ -371,7 +409,7 @@ begin
console.writehexex(i, Console_Properties.Default_Attribute);
end;
procedure writehexlnex(i : dword; attributes : char);
procedure writehexlnex(i : dword; attributes: uint32);
begin
console.writehexex(i, attributes);
console._safeincrement_y();
@ -396,7 +434,7 @@ begin
writestringln(' ');
end;
procedure writestringex(str: PChar; attributes: char); [public, alias: 'console_writestringex'];
procedure writestringex(str: PChar; attributes: uint32); [public, alias: 'console_writestringex'];
var
i : integer;
@ -408,7 +446,7 @@ begin
end;
end;
procedure writeintex(i: Integer; attributes : char); [public, alias: 'console_writeintex'];
procedure writeintex(i: Integer; attributes: uint32); [public, alias: 'console_writeintex'];
var
buffer: array [0..11] of Char;
str: PChar;
@ -436,7 +474,7 @@ begin
console.writestringex(str, attributes);
end;
procedure writewordex(i: DWORD; attributes : char); [public, alias: 'console_writedwordex'];
procedure writewordex(i: DWORD; attributes: uint32); [public, alias: 'console_writedwordex'];
var
buffer: array [0..11] of Char;
str: PChar;
@ -454,33 +492,33 @@ begin
console.writestringex(@Buffer[0], attributes);
end;
procedure writecharlnex(character: char; attributes: char); [public, alias: 'console_writecharlnex'];
procedure writecharlnex(character: char; attributes: uint32); [public, alias: 'console_writecharlnex'];
begin
console.writecharex(character, attributes);
console._safeincrement_y();
end;
procedure writestringlnex(str: PChar; attributes: char); [public, alias: 'console_writestringlnex'];
procedure writestringlnex(str: PChar; attributes: uint32); [public, alias: 'console_writestringlnex'];
begin
console.writestringex(str, attributes);
console._safeincrement_y();
end;
procedure writeintlnex(i: Integer; attributes: char); [public, alias: 'console_writeintlnex'];
procedure writeintlnex(i: Integer; attributes: uint32); [public, alias: 'console_writeintlnex'];
begin
console.writeintex(i, attributes);
console._safeincrement_y();
end;
procedure writewordlnex(i: DWORD; attributes: char); [public, alias: 'console_writewordlnex'];
procedure writewordlnex(i: DWORD; attributes: uint32); [public, alias: 'console_writewordlnex'];
begin
console.writewordex(i, attributes);
console._safeincrement_y();
end;
function combinecolors(Foreground, Background: TColor): char; [public, alias: 'console_combinecolors'];
function combinecolors(Foreground, Background: uint16): uint32;
begin
combinecolors:= char(((ord(Background) shl 4) or ord(Foreground)));
combinecolors:= (uint32(Foreground) SHL 16) OR Background;
end;
procedure _update_cursor(); [public, alias: '_console_update_cursor'];
@ -509,16 +547,16 @@ end;
procedure _increment_x(); [public, alias: '_console_increment_x'];
begin
Console_Cursor.X:= Console_Cursor.X+1;
If Console_Cursor.X > 79 then Console_Cursor.X:= 0;
If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
console._update_cursor;
end;
procedure _increment_y(); [public, alias: '_console_increment_y'];
begin
Console_Cursor.Y:= Console_Cursor.Y+1;
If Console_Cursor.Y > 24 then begin
If Console_Cursor.Y > 63 then begin
console._newline();
Console_Cursor.Y:= 24;
Console_Cursor.Y:= 63;
end;
console._update_cursor;
end;
@ -526,7 +564,7 @@ end;
procedure _safeincrement_x(); [public, alias: '_console_safeincrement_x'];
begin
Console_Cursor.X:= Console_Cursor.X+1;
If Console_Cursor.X > 79 then begin
If Console_Cursor.X > 159 then begin
console._safeincrement_y();
end;
console._update_cursor;
@ -535,9 +573,9 @@ end;
procedure _safeincrement_y(); [public, alias: '_console_safeincrement_y'];
begin
Console_Cursor.Y:= Console_Cursor.Y+1;
If Console_Cursor.Y > 24 then begin
If Console_Cursor.Y > 63 then begin
console._newline();
Console_Cursor.Y:= 24;
Console_Cursor.Y:= 63;
end;
Console_Cursor.X:= 0;
console._update_cursor;
@ -548,16 +586,21 @@ var
x, y : byte;
begin
for x:=0 to 79 do begin
for y:=0 to 23 do begin
Console_Matrix^[y][x]:= Console_Matrix^[y+1][x];
for x:=0 to 159 do begin
for y:=0 to 63 do begin
Console_Matrix[y][x]:= Console_Matrix[y+1][x];
end;
end;
for x:=0 to 79 do begin
Console_Matrix^[24][x].Character:= #0;
Console_Matrix^[24][x].Attributes:= #7;
for x:=0 to 159 do begin
Console_Matrix[63][x].Character:= ' ';
Console_Matrix[63][x].Attributes:= $FFFF0000;
end;
console._update_cursor
for x:=0 to 159 do begin
for y:=0 to 63 do begin
OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
end;
end;
console._update_cursor;
end;
end.

8210
src/include/fonts.pas Normal file

File diff suppressed because it is too large Load Diff

View File

@ -305,24 +305,24 @@ var
begin
disable_cursor;
if not BSOD_ENABLE then exit;
console.setdefaultattribute(console.combinecolors(white, Red));
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
console.clear;
console.writestringln(' ');
console.writestringln(' ');
console.writestring(' ');
console.setdefaultattribute(console.combinecolors(black, white));
console.setdefaultattribute(console.combinecolors($0000, $FFFF));
console.writestring(' ');
console.setdefaultattribute(console.combinecolors(white, Red));
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
console.writestringln(' ');
console.writestring(' ');
console.setdefaultattribute(console.combinecolors(black, white));
console.setdefaultattribute(console.combinecolors($0000, $FFFF));
console.writestring(' ASURO DID A WHOOPSIE! :( ');
console.setdefaultattribute(console.combinecolors(lwhite, Red));
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
console.writestringln(' ');
console.writestring(' ');
console.setdefaultattribute(console.combinecolors(black, white));
console.setdefaultattribute(console.combinecolors($0000, $FFFF));
console.writestring(' ');
console.setdefaultattribute(console.combinecolors(white, Red));
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
console.writestringln(' ');
console.writestringln(' ');
console.writestringln(' ');

View File

@ -42,7 +42,8 @@ uses
net,
fat32,
isrmanager,
faults;
faults,
fonts;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@ -84,45 +85,68 @@ begin
pop_trace;
end;
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
var
dest : puint16;
dest32 : puint32;
fgcolor32, bgcolor32 : uint32;
mask : puint32;
i : uint32;
begin
fgcolor32:= fgcolor OR (fgcolor SHL 8) OR (fgcolor SHL 16) OR (fgcolor SHL 24);
bgcolor32:= bgcolor OR (bgcolor SHL 8) OR (bgcolor SHL 16) OR (bgcolor SHL 24);
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y*(1280 * 16)) + (x * 8);
dest32:= puint32(dest);
for i:=0 to 15 do begin
dest32[(i*640)+0]:= (bgcolor32 AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
dest32[(i*640)+1]:= (bgcolor32 AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
dest32[(i*640)+2]:= (bgcolor32 AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
dest32[(i*640)+3]:= (bgcolor32 AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
end;
end;
procedure GraphicsTesting();
var
i : uint32;
z : uint32;
atmp : puint32;
fb : puint16;
val : uint16;
AChar : Array[0..15] of uint8 = ( %00000000,
%00000000,
%00000000,
%00010000,
%00111000,
%01101100,
%11000110,
%11000110,
%11111110,
%11000110,
%11000110,
%11000110,
%11000110,
%00000000,
%00000000,
%00000000 );
//AChar : uint8 = %00000000;
fb : puint32;
val : uint32;
test : pchar = 'helloworld';
mask : puint32;
begin
i:= $2000000;
kpalloc(i);
atmp:= puint32(i);
fb:= puint16(uint32(multibootinfo^.framebuffer_addr));
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
kpalloc(uint32(fb));
atmp^:= multibootinfo^.framebuffer_bpp;
for z:=0 to 15 do begin
for i:=0 to 8 do begin
val:= $0000;
if ((AChar[z] SHR i) AND $1) = $1 then val:= $FFFF;
if val <> 0 then fb[(z * 1280)+i]:= val;
end;
end;
outputChar('T', 0, 0, $FFFF, $0000);
outputChar('E', 0, 1, $FFFF, $0000);
outputChar('S', 0, 2, $FFFF, $0000);
outputChar('T', 0, 3, $FFFF, $0000);
outputChar('E', 1, 0, $FFFF, $0000);
outputChar('S', 2, 0, $FFFF, $0000);
outputChar('T', 3, 0, $FFFF, $0000);
{mask:= puint32(@Std_Mask[uint32(test[0]) * (16 * 8)]);
for i:=0 to 15 do begin
fb[(i*640)+0]:= mask[(i*4)+0];
fb[(i*640)+1]:= mask[(i*4)+1];
fb[(i*640)+2]:= mask[(i*4)+2];
fb[(i*640)+3]:= mask[(i*4)+3];
end;}
//for z:=0 to 15 do begin
// for i:=0 to 8 do begin
// val:= $0000;
// //if ((Std_Font[(37*16)+z] SHR i) AND $1) = $1 then val:= $FFFF;
//
// //if ((Std_Font[(38 * 16)+z]) AND ($1 SHL ((8-i)+1))) > 0 then val:= $FFFF;
// //if val <> 0 then fb[(z * 1280)+i]:= val;
// end;
//end;
while true do begin
end;
end;
@ -150,9 +174,6 @@ begin
{ Ensure tracer is frozen }
tracer.freeze();
{ Console Init }
console.init();
{ Terminal Init }
terminal.init();
terminal.registerCommand('MEMINFO', @terminal_command_meminfo, 'Print Simple Memory Information.');
@ -162,7 +183,7 @@ begin
{ Check for Multiboot }
if (multibootmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
console.setdefaultattribute(console.combinecolors(Red, Black));
console.setdefaultattribute(console.combinecolors($F800, $0000));
console.outputln('KERNEL', 'Multiboot Compliant Boot-Loader Needed!');
console.outputln('KERNEL', 'HALTING.');
BSOD('Multiboot Error', 'Multiboot Compliant Boot-Loader Needed!');
@ -194,7 +215,9 @@ begin
scheduler.init();
{ Graphics Mode Test Stuff }
GraphicsTesting();
//GraphicsTesting();
{ Console Init }
console.init();
{ Call Tracer }
tracer.init();
@ -243,9 +266,9 @@ begin
{ End of Boot }
tracer.push_trace('kmain.EOB');
console.writestringln('');
console.setdefaultattribute(console.combinecolors(Green, Black));
console.setdefaultattribute(console.combinecolors($17E0, $0000));
console.writestringln('Asuro Booted Correctly!');
console.setdefaultattribute(console.combinecolors(White, Black));
console.setdefaultattribute(console.combinecolors($FFFF, $0000));
//if INTE then console.writestringln('Interrupts are enabled.') else console.writestringln('Interrupts are disabled.');
console.writestringln('');
console.writestringln('Press any key to boot in to Asuro Terminal...');