Vesa32 additions + util functions to support

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