-
Notifications
You must be signed in to change notification settings - Fork 1
/
1.c
169 lines (138 loc) · 2.61 KB
/
1.c
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
#define __LIBRARY__
#include<stdio.h>
#include<unistd.h>
#include<errno.h>
#include<time.h>
#define vga_graph_memstart 0xA0000
#define vga_graph_memsize 64000
#define cursor_side 6
#define vga_width 320
#define vga_height 200
#define BIRD_X 120
#define BIRD_Y 100
#define BIRD_WIDTH 10
#define BIRD_HEIGHT 8
typedef struct{
int posx;
int posy;
int width;
int height;
}object;
char *p;
int i,j,x_pos,y_pos;
int m;
int cnt;
int bird_y;
object objects[20];
void repaint(int nn){
object cur;
cur=objects[nn];
char *startt;
char *pp;
int ii,jj;
startt=(char *)vga_graph_memstart+cur.posy*vga_width+cur.posx;
for(ii=0;ii<cur.width;ii++)
{
for(jj=0;jj<cur.height;jj++)
{
pp=startt+vga_width*jj+ii;
*pp=13;
//*pp is op
}
}
}
_syscall0(void,init_graphics)
_syscall0(int,get_message)
int main(void)
{
p=vga_graph_memstart;
x_pos=20;
y_pos=20;
bird_y=BIRD_Y;
init_graphics();
for(i=0;i<vga_graph_memsize;i++)
*p++ = 3;
for (i=x_pos-cursor_side;i<=x_pos+cursor_side;i++)
for(j=y_pos-cursor_side;j<=y_pos+cursor_side;j++)
{
p=(char *)vga_graph_memstart+j*vga_width+i;
*p=12;
}
objects[0].posx=BIRD_X;
objects[0].posy=bird_y;
objects[0].width=BIRD_WIDTH;
objects[0].height=BIRD_HEIGHT;
cnt=10;
//
// sheng cheng zhang ai wu
//
}
#define __LIBRARY__
#include<stdio.h>
#include<unistd.h>
#include<errno.h>
#include<time.h>
#define vga_graph_memstart 0xA0000
#define vga_graph_memsize 64000
#define cursor_side 6
#define vga_width 320
#define vga_height 200
#define BIRD_X 120
#define BIRD_Y 100
#define BIRD_WIDTH 10
#define BIRD_HEIGHT 8
typedef struct{
int posx;
int posy;
int width;
int height;
}object;
char *p;
int i,j,x_pos,y_pos;
int m;
int cnt;
int bird_y;
object objects[20];
void repaint(int nn){
object cur;
cur=objects[nn];
char *startt;
char *pp;
int ii,jj;
startt=(char *)vga_graph_memstart+cur.posy*vga_width+cur.posx;
for(ii=0;ii<cur.width;ii++)
{
for(jj=0;jj<cur.height;jj++)
{
pp=startt+vga_width*jj+ii;
*pp=13;
//*pp is op
}
}
}
_syscall0(void,init_graphics)
_syscall0(int,get_message)
int main(void)
{
p=vga_graph_memstart;
x_pos=20;
y_pos=20;
bird_y=BIRD_Y;
init_graphics();
for(i=0;i<vga_graph_memsize;i++)
*p++ = 3;
for (i=x_pos-cursor_side;i<=x_pos+cursor_side;i++)
for(j=y_pos-cursor_side;j<=y_pos+cursor_side;j++)
{
p=(char *)vga_graph_memstart+j*vga_width+i;
*p=12;
}
objects[0].posx=BIRD_X;
objects[0].posy=bird_y;
objects[0].width=BIRD_WIDTH;
objects[0].height=BIRD_HEIGHT;
cnt=10;
//
// sheng cheng zhang ai wu
//
}