summaryrefslogtreecommitdiff
path: root/kernel/Helpers/memPrint.hpp
blob: 19a67082020f9e0cb48dd0c39f6a17d61a5bd66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef __memPrint__
#define __memPrint__

#include "./types.hpp"


#define MEMPRINTSTARTADR 0xB8000
#define MAXCURSORX 80
#define MAXCURSORY 25




//Define the bios color
enum colorBios{

    BLACK=0x0,
    BLUE=0x1,
    GREEN=0x2,
    CYAN=0x3,
    RED=0x4,
    MAGENTA=0x5,
    BROWN=0x6,
    LIGHTGRAY=0x7,
    DARKGRAY=0x8,
    LIGHTBLUE=0x9,
    LIGHTGREEN=0xA,
    LIGHTCYAN=0xB,
    LIGHTRED=0xC,
    LIGHTMAGENTA=0xD,
    YELLOW=0xE,
    WHITE=0xF

};

//Type def for biosColor
typedef enum colorBios colorBios;


//Class to print char on screen using Video Ram mapping
class memPrint{

    private:

        //Cursor position
        u8 m_cursorX;
        u8 m_cursorY;

        //Current colors (background and foreground):
        u8 m_colors;

        //Methods
        void updateCursor();

    public:

        //Constructor
		memPrint();

		//Destructor
		~memPrint();

		//Set color
		void setBackground(colorBios color);
		void setForeground(colorBios color);

		//Putchar
		void putChar(u8 character);

		//Print
        void print(char *str);

        //Scroll up
        void scrollUp(u8 number);

        //Clear screen
        void clear();

};

#endif