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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 224 - (hide annotations)
Tue Feb 2 20:17:28 2010 UTC (9 years, 10 months ago) by dbug
File MIME type: text/plain
File size: 5013 byte(s)
Moved the rasterization effects to a new public folder
1 dbug 46
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 dbug 219 void DrawLine8();
51     void DrawLine8_toptobottomandlefttoright();
52 dbug 46
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 dbug 219 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 dbug 46
80 dbug 219 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     for (i=0;i<239;i++)
128     {
129     OtherPixelX=i;
130     OtherPixelY=0;
131     CurrentPixelX=239-i;
132     CurrentPixelY=199;
133    
134     DrawLine8();
135     }
136     for (i=0;i<199;i++)
137     {
138     OtherPixelX=0;
139     OtherPixelY=i;
140     CurrentPixelX=239;
141     CurrentPixelY=199-i;
142    
143     DrawLine8();
144     }
145     /*
146     for (i=0;i<239;i++)
147     {
148     CurrentPixelX=i;
149     CurrentPixelY=0;
150     OtherPixelX=239-i;
151     OtherPixelY=199;
152    
153     DrawLine8();
154     }
155     for (i=0;i<199;i++)
156     {
157     CurrentPixelX=0;
158     CurrentPixelY=i;
159     OtherPixelX=239;
160     OtherPixelY=199-i;
161    
162     DrawLine8();
163     }
164     */
165     }
166    
167    
168 dbug 46 void line_mike()
169     {
170     int i;
171    
172     /*
173     CurrentPixelX=0;
174     CurrentPixelY=0;
175     OtherPixelX=0;
176     OtherPixelY=199;
177    
178     DrawLine();
179     */
180 dbug 219
181     /*
182     while (1)
183     {
184     LargeX0=0;
185     LargeY0=0;
186     LargeX1=239;
187     LargeY1=199;
188 dbug 46
189 dbug 219 DrawClippedLine();
190     }
191     */
192    
193     /*
194     while (1)
195 dbug 46 {
196 dbug 219 for (i=30;i<50;i++)
197     {
198 dbug 46 LargeX0=i;
199     LargeY0=0;
200     LargeX1=239-i;
201     LargeY1=199;
202    
203     DrawClippedLine();
204     }
205 dbug 219 }
206 dbug 46 for (i=0;i<199;i++)
207     {
208     LargeX0=0;
209     LargeY0=i;
210     LargeX1=239;
211     LargeY1=199-i;
212    
213     DrawClippedLine();
214     }
215 dbug 219 */
216    
217 dbug 46 for (i=0;i<239;i++)
218     {
219     OtherPixelX=i;
220     OtherPixelY=0;
221     CurrentPixelX=239-i;
222     CurrentPixelY=199;
223    
224     DrawLine();
225     }
226     for (i=0;i<199;i++)
227     {
228     OtherPixelX=0;
229     OtherPixelY=i;
230     CurrentPixelX=239;
231     CurrentPixelY=199-i;
232    
233     DrawLine();
234     }
235 dbug 219 /*
236     for (i=0;i<239;i++)
237     {
238     CurrentPixelX=i;
239     CurrentPixelY=0;
240     OtherPixelX=239-i;
241     OtherPixelY=199;
242    
243     DrawLine();
244     }
245     for (i=0;i<199;i++)
246     {
247     CurrentPixelX=0;
248     CurrentPixelY=i;
249     OtherPixelX=239;
250     OtherPixelY=199-i;
251    
252     DrawLine();
253     }
254 dbug 46 */
255 dbug 219
256 dbug 46 }
257    
258    
259     void line_basic()
260     {
261     unsigned char i;
262     for (i=0;i<239;i++)
263     {
264     curset(i,0,3);
265     draw(239-i-i,199,2);
266     }
267     for (i=0;i<199;i++)
268     {
269     curset(0,i,3);
270     draw(239,199-i-i,2);
271     }
272     }
273    
274    
275     void test()
276     {
277     unsigned int delay;
278    
279     while (1)
280     {
281 dbug 219 // Judd routine first
282     printf("\nMike 8bit: ");
283     *(unsigned int*)0x276=0;
284     line_mike_8();
285     delay=65536-(*(unsigned int*)0x276);
286     printf(" duration: %d",delay);
287     /*
288 dbug 46 // Mike routine first
289 dbug 219 printf("\nMike 16bit: ");
290 dbug 46 *(unsigned int*)0x276=0;
291     line_mike();
292     delay=65536-(*(unsigned int*)0x276);
293 dbug 219 printf(" duration: %d",delay);
294    
295 dbug 46 // Basic routine second
296     printf("\nBasic: ");
297     *(unsigned int*)0x276=0;
298     line_basic();
299     delay=65536-(*(unsigned int*)0x276);
300 dbug 219 printf(" duration: %d",delay);
301     */
302 dbug 46 }
303     }
304    
305    
306 dbug 219
307    
308 dbug 46 void main()
309     {
310     GenerateTables();
311     hires();
312    
313     test();
314 dbug 219 //test0();
315 dbug 46 }
316    
317    

  ViewVC Help
Powered by ViewVC 1.1.26