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

This commit is contained in:
kieron
2018-04-26 16:48:19 +00:00
parent 72f2b6da93
commit 11542b4c34
66 changed files with 4232 additions and 4121 deletions

View File

@ -97,9 +97,17 @@ procedure _safeincrement_x();
procedure _newline();
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);
function getPixel(x : uint32; y : uint32) : uint16;
procedure outputCharToScreenSpace(c : char; x : uint8; y : uint8; fgcolor : uint16);
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
function getPixel(x : uint32; y : uint32) : uint16;
procedure drawPixel(x : uint32; y : uint32; color : uint16);
function getPixel32(x : uint32; y : uint32) : uint32;
procedure drawPixel32(x : uint32; y : uint32; pixel : uint32);
function getPixel64(x : uint32; y : uint32) : uint64;
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
implementation
uses
@ -129,8 +137,7 @@ type
var
Console_Properties : TConsoleProperties;
//Console_Memory : PVideoMemory = PVideoMemory($C00b8000);
Console_Matrix : T2DVideoMemory;//P2DVideoMemory = P2DVideoMemory($C00b8000);
Console_Matrix : T2DVideoMemory;
Console_Cursor : TCoord;
Ready : Boolean = false;
@ -139,12 +146,10 @@ var
dest : puint16;
begin
//push_trace('console.getPixel');
if not ready then exit;
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
getPixel:= dest^;
//pop_trace;
end;
procedure drawPixel(x : uint32; y : uint32; color : uint16);
@ -152,12 +157,104 @@ var
dest : puint16;
begin
//push_trace('console.drawPixel');
if not ready then exit;
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
dest^:= color;
//pop_trace;
end;
function getPixel32(x : uint32; y : uint32) : uint32;
var
dest : puint16;
dest32 : puint32;
begin
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
dest32:= puint32(dest);
getPixel32:= dest32[0];
end;
procedure drawPixel32(x : uint32; y : uint32; pixel : uint32);
var
dest : puint16;
dest32 : puint32;
begin
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
dest32:= puint32(dest);
dest32[0]:= pixel;
end;
function getPixel64(x : uint32; y : uint32) : uint64;
var
dest : puint16;
dest64 : puint64;
begin
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
dest64:= puint64(dest);
getPixel64:= dest64[0];
end;
procedure drawPixel64(x : uint32; y : uint32; pixel : uint64);
var
dest : puint16;
dest64 : puint64;
begin
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y * 1280) + x;
dest64:= puint64(dest);
dest64[0]:= pixel;
end;
procedure outputCharToScreenSpace(c : char; x : uint8; y : uint8; fgcolor : uint16);
var
dest : puint16;
dest32 : puint32;
fgcolor32, bgcolor32 : uint32;
mask : puint32;
i : uint32;
begin
if not ready then exit;
fgcolor32:= fgcolor OR (fgcolor SHL 16);
mask:= puint32(@Std_Mask[uint32(c) * (16 * 8)]);
dest:= puint16(multibootinfo^.framebuffer_addr);
dest:= dest + (y*1280) + x;
dest32:= puint32(dest);
for i:=0 to 15 do begin
dest32[(i*640)+0]:= (dest32[(i*640)+0] AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
dest32[(i*640)+1]:= (dest32[(i*640)+1] AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
dest32[(i*640)+2]:= (dest32[(i*640)+2] AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
dest32[(i*640)+3]:= (dest32[(i*640)+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
end;
end;
procedure outputCharTransparent(c : char; x : uint8; y : uint8; fgcolor : uint16);
var
dest : puint16;
dest32 : puint32;
fgcolor32, bgcolor32 : uint32;
mask : puint32;
i : uint32;
begin
if not ready then exit;
fgcolor32:= fgcolor OR (fgcolor SHL 16);
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]:= (dest32[(i*640)+0] AND NOT(mask[(i*4)+0])) OR (fgcolor32 AND mask[(i*4)+0]);
dest32[(i*640)+1]:= (dest32[(i*640)+1] AND NOT(mask[(i*4)+1])) OR (fgcolor32 AND mask[(i*4)+1]);
dest32[(i*640)+2]:= (dest32[(i*640)+2] AND NOT(mask[(i*4)+2])) OR (fgcolor32 AND mask[(i*4)+2]);
dest32[(i*640)+3]:= (dest32[(i*640)+3] AND NOT(mask[(i*4)+3])) OR (fgcolor32 AND mask[(i*4)+3]);
end;
end;
procedure outputChar(c : char; x : uint8; y : uint8; fgcolor : uint16; bgcolor : uint16);

View File

@ -47,7 +47,7 @@ implementation
var
Current, Last : TMousePos;
FirstDraw : boolean = true;
BackPixels : Array[0..1] of Array[0..1] of uint16;
BackPixels : Array[0..1] of Array[0..7] of uint64;
Cycle : uint32 = 0;
Mouse_Byte : Array[0..2] of uint8;
Packet : uint32;
@ -65,20 +65,31 @@ begin
if not NeedsRedraw then exit;
NeedsRedraw:= false;
if not FirstDraw then begin
for y:=0 to 1 do begin
{for y:=0 to 1 do begin
for x:=0 to 1 do begin
DrawPixel(Last.x + x, Last.y + y, BackPixels[x][y]);
end;
end;}
for y:=0 to 7 do begin
for x:=0 to 1 do begin
drawPixel64(Last.x + x * 4, Last.y + y, BackPixels[x][y]);
end;
end;
end;
Last.x:= nx;
Last.y:= ny;
for y:=0 to 1 do begin
{for y:=0 to 1 do begin
for x:=0 to 1 do begin
BackPixels[x][y]:= GetPixel(nx + x, ny + y);
DrawPixel(nx + x, ny + y, $FFFF);
end;
end;}
for y:=0 to 7 do begin
for x:=0 to 1 do begin
BackPixels[x][y]:= GetPixel64(nx + x * 4, ny + y);
end;
end;
outputCharToScreenSpace(char(0), nx, ny, $FFFF);
FirstDraw:= false;
end;
@ -126,7 +137,6 @@ var
r : pchar;
begin
//push_trace('mouse.main');
while mouse_wait(0) do begin
b:= mouse_read;
if Cycle = 0 then begin
@ -145,8 +155,8 @@ begin
Packet.y_sign:= (f AND %00100000) = %00100000;
Packet.x_overflow:= (f AND $40) = $40;
Packet.y_overflow:= (f AND $80) = $80;
Packet.x_movement:= Mouse_Byte[1] - ((f SHL 4) AND $100);//Packet.x_movement div 4;
Packet.y_movement:= Mouse_Byte[2] - ((f SHL 3) AND $100);//Packet.y_movement div 4;
Packet.x_movement:= Mouse_Byte[1] - ((f SHL 4) AND $100);
Packet.y_movement:= Mouse_Byte[2] - ((f SHL 3) AND $100);
if not(Packet.x_overflow) and not(Packet.y_overflow) then begin
Current.x:= Current.x + Packet.x_movement;
Current.y:= Current.y - Packet.y_movement;

File diff suppressed because it is too large Load Diff

View File

@ -287,6 +287,8 @@ begin
tracer.push_trace('kmain.END');
outputCharToScreenSpace(char(0), 10, 10, $FFFF);
while true do begin
mouse.DrawCursor();
end;