1 //DOS Graphics thingy by sparky4 licence GPL v2
\r
2 //a special thanks to everyone to release source code for mode X
\r
11 int bakax = 0, bakay = 0;
\r
12 cord xx = rand()&0%320, yy = rand()&0%240, sx = 0, sy = 0;
\r
15 byte *vga = (byte *) MK_FP(0xA000, 0);
\r
18 * Comment out the following #define if you don't want the testing main()
\r
23 /////////////////////////////////////////////////////////////////////////////
\r
25 // setvideo() - This function Manages the video modes //
\r
27 /////////////////////////////////////////////////////////////////////////////
\r
28 void setvideo(/*byte mode, */int vq){
\r
31 if(!vq){ // deinit the video
\r
32 // change to the video mode we were in before we switched to mode 13h
\r
33 //mxSetMode( MX_TEXT );
\r
37 int86(0x10, &in, &out);
\r
39 }else if(vq == 1){ // init the video
\r
40 // get old video mode
\r
42 int86(0x10, &in, &out);
\r
43 old_mode = out.h.al;
\r
47 mxSetMode( MX_320x240 );
\r
48 // mxSetVirtualScreen(SW+(SW/4), SH+(SH/4));
\r
49 // mxSetVirtualScreen(SW*2, SH*2);
\r
50 mxSetVirtualScreen(VW,VH);
\r
51 // mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4)));
\r
53 //mxSetClipRegion(0, 0, SW, SH);
\r
57 /////////////////////////////////////////////////////////////////////////////
\r
59 // cls() - This clears the screen to the specified color, on the VGA or on //
\r
60 // the Virtual screen. //
\r
62 /////////////////////////////////////////////////////////////////////////////
\r
63 void cls(byte color, byte *Where){
\r
64 _fmemset(Where, color, VW*(VH));
\r
67 //color
\82Ä
\82·
\82Æ
\r
69 if(gq < NUM_COLORS){
\r
76 //color
\82Ä
\82·
\82Æ
\r
79 //---- cls(gq, vaddr);
\r
86 //slow spectrum down
\r
90 //plotpixel(xx, yy, coor, vga);
\r
91 //ppf(sx, sy, coor, vga);
\r
92 mxPutPixel(sx, sy, coor);
\r
93 //printf("%d %d %d %d\n", sx, sy, svq, coor);
\r
98 if(svq == 7) coor++;
\r
99 if(sy == SH && svq == 8) coor = rand()%NUM_COLORS;
\r
104 /*-----------ding-------------*/
\r
109 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
\r
114 if(coor < HGQ && coor < LGQ) coor = LGQ;
\r
118 bakax = rand()%3; bakay = rand()%3;
\r
122 if(q==8){ colorz(); return gq; }else
\r
123 if(q==10){ ssd(q); /*printf("%d\n", coor);*/ }else
\r
124 if(q==5){ colortest(); return gq; }else
\r
125 if(q==11){ colorz(); delay(100); return gq; }
\r
127 coor = rand()%NUM_COLORS;
\r
135 if(q == 9){ ssd(q); coor++; }
\r
139 if((q<5 && gq<BONK) || (q==16 && gq<BONK)){ // the number variable make the colors more noticable
\r
141 if(xx==SW){bakax=0;}
\r
142 if(xx==0){bakax=1;}
\r
143 if(yy==SH){bakay=0;}
\r
144 if(yy==0){bakay=1;}
\r
146 if(xx!=SW||yy!=SH){
\r
147 if(xx==0){bakax=1;bakay=-1;d3y=1;}
\r
148 if(yy==0){bakax=1;bakay=0;d3y=1;}
\r
149 if(xx==SW){bakax=-1;bakay=-1;d3y=1;}
\r
150 if(yy==SH){bakax=1;bakay=0;d3y=1;}
\r
151 }else if(xx==SW&&yy==SH) xx=yy=0;
\r
202 if(xx<0) xx=(VW/*-TILEWH*/);
\r
203 if(yy<0) yy=(VH/*-TILEWH*/);
\r
204 if(xx>(VW/*-TILEWH*/)) xx=0;
\r
205 if(yy>(VH/*-TILEWH*/)) yy=0;
\r
208 //interesting effects
\r
214 mxPutPixel(tx, ty, coor);
\r
215 //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH);
\r
219 // mxFillBox(xx, yy, TILEWH, TILEWH, coor, 16);
\r
220 mxPutPixel(xx, yy, coor);
\r
223 if(q==2) mxPutPixel(rand()%VW, rand()%(VH), 0);
\r
224 if(q==16) mxPutPixel(rand()%VW, rand()%(VH), 0);
\r
225 if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; } //random 3 switch
\r
227 //if(xx<0||xx>320||yy<0||yy>(SH*3))
\r
228 // printf("%d %d %d %d %d %d\n", xx, yy, coor, bakax, bakay, getPixel_X(xx,yy));
\r
229 // printf("%d\n", getPixel_X(xx,yy));
\r
236 * The library testing routines follows below.
\r
242 * Library test (program) entry point.
\r
247 int key,d,xpos,ypos,xdir,ydir;
251 d=1; // switch variable
\r
252 key=4; // default screensaver number
\r
260 /*while(d!=0){ // on!
\r
261 if(!kbhit()){ // conditions of screen saver
\r
265 // user imput switch
\r
266 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.\n", getch()); // prompt the user
\r
268 //if(key==3){xx=yy=0;} // crazy screen saver wwww
\r
273 while(1){ // conditions of screen saver
277 //end of screen savers
\r
279 for (int x = 0; x < VW; ++x)
\r
281 mxPutPixel(x, 0, 15);
\r
282 mxPutPixel(x, SH-1, 15);
\r
284 for (int y = 0; y < VH; ++y)
\r
286 mxPutPixel(0, y, 15);
\r
287 mxPutPixel(SW-1, y, 15);
\r
289 for (int x = 320; x < VW; ++x)
\r
291 mxPutPixel(x, 0, 15);
\r
292 mxPutPixel(x, VH-1, 15);
\r
294 for (int y = 240; y < VH; ++y)
\r
296 mxPutPixel(0, y, 15);
\r
297 mxPutPixel(VW-1, y, 15);
\r
301 //mxFillBox(xx, yy, QUADWH, QUADWH, 1, 16);
302 //mxFillBox(xx, yy, QUADWH, QUADWH, 2, 16);
303 //mxFillBox(xx, yy, QUADWH, QUADWH, 3, 16);
304 //mxFillBox(xx, yy, QUADWH, QUADWH, 4, 16);
\r
305 mxSetTextColor(16, OP_TRANS);
\r
306 mxOutText(56, SH-40, "CRAZY!!!!]");
\r
307 mxOutText(64, SH-32, "CRAZY!!!!]");
\r
308 mxOutText(64, SH-24, "____ CRAZY!!!!]");
\r
309 mxOutText(56, SH-16, "___ _ CRAZY!!!!]");
\r
316 //for(int i=0;i<TILEWH;i++){
\r
318 //mxOutText(64, SH-40, "CRAZY!!!!");
\r
319 //mxOutText(64, SH-32, "CRAZY!!!!");
\r
320 //mxOutText(64, SH-24, " _ CRAZY!!!!");
\r
321 //mxOutText(64, SH-16, " _ _ CRAZY!!!!");
323 for(int o = 0; o<TILEWH; o++){
328 if( (xpos>(VW-SW-1)) || (xpos<1)){xdir=-xdir;}
\r
329 if( (ypos>(VH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
\r
333 if(ch==0x71)break; // 'q'
\r
334 if(ch==0x1b)break; // 'ESC'
\r
337 printf("wwww\nResolution: %dx%d\n", SW,SH);
\r
338 printf("Mode X Library Version: %d\n", mxGetVersion());
\r
339 //puts("where to next? It's your move! wwww");
\r
340 printf("bakapi ver. 1.04.09.04\nis made by sparky4
\81i
\81\86\83Ö
\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");
\r