URL
https://opencores.org/ocsvn/opb_vga_char_display_nodac/opb_vga_char_display_nodac/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 3 |
Rev 4 |
?rev1line? |
?rev2line? |
|
#define VGA_LINES_PER_ROW 75
|
|
unsigned char vga_current_line = 0;
|
|
unsigned char vga_current_row = 0;
|
|
unsigned char VGAcolor;
|
|
|
|
PutVGAChar(unsigned char CH, char color)
|
|
{
|
|
VGAcolor = color;
|
|
WriteVGAData(CH);
|
|
}
|
|
|
|
WriteVGAData(Data)
|
|
{
|
|
Xuint32 VGAAddress;
|
|
|
|
VGAAddress = (((vga_current_row * VGA_LINES_PER_ROW) + vga_current_line) << 18); // Character location
|
|
VGAAddress = VGAAddress + (VGAcolor << 14); // 7 is the foreground color white
|
|
VGAAddress = VGAAddress + (Data << 6); // The character to write
|
|
WriteREG (XPAR_S3E_VGA_CHAR_DEV_0_BASEADDR,USER,0x0,VGAAddress);
|
|
|
|
vga_current_line = vga_current_line + 1;
|
|
if (vga_current_line > VGA_LINES_PER_ROW) {
|
|
vga_current_line = 0;
|
|
vga_current_row = vga_current_row + 1;
|
|
}
|
|
}
|
|
|
|
WriteVGAString(char*STR, char color)
|
|
{
|
|
int i=0;
|
|
Xuint32 VGAAddress;
|
|
|
|
while (STR[i]!='\0')
|
|
{
|
|
VGAcolor = color;
|
|
WriteVGAData(STR[i]);
|
|
i++;
|
|
}
|
|
VGAcolor = color;
|
|
WriteVGAData(0x20);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
//
|
|
// Colors are controlled through the lower four bits of the color parameter.
|
|
// Bit zero (the LSB) controls the red portion of the color (on or off).
|
|
// Bit one controls green, bit two controls blue.
|
|
// Bit three, if set, inverts the character.
|
|
//
|
|
//----------------------------------------------------------------------------------
|
|
|
|
// Example Call:
|
|
vga_current_row = 0;
|
|
vga_current_line = 0;
|
|
WriteVGAString("Testing VGA Generator Core",0x7); // White, noninverted
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.