Begin reimplementing framebuffer mode list storage and VideoRep funtionality.

This commit is contained in:
TomAwezome 2022-10-14 19:41:46 -04:00
parent 4d6f3f380c
commit a2be44fa28
5 changed files with 78 additions and 13 deletions

View file

@ -64,6 +64,8 @@ SYS_BOOT_STACK:: DU32 BOOT_RAM_LIMIT;
SYS_IS_UEFI_BOOTED:: DU8 0; SYS_IS_UEFI_BOOTED:: DU8 0;
//SYS_FRAMEBUFFER_LIST:: DU8 sizeof(CVideoInfo) * VBE_MODES_NUM DUP(0);
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE) #assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
REQUESTED_SCREEN_WIDTH: DU16 1024; REQUESTED_SCREEN_WIDTH: DU16 1024;
@ -74,6 +76,8 @@ VBE_INFO: DU8 sizeof(CVBEInfo) DUP(0);
VBE_FINAL_MODE_NUM: DU16 0; // gets set to final result mode number VBE_FINAL_MODE_NUM: DU16 0; // gets set to final result mode number
VBE_STD_MODE_NUM: DU16 0; // gets set to mode number for standard 1024x768 VBE_STD_MODE_NUM: DU16 0; // gets set to mode number for standard 1024x768
SYS_FRAMEBUFFER_LIST:: DU8 sizeof(CVideoInfo) * VBE_MODES_NUM DUP(0);
//************************************ //************************************
CORE0_16BIT_INIT:: CORE0_16BIT_INIT::
//EAX is $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.ZC,[SYS_BOOT_SRC]"$. (Value passed from boot block, $LK,"BootHD",A="FF:::/System/Boot/BootHD.ZC,BOOT_SRC_HARDDRIVE"$, $LK,"BootDVD",A="FF:::/System/Boot/BootDVD.ZC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/System/Boot/BootRAM.ZC,BOOT_SRC_RAM"$.) //EAX is $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.ZC,[SYS_BOOT_SRC]"$. (Value passed from boot block, $LK,"BootHD",A="FF:::/System/Boot/BootHD.ZC,BOOT_SRC_HARDDRIVE"$, $LK,"BootDVD",A="FF:::/System/Boot/BootDVD.ZC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/System/Boot/BootRAM.ZC,BOOT_SRC_RAM"$.)
@ -119,6 +123,7 @@ GET_IP: POP BX
/*Loop variables: /*Loop variables:
DI <- Temporary storage for mode information DI <- Temporary storage for mode information
CX <- Mode number CX <- Mode number
DX <- 'mode' array
GS <- Segment for video modes list GS <- Segment for video modes list
SI <- Offset for video modes list SI <- Offset for video modes list
*/ */
@ -126,6 +131,7 @@ GET_IP: POP BX
MOV AX, VBE_INFO MOV AX, VBE_INFO
MOV SI, CVBEInfo.video_modes[AX] MOV SI, CVBEInfo.video_modes[AX]
MOV GS, CVBEInfo.video_modes+2[AX] MOV GS, CVBEInfo.video_modes+2[AX]
MOV DX, SYS_FRAMEBUFFER_LIST
MOV DI, VBE_TEMP_MODE MOV DI, VBE_TEMP_MODE
@@15: //Loop through all the mode numbers @@15: //Loop through all the mode numbers
@ -169,6 +175,12 @@ GET_IP: POP BX
@@18: MOV BX, CVBEMode.height[DI] @@18: MOV BX, CVBEMode.height[DI]
@@20: MOV AX, CVBEMode.width[DI] @@20: MOV AX, CVBEMode.width[DI]
// Copy info into DX SYS_FRAMEBUFFER_LIST
MOV CVideoInfo.height[DX], BX
MOV CVideoInfo.width[DX], AX
ADD DX, sizeof(CVideoInfo) // next array element
//Check if width and height match standard 1024x768 //Check if width and height match standard 1024x768
//If they match, set VBE_STD_MODE_NUM to this mode num //If they match, set VBE_STD_MODE_NUM to this mode num
CMP AX, 1024 CMP AX, 1024

View file

@ -536,6 +536,12 @@ class CVBEMode
}; };
#assert sizeof(CVBEMode) == 256 #assert sizeof(CVBEMode) == 256
class CVideoInfo
{
U16 width;
U16 height;
};
#help_index "Boot" #help_index "Boot"
class CKernel class CKernel
{//Must match $LK,"OSStartUp",A="FF:::/Kernel/KStart16.ZC,MEM_BOOT_BASE"$ {//Must match $LK,"OSStartUp",A="FF:::/Kernel/KStart16.ZC,MEM_BOOT_BASE"$
@ -564,7 +570,8 @@ class CKernel
U64 sys_smbios_entry; U64 sys_smbios_entry;
U64 sys_disk_uuid[2]; U64 sys_disk_uuid[2];
U32 sys_boot_stack; U32 sys_boot_stack;
Bool sys_is_uefi_booted; Bool sys_is_uefi_booted;
// CVideoInfo sys_framebuffer_list[VBE_MODES_NUM];
}; };
//Run-Levels //Run-Levels

View file

@ -244,11 +244,13 @@ public _intern IC_FS CTask *Fs(); //FS segment register points to the current $L
public _intern IC_RDTSC I64 TSCGet(); //Get time stamp counter. public _intern IC_RDTSC I64 TSCGet(); //Get time stamp counter.
#help_index "Graphics/Framebuffer" #help_index "Graphics/Framebuffer"
public _extern SYS_FRAMEBUFFER_ADDR U8 *sys_framebuffer_addr; public _extern SYS_FRAMEBUFFER_ADDR U8 *sys_framebuffer_addr;
public _extern SYS_FRAMEBUFFER_WIDTH U64 sys_framebuffer_width; public _extern SYS_FRAMEBUFFER_WIDTH U64 sys_framebuffer_width;
public _extern SYS_FRAMEBUFFER_HEIGHT U64 sys_framebuffer_height; public _extern SYS_FRAMEBUFFER_HEIGHT U64 sys_framebuffer_height;
public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch; public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch;
public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp; public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp;
_extern SYS_FRAMEBUFFER_LIST CVideoInfo sys_framebuffer_list[VBE_MODES_NUM];
#help_index "Processor/SMBIOS" #help_index "Processor/SMBIOS"
public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry; public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry;

View file

@ -1,8 +1,52 @@
public U0 VideoRep()
{ //Report screen information. public I64 VideoRep()
{ // List available screen resolutions.
"\n"; "\n";
"Resolution: $$RED$$%d x %d$$FG$$ \n", sys_framebuffer_width, sys_framebuffer_height; "$$PURPLE$$Framebuffer pointer: $$BLACK$$0x%8X$$FG$$ \n", sys_framebuffer_addr;
"Pitch: $$RED$$%d$$FG$$ \n", sys_framebuffer_pitch;
"Bits-per-pixel: $$RED$$%d$$FG$$ \n", sys_framebuffer_bpp; I64 i, count = 0;
"Framebuffer pointer: $$RED$$0x%8X$$FG$$ \n\n", sys_framebuffer_addr; CVideoInfo *info;
"\nAll modes shown are 32-bit color.\n\n";
if (!IsRaw)
"$$LTCYAN$$ # W x H$$FG$$\n\n";
else
"#\t\t W x H\n\n";
for (i = 0; i < VBE_MODES_NUM; i++)
{
info = &sys_framebuffer_list[i];
if (info->height)
{
if (!IsRaw)
"$$PURPLE$$ $$BT+X,\"%d\",LM=\"%d\\n\"$$$$FG$$$$LM,4$$", i+1, i+1;
else
" [%d]\t", i+1;
if (info->width == sys_framebuffer_width && info->height == sys_framebuffer_height)
{
if (!IsRaw)
"$$RED$$%4d x %4d (Current resolution)$$FG$$$$LM,0$$", info->width, info->height;
else
"%4d x %4d (Current resolution)", info->width, info->height;
}
else
{
if (!IsRaw)
"$$BLACK$$%4d x %4d $$FG$$$$LM,0$$", info->width, info->height;
else
"%4d x %4d ", info->width, info->height;
}
"\n\n\n";
count++;
}
}
return count;
} }
VideoRep;

View file

@ -21,7 +21,7 @@ static volatile struct limine_memmap_request memmap_request = {
static volatile struct limine_framebuffer_request framebuffer_request = { static volatile struct limine_framebuffer_request framebuffer_request = {
.id = LIMINE_FRAMEBUFFER_REQUEST, .id = LIMINE_FRAMEBUFFER_REQUEST,
.revision = 0 .revision = 1
}; };
static volatile struct limine_smbios_request smbios_request = { static volatile struct limine_smbios_request smbios_request = {