[FREELDR:PC] pccons.c, pcvesa.c, pcvideo.c: Reformatting (#8504)

This commit is contained in:
Hermès Bélusca-Maïto
2025-12-01 16:18:02 +01:00
parent 5047e62e3d
commit 0ffed7fd1e
3 changed files with 835 additions and 888 deletions

View File

@@ -21,101 +21,101 @@
VOID
PcConsPutChar(int Ch)
{
REGS Regs;
REGS Regs;
/* If we are displaying a CR '\n' then do a LF also */
if ('\n' == Ch)
/* If we are displaying a CR '\n' then do a LF also */
if (Ch == '\n')
{
/* Display the LF */
PcConsPutChar('\r');
/* Display the LF */
PcConsPutChar('\r');
}
/* If we are displaying a TAB '\t' then display 8 spaces ' ' */
if ('\t' == Ch)
/* If we are displaying a TAB '\t' then display 8 spaces ' ' */
if (Ch == '\t')
{
/* Display the 8 spaces ' ' */
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
return;
/* Display the 8 spaces ' ' */
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
PcConsPutChar(' ');
return;
}
/* Int 10h AH=0Eh
* VIDEO - TELETYPE OUTPUT
*
* AH = 0Eh
* AL = character to write
* BH = page number
* BL = foreground color (graphics modes only)
*/
Regs.b.ah = 0x0E;
Regs.b.al = Ch;
Regs.w.bx = 1;
Int386(0x10, &Regs, &Regs);
/* Int 10h AH=0Eh
* VIDEO - TELETYPE OUTPUT
*
* AH = 0Eh
* AL = character to write
* BH = page number
* BL = foreground color (graphics modes only)
*/
Regs.b.ah = 0x0E;
Regs.b.al = Ch;
Regs.w.bx = 1;
Int386(0x10, &Regs, &Regs);
}
BOOLEAN
PcConsKbHit(VOID)
{
REGS Regs;
REGS Regs;
/* Int 16h AH=01h
* KEYBOARD - CHECK FOR KEYSTROKE
*
* AH = 01h
* Return:
* ZF set if no keystroke available
* ZF clear if keystroke available
* AH = BIOS scan code
* AL = ASCII character
*/
Regs.b.ah = 0x01;
Int386(0x16, &Regs, &Regs);
/* Int 16h AH=01h
* KEYBOARD - CHECK FOR KEYSTROKE
*
* AH = 01h
* Return:
* ZF set if no keystroke available
* ZF clear if keystroke available
* AH = BIOS scan code
* AL = ASCII character
*/
Regs.b.ah = 0x01;
Int386(0x16, &Regs, &Regs);
return 0 == (Regs.x.eflags & EFLAGS_ZF);
return !(Regs.x.eflags & EFLAGS_ZF);
}
int
PcConsGetCh(void)
{
REGS Regs;
static BOOLEAN ExtendedKey = FALSE;
static char ExtendedScanCode = 0;
REGS Regs;
static BOOLEAN ExtendedKey = FALSE;
static char ExtendedScanCode = 0;
/* If the last time we were called an
* extended key was pressed then return
* that keys scan code. */
if (ExtendedKey)
/* If the last time we were called an
* extended key was pressed then return
* that keys scan code. */
if (ExtendedKey)
{
ExtendedKey = FALSE;
return ExtendedScanCode;
ExtendedKey = FALSE;
return ExtendedScanCode;
}
/* Int 16h AH=00h
* KEYBOARD - GET KEYSTROKE
*
* AH = 00h
* Return:
* AH = BIOS scan code
* AL = ASCII character
*/
Regs.b.ah = 0x00;
Int386(0x16, &Regs, &Regs);
/* Int 16h AH=00h
* KEYBOARD - GET KEYSTROKE
*
* AH = 00h
* Return:
* AH = BIOS scan code
* AL = ASCII character
*/
Regs.b.ah = 0x00;
Int386(0x16, &Regs, &Regs);
/* Check for an extended keystroke */
if (0 == Regs.b.al)
/* Check for an extended keystroke */
if (Regs.b.al == 0)
{
ExtendedKey = TRUE;
ExtendedScanCode = Regs.b.ah;
ExtendedKey = TRUE;
ExtendedScanCode = Regs.b.ah;
}
/* Return keystroke */
return Regs.b.al;
/* Return keystroke */
return Regs.b.al;
}
/* EOF */

View File

@@ -25,31 +25,31 @@ DBG_DEFAULT_CHANNEL(HWDETECT);
#include <pshpack2.h>
typedef struct
{
UCHAR Signature[4]; // (ret) signature ("VESA")
UCHAR Signature[4]; // (ret) signature ("VESA")
// (call) VESA 2.0 request signature ("VBE2"), required to receive
// version 2.0 info
USHORT VesaVersion; // VESA version number (one-digit minor version -- 0102h = v1.2)
ULONG OemNamePtr; // pointer to OEM name
USHORT VesaVersion; // VESA version number (one-digit minor version -- 0102h = v1.2)
ULONG OemNamePtr; // Pointer to OEM name
// "761295520" for ATI
ULONG Capabilities; // capabilities flags (see #00078)
ULONG SupportedModeListPtr; // pointer to list of supported VESA and OEM video modes
ULONG Capabilities; // Capabilities flags (see #00078)
ULONG SupportedModeListPtr; // Pointer to list of supported VESA and OEM video modes
// (list of words terminated with FFFFh)
USHORT TotalVideoMemory; // total amount of video memory in 64K blocks
USHORT TotalVideoMemory; // Total amount of video memory in 64K blocks
// ---VBE v1.x ---
//UCHAR Reserved[236];
//UCHAR Reserved[236];
// ---VBE v2.0 ---
USHORT OemSoftwareVersion; // OEM software version (BCD, high byte = major, low byte = minor)
ULONG VendorNamePtr; // pointer to vendor name
ULONG ProductNamePtr; // pointer to product name
ULONG ProductRevisionStringPtr; // pointer to product revision string
USHORT VBE_AF_Version; // (if capabilities bit 3 set) VBE/AF version (BCD)
USHORT OemSoftwareVersion; // OEM software version (BCD, high byte = major, low byte = minor)
ULONG VendorNamePtr; // Pointer to vendor name
ULONG ProductNamePtr; // Pointer to product name
ULONG ProductRevisionStringPtr; // Pointer to product revision string
USHORT VBE_AF_Version; // (if capabilities bit 3 set) VBE/AF version (BCD)
// 0100h for v1.0P
ULONG AcceleratedModeListPtr; // (if capabilities bit 3 set) pointer to list of supported
// accelerated video modes (list of words terminated with FFFFh)
UCHAR Reserved[216]; // reserved for VBE implementation
UCHAR ScratchPad[256]; // OEM scratchpad (for OEM strings, etc.)
ULONG AcceleratedModeListPtr; // (if capabilities bit 3 set) pointer to list of supported
// Accelerated video modes (list of words terminated with FFFFh)
UCHAR Reserved[216]; // Reserved for VBE implementation
UCHAR ScratchPad[256]; // OEM scratchpad (for OEM strings, etc.)
} VESA_SVGA_INFO, *PVESA_SVGA_INFO;
#include <poppack.h>
@@ -88,7 +88,7 @@ typedef struct
#if 0
static VOID BiosSetVideoFont8x16(VOID)
{
REGS Regs;
REGS Regs;
// Int 10h AX=1114h
// VIDEO - TEXT-MODE CHARGEN - LOAD ROM 8x16 CHARACTER SET (VGA)
@@ -108,7 +108,7 @@ static VOID VideoSetTextCursorPosition(ULONG X, ULONG Y)
static ULONG VideoGetTextCursorPositionX(VOID)
{
REGS Regs;
REGS Regs;
// Int 10h AH=03h
// VIDEO - GET CURSOR POSITION AND SIZE
@@ -133,7 +133,7 @@ static ULONG VideoGetTextCursorPositionX(VOID)
static ULONG VideoGetTextCursorPositionY(VOID)
{
REGS Regs;
REGS Regs;
// Int 10h AH=03h
// VIDEO - GET CURSOR POSITION AND SIZE
@@ -159,10 +159,10 @@ static ULONG VideoGetTextCursorPositionY(VOID)
USHORT BiosIsVesaSupported(VOID)
{
REGS Regs;
PVESA_SVGA_INFO SvgaInfo = (PVESA_SVGA_INFO)BIOSCALLBUFFER;
//USHORT* VideoModes;
//USHORT Index;
REGS Regs;
PVESA_SVGA_INFO SvgaInfo = (PVESA_SVGA_INFO)BIOSCALLBUFFER;
//USHORT* VideoModes;
//USHORT Index;
TRACE("BiosIsVesaSupported()\n");
@@ -237,7 +237,6 @@ USHORT BiosIsVesaSupported(VOID)
return SvgaInfo->VesaVersion;
}
BOOLEAN
BiosIsVesaDdcSupported(VOID)
{
@@ -267,7 +266,6 @@ BiosIsVesaDdcSupported(VOID)
return (Regs.b.ah == 0);
}
BOOLEAN
BiosVesaReadEdid(VOID)
{

File diff suppressed because it is too large Load Diff