Vesa32 additions + util functions to support

This commit is contained in:
2022-01-23 16:58:46 +00:00
parent ee17f69115
commit 6b81c4ece0
5 changed files with 200 additions and 28 deletions
+2 -2
View File
@@ -35,11 +35,11 @@ var
LocationIndex : Uint32;
begin
tracer.push_trace('vesa32.DrawPixel.enter');
//tracer.push_trace('vesa32.DrawPixel.enter');
Location:= Puint32(Buffer^.Location);
LocationIndex:= (Y * Buffer^.Width) + X;
Location[LocationIndex]:= uint32(Pixel);
tracer.push_trace('vesa32.DrawPixel.exit');
//tracer.push_trace('vesa32.DrawPixel.exit');
end;
procedure init(DrawRoutines : PDrawRoutines);
File diff suppressed because it is too large Load Diff
+10 -1
View File
@@ -25,7 +25,7 @@ uses
color;
type
//Arbitrary pointer to a video buffer in memory
//Arbitrary pointer to a raw video buffer in memory
VideoBuffer = uint32;
//Struct representing a Memory Mapped Video Buffer
@@ -48,11 +48,20 @@ type
FDrawPixel = procedure(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
//(Abstract) Flush backbuffer to MMIO Buffer
FFlush = procedure(FrontBuffer : PVideoBuffer; BackBuffer : PVideoBuffer);
//(Abstract) Draw a line to the screen
FDrawLine = procedure(Buffer : PVideoBuffer; x1,y1,x2,y2 : uint32; thickness : uint32; Color : TRGB32);
//(Abstract) Draw a rect to the screen
FDrawRect = procedure(Buffer : PVideoBuffer; x1,y1,x2,y2 : uint32; line_thickness : uint32; Color : TRGB32);
//(Abstract) Draw a filled rect to the screen
FFillRect = procedure(Buffer : PVideoBuffer; x1,y1,x2,y2 : uint32; line_thickness : uint32; Line_Color : TRGB32; Fill_Color : TRGB32);
//Routines for drawing to the screen
TDrawRoutines = record
DrawPixel : FDrawPixel;
Flush : FFlush;
DrawLine : FDrawLine;
DrawRect : FDrawRect;
FillRect : FFillRect;
end;
//Pointer to drawing routines
PDrawRoutines = ^TDrawRoutines;
+11
View File
@@ -80,6 +80,8 @@ function RorDWord(AValue : uint32; Dist : uint8) : uint32;
function MsSinceSystemBoot : uint64;
function abs(x : sint32) : uint32;
var
endptr : uint32; external name '__end';
stack : uint32; external name 'KERNEL_STACK';
@@ -89,6 +91,15 @@ implementation
uses
console, RTC, cpu, serial, strings, isr_types;
function abs(x : sint32) : uint32;
var
y : uint32;
begin
y:= x SHR 31;
abs:= (x XOR y) - y;
end;
function MsSinceSystemBoot : uint64;
begin
MsSinceSystemBoot:= div6432(getTSC, (CPUID.ClockSpeed.Hz div 1000));
+13 -15
View File
@@ -208,24 +208,22 @@ begin
doublebuffer.init(@video.register);
video.enable('VESA');
video.enable('BASIC_DOUBLE_BUFFER');
colour:= color.red;
while true do begin
for i:=0 to video.frontBufferWidth-1 do begin
for z:=0 to video.frontBufferHeight-1 do begin
video.DrawPixel(i, z, colour);
end;
end;
if uint32(colour) = uint32(color.red) then
colour:= color.green
else if uint32(colour) = uint32(color.green) then
colour:= color.blue
else if uint32(colour) = uint32(color.blue) then
colour:= color.red;
colour:= color.white;
video.Flush();
for i:=0 to video.frontBufferWidth-1 do begin
for z:=0 to video.frontBufferHeight-1 do begin
video.DrawPixel(i, z, colour);
end;
end;
video.DrawLine(50,50,100,100,1,color.black);
video.DrawRect(50,150,100,200,1,color.black);
video.FillRect(50,250,100,300,1,color.black,color.red);
video.DrawLine(50,350,100,350,1,color.black);
video.Flush();
while true do begin end;
{ VFS Init }
vfs.init();