-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLOUD.CPP
170 lines (108 loc) · 2.28 KB
/
CLOUD.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include <alloc.h>
#include <conio.h>
#include <dos.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#define NUM_COLORS 256
#define SET_MODE 0x00
#define VIDEO_INT 0x10
#define VGA_256_COLOR_MODE 0x13
#define TEXT_MODE 0x03
int height= 320;
int width= 200;
#define PALETTE_INDEX 0x3C8
#define PALETTE_DATA 0x3C9
typedef unsigned char byte;
byte far *VGA=(byte far *)0xA0000000L;
#define SETPIX(x,y,c) *(VGA+(x)+(y)*height)=c
#define GETPIX(x,y) *(VGA+(x)+(y)*SCREEN_WIDTH)
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
int x, y,i,j,l;
void set_mode(byte mode)
{
union REGS regs;
regs.h.ah = SET_MODE;
regs.h.al = mode;
int86( VIDEO_INT, ®s, ®s );
}
void put_pixels(){
union REGS regs;
regs.h.ah = 0x0c;
regs.h.al = 4;
regs.x.cx = x;
regs.x.dx = y;
int86( VIDEO_INT, ®s, ®s );
}
void default_scene1(){
// SETPIX( x , *VGA^2*i&y&x, i&y );
// SETPIX( *VGA^1&x, *VGA^2^i*x^y, tan(i*x));
SETPIX( x+i,y+i, 4);
// SETPIX( x, y, y );
}
void default_scene(){
for( i =0; i < 200; ++i ) {
SETPIX( x^i,y^i , i );
x++;
// y++;
//
// SETPIX( x, *VGA^2*i, i *(sin(y) );
// SETPIX( x, y, y );
}
}
int main()
{
int c,l;
x=100;
y=100;
char kc = 0;
char s[255];
byte *pal;
set_mode( VGA_256_COLOR_MODE );
/* printf("Hello, world!\n"); */
/* loop until ESC pressed */
while( kc != 0x1b )
{
for(l=10;l<190;l++){
for(c=10;c<310;c++){
SETPIX (c,y,0);
}
}
// i=i+1;
default_scene();
if(kbhit()) {
kc = getch();
if( kc == (char)0 ) {
kc = getch();
/* special key handling */
switch( kc )
{
case 0x48: /* up arrow */
y=y-1;
//strcpy(s, "up arrow");
break;
case 0x4d:
x=x+1;
break;
case 0x4b:
x=x-1;
break;
case 0x50: /* down arrow */
y=y+1;
//strcpy(s, "down arrow");
break;
default: /* other special keys */
// sprintf(s, "00 %02x", kc);
break;
}
} else {
// sprintf(s, "%02x", kc);
}
// printf("Key pressed: %s\n", s);
}
}
set_mode( TEXT_MODE );
return 0;
}