* Thanks go out to various helpful netters who spotted the 0xE7 bug\r
* in the set320x240x256() function!\r
*\r
- * modified by sparky4 so it can be compiled in open watcom ^^\r
+ * Modified by sparky4 so it can be compiled in open watcom ^^\r
*/\r
\r
\r
}\r
\r
\r
-/*-----------XXXX-------------*/
+/*-----------XXXX-------------*/\r
/*tile*/\r
-void putColorBox_X(int x, int y, int w, int h, byte color) {
- outp(0x3c4, 0x02);
-
- int curx, cury;
- unsigned drawptr;
- for (curx=x; curx<(x+w); curx++) {
- outp(0x3c5, 0x01 << (curx & 3));
- drawptr = (unsigned)(widthBytes * y) + (curx / 4) + actStart;
- for (cury=0; cury<h; cury++) {
- vga[drawptr] = color;
- drawptr += widthBytes;
- }
- }
-}
-/*OFFSET = 0
-WHILE NOT FINISHED DO
- OFFSET = OFFSET + 80
- IF OFFSET >= (200 * 80) THEN OFFSET = 0
- DRAW TO ROW 200
- SET VGA OFFSET = OFFSET
- DRAW TO ROW -1 (was row 0 before scroll)
-END WHILE*//*
-void scrolly(){
- int OFFSET = 0
- WHILE NOT FINISHED DO
- OFFSET = OFFSET + 80
- IF OFFSET >= (240 * 80) THEN OFFSET = 0
- RAW TO ROW 240
- SET VGA OFFSET = OFFSET
- DRAW TO ROW -1 (was row 0 before scroll)
- }
-}
+void putColorBox_X(int x, int y, int w, int h, byte color) {\r
+ outp(0x3c4, 0x02);\r
+\r
+ int curx, cury;\r
+ unsigned drawptr;\r
+ for (curx=x; curx<(x+w); curx++) {\r
+ outp(0x3c5, 0x01 << (curx & 3));\r
+ drawptr = (unsigned)(widthBytes * y) + (curx / 4) + actStart;\r
+ for (cury=0; cury<h; cury++) {\r
+ vga[drawptr] = color;\r
+ drawptr += widthBytes;\r
+ }\r
+ }\r
+}\r
+/*OFFSET = 0\r
+WHILE NOT FINISHED DO\r
+ OFFSET = OFFSET + 80\r
+ IF OFFSET >= (200 * 80) THEN OFFSET = 0\r
+ DRAW TO ROW 200\r
+ SET VGA OFFSET = OFFSET\r
+ DRAW TO ROW -1 (was row 0 before scroll)\r
+END WHILE*//*\r
+void scrolly(){\r
+ int OFFSET = 0\r
+ WHILE NOT FINISHED DO\r
+ OFFSET = OFFSET + 80\r
+ IF OFFSET >= (240 * 80) THEN OFFSET = 0\r
+ RAW TO ROW 240\r
+ SET VGA OFFSET = OFFSET\r
+ DRAW TO ROW -1 (was row 0 before scroll)\r
+ }\r
+}\r
*/\r
//---------------------------------------------------\r
//\r
// //\r
/////////////////////////////////////////////////////////////////////////////\r
void cls(byte color, byte *Where){\r
- _fmemset(Where, color, width*(height*17));
+ _fmemset(Where, color, width*(height*17));\r
}\r
\r
//color \82Ä\82·\82Æ\r
||q==16\r
) && gq == BONK-1){\r
if(coor < HGQ && coor < LGQ) coor = LGQ;\r
- if(coor < HGQ-1){\r
+ if(coor < HGQ){\r
coor++;\r
}else{ coor = LGQ;\r
bakax = rand()%3; bakay = rand()%3;\r
}\r
}\r
\r
- if(q == 5){ colortest(); return gq; }\r
- if(q == 10){ colorz(); return gq; }\r
+ if(q == 8){ colorz(); return gq; }else\r
+ if(q == 10){ ssd(q); /*printf("%d\n", coor);*/ }else\r
+ if(q == 5){ colortest(); return gq; }else\r
if(q == 11){ colorz(); delay(100); return gq; }\r
- if(q == 8){ ssd(q); /*printf("%d\n", coor);*/ }\r
if(q == 6){\r
coor = rand()%NUM_COLORS;\r
//---- cls(coor, vaddr);\r
\r
// plot the pixel\r
//---- ppf(xx, yy, coor, vga);\r
- }else if(xx>=0 && xx<width && yy>=0 && PixelY<height){
- putColorBox_X(xx, yy, TILEWH, TILEWH, coor);
-//++++0000 putPixel_X(xx, yy, coor);
- }
-
+ }else if(xx>=0 && xx<width && yy>=0 && yy<height){\r
+ putColorBox_X(xx, yy, TILEWH, TILEWH, coor);\r
+//++++0000 putPixel_X(xx, yy, coor);\r
+ } \r
+\r
//---- if(q==2) ppf(rand()%, rand()%height, 0, vga);\r
- if(q==2) putColorBox_X(rand()%width, rand()%height, TILEWH, TILEWH, 0);
+ if(q==2) putColorBox_X(rand()%width, rand()%height, TILEWH, TILEWH, 0);\r
if(q==16) putPixel_X(rand()%width, rand()%height, 0);\r
if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; }\r
gq++;\r
doTest();\r
setvideo(0);\r
puts("Where to next? It's your move! wwww");\r
- printf("bakapi ver. 1.04.09a\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");\r
+ printf("bakapi ver. 1.04.09.01\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");\r
return 0;\r
}\r
\r
+++ /dev/null
-#define JOYPORT 0x201
-#define J1B1 0x10
-#define J1B2 0x20
-#define J2B1 0x40
-#define J2B2 0x80
-#define J1 0x01
-#define J2 0x02
-#define J1X 0x01
-#define J1Y 0x02
-
-
-unsigned char joybutton(unsigned char button) {
- outp(JOYPORT,0);
- return ((unsigned char) (~inp(JOYPORT) &button));
-}//end joybutton
-
-int joy1b(int button);
- #pragma aux joy1b = \
- "mov dx, 0x201" \
- "out dx, al" \
- "in al, dx" \
- "and ax, bx" \
- "xor ax, bx" \
- parm [bx] \
- modify[dx ax] \
- value[ax];
-
-extern unsigned int joystick( unsigned char _stick );
- #pragma aux joystick = \
- "cli" \
- "mov ah,ch" \
- "xor al,al" \
- "xor cx,cx" \
- "mov dx,0x201" \
- "out dx,al" \
- "charged:" \
- "in al,dx" \
- "test al,ah" \
- "loopne charged" \
- "xor ax,ax" \
- "sub ax,cx" \
- "sti" \
- parm [ch] \
- modify [ax];
-
-
+++ /dev/null
-#include<conio.h>
-#include<dos.h>
-
-#include "keydrv.h"
-
-extern int pressed;
-extern char keymap[];
-
-static void (__interrupt __far * old9h ) () ; //holds dos key int
-
-
-
-void __interrupt __far Key_handler() {
- int scan,cv;
-
- irenable();
- scan = inp(0x60); //read scan code
- cv = inp(0x61);
- outp( 0x61, cv | 0x80 );
- outp( 0x61, cv );
- outp(0x20, 0x20); //reset key int
-
- if(scan > 127) { //on break set keymap 0, dec pressed
- keymap[(scan & 127)] = 0;
- pressed -= 1;
- }
- else if(keymap[scan] == 0) { //on make set keymap 1, inc pressed
- pressed += 1; //if not already set
- keymap[scan] = 1;
- }
-
-}
-
-void hook_keys() {
- int i;
-
- for(i=0; i<128; i++) //set all keys to off
- keymap[i] = 0;
- pressed = 0; //set number keys pressed to 0
-
- old9h = _dos_getvect ( 0x9 ); //save old key int
- _dos_setvect ( 0x9 , Key_handler ); //set key int to new handler
-}
-
-void release_keys() {
- _dos_setvect ( 0x9 , old9h ) ; // Return to DOS keyboard driver
-}
-
-void waitkey(int key) {
- int temp = 0;
- while(!temp)
- if(keymap[key])
- temp = 1;
-}
-
-void waitkeyup(int key) {
- int temp = 0;
- while(!temp)
- if(!keymap[key])
- temp = 1;
-}//end waitkeyup
-
-
-
+++ /dev/null
-/**********************************************
- to use keydrv must include global variables:
- int pressed; //globals for key driver (# keys pressed)
- char keymap[128]; //map of all keys and their state
-***********************************************/
-
-#ifndef keydrv_h
-#define keydrv_h
-
-
-void irdisable();
-#pragma aux irdisable = \
- "cli";
-
-void irenable();
-#pragma aux irenable = \
- "sti";
-
-void hook_keys(); //installs keydrv,saves dos driver,0's out globals
-void release_keys(); //reinstalls dos driver
-void waitkey(int key); //waits for a key to be pressed then returns
-void waitkeyup(int key); //waits for key specified by parameter
- //to be released
-
-//scan code defines
-#define ESC 1
-#define KEY1 2
-#define KEY2 3
-#define KEY3 4
-#define KEY4 5
-#define KEY5 6
-#define KEY6 7
-#define KEY7 8
-#define KEY8 9
-#define KEY9 10
-#define KEY0 11
-#define KEYQ 16
-#define KEYA 30
-#define KEYJ 36
-#define KEYL 38
-#define LSHIFT 42
-#define KEYZ 44
-#define SPACE 57
-#define UP 72
-#define LEFT 75
-#define RIGHT 77
-#define DOWN 80
-
-#endif
-
-
+++ /dev/null
-#include<malloc.h>
-#include<string.h>
-
-#include "sprite.h"
-
-extern unsigned char far* dbuffer;
-
-int sprcreate(sprite *spr, int width, int height, int frames, int trans) {
- int i; //loop counter
- int error = 0;
-
- spr->x_dim = width;
- spr->y_dim = height;
- spr->numimages = frames;
- spr->state = 0;
- spr->transparent = trans;
- for(i=0; i<frames; i++) {
- spr->images[i] = (unsigned char far*)_fmalloc(width * height);
- if(!spr->images[i])
- error = 1;
- }
- spr->background = (unsigned char far*)_fmalloc(width * height);
- if(!spr->background)
- error = 1;
-
- return error;
-}//end sprcreate
-
-void sprclose(sprite *spr) {
- int i; // loop counter
-
- for(i=0; i<spr->numimages; i++)
- _ffree(spr->images[i]);
- _ffree(spr->background);
-}//end sprclose
-
-void sprload (sprite * spr) {
- unsigned char far* dest;
- unsigned char far* source;
- int x_loc = 0, y_loc = 0; //frame coordinates in dbuffer
- int i,j; //loop counters
-
- for(i=0; i < spr->numimages; i++) {
- x_loc = i * (spr->x_dim + 1);
- if (x_loc > (320 - spr->x_dim)) {
- x_loc = 0;
- y_loc += (spr->y_dim + 1);
- }//endif
- source = dbuffer + ((y_loc * 320) + x_loc);
- dest = spr->images[i];
- for(j=0; j < spr->y_dim; j++) {
- _fmemcpy(dest,source,spr->x_dim);
- source += 320;
- dest += spr->x_dim;
- }//end for
- }//end outer for
-
-}//end sprload
-
-void sprinit(sprite *spr,int x,int y,int fimage) {
- spr->state = 1;
- spr->x_loc = x;
- spr->y_loc = y;
- spr->curimage = fimage;
- sprback(spr);
-}//end sprinit
-
-void sprback(sprite * spr) {
- int width = spr->x_dim;
- int height = spr->y_dim;
- int xloc = spr->x_loc;
- int yloc = spr->y_loc;
- unsigned char far* source = dbuffer;
- unsigned char * dest = spr->background;
- int i; //loop counter
-
- source += ((yloc << 8) + (yloc << 6) + xloc);
-
- for(i=0; i < height; i++) {
- puturow(dest,source,width);
- source += 320;
- dest += width;
- }//end for
-}//end sprback
-
-void sprwrite(sprite *spr) {
- unsigned char far* dest = dbuffer;
- unsigned char * source = spr->images[spr->curimage];
- int height = spr->y_dim;
- int width = spr->x_dim;
- int i,x,y; //loop counters
-
- dest += ((spr->y_loc << 8) + (spr->y_loc << 6) + spr->x_loc);
-
- if(!(spr->transparent))
- for(i=0; i < height; i++) {
- _fmemcpy(dest,source,width);
- dest += 320;
- source += width;
- }//end for
- else {
- for(y=0; y<height; y++) {
- for(x=0; x<width; x++) {
- if((*source != 0))
- dest[x] = *source;
- source++;
- }//endfor
- dest += 320;
- }//endfor
- }//end else
-}//end sprwrite
-
-void sprerase(sprite * spr) {
- unsigned char far* dest = dbuffer;
- unsigned char * source = spr->background;
- int height = spr->y_dim;
- int width = spr->x_dim;
- int i; //loop counter
-
- dest += ((spr->y_loc << 8) + (spr->y_loc << 6) + spr->x_loc);
-
-
- for(i=0; i<height; i++) {
- puturow(dest,source,width);
- dest += 320;
- source += width;
- }//end for
-}//end sprerase
-
-void sprcopy(sprite *dest, sprite *source) {
- int i; //loop counter
-
- dest->x_dim = source->x_dim;
- dest->y_dim = source->y_dim;
- dest->state = source->state;
- dest->numimages = source->numimages;
- dest->curimage = source->curimage;
- dest->transparent = source->transparent;
- for(i=0; i<source->numimages; i++)
- dest->images[i] = source->images[i];
- dest->background = (unsigned char far*)_fmalloc(source->x_dim * source->y_dim);
-}//end copy
-
-/*
-
-sprcopy(sprite *dest, sprite *source) {
- int i; //loop counter
-
- dest->x_dim = source->x_dim;
- dest->y_dim = source->y_dim;
- dest->numimages = source->numimages;
- dest->curimage = source->curimage;
- dest->transparent = source->transparent;
- for(i=0; i<numimages; i++)
- dest->images[i] = source->images[i];
- dest->background = (unsigned char far*)_fmalloc(width * height);
-}//end copy
-
-int collide(sprite * orig,sprite *check) {
- if(orig->x_loc > check->x_loc) {
- if((orig->x_loc - check->x_loc) >= check->x_dim)
- return 0;
- }
- else if((check->x_loc - orig->x_loc) >= orig->x_dim)
- return 0;
- if(orig->y_loc > check->y_loc) {
- if((orig->y_loc - check->y_loc) >= check->y_dim)
- return 0;
- }
- else if((check->y_loc - orig->y_loc) >= orig->y_dim)
- return 0;
- return 1;
-}//end collide
-
-
-
-
-
-
-writesprclip(sprite * in,unsigned char far * dest) {
- unsigned char far * source = in->images[in->curimage];
-
- int sx,sy;
- int width;
- int bx = 0,by = 0, bwidth = 0,bheight = 0;
- unsigned char pixel;
-
- width = in->x_dim;
- bwidth = width;
- bheight = in->y_dim;
- sx = in->x_loc;
- sy = in->y_loc;
-
- if(!(sx>319 || sy>199 || sx+width<1 || sy+bheight<1)) {
- if(sx<0) {
- bx = -sx;
- sx = 0;
- bwidth -= bx;
- }
- else if(sx+width >= 319) {
- bx = 0;
- bwidth = 319 -sx;
- }
-
- if(sy<0) {
- by = -sy;
- sy = 0;
- bheight -= by;
- }
- else if(sy+bheight>199) {
- by = 0;
- bheight = 199 - sy;
- }
-
- dest = dest + (sy << 8) + (sy << 6) + sx;
- in->preclip = (by * width) + bx;
- source = source + in->preclip;
-
- if(in->transparent) {
- for(int y = 0; y < bheight; y++) {
- for(int x = 0; x < bwidth; x++) {
- if((pixel=source[x]))
- dest[x] = pixel;
- }//end for x
- dest +=320;
- source+=width;
- }//end for y
- }//end if
- else {
- for(int y =0; y < bheight; y++) {
- _fmemcpy(dest,source,bwidth);
- dest += 320;
- source += width;
- }//end for y
- }//end else
-
- in->x_clip = sx;
- in->y_clip = sy;
- in->x_dim_clip = bwidth;
- in->y_dim_clip = bheight;
- }
-
-}//end writesprclip
-
-*/
+++ /dev/null
-#ifndef sprite_h
-#define sprite_h
-
-#define NUMFRAME 11 //max # of frames per sprite
-
-typedef struct sprite_typ
- {
- int x_loc;
- int y_loc;
- int x_dim;
- int y_dim;
- short numimages;
- short curimage;
- short state;
- short transparent;
- unsigned char far * images[NUMFRAME];
- unsigned char far * background;
- }sprite;
-
-int sprcreate(sprite *spr, int width, int height, int frames, int trans);
-void sprclose(sprite *spr);
-void sprload (sprite * spr);
-void sprinit(sprite *spr,int x,int y,int fimage);
-void sprback(sprite * spr);
-void sprwrite(sprite *spr);
-void sprwrite(sprite *spr);
-void sprerase(sprite *spr);
-void sprcopy(sprite *dest, sprite *source);
-
-void puturow(unsigned char far* dest, unsigned char far* source, int size);
-#pragma aux puturow = \
- "mov bx, 0x3" \
- "and bx, cx" \
- "shr cx, 0x2" \
- "rep movsd" \
- "mov cx, bx" \
- "rep movsb" \
- parm [es di] [ds si] [cx] \
- modify [bx];
-#endif
+++ /dev/null
-#include "tile.h"
-#include <mem.h>
-#include <malloc.h>
-
-
-extern unsigned char far* dbuffer;
-
-//copy 16x16 tile to dest, loop unrolled 4 times
-void putile(unsigned char far* dest, unsigned char far* source);
-#pragma aux putile= \
- "mov bx, 0" \
- "marker:" \
- "mov cx, 4" \
- "rep movsb" \
- "add di, 304" \
- "mov cx, 4" \
- "rep movsb" \
- "add di, 304" \
- "mov cx, 4" \
- "rep movsb" \
- "add di, 304" \
- "mov cx, 4" \
- "rep movsb" \
- "add di, 304" \
- "add bx, 1" \
- "cmp bx, 4" \
- "jnz marker" \
- modify [cx bx] \
- parm [es di] [ds si];
-
-int tilecreate(tile *ntile, int frames) {
- int i; //loop counter
- int error = 0;
-
- ntile->numimages = frames;
- ntile->state = 0;
-
- for(i=0; i<frames; i++) {
- ntile->images[i] = (unsigned char far*)_fmalloc(256);
- if(!ntile->images[i])
- error = 1;
- }
-
- return error;
-}//end tilecreate
-
-void tileclose(tile *dtile) {
- int i; // loop counter
-
- for(i=0; i<dtile->numimages; i++)
- _ffree(dtile->images[i]);
-}//end sprclose
-
-void tileload (tile * in) {
- unsigned char far* dest;
- unsigned char far* source;
- int x_loc = 0, y_loc = 0; //frame coordinates in dbuffer
- int i,j; //loop counters
-
- for(i=0; i < in->numimages; i++) {
- x_loc = i * (17);
- if (x_loc > (304)) {
- x_loc = 0;
- y_loc += (17);
- }//endif
- source = dbuffer + ((y_loc * 320) + x_loc);
- dest = in->images[i];
- for(j=0; j < 16; j++) {
- _fmemcpy(dest,source,16);
- source += 320;
- dest += 16;
- }//end for
- }//end outer for
-
-}//end tileload
-
-writetile(tile *out, unsigned char far* dest) {
- unsigned char far* source;
-
- dest += ((out->y_loc << 8) + (out->y_loc << 6) + out->x_loc);
- source = out->images[out->curimage];
-
- putile(dest,source);
- return 0;
-
-}//end writetile
-
-int writetile_xclip(tile *out, unsigned char far* dest) {
- int dx; //clipped starting x location
- int dwidth; //clipped width of sprite
- int i;
-
- unsigned char far * source = out->images[out->curimage];
-
-
- if(out->x_loc < 0) {
- if(out->x_loc > -16) {
- dx = 0;
- // preclip = - out->x_loc;
- source -= out->x_loc;
- dwidth = 16 + out->x_loc;
- }
- else
- return 0; //tile not visible
- }
- else if(out->x_loc > 303) {
- if(out->x_loc < 320) {
- // preclip = 0;
- dx = out->x_loc;
- dwidth = 320 - dx;
- }
- else
- return 0; //tile not visible
- }
- else {
- // preclip = 0;
- dwidth = 16;
- dx = out->x_loc;
- }
-
-
- dest= dest + (out->y_loc << 8) + (out->y_loc << 6) + dx; //find first pixel in dest
-
- for(i = 0; i < 16; i++) {
- _fmemcpy(dest,source,dwidth);
- source += 16;
- dest += 320;
- }
-
- // x_clip = dx;
- // x_dim_clip = dwidth;
-
- return 1;
-}//writetile_xclip
-
-/* not sure if this is working
-***********************************************************
-sprite::writetile_prexclip(unsigned char far* dest) {
- int dwidth = x_dim_clip;
- unsigned char far * source = images[curimage];
- int i;
-
- dest= dest + (y_loc << 8) + (y_loc << 6) + x_clip; //find first pixel in dest
- source += preclip; //set source at first visible pixel
-
- for(i = 0; i < 16; i++) {
- _fmemcpy(dest,source,dwidth);
- source += 16;
- dest += 320;
- }
-}
-***************************************************************/
+++ /dev/null
-#ifndef tile_h
-#define tile_h
-
-
-#define NUMTIMAGE 10 // size of tile image array
-
-// all tiles are 16x16 images with no background scanning
-typedef struct tile_typ
- {
- int x_loc;
- int y_loc;
- short numimages;
- short curimage;
- short state;
- unsigned char far * images[NUMTIMAGE];
- }tile;
-
-//FUNCTIONS
-
-// allocate memory for a tile with images[frames]
-// sets tile.state = 0; returns 1 if memory not allocated
-int tilecreate(tile *ntile, int frames);
-
-//frees image memory used by tile
-void tileclose(tile *dtile);
-
-// reads all tile images from double buffer
-// images must be in double buffer b4 called
-void tileload (tile * in);
-
-// writes tile to screen(dest points to upper left corner)
-// at location (tile.x_loc,tile.y_loc)
-writetile(tile *out, unsigned char far* dest);
-
-// writes tile to screen(dest) clipping the left or right
-// edge if necessary, returns 0 if tile completely off screen
-int writetile_xclip(tile *out, unsigned char far* dest);
-
-#endif
+++ /dev/null
-#include<malloc.h>
-
-#include "vgautils.h"
-#include "vgabuff.h"
-
-extern unsigned char far * dbuffer;
-static FILE * fptr; //used to hold location in graphics file
-
-int vbinit(int height) {
- height = height * 320;
- dbuffer = (unsigned char far*)_fmalloc(height);
- if(dbuffer)
- return 1;
- else
- return 0;
-}//initbuff
-
-vbclose() {_ffree(dbuffer);}
-
-int getpcximage(char fname[], int plt)
-{
- int z,t; //loop counters
- FILE * fptr;
- rgbcolor_ptr tcolor;
- unsigned int index = 0;
- char temp;
- int run;
-
- if ((fptr = fopen(fname,"rb")) == 0) {
- return 0;
- }//end if file not found
-
- if(!dbuffer) //if buff memory not allocated ret 0
- return 0;
-
- for(z=0; z<128; z++)
- (char)getc(fptr);
- while(index < 64000) {
- temp = (char)getc(fptr);
- if(temp>=192) {
- run = temp - 192;
- temp = (char)getc(fptr);
- while ((run-- > 0) && (index < 64000))
- dbuffer[index++] = temp;
- }//endif
- else
- dbuffer[index++] = temp;
- }//end while
-
- if(plt) {
- fseek(fptr,-768L,SEEK_END);
- for(t=0; t<256; t++) {
- tcolor->red = (unsigned char)(getc(fptr) >> 2);
- tcolor->green = (unsigned char)(getc(fptr) >> 2);
- tcolor->blue = (unsigned char)(getc(fptr) >> 2);
- write_rgbcolor_reg(t,tcolor);
- }//end for
- }//end if
-
- fclose(fptr);
-
- return 1;
-}//end getpcximage
-
-int pcxopen(char fname[])
-{
- int z; //loop counter
-
- if ((fptr = fopen(fname,"rb")) == 0) {
- return 0;
- }//end if file not found
-
- if(!dbuffer) //if buff memory not allocated ret 0
- return 0;
- //read past header
- for(z=0; z<128; z++)
- (char)getc(fptr);
-
- pcxfadvance();
-
- return 1;
-}//end pcxopen
-
-
-void pcxfadvance()
-{
- unsigned int index = 0;
- char temp;
- int run;
-
- while(index < 64000) {
- temp = (char)getc(fptr);
- if(temp>=192) {
- run = temp - 192;
- temp = (char)getc(fptr);
- while ((run-- > 0) && (index < 64000))
- dbuffer[index++] = temp;
- }//endif
- else
- dbuffer[index++] = temp;
- }//end while
-
-}//end pcxfadvance
-
-void pcxclose()
-{
- int t; //loop counters
- rgbcolor_ptr tcolor;
-
- fseek(fptr,-768L,SEEK_END);
- for(t=0; t<256; t++) {
- tcolor->red = (unsigned char)(getc(fptr) >> 2);
- tcolor->green = (unsigned char)(getc(fptr) >> 2);
- tcolor->blue = (unsigned char)(getc(fptr) >> 2);
- write_rgbcolor_reg(t,tcolor);
- }//end for
-
- fclose(fptr);
-
-}//end pcxclose
+++ /dev/null
-#ifndef vgabuff_h
-#define vgabuff_h
-
-//allocates 320 * height bytes for buff
-int vbinit(int height);
-
-//frees space held by buff
-vbclose();
-
-/********** dbtovga *****************************
-* function to copy from memory to vga
-* dest = location in vga to start copying to
-* size = source size / 4 (size mod 4 must = 0)
-************************************************/
-void dbtovga(unsigned char far* dest, unsigned char far* source, int size);
-#pragma aux dbtovga= \
- "rep movsd" \
- parm [es di] [ds si] [cx];
-
-/************* getpcximage ***********************************
-* function reads a 320x200x256 pcx file and outputs to screen
-* if plt = 0 then the palette is not read
-* returns 0 if file unopened or screen not allocated
-*************************************************************/
-int getpcximage(char fname[], int plt);
-
-/***************************************************************
-* new pcx functions for single graphics file created 10/12/97
-* still use whole 320x200 for each sprite/tile - change soon!
-* note: no error checking, yet
-* functions should be moved to own file
-***************************************************************/
-
-//opens pcx file and reads first 320x200 image, no palette
-//returns 0 if file not found, 1 otherwise
-int pcxopen(char fname[]);
-
-//reads next 320x200 image in file opened by pcxopen
-void pcxfadvance();
-
-//reads the pallette into the vga registers and closes the file
-void pcxclose();
-
-
-#endif
+++ /dev/null
-#include "vgautils.h"
-
-void setvgamode(int mode)
-{
- union REGS inregs,outregs;
-
- inregs.h.ah = 0; //set video mode subfunction
- inregs.h.al = (unsigned char)mode; //video mode to change to
- int86(0x10, &inregs, &outregs);
-}//end set_graphics_mode
-
-void write_rgbcolor_reg(int index, rgbcolor_ptr color)
-{
- outp(COLOR_REGISTER_WR, index); //set register
- outp(COLOR_DATA,color->red);
- outp(COLOR_DATA,color->green);
- outp(COLOR_DATA,color->blue);
-}//end write_rgbcolor_reg
-
-rgbcolor_ptr read_rgbcolor_reg(int index, rgbcolor_ptr color)
-{
- outp(COLOR_REGISTER_RD, index);
- color->red = (unsigned char)inp(COLOR_DATA);
- color->green = (unsigned char)inp(COLOR_DATA);
- color->blue = (unsigned char)inp(COLOR_DATA);
- return color;
-}//emd read_rgbcolor_reg
-
-void read_palette(int start_reg,int end_reg,rgb_palette_ptr pal)
-{
- int index;
- rgbcolor color;
-
- for(index = start_reg; index<=end_reg; index++)
- {
- read_rgbcolor_reg(index,(rgbcolor_ptr)&color);
-
- pal->colors[index].red = color.red;
- pal->colors[index].green = color.green;
- pal->colors[index].blue = color.blue;
- }//end for
-
- pal->start_reg = start_reg;
- pal->end_reg = end_reg;
-}//end read_palette
-
-void write_palette(int start_reg,int end_reg, rgb_palette_ptr pal)
-{
- int index;
-
- for(index=start_reg; index <= end_reg; index++)
- write_rgbcolor_reg(index,&(pal->colors[index]));
-}//end write_palette
-
-void putchr(char out, int color, unsigned char far* dest) {
- unsigned char far* chrs = (unsigned char far*)ROMCHRS;
- int i,j; //loop counters
- int mask; //bitmask to extract bits from character set
-
- chrs += (out << 3); //set romptr to char * 8 bytes per char
-
- for(i=0; i<8; i++) {
- mask = 128;
- for(j=0; j<8; j++) {
- if(*chrs & mask)
- dest[j] = color;
- mask = mask >> 1;
- }
- chrs++;
- dest += 320;
- }
-}//end putchr
-
+++ /dev/null
-#ifndef vgautils_h
-#define vgautils_h
-
-#define MODE13 0x13
-#define TEXT 0x03
-#define SCREEN_WIDTH 320
-#define SCREEN_HEIGHT 200
-
-#define COLOR_MASK 0x3c6
-#define COLOR_REGISTER_RD 0x3c7
-#define COLOR_REGISTER_WR 0x3c8
-#define COLOR_DATA 0x3c9
-#define VGACARD 0xA0000000
-#define ROMCHRS 0xF000FA6E
-
-#include<conio.h>
-#include<stdlib.h>
-#include<stdio.h>
-#include<dos.h>
-#include<math.h>
-
-typedef struct rgbcolor_typ
- {
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- }rgbcolor, *rgbcolor_ptr;
-
-typedef struct rgb_palette_typ
- {
- int start_reg; //starting register to save
- int end_reg; // last register to save
- rgbcolor colors[256]; // palette storage
- }rgb_palette, *rgb_palette_ptr;
-
-void setvgamode(int mode);
-void write_rgbcolor_reg(int index, rgbcolor_ptr color);
-rgbcolor_ptr read_rgbcolor_reg(int index, rgbcolor_ptr color);
-void read_palette(int start_reg,int end_reg,rgb_palette_ptr pal);
-void write_palette(int start_reg,int end_reg, rgb_palette_ptr pal);
-void putchr(char out, int color, unsigned char far* dest);
-
-/***** syncvr() ***********************************
-* inline funtction that waits for verticle retrace
-***************************************************/
-#define syncvr() while(inp(0x3da) & 0x08);while(!(inp(0x3da) & 0x08));
-
-#endif