The Pedigree Project 0.1
kernel/machine/hosted/Vga.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef MACHINE_HOSTED_VGA_H
21#define MACHINE_HOSTED_VGA_H
22#include "pedigree/kernel/machine/Vga.h"
23
24#include <config.h>
25
29class HostedVga : public Vga {
30 public:
31 HostedVga();
32 virtual ~HostedVga();
33
38 virtual bool setLargestTextMode();
39
43 virtual size_t getNumCols() {
44 return m_nWidth;
45 }
46
50 virtual size_t getNumRows() {
51 return m_nHeight;
52 }
53
64 virtual void pokeBuffer(uint8_t* pBuffer, size_t nBufLen);
65
75 virtual void peekBuffer(uint8_t* pBuffer, size_t nBufLen);
76
82 virtual void moveCursor(size_t nX, size_t nY);
83
84 bool initialise();
85
86 operator uint16_t*() const {
87 return m_pBackbuffer;
88 }
89
90 private:
91 HostedVga(const HostedVga&);
92 HostedVga& operator=(const HostedVga&);
93
97 static void printAttrAsAnsi(uint8_t attr);
98
102 static uint8_t ansiColourFixup(uint8_t colour);
103
107 size_t m_nWidth;
108
112 size_t m_nHeight;
113
117 size_t m_CursorX;
118
122 size_t m_CursorY;
123
127 uint16_t* m_pBackbuffer;
128};
129
130#endif
static void printAttrAsAnsi(uint8_t attr)
static uint8_t ansiColourFixup(uint8_t colour)
Definition hosted/Vga.cc:97
virtual void moveCursor(size_t nX, size_t nY)
Definition hosted/Vga.cc:77
virtual size_t getNumCols()
virtual void pokeBuffer(uint8_t *pBuffer, size_t nBufLen)
Definition hosted/Vga.cc:36
virtual bool setLargestTextMode()
Definition hosted/Vga.cc:32
virtual void peekBuffer(uint8_t *pBuffer, size_t nBufLen)
Definition hosted/Vga.cc:67
virtual size_t getNumRows()