VBE.H
资源名称:泡泡龙源代码.zip [点击查看]
上传用户:junwei_58
上传日期:2007-05-15
资源大小:79k
文件大小:11k
源码类别:
其他智力游戏
开发平台:
Visual C++
- #ifndef VBE_H
- #define VBE_H
- /*===============================================*
- Super VGA VBE 2.0 Driver Level
- Head file
- Group. Birdmen
- included in vbeasm.c
- *===============================================*/
- //#pragma inline
- #define VBE_SUCCESS 0x4F
- #define false 0
- #define true 1
- #ifdef EXTERN
- #undef EXTERN
- #endif
- #define EXTERN extern
- #ifdef VBE_CPP
- #undef EXTERN
- #define EXTERN
- #endif
- #define PRIVATE static
- #define PUBLIC
- #ifdef NULL
- #undef NULL
- #endif
- #define NULL 0
- #define returnMode() setMode(oldmode)
- typedef unsigned long ulong;
- typedef unsigned short ushort;
- typedef unsigned char uchar;
- typedef unsigned long color;
- #define getmaxx() (xres-1)
- #define getmaxy() (yres-1)
- #define getcolor() COLOR
- #define getbkcolor() BKCOLOR
- #define setcolor(color) COLOR=color
- #define setbkcolor(color) BKCOLOR=color
- typedef struct {
- char VESASignature[4]; /* 'VESA' 4 byte signature */
- short VESAVersion; /* VBE version number */
- char far *OemStringPtr; /* Pointer to OEM string */
- ulong Capabilities; /* Capabilities of video card */
- ushort far *VideoModePtr; /* Pointer to supported modes */
- short TotalMemory; /* Number of 64kb memory blocks */
- /* VBE 2.0 extension information */
- short OemSoftwareRev; /* OEM Software revision number */
- char far *OemVendorNamePtr; /* Pointer to Vendor Name string */
- char far *OemProductNamePtr; /* Pointer to Product Name string */
- char far *OemProductRevPtr; /* Pointer to Product Revision str */
- char reserved[222]; /* Pad to 256 byte block size */
- char OemDATA[256]; /* Scratch pad for OEM data */
- }Struct_VBE_vgaInfo;
- typedef struct {
- short ModeAttributes; /* Mode attributes */
- char WinAAttributes; /* Window A attributes */
- char WinBAttributes; /* Window B attributes */
- short WinGranularity; /* Window granularity in k */
- short WinSize; /* Window size in k */
- ushort WinASegment; /* Window A segment */
- ushort WinBSegment; /* Window B segment */
- void * bankfunc; /* Pointer to window function */
- short BytesPerScanLine; /* Bytes per scanline */
- short XResolution; /* Horizontal resolution */
- short YResolution; /* Vertical resolution */
- char XCharSize; /* Character cell width */
- char YCharSize; /* Character cell height */
- char NumberOfPlanes; /* Number of memory planes */
- char BitsPerPixel; /* Bits per pixel */
- char NumberOfBanks; /* Number of CGA style banks */
- char MemoryModel; /* Memory model type */
- char BankSize; /* Size of CGA style banks */
- char NumberOfImagePages; /* Number of images pages (Max) */
- char res1; /* Reserved */
- char RedMaskSize; /* Size of direct color red mask */
- char RedFieldPosition; /* Bit posn of lsb of red mask */
- char GreenMaskSize; /* Size of direct color green mask */
- char GreenFieldPosition; /* Bit posn of lsb of green mask */
- char BlueMaskSize; /* Size of direct color blue mask */
- char BlueFieldPosition; /* Bit posn of lsb of blue mask */
- char RsvdMaskSize; /* Size of direct color res mask */
- char RsvdFieldPosition; /* Bit posn of lsb of res mask */
- char DirectColorModeInfo; /* Direct color mode attributes */
- /* VBE 2.0 extension information */
- ulong PhysBasePtr; /* Physical address for linear buf */
- ulong OffScreenMemOffset; /* Pointer to start of offscreen mem*/
- short OffScreenMemSize; /* Amount of offscreen mem in 1K's */
- /* VBE 2.1 extension information */
- short LinBytesPerScanLine; /* Bytes per scanline */
- char BnkNumberOfImagePages; /* Number of images pages (banked) */
- char LinNumberOfImagePages; /* Number of images pages (linear) */
- char LinRedMaskSize; /* Size of direct color red mask */
- char LinRedFieldPosition; /* Bit posn of lsb of red mask */
- char LinGreenMaskSize; /* Size of direct color green mask */
- char LinGreenFieldPosition; /* Bit posn of lsb of green mask */
- char LinBlueMaskSize; /* Size of direct color blue mask */
- char LinBlueFieldPosition; /* Bit posn of lsb of blue mask */
- char LinRsvdMaskSize; /* Size of direct color res mask */
- char LinRsvdFieldPosition; /* Bit posn of lsb of res mask */
- char res2[194]; /* Pad to 256 byte block size */
- }Struct_VBE_modeInfo;
- /* 32 bit protected mode info block */
- typedef struct {
- short setWindow; /* Offset of Set Window call */
- short setDisplayStart; /* Offset of Set Display Start call */
- short setPalette; /* Offset of Set Primary Palette */
- short IOPrivInfo; /* Offset of I/O priveledge info */
- /* VBE 2.1 extensions */
- long extensionSig; /* Identify extension (0xFBADFBAD) */
- long setWindowLen; /* Used to virtualise framebuffer */
- long setDisplayStartLen;
- long setPaletteLen;
- /* ... code and tables located in here */
- } VBE_pmInfo;
- typedef struct {
- uchar blue; /* Blue component of color */
- uchar green; /* Green component of color*/
- uchar red; /* Red component of color */
- uchar alpha; /* Alpha or alignment byte */
- }SvgaDAC;
- typedef struct {
- ushort width,height; // word ptr [bp+n] / [bp+n]+2
- char far *imgbuf; // dword ptr [bp+n]+4
- ushort where; // word ptr [bp+n]+8
- uchar bytesperpixel; // word ptr [bp+n]+10
- uchar reserved[5]; // word ptr [bp+n]+11
- }Image;
- typedef struct{
- long x,y;
- }point;
- EXTERN enum {COPY_PUT=0,XOR_PUT,AND_PUT,OR_PUT}WriteMode;
- EXTERN char far const *ScreenPtr;
- EXTERN ushort oldmode;
- EXTERN ushort xres,yres;
- EXTERN void *bankfunc;
- EXTERN ushort bytesperline;
- EXTERN ushort bytesperpixel;
- EXTERN ushort maxpage;
- EXTERN ushort VRAMStartX,VRAMStartY;
- EXTERN ushort waitVR;
- EXTERN ushort bankshift;
- EXTERN ushort curbank;
- EXTERN ulong COLOR,BKCOLOR;
- EXTERN void (*setbank) (short);
- EXTERN void (*setpixel)(int,int,ulong);//x,y,c
- EXTERN ulong (*getpixel)(int,int);//return color
- EXTERN ulong (*rgbcolor)(uchar,uchar,uchar);
- EXTERN int (*setpalette)(ushort start,ushort num,SvgaDAC far * pal);
- EXTERN int (*getpalette)(ushort start,ushort num,SvgaDAC far * pal);
- EXTERN Struct_VBE_vgaInfo VBE_vgaInfo;
- EXTERN Struct_VBE_modeInfo VBE_modeInfo;
- //in levelsup.c
- extern void (*Imgsetpixel)(Image img,int x,int y,ulong color);
- extern ulong (*Imggetpixel)(Image img,int x,int y);
- /*== functions ==*/
- #ifdef __cplusplus
- extern "C"{
- #endif
- PUBLIC EXTERN void lineH(int x,int y,int dy,ulong c=COLOR);
- PUBLIC EXTERN void lineV(int x,int y,int dx,ulong c=COLOR);
- PUBLIC EXTERN void line(int left,int top,int right,int bottom,ulong c=COLOR);
- PUBLIC EXTERN void rectant(int left,int top,ushort width,ushort height,ulong c=COLOR);
- PUBLIC EXTERN void rectantB(int left,int top,ushort width,ushort height,ulong c=COLOR);
- PUBLIC EXTERN void bar(int left,int top,ushort width,ushort height,ulong c=COLOR,ulong cB=BKCOLOR);
- PUBLIC EXTERN void circle(int centerx,int centery,ushort radius,ulong c=COLOR);
- PUBLIC EXTERN void circleB(int centerx,int centery,ushort radius,ulong c=COLOR);
- PUBLIC EXTERN void circleb(int centerx,int centery,ushort radius,ulong c=COLOR,ulong cB=BKCOLOR);
- PUBLIC EXTERN char *getModeName();
- PUBLIC EXTERN char *sprintVBEInfo();
- PUBLIC EXTERN int initVBEMode(int mode);
- PUBLIC EXTERN void fill(int x,int y,ulong colorB,ulong color);
- // in vbeasm.c
- extern int getVBEInfo();
- extern int getModeInfo(int mode);
- extern int setMode(int mode);
- extern int getVBEMode();
- extern ushort rgbcolor32k(uchar r,uchar g,uchar b);
- extern ushort rgbcolor64k(uchar r,uchar g,uchar b);
- extern ulong rgbcolor16m(uchar r,uchar g,uchar b);
- extern void clrScr(ulong c=BKCOLOR);
- extern void putIreImage(int left,int top,Image img,uchar color);//ushort getImgWidth(Img *img);//asm//ushort getImgHeight(Img *img);//asm//void storeImgHead(char far *imgbuf,ushort width,ushort height);//asm
- extern int setpaletteVGA(ushort start,ushort num,SvgaDAC far * pal);
- extern int getpaletteVGA(ushort start,ushort num,SvgaDAC far * pal);
- extern int setpaletteVBE(ushort start,ushort num,SvgaDAC far * pal);
- extern int getpaletteVBE(ushort start,ushort num,SvgaDAC far * pal);
- extern void setpal(uchar ColorNo, uchar R,uchar G,uchar B);
- extern void setpixel256(int x,int y,ulong color);
- extern ulong getpixel256(int x,int y);
- extern void setpixel64k(int x,int y,ulong color);
- extern ulong getpixel64k(int x,int y);
- extern void setpixel16m(int x,int y,ulong color);
- extern ulong getpixel16m(int x,int y);
- extern void setBankA(short bank);
- extern void setBankAB(short bank);
- extern void getimage(int left,int top,Image img);
- extern void putimage(int left,int top,Image img,uchar op);
- #ifdef __cplusplus
- }
- #endif
- #include "c:languagezzksvga.libvbefont.h"
- EXTERN void textxy(int x,int y,char *str,int mode=1);
- EXTERN void ctextxy(int x,int y,uchar *hzstr,int mode=1);
- EXTERN void besaer(point *,point *,point *,color);
- EXTERN void besaerL(point s[],color,int);
- EXTERN void bezier(point *p0,const unsigned n,const unsigned t);
- PUBLIC EXTERN void setpixelM(point p,color);
- //in gui
- extern void initSystemColor();
- //in levelsup.c
- extern void Imgsetpixel256(Image dimg,int x,int y,ulong color);
- extern ulong Imggetpixel256(Image dimg,int x,int y);
- extern void Imgsetpixel64k(Image dimg,int x,int y,ulong color);
- extern ulong Imggetpixel64k(Image dimg,int x,int y);
- extern void Imggetimage(Image dimg,int left,int top,Image img);
- extern void Imgputimage(Image dimg,int left,int top,Image img,uchar op);
- extern void ImgputIreImage(Image dimg,int left,int top,Image img,ulong color);
- //in vbefont.cpp
- extern void Imgtextxy(Image dimg,int x,int y,char *str,int mode);
- extern void Imgctextxy(Image dimg,int x,int y,uchar *hzstr,int mode);
- #endif