URL
https://opencores.org/ocsvn/opb_vga_char_display_nodac/opb_vga_char_display_nodac/trunk
Subversion Repositories opb_vga_char_display_nodac
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 2 to Rev 3
- ↔ Reverse comparison
Rev 2 → Rev 3
/trunk/microblaze_functions.txt
0,0 → 1,55
#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 |