The Pedigree Project 0.1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
HostedVga Class Reference

#include <Vga.h>

+ Inheritance diagram for HostedVga:
+ Collaboration diagram for HostedVga:

Public Member Functions

virtual bool setLargestTextMode ()
 
virtual size_t getNumCols ()
 
virtual size_t getNumRows ()
 
virtual void pokeBuffer (uint8_t *pBuffer, size_t nBufLen)
 
virtual void peekBuffer (uint8_t *pBuffer, size_t nBufLen)
 
virtual void moveCursor (size_t nX, size_t nY)
 
bool initialise ()
 
 operator uint16_t * () const
 
- Public Member Functions inherited from Vga
virtual void flush ()
 
virtual void enterPanicMode ()
 
virtual bool setFramebuffer (Framebuffer *)
 

Private Member Functions

 HostedVga (const HostedVga &)
 
HostedVga & operator= (const HostedVga &)
 

Static Private Member Functions

static void printAttrAsAnsi (uint8_t attr)
 
static uint8_t ansiColourFixup (uint8_t colour)
 

Private Attributes

size_t m_nWidth
 
size_t m_nHeight
 
size_t m_CursorX
 
size_t m_CursorY
 
uint16_t * m_pBackbuffer
 

Detailed Description

Vga device abstraction.

Definition at line 29 of file kernel/machine/hosted/Vga.h.

Constructor & Destructor Documentation

◆ HostedVga()

HostedVga::HostedVga ( )

Definition at line 25 of file hosted/Vga.cc.

◆ ~HostedVga()

HostedVga::~HostedVga ( )
virtual

Definition at line 28 of file hosted/Vga.cc.

Member Function Documentation

◆ ansiColourFixup()

uint8_t HostedVga::ansiColourFixup ( uint8_t  colour)
staticprivate

Fix up the given colour into a proper ANSI colour.

Definition at line 97 of file hosted/Vga.cc.

Referenced by printAttrAsAnsi().

+ Here is the caller graph for this function:

◆ getNumCols()

virtual size_t HostedVga::getNumCols ( )
inlinevirtual
Returns
The number of columns in the current mode.

Implements Vga.

Definition at line 43 of file kernel/machine/hosted/Vga.h.

References m_nWidth.

◆ getNumRows()

virtual size_t HostedVga::getNumRows ( )
inlinevirtual
Returns
The number of rows in the current mode.

Implements Vga.

Definition at line 50 of file kernel/machine/hosted/Vga.h.

References m_nHeight.

◆ initialise()

bool HostedVga::initialise ( )

Definition at line 86 of file hosted/Vga.cc.

◆ moveCursor()

void HostedVga::moveCursor ( size_t  nX,
size_t  nY 
)
virtual

Moves the cursor to the position specified by the parameters.

Parameters
nXThe column to move to.
nYThe row to move to.

Implements Vga.

Definition at line 77 of file hosted/Vga.cc.

References m_CursorX, m_CursorY, and m_pBackbuffer.

Referenced by pokeBuffer().

+ Here is the caller graph for this function:

◆ operator uint16_t *()

HostedVga::operator uint16_t * ( ) const
inlinevirtual

Implements Vga.

Definition at line 86 of file kernel/machine/hosted/Vga.h.

◆ peekBuffer()

void HostedVga::peekBuffer ( uint8_t *  pBuffer,
size_t  nBufLen 
)
virtual

Copies the current framebuffer into the given buffer.

The buffer is assumed to be in the correct format for directly copying from video memory. This will obviously depend on the current mode (text/graphical) as well as resolution and bits per pixel (graphics mode only).

Parameters
pBufferA pointer to the buffer.
nBufLenThe length of pBuffer.

Implements Vga.

Definition at line 67 of file hosted/Vga.cc.

References m_nWidth, and m_pBackbuffer.

◆ pokeBuffer()

void HostedVga::pokeBuffer ( uint8_t *  pBuffer,
size_t  nBufLen 
)
virtual

Copies the given buffer into video memory, replacing the current framebuffer.

The buffer is assumed to be in the correct format for directly copying into video memory. This will obviously depend on the current mode (text/graphical) as well as resolution and bits per pixel (graphics mode only).

Parameters
pBufferA pointer to the buffer to swap into video memory.
nBufLenThe length of pBuffer.

Implements Vga.

Definition at line 36 of file hosted/Vga.cc.

References m_CursorX, m_CursorY, m_nHeight, m_nWidth, m_pBackbuffer, moveCursor(), and printAttrAsAnsi().

◆ printAttrAsAnsi()

void HostedVga::printAttrAsAnsi ( uint8_t  attr)
staticprivate

Print the given VGA attribute as an ANSI escape sequence.

Definition at line 129 of file hosted/Vga.cc.

References ansiColourFixup().

Referenced by pokeBuffer().

+ Here is the caller graph for this function:

◆ setLargestTextMode()

bool HostedVga::setLargestTextMode ( )
virtual

Sets the largest possible text mode.

Returns
True on success, false on failure.

Implements Vga.

Definition at line 32 of file hosted/Vga.cc.

Member Data Documentation

◆ m_CursorX

size_t HostedVga::m_CursorX
private

Cursor X.

Definition at line 117 of file kernel/machine/hosted/Vga.h.

Referenced by moveCursor(), and pokeBuffer().

◆ m_CursorY

size_t HostedVga::m_CursorY
private

Cursor Y.

Definition at line 122 of file kernel/machine/hosted/Vga.h.

Referenced by moveCursor(), and pokeBuffer().

◆ m_nHeight

size_t HostedVga::m_nHeight
private

The height of the current mode.

Definition at line 112 of file kernel/machine/hosted/Vga.h.

Referenced by getNumRows(), and pokeBuffer().

◆ m_nWidth

size_t HostedVga::m_nWidth
private

The width of the current mode.

Definition at line 107 of file kernel/machine/hosted/Vga.h.

Referenced by getNumCols(), peekBuffer(), and pokeBuffer().

◆ m_pBackbuffer

uint16_t* HostedVga::m_pBackbuffer
private

Backbuffer for text.

Definition at line 127 of file kernel/machine/hosted/Vga.h.

Referenced by moveCursor(), peekBuffer(), and pokeBuffer().


The documentation for this class was generated from the following files: