1 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
3 //=- Tauron VGA Utilities Version 3.0 -=
\r
4 //=- Released September 20, 1998 -=
\r
6 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
7 //=- Copyright (c) 1997, 1998 by Jeff Morgan =-= This code is FREE provided -=
\r
8 //=- All Rights Reserved. =-= that you put my name some- -=
\r
9 //=- =-= where in your credits. -=
\r
10 //=- DISCLAIMER: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
11 //=- I assume no responsibility whatsoever for any effect that this package, -=
\r
12 //=- the information contained therein or the use thereof has on you, your -=
\r
13 //=- sanity, computer, spouse, children, pets or anything else related to -=
\r
14 //=- you or your existance. No warranty is provided nor implied with this -=
\r
15 //=- source code. -=
\r
16 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
21 #define ABS(a) ((a < 0) ? -a : a)
\r
22 #define SGN(a) ((a < 0) ? -1 : 1)
\r
24 void Pixel13H(int x, int y, char color)
\r
26 int width = Mode.width;
\r
28 MOV AX,0A000H // video memory segment number
\r
29 MOV ES,AX // place it in es
\r
44 // Calculate the Offset
\r
45 mov ax,width // width
\r
46 mul y // (Y * width))
\r
47 mov bx,x // (X + (Y * width))
\r
52 mov ah,color // move the Color into ah
\r
53 mov es:[di],ah // move the value to the screen
\r
57 void pixel(int x, int y, char color)
\r
59 int width = Mode.width;
\r
60 if (Mode.mode == MODE13H)
\r
61 Pixel13H(x,y,color);
\r
62 else if (Mode.attrib & TVU_UNCHAINED) {
\r
64 MOV AX,0A000H // video memory segment number
\r
65 MOV ES,AX // place it in es
\r
80 // Calculate the Offset
\r
81 mov ax,width // width / 4
\r
83 mul y // (Y * (width / 4))
\r
84 mov bx,x // (X / 4) + (Y * (width / 4))
\r
90 mov ah,color // move the Color into ah
\r
91 mov es:[di],ah // move the value to the screen
\r
93 else if (Mode.attrib & TVU_PLANAR)
\r
96 MOV AX,0A000H // video memory segment number
\r
97 MOV ES,AX // place it in es
\r
101 MOV AX,y // Y Value
\r
126 MOV BYTE PTR ES:[DI],0FFh
\r
137 // This is Bresenham's Line Drawing Algorithm
\r
138 void drawline(int x1, int y1, int x2, int y2, char col)
\r
140 int d, x, y, ax, ay, sx, sy, dx, dy;
\r
153 d = ay - (ax >> 1);
\r
156 pixel( x, y, col );
\r
168 d = ax - (ay >> 1);
\r
171 pixel( x, y, col );
\r
184 void drawrect(int x1, int y1, int x2, int y2, char color)
\r
186 drawline(x1,y1,x2,y1,color);
\r
187 drawline(x1,y2,x2,y2,color);
\r
188 drawline(x1,y1,x1,y2,color);
\r
189 drawline(x2,y1,x2,y2+1,color);
\r
192 void hline(int x1, int x2, int y, char color)
\r
194 drawline(x1,y,x2,y,color);
\r
197 void vline(int y1, int y2, int x, char color)
\r
199 drawline(x,y1,x,y2,color);
\r
202 void fillrect(int x1, int y1, int x2, int y2, char color)
\r
204 for (int i = y1; i < y2; i++)
\r
205 hline(x1,x2,i,color);
\r
210 if (Mode.mode == MODE13H)
\r
214 else if (Mode.attrib & TVU_PLANAR)
\r
218 else if (Mode.attrib & TVU_UNCHAINED)
\r
223 /* Print mode stats
\r
227 drawrect(0,0,Mode.width-1,Mode.height-1,15);
\r
228 for (int i = 50; i < Mode.height; i += 100)
\r
231 hline(0,25,i+50,15);
\r
234 for (int i = 40; i < Mode.width; i += 80)
\r
237 vline(0,30,i+40,15);
\r
240 if (Mode.colors == 2)
\r
243 x = Mode.width - 420;
\r
244 y = Mode.height - 220;
\r
245 fillrect(x,y,x+200,y+200,0);
\r
247 fillrect(x,y,x+200,y+200,15);
\r
248 drawrect(x-200,y,x+200,y+200,15);
\r
250 else if (Mode.colors == 16)
\r
253 x = Mode.width - 522;
\r
254 y = Mode.height - 135;
\r
255 for (int i = 0; i < 8; i++)
\r
257 fillrect(x,y,x+64,y+64,i);
\r
260 x = Mode.width - 522;
\r
262 for (int i = 8; i < 16; i++)
\r
264 fillrect(x,y,x+64,y+64,i);
\r
267 drawrect(x-512,y-64,x,y+64,15);
\r
269 else if (Mode.colors == 256)
\r
272 x = Mode.width - 165;
\r
273 y = Mode.height - 165;
\r
275 for (int i = 0; i < 16; i++)
\r
277 for (int j = 0; j < 16; j++)
\r
279 fillrect(x,y,x+10,y+10,k);
\r
283 x = Mode.width - 165;
\r
286 drawrect(Mode.width - 165,Mode.height - 165,Mode.width -5,Mode.height - 5,15);
\r
294 if (Mode.mode == MODE00H)
\r
296 // ** NOTE ** the gotoxy's here are a hack so that i could use the
\r
297 // standard C functions to program this mode. Normally you would just
\r
298 // calculate the proper address and display the text but since DOS still
\r
299 // thinks we are in mode 03h (it checks the BIOS), this is necessary.
\r
301 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
303 printf("³Text Mode: 00H ³\n");
\r
305 printf("³Width: 40 Height: 25³\n");
\r
307 printf("³Bytes per screen: 2000³\n");
\r
309 printf("³Number of pages: 8 ³\n");
\r
311 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r
313 else if (Mode.mode == MODE03H)
\r
315 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
316 printf("³Text Mode: 03H ³\n");
\r
317 printf("³Width: 80 Height: 25³\n");
\r
318 printf("³Bytes per screen: 4000³\n");
\r
319 printf("³Number of pages: 8 ³\n");
\r
320 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r
322 else if (Mode.mode == MODE_J)
\r
324 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
325 printf("³Text Mode K ³\n");
\r
326 printf("³Width: 80 Height: 43³\n");
\r
327 printf("³Bytes per screen: 3440³\n");
\r
328 printf("³Number of pages: 8 ³\n");
\r
329 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r
331 else if (Mode.mode == MODE_K)
\r
333 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
334 printf("³Text Mode K ³\n");
\r
335 printf("³Width: 80 Height: 50³\n");
\r
336 printf("³Bytes per screen: 4000³\n");
\r
337 printf("³Number of pages: 8 ³\n");
\r
338 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r
340 else if (Mode.mode == MODE_L)
\r
342 // ** NOTE ** the gotoxy's here are a hack so that i could use the
\r
343 // standard C functions to program this mode. Normally you would just
\r
344 // calculate the proper address and display the text but since DOS still
\r
345 // thinks we are in mode 03h (it checks the BIOS), this is necessary.
\r
346 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
348 printf("³Text Mode L ³\n");
\r
350 printf("³Width: 40 Height: 43³\n");
\r
352 printf("³Bytes per screen: 3440³\n");
\r
354 printf("³Number of pages: 8 ³\n");
\r
356 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r
358 else if (Mode.mode == MODE_M)
\r
360 // ** NOTE ** the gotoxy's here are a hack so that i could use the
\r
361 // standard C functions to program this mode. Normally you would just
\r
362 // calculate the proper address and display the text but since DOS still
\r
363 // thinks we are in mode 03h (it checks the BIOS), this is necessary.
\r
364 printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
\r
366 printf("³Text Mode K ³\n");
\r
367 printf("³Width: 40 Height: 50³\n");
\r
370 printf("³Bytes per screen: 4000³\n");
\r
372 printf("³Number of pages: 8 ³\n");
\r
374 printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
\r