/[projet1]/public/oric/routines/rasterization/linebench/Main.c
Defence Force logotype

Contents of /public/oric/routines/rasterization/linebench/Main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 259 - (show annotations)
Sun Feb 7 23:13:49 2010 UTC (9 years, 7 months ago) by thrust26
File MIME type: text/plain
File size: 8873 byte(s)
chunking, initial version, 501
1
2 #include <lib.h>
3
4 // --------------------------------------
5 // LineBench
6 // --------------------------------------
7 // (c) 2003-2008 Mickael Pointier.
8 // This code is provided as-is.
9 // I do not assume any responsability
10 // concerning the fact this is a bug-free
11 // software !!!
12 // Except that, you can use this example
13 // without any limitation !
14 // If you manage to do something with that
15 // please, contact me :)
16 // --------------------------------------
17 // --------------------------------------
18 // For more information, please contact me
19 // on internet:
20 // e-mail: mike@defence-force.org
21 // URL: http://www.defence-force.org
22 // --------------------------------------
23 // Note: This text was typed with a Win32
24 // editor. So perhaps the text will not be
25 // displayed correctly with other OS.
26
27
28 // ============================================================================
29 //
30 // Externals
31 //
32 // ============================================================================
33
34 #include "params.h"
35
36 //
37 // ===== Display.s =====
38 //
39 extern unsigned char CurrentPixelX; // Coordinate X of edited pixel/byte
40 extern unsigned char CurrentPixelY; // Coordinate Y of edited pixel/byte
41
42 extern unsigned char OtherPixelX; // Coordinate X of other edited pixel/byte
43 extern unsigned char OtherPixelY; // Coordinate Y of other edited pixel/byte
44
45
46 //
47 // ===== Buffer.s =====
48 //
49 void DrawLine();
50 void DrawLine8();
51 void DrawLine8_toptobottomandlefttoright();
52
53 //
54 // ===== Clip.s =====
55 //
56 void DrawClippedLine();
57 void Break();
58
59 extern int LargeX0;
60 extern int LargeY0;
61 extern int LargeX1;
62 extern int LargeY1;
63
64 extern int LargeX;
65 extern int LargeY;
66
67
68 void test0()
69 {
70 int i;
71
72 // Testing all positions from top left
73 for (i=0;i<=239;i++)
74 {
75 CurrentPixelX=0;
76 CurrentPixelY=0;
77 OtherPixelX=i;
78 OtherPixelY=199;
79
80 DrawLine8();
81 //DrawLine8_toptobottomandlefttoright();
82 }
83
84 /*
85 // TopLeft to BottomRight
86 CurrentPixelX=0;
87 CurrentPixelY=0;
88 OtherPixelX=239;
89 OtherPixelY=199;
90 */
91
92 /*
93 // TopLeft to BottomRight - diagonal
94 CurrentPixelX=1;
95 CurrentPixelY=0;
96 OtherPixelX=199;
97 OtherPixelY=199;
98 */
99
100 /*
101 // BottomLeft to TopRight
102 CurrentPixelX=0;
103 CurrentPixelY=199;
104 OtherPixelX=239;
105 OtherPixelY=0;
106 */
107
108 /*
109 // TopRight to BottomLeft
110 CurrentPixelX=239;
111 CurrentPixelY=0;
112 OtherPixelX=0;
113 OtherPixelY=199;
114 */
115
116 //DrawLine();
117 //DrawLine8();
118
119 while (1);
120 }
121
122
123 void line_mike_8()
124 {
125 int i;
126
127 /*// mainly horizontal
128 CurrentPixelX = 20;
129 CurrentPixelY = 10;
130 OtherPixelX = 220;
131 OtherPixelY = 48;
132 //DrawLine8();
133
134 // mainly horizontal
135 CurrentPixelX = 20;
136 CurrentPixelY = 10;
137 OtherPixelX = 220;
138 OtherPixelY = 50;
139 DrawLine8();
140
141 // mainly horizontal
142 CurrentPixelX = 20;
143 CurrentPixelY = 10;
144 OtherPixelX = 220;
145 OtherPixelY = 52;
146 //DrawLine8();
147
148 // mainly horizontal
149 CurrentPixelX = 20;
150 CurrentPixelY = 10;
151 OtherPixelX = 220;
152 OtherPixelY = 54;
153 //DrawLine8();*/
154
155 /*// mainly horizontal
156 CurrentPixelX = 220;
157 CurrentPixelY = 40;
158 OtherPixelX = 70;
159 OtherPixelY = 140;
160 DrawLine8();
161
162 // mainly vertical
163 CurrentPixelX = 20;
164 CurrentPixelY = 10;
165 OtherPixelX = 70;
166 OtherPixelY = 140;
167 DrawLine8();*/
168
169 /*// very horizontal
170 CurrentPixelX = 220;
171 CurrentPixelY = 40;
172 OtherPixelX = 21;
173 OtherPixelY = 10;
174 DrawLine8();
175
176 // very horizontal
177 CurrentPixelX = 220;
178 CurrentPixelY = 10;
179 OtherPixelX = 21;
180 OtherPixelY = 40;
181 DrawLine8();
182
183 // vertical
184 CurrentPixelX = 21;
185 CurrentPixelY = 15;
186 OtherPixelX = 21;
187 OtherPixelY = 35;
188 DrawLine8();
189
190 // vertical
191 CurrentPixelX = 220;
192 CurrentPixelY = 15;
193 OtherPixelX = 220;
194 OtherPixelY = 35;
195 DrawLine8();*/
196
197 for (i=0;i<239;i++)
198 {
199 OtherPixelX=i;
200 OtherPixelY=0;
201 CurrentPixelX=239-i;
202 CurrentPixelY=199;
203
204 DrawLine8();
205 }
206 for (i=0;i<199;i++)
207 {
208 OtherPixelX=0;
209 OtherPixelY=i;
210 CurrentPixelX=239;
211 CurrentPixelY=199-i;
212
213 DrawLine8();
214 }
215
216 /*
217 for (i=0;i<239;i++)
218 {
219 CurrentPixelX=i;
220 CurrentPixelY=0;
221 OtherPixelX=239-i;
222 OtherPixelY=199;
223
224 DrawLine8();
225 }
226 for (i=0;i<199;i++)
227 {
228 CurrentPixelX=0;
229 CurrentPixelY=i;
230 OtherPixelX=239;
231 OtherPixelY=199-i;
232
233 DrawLine8();
234 }
235 */
236 }
237
238
239 void line_mike()
240 {
241 int i;
242
243 /*
244 CurrentPixelX=0;
245 CurrentPixelY=0;
246 OtherPixelX=0;
247 OtherPixelY=199;
248
249 DrawLine();
250 */
251
252 /*
253 while (1)
254 {
255 LargeX0=0;
256 LargeY0=0;
257 LargeX1=239;
258 LargeY1=199;
259
260 DrawClippedLine();
261 }
262 */
263
264 /*
265 while (1)
266 {
267 for (i=30;i<50;i++)
268 {
269 LargeX0=i;
270 LargeY0=0;
271 LargeX1=239-i;
272 LargeY1=199;
273
274 DrawClippedLine();
275 }
276 }
277 for (i=0;i<199;i++)
278 {
279 LargeX0=0;
280 LargeY0=i;
281 LargeX1=239;
282 LargeY1=199-i;
283
284 DrawClippedLine();
285 }
286 */
287
288 for (i=0;i<239;i++)
289 {
290 OtherPixelX=i;
291 OtherPixelY=0;
292 CurrentPixelX=239-i;
293 CurrentPixelY=199;
294
295 DrawLine();
296 }
297 for (i=0;i<199;i++)
298 {
299 OtherPixelX=0;
300 OtherPixelY=i;
301 CurrentPixelX=239;
302 CurrentPixelY=199-i;
303
304 DrawLine();
305 }
306 /*
307 for (i=0;i<239;i++)
308 {
309 CurrentPixelX=i;
310 CurrentPixelY=0;
311 OtherPixelX=239-i;
312 OtherPixelY=199;
313
314 DrawLine();
315 }
316 for (i=0;i<199;i++)
317 {
318 CurrentPixelX=0;
319 CurrentPixelY=i;
320 OtherPixelX=239;
321 OtherPixelY=199-i;
322
323 DrawLine();
324 }
325 */
326
327 }
328
329
330 void line_basic()
331 {
332 unsigned char i;
333 for (i=0;i<239;i++)
334 {
335 curset(i,0,3);
336 draw(239-i-i,199,2);
337 }
338 for (i=0;i<199;i++)
339 {
340 curset(0,i,3);
341 draw(239,199-i-i,2);
342 }
343 }
344
345
346 void test()
347 {
348 unsigned int delay;
349
350 while (1)
351 {
352 // Judd routine first
353 printf("\nMike 8bit: ");
354 *(unsigned int*)0x276=0;
355 line_mike_8();
356 delay=65536-(*(unsigned int*)0x276);
357 printf(" duration: %d",delay);
358 /*
359 // Mike routine first
360 printf("\nMike 16bit: ");
361 *(unsigned int*)0x276=0;
362 line_mike();
363 delay=65536-(*(unsigned int*)0x276);
364 printf(" duration: %d",delay);
365
366 // Basic routine second
367 printf("\nBasic: ");
368 *(unsigned int*)0x276=0;
369 line_basic();
370 delay=65536-(*(unsigned int*)0x276);
371 printf(" duration: %d",delay);
372 */
373 }
374 }
375
376
377
378
379 void main()
380 {
381 GenerateTables();
382 hires();
383
384 test();
385 //test0();
386 }
387
388

  ViewVC Help
Powered by ViewVC 1.1.26