vga-logic-processor-examples/main.c

63 lines
1.0 KiB
C

#include <i86.h>
#include <conio.h>
extern void __cdecl enableUnchainedVGAMode();
extern void __cdecl enableTextMode();
extern void __cdecl fillScreen(int);
extern void __cdecl latchCopyCube();
char far *VGA = (char*)0xA0000;
#define PLANE_WIDTH (320 / 4)
void populateExampleCube(void) {
int y, x;
outp(0x3c4, 0x02);
for (y = 0; y < 15; ++y) {
for (x = 0; x < 15; ++x) {
outp(0x3c5, 1 << (x % 4));
VGA[y * PLANE_WIDTH + x / 4] = y * 16 + x;
}
}
}
int main(void) {
// activate unchained vga mode
// set up 8 very clear colors
// place some data into video memory to be latch copied
// show off the following
// * latch copies
// * masking
// * barrel shifting
int i,j;
enableUnchainedVGAMode();
fillScreen(0);
populateExampleCube();
latchCopyCube();
delay(2000);
/*
outp(0x3c4, 0x02);
for (i = 0; i < 200; ++i) {
for (j = 0; j < 4; ++j) {
outp(0x3c5, 1 << j);
VGA[i] = j + 1;
}
}
*/
//delay(3000);
enableTextMode();
}