/[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 46 - (hide annotations)
Wed Mar 25 21:32:32 2009 UTC (10 years, 11 months ago) by dbug
Original Path: users/dbug/rasterization/linebench/Main.c
File MIME type: text/plain
File size: 3022 byte(s)
Added PolyBench and LineBench
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    
51     //
52     // ===== Clip.s =====
53     //
54     void DrawClippedLine();
55     void Break();
56    
57     extern int LargeX0;
58     extern int LargeY0;
59     extern int LargeX1;
60     extern int LargeY1;
61    
62     extern int LargeX;
63     extern int LargeY;
64    
65    
66    
67     void line_mike()
68     {
69     int i;
70    
71     /*
72     CurrentPixelX=0;
73     CurrentPixelY=0;
74     OtherPixelX=0;
75     OtherPixelY=199;
76    
77     DrawLine();
78     */
79    
80     for (i=0;i<239;i++)
81     {
82     LargeX0=i;
83     LargeY0=0;
84     LargeX1=239-i;
85     LargeY1=199;
86    
87     DrawClippedLine();
88     }
89     for (i=0;i<199;i++)
90     {
91     LargeX0=0;
92     LargeY0=i;
93     LargeX1=239;
94     LargeY1=199-i;
95    
96     DrawClippedLine();
97     }
98     /*
99     for (i=0;i<239;i++)
100     {
101     OtherPixelX=i;
102     OtherPixelY=0;
103     CurrentPixelX=239-i;
104     CurrentPixelY=199;
105    
106     DrawLine();
107     }
108     for (i=0;i<199;i++)
109     {
110     OtherPixelX=0;
111     OtherPixelY=i;
112     CurrentPixelX=239;
113     CurrentPixelY=199-i;
114    
115     DrawLine();
116     }
117     */
118     }
119    
120    
121     void line_basic()
122     {
123     unsigned char i;
124     for (i=0;i<239;i++)
125     {
126     curset(i,0,3);
127     draw(239-i-i,199,2);
128     }
129     for (i=0;i<199;i++)
130     {
131     curset(0,i,3);
132     draw(239,199-i-i,2);
133     }
134     }
135    
136    
137     void test()
138     {
139     unsigned int delay;
140    
141     while (1)
142     {
143     // Mike routine first
144     printf("\nMike test: ");
145     *(unsigned int*)0x276=0;
146     line_mike();
147     delay=65536-(*(unsigned int*)0x276);
148     printf(" duration (in 100th of second): %d",delay);
149    
150     // Basic routine second
151     printf("\nBasic: ");
152     *(unsigned int*)0x276=0;
153     line_basic();
154     delay=65536-(*(unsigned int*)0x276);
155     printf(" duration (in 100th of second): %d",delay);
156     }
157     }
158    
159    
160     void main()
161     {
162     GenerateTables();
163     hires();
164    
165     test();
166     }
167    
168    

  ViewVC Help
Powered by ViewVC 1.1.26