Loading [MathJax]/extensions/tex2jax.js
CS350 COS
COS
All Data Structures Files Functions Variables Typedefs Macros
vgacons.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SCREEN_CONSOLE   1
 
#define SCREEN_KLOG   2
 
#define SCREEN_KDEBUG   3
 
#define SCREEN_EXTRA   4
 
#define MAX_SCREENS   4
 
#define COLOR_BLACK   0
 
#define COLOR_BLUE   1
 
#define COLOR_DARKGRAY   2
 
#define COLOR_LIGHTBLUE   3
 
#define COLOR_RED   4
 
#define COLOR_MAGENTA   5
 
#define COLOR_LIGHTRED   6
 
#define COLOR_LIGHTMAGENTA   7
 
#define COLOR_GREEN   8
 
#define COLOR_CYAN   9
 
#define COLOR_LIGHTGREEN   10
 
#define COLOR_LIGHTCYAN   11
 
#define COLOR_BROWN   12
 
#define COLOR_LIGHTGREY   13
 
#define COLOR_YELLOW   14
 
#define COLOR_WHITE   15
 

Functions

void VGA_Init (void)
 
void VGA_LateInit (void)
 
void VGA_SwitchTo (int screen)
 
void VGA_LoadFont (void *fontBuffer, int maxLength)
 
void VGA_SaveFont (void *fontBuffer, int maxLength)
 
void VGA_ClearDisplay (void)
 
void VGA_ScollDisplay (void)
 
void VGA_Putc (short ch)
 
void VGA_Puts (const char *str)
 
void Panic (const char *str)
 

Macro Definition Documentation

◆ COLOR_BLACK

#define COLOR_BLACK   0

Definition at line 17 of file vgacons.h.

◆ COLOR_BLUE

#define COLOR_BLUE   1

Definition at line 18 of file vgacons.h.

◆ COLOR_BROWN

#define COLOR_BROWN   12

Definition at line 29 of file vgacons.h.

◆ COLOR_CYAN

#define COLOR_CYAN   9

Definition at line 26 of file vgacons.h.

◆ COLOR_DARKGRAY

#define COLOR_DARKGRAY   2

Definition at line 19 of file vgacons.h.

◆ COLOR_GREEN

#define COLOR_GREEN   8

Definition at line 25 of file vgacons.h.

◆ COLOR_LIGHTBLUE

#define COLOR_LIGHTBLUE   3

Definition at line 20 of file vgacons.h.

◆ COLOR_LIGHTCYAN

#define COLOR_LIGHTCYAN   11

Definition at line 28 of file vgacons.h.

◆ COLOR_LIGHTGREEN

#define COLOR_LIGHTGREEN   10

Definition at line 27 of file vgacons.h.

◆ COLOR_LIGHTGREY

#define COLOR_LIGHTGREY   13

Definition at line 30 of file vgacons.h.

◆ COLOR_LIGHTMAGENTA

#define COLOR_LIGHTMAGENTA   7

Definition at line 24 of file vgacons.h.

◆ COLOR_LIGHTRED

#define COLOR_LIGHTRED   6

Definition at line 23 of file vgacons.h.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   5

Definition at line 22 of file vgacons.h.

◆ COLOR_RED

#define COLOR_RED   4

Definition at line 21 of file vgacons.h.

◆ COLOR_WHITE

#define COLOR_WHITE   15

Definition at line 32 of file vgacons.h.

◆ COLOR_YELLOW

#define COLOR_YELLOW   14

Definition at line 31 of file vgacons.h.

◆ MAX_SCREENS

#define MAX_SCREENS   4

Definition at line 15 of file vgacons.h.

◆ SCREEN_CONSOLE

#define SCREEN_CONSOLE   1

Definition at line 11 of file vgacons.h.

◆ SCREEN_EXTRA

#define SCREEN_EXTRA   4

Definition at line 14 of file vgacons.h.

◆ SCREEN_KDEBUG

#define SCREEN_KDEBUG   3

Definition at line 13 of file vgacons.h.

◆ SCREEN_KLOG

#define SCREEN_KLOG   2

Definition at line 12 of file vgacons.h.

Function Documentation

◆ Panic()

void Panic ( const char *  str)

Definition at line 164 of file vgacons.c.

165{
166 VGA_Puts(str);
167 __asm__("int3");
168 while (1)
169 {
170 __asm__("hlt");
171 }
172}
void VGA_Puts(const char *str)
Definition: vgacons.c:157

◆ VGA_ClearDisplay()

void VGA_ClearDisplay ( void  )

◆ VGA_Init()

void VGA_Init ( void  )

Definition at line 75 of file vgacons.c.

76{
77 int i = 0;
78
79 for (i = 0;i < SizeX * SizeY;i++)
80 {
81 VideoBuffer[i] = (TextAttribute << 8) | ' ';
82 }
83
84 CurrentX = 0;
85 CurrentY = 0;
86
87 /*
88 * At initialization the video memory is located at 0xB8000.
89 * We will map the memory after memory management has been
90 * initialized.
91 */
92}
static short * VideoBuffer
Definition: vgacons.c:16
static int CurrentY
Definition: vgacons.c:18
static int SizeY
Definition: vgacons.c:20
static unsigned char TextAttribute
Definition: vgacons.c:21
static int SizeX
Definition: vgacons.c:19
static int CurrentX
Definition: vgacons.c:17
Here is the caller graph for this function:

◆ VGA_LateInit()

void VGA_LateInit ( void  )

Definition at line 94 of file vgacons.c.

95{
96 // Map in video memory
97 // Set VideoBuffer pointer
98}

◆ VGA_LoadFont()

void VGA_LoadFont ( void *  fontBuffer,
int  maxLength 
)

◆ VGA_Putc()

void VGA_Putc ( short  ch)

Definition at line 115 of file vgacons.c.

116{
117 c |= (TextAttribute << 8);
118 switch (c & 0xFF)
119 {
120 case '\b':
121 if (CurrentX > 0) {
122 CurrentX--;
123 VideoBuffer[CurrentX + CurrentY * SizeX] = 0x20 | (TextAttribute << 8);
124 }
125 break;
126 case '\n':
127 if (CurrentY >= (SizeY - 1)) {
129 } else {
130 CurrentY++;
131 }
132 CurrentX = 0;
133 break;
134 case '\r':
135 break;
136 case '\t':
137 VGA_Putc(' ');
138 VGA_Putc(' ');
139 VGA_Putc(' ');
140 VGA_Putc(' ');
141 break;
142 default:
144 CurrentX++;
145 if (CurrentX == SizeX) {
146 if (CurrentY >= (SizeY - 1)) {
148 } else {
149 CurrentY++;
150 }
151 CurrentX = 0;
152 }
153 break;
154 }
155}
void VGA_ScrollDisplay(void)
Definition: vgacons.c:100
void VGA_Putc(short c)
Definition: vgacons.c:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ VGA_Puts()

void VGA_Puts ( const char *  str)

Definition at line 157 of file vgacons.c.

158{
159 const char *p = str;
160 while (*p != '\0')
161 VGA_Putc(*p++);
162}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ VGA_SaveFont()

void VGA_SaveFont ( void *  fontBuffer,
int  maxLength 
)

◆ VGA_ScollDisplay()

void VGA_ScollDisplay ( void  )

◆ VGA_SwitchTo()

void VGA_SwitchTo ( int  screen)