-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheckbox.cpp
93 lines (81 loc) · 1.67 KB
/
eckbox.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*******************************************************
* Authors: *
* Nick Rupert - [email protected] *
* Luke Garfield - [email protected] *
* *
* Project Homepage: http://eckbox.sourceforge.net *
* *
* License: Jabber Open Source License *
*******************************************************/
#include <vga.h>
#define extern static
#include <asm/io.h>
#undef extern
#include <sys/perm.h>
#include <fstream>
#include "eckbox.h"
using namespace std;
int main(int argc, char** argv)
{
vga_init();
vga_setmode(G800x600x256);
int pix, href, vref, x, y;
if(argv[1])
{
x=atoi(argv[1]);
y=atoi(argv[2]);
}
else
{
x=800;
y=600;
}
ifstream fin;
fin.open("delays",ios::in);
fin>>pix;
fin>>href;
fin>>vref;
fin.close();
ioperm(0x378,1,1);
int p1, p2;
unsigned long long int t1=0, t2=0;
while(t2-t1<vref-50) //this while just pauses execution until
{ // a vref has been done
p1=inb(0x378);
t1=rdtsc();
p2=inb(0x378);
while(p2<10) //10 here is approx noise val for no pixel
{
inb(0x378);
t2=rdtsc();
}
}
while(true)
{
for(int i=0; i<y; i++)
{
for(int k=0; k<x; k++)
{
p1=inb(0x378);
if(p1<128)
{
vga_setcolor(0);
vga_drawpixel(k,i);
}
else
{
vga_setcolor(15);
vga_drawpixel(k,i);
}
if(k<x-1)
pause(pix);
else if(k==x-1 && i<y-1)
pause(href);
else
pause(vref);
}
}
}
vga_setmode(TEXT);
return (0);
}