2024-03-19 12:18:55 +00:00
|
|
|
#include <i86.h>
|
|
|
|
#include <conio.h>
|
|
|
|
|
|
|
|
extern void __cdecl enableUnchainedVGAMode();
|
|
|
|
extern void __cdecl enableTextMode();
|
2024-03-20 02:08:42 +00:00
|
|
|
extern void __cdecl fillScreen(int);
|
|
|
|
extern void __cdecl latchCopyCube();
|
2024-03-19 12:18:55 +00:00
|
|
|
|
|
|
|
char far *VGA = (char*)0xA0000;
|
|
|
|
|
2024-03-20 02:08:42 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-19 12:18:55 +00:00
|
|
|
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();
|
|
|
|
|
2024-03-20 02:08:42 +00:00
|
|
|
fillScreen(0);
|
|
|
|
|
|
|
|
populateExampleCube();
|
|
|
|
latchCopyCube();
|
|
|
|
|
|
|
|
delay(2000);
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2024-03-19 12:18:55 +00:00
|
|
|
outp(0x3c4, 0x02);
|
|
|
|
|
|
|
|
for (i = 0; i < 200; ++i) {
|
|
|
|
for (j = 0; j < 4; ++j) {
|
|
|
|
outp(0x3c5, 1 << j);
|
|
|
|
VGA[i] = j + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-20 02:08:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//delay(3000);
|
2024-03-19 12:18:55 +00:00
|
|
|
|
|
|
|
enableTextMode();
|
|
|
|
}
|