亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? images.cpp

?? DOS游戲編程中處理Int 13的工具包
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
//**************************************************************************
// IMAGES.CPP -source file for basic video operations in mode 0x13.        *
// Copyright 1991 by the Gamers Programming Workshop, a function of the    *
// GAMERS forum, Compuserve. For more info e-mail 76605,2346.              *
//                                                                         *
// License is granted for use or modification of this code as long as      *
// this notice remains intact, and all improvements are listed in the      *
// version history below, and uploaded to the GAMERS forum. This code      *
// may not be used for any commercial purpose.                             *
//                                                                         *
// PCX stuff adapted from "BitMapped Graphics"  by Steve Rimmer (1990      *
// Windcrest)                                                              *
//**************************************************************************

//**************************************************************************
// Version history:                                                        *
//                                                                         *
// Version 1.0                                                             *
// Developed: May 2, 1991                                                  *
// Author:    Mark Betz, 76605, 2346                                       *
// Last update: July 5, 1991                                               *
//**************************************************************************

// INCLUDES ****************************************************************

#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <mem.h>
#include <alloc.h>
#include <io.h>
#include <fcntl.h>
#include "images.hpp"
#include "keyboard.hpp"

// *************************************************************************

// local constants *********************************************************

const int DacWrite = 0x3C8;        // DAC write index register
const int DacRead  = 0x3C7;        // DAC read index register
const int DacData  = 0x3C9;        // DAC data register
const int input_status_1 = 0x3DA;  // Port addr. of VGA input status 1 reg.
const int vbi_mask = 0x8;          // test bit 3 of input_status_1

// *************************************************************************

// Variables ***************************************************************

static unsigned int GRAPH_SEG = 0xA000; // segment for video operations
static p_rec current;                   // palette record for fades

// *************************************************************************

// *************************************************************************
// *************************************************************************
// NOTE:
//        The assembler functions in this module do not save any of the
//        registers they use, with the exception of di and si, which are
//        handled by the standard stack frame. When calling them expect
//        register values to be altered.
//
// *************************************************************************
// *************************************************************************

// *************************************************************************
// reporterr() should be called anytime one of the routines in this module
// returns a code other that NoErr. Pass it the error code returned by the
// offending subroutine, and a max. 30 character string describing the loc-
// ation of the error.
// *************************************************************************

void reporterr(char type, char mess[30])
	{
	settextmode();
	sound(300);
	delay(200);
	sound(250);
	delay(150);
	nosound();
	switch (type)
		{
		case MemErr        : printf("An error occured allocating memory...");
							 break;
		case FileReadErr   : printf("An error occured reading a file...");
							 break;
		case FileWriteErr  : printf("An error occured writing a file...");
							 break;
		case FileMakeErr   : printf("An error occured creating a file...");
							 break;
		case FileOpenErr   : printf("An error occured opening a file...");
							 break;
		case FileFormatErr : printf("A file format error has occured...");
							 break;
		case SecondaryErr  : printf("An error has occured in a subroutine...");
							 break;
		case UnknownErr    : printf("An unknown error has occured...");
		}
	printf(" error occured in ");
	printf(mess);
	return;
	}

// *************************************************************************
// UnpackPcx() unpacks the RLE encoded PCX data from a file if pcx != NULL,
// or the source buffer if pcx==NULL, to the Dest buffer. Unpacks NumBytes
// bytes of decompressed data. (max 64000) This is a pretty dumb routine.
// It's fast, but it expects you to know the uncompressed size of the data
// (the NumBytes parameter), and you have to do all of the file and buffer
// set-up elsewhere. Basically it's a core decoding engine. The InitPcxFile()
// function above is provided for opening a PCX file and saving the header
// and palette in data. For buffering and decoding of pcx's with various
// fade types see the fadeinpcx() function below.
// *************************************************************************

// *************************************************************************
// NOTE: this function isn't called by the PVC class objects when they dis-
// play themselves. It is an earlier version of the algrotihm, and they have
// their own version of it. I left this in in case anyone wanted to use it.
// **************************************************************************

void  unpackpcx(FILE *pcx, const char far *source, char far *dest,
				unsigned int num_bytes)
	{
	unsigned int     bytes=0;       // counts unpacked bytes
	unsigned char    c;             // byte being processed
	unsigned int     src_cntr=0;    // pointer into source buffer
	unsigned int     runlen;        // length of packet

	do
		{
		// get a key byte
		if (pcx!=NULL)
		   c=fgetc(pcx);
		else
		   c=source[src_cntr++] & 0xff;
		// check if it's a packet
		if ((c & 0xc0) == 0xc0)
			{
			// and off the high bits
			runlen = (c & 0x3f);
			// get the run value
			if (pcx!=NULL)
				c=fgetc(pcx);
			else
				c = source[src_cntr++];
			// run it out
			while(runlen--) (dest[bytes++]=c);
			}
		else
			dest[bytes++]=c;
		} while (bytes<num_bytes);
	}

// *************************************************************************
// sets the segment address that will be used in all graphics operations
// within this module. Can be used to operate on a buffer offscreen. This
// is a fairly powerfull feature, as any of the functions provided which
// write or read video memory will act on the segment contained in GRAPH_
// SEG. If you allocate a 64k buffer, and call _setgraphseg() with it's
// segment you can then create the screen there, and block copy it to
// video ram when you're finished.
// *************************************************************************

void setgraphseg(unsigned int newseg)
	{
	GRAPH_SEG = newseg;
	}

// *************************************************************************
// call bios interrupt 0x10, function 13, subfunction 00 to set up mode
// 0x13 graphics.
// *************************************************************************

void setgraphmode()
	{
	asm	{
		xor ah, ah          // zero out ah, subfunction 00
		mov al, 0x13        // function 0x13
		int 0x10            // interrupt 0x10
		}
	}

// *************************************************************************
// call bios interrupt 0x10 in same manner as previous function to restore
// text mode
// *************************************************************************

void settextmode()
	{
	asm	{
		xor ah, ah
		mov al, 0x03
		int 0x10
		}
	}

// **************************************************************************
// wait_vbi() waits twice for the vertical blanking interval. Once to make
// sure any current vbi is completed, and once for the start of the next vbi
// **************************************************************************

void wait_vbi()
	{
	asm mov dx, input_status_1;
	test_1:
	asm	{
		in al, dx
		test al,0x8
		jnz test_1
		}
	test_2:
	asm	{
		in al, dx
		test al,0x8
		jz test_2
		}
	}


// *************************************************************************
// loads the vga dac by direct method via the DAC access ports. Disables
// interrupts during load of each triplet. Does not do snow checking. Call
// with start = first register to load, number = number of registers to
// load, and palette pointing to a structure of type PRec containing the
// palette data. If start or number out of range, or palette is null then
// the function returns.
// *************************************************************************

void loadpalette(int start, int number, const p_rec palette)
	{
	unsigned int i;
	if ((start>256) || (start<0) || ((start+number)>256))
		return;
	for (i=start;i<(start+number);i++)
		{
		asm cli;
		outportb(DacWrite,i);
		outportb(DacData,palette[i][Red]);
		outportb(DacData,palette[i][Green]);
		outportb(DacData,palette[i][Blue]);
		asm sti;
		}
	}

// *************************************************************************
// same as previous function only reads the dac data into the supplied
// palette structure.
// *************************************************************************

void readpalette(int start, int number, p_rec palette)
	{
	unsigned int i;
	if ((start>256) | (start<0) | ((start+number)>256))
		return;
	for (i=start;i<(start+number);i++)
		{
		asm cli;
		outportb(DacRead,i);
		palette[i][Red] = inportb(DacData);
		palette[i][Green] = inportb(DacData);
		palette[i][Blue] = inportb(DacData);
		asm sti;
		}
	}

// **************************************************************************
// clears a range of palette registers to zero
// **************************************************************************

void clrpalette(int start, int number)
	{
	unsigned int i;
	if ((start>256) | (start<0) | ((start+number)>256))
		return;
	for (i=start;i<(start+number);i++)
		{
		asm cli;
		outportb(DacWrite,i);
		outportb(DacData,0);
		outportb(DacData,0);
		outportb(DacData,0);
		asm sti;
		}
	}

// **************************************************************************
// fadepalettein() fades the dac palette from 0 (black) to the default pal-
// ette values passed in palette structure. Fade is done in 64 passes, and
// is very smooth. Operates on count registers starting with register start.
// NOTE: this funtion expect the dac palette registers to be zero'd before
// it is called. Call clrpalette() to clear the registers.
// **************************************************************************

void fadepalettein(int start, int count, const p_rec palette)
	{
	int i, j, cycle;
	memset((void *)current,0,sizeof(p_rec));
	for (cycle=0;cycle<64;cycle++)
		{
		i=start;
		wait_vbi();
		outportb(DacWrite,i);
		asm cli;
		for (;i<((start+count)/2);i++)
			{
			for (j=0;j<3;j++)
				{
				if ((64-cycle)<=palette[i][j])
					current[i][j]++;
				outportb(DacData,current[i][j]);
				}
			}
		asm sti;
		wait_vbi();
		asm cli;
		for (;i<(start+count);i++)
			{
			for (j=0;j<3;j++)
				{
				if ((64-cycle)<=palette[i][j])
					current[i][j]++;
				outportb(DacData,current[i][j]);
				}
			}
		asm sti;
		}
	}

// **************************************************************************
// fadepaletteout() fades the current palette to black. It operates on count
// registers starting with register start. NOTE: this function destroys the
// current contents of temp_pal (images.cpp internal palette structure).
// **************************************************************************

void fadepaletteout(int start, int count)
	{
	int i, j, cycle;
	readpalette(0,256,current);
	for (cycle=64;cycle>0;cycle--)
		{
		i=start;
		wait_vbi();
		outportb(DacWrite,i);
		asm cli;
		for (;i<((start+count)/2);i++)
			{
			for (j=0;j<3;j++)
				{
				if (current[i][j]!=0)
					current[i][j]--;
				outportb(DacData,current[i][j]);
				}
			}
		asm sti;
		wait_vbi();
		asm cli;
		for (;i<(start+count);i++)
			{
			for (j=0;j<3;j++)
				{
				if (current[i][j]!=0)
					current[i][j]--;
				outportb(DacData,current[i][j]);
				}
			}
		asm sti;
		}
	clearscr(0);
	}

// *************************************************************************
// clear the graphics screen to the color provided
// *************************************************************************

void clearscr(int color)
	{
	asm {
		mov es, GRAPH_SEG
		xor di, di
		mov ax, color
		mov cx, 32000
		rep stosw
		}
	}

// *************************************************************************
// fill the rectangular area bounded by (tlx,tly)(brx,bry) with color.
// tlx = top left x, tly = top left y, brx = bottom right x, bry = bottom
// right y.
//
// This function needs to be recoded in assembler
// *************************************************************************

void barfill(int tlx, int tly, int brx, int bry, int color)
	{
	int row;
	void far *line;
	for (row=tly;row<bry;row++)
		{
		line = MK_FP(GRAPH_SEG,((row*320)+tlx));
		_fmemset(line,color,(brx-tlx));
		}
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜电影小说| 亚洲成人激情综合网| 久久综合精品国产一区二区三区| 欧美视频一区在线| 欧美熟乱第一页| 欧美老年两性高潮| 日韩天堂在线观看| 精品av综合导航| 久久精品一区二区三区不卡牛牛 | 制服丝袜av成人在线看| 欧美色综合影院| 日韩午夜在线观看视频| 久久精品水蜜桃av综合天堂| 久久综合精品国产一区二区三区| 国产欧美一区二区精品久导航| 国产精品美女久久久久久2018| ...av二区三区久久精品| 一区二区成人在线视频| 午夜精品成人在线| 狠狠色丁香婷婷综合| 国产乱码精品1区2区3区| 国产精品一区二区在线看| 日韩av成人高清| 麻豆国产精品视频| 成人久久18免费网站麻豆| 97se亚洲国产综合在线| 欧美老肥妇做.爰bbww| www国产亚洲精品久久麻豆| 国产精品全国免费观看高清 | 久久久久久97三级| 综合久久一区二区三区| 日韩精彩视频在线观看| 国产精品伊人色| 色综合久久久久| 欧美探花视频资源| 欧美国产精品一区| 日韩国产精品91| www.亚洲人| 久久在线免费观看| 亚洲综合在线电影| 国产精品一二三在| 欧美日韩一区二区三区四区| 久久久久久免费| 日本不卡一二三| www.66久久| 日韩精品一区二区三区在线| 亚洲人成电影网站色mp4| 美国毛片一区二区三区| 色老汉av一区二区三区| 久久精品这里都是精品| 日韩av成人高清| 欧洲一区在线观看| 国产精品国产三级国产aⅴ无密码| 三级亚洲高清视频| 色婷婷久久久亚洲一区二区三区 | 欧美一区二区三区白人| 亚洲黄色性网站| 成人黄色大片在线观看| 精品国产精品网麻豆系列| 亚洲成av人片在线观看无码| 97se狠狠狠综合亚洲狠狠| 国产片一区二区三区| 韩国视频一区二区| 欧美一级欧美三级在线观看| 亚洲电影一区二区| 91丨porny丨蝌蚪视频| 欧美激情在线一区二区| 国产精品综合网| 久久久国产精品午夜一区ai换脸| 看国产成人h片视频| 91精品在线免费| 日韩专区欧美专区| 欧美一区中文字幕| 秋霞午夜av一区二区三区| 欧美日韩激情一区二区三区| 亚洲午夜国产一区99re久久| 91福利在线播放| 亚洲国产日韩综合久久精品| 91国偷自产一区二区三区成为亚洲经典| 亚洲日本免费电影| 欧美天堂一区二区三区| 视频一区免费在线观看| 制服.丝袜.亚洲.中文.综合| 日本va欧美va精品| 精品国产麻豆免费人成网站| 国产一区二区在线看| www一区二区| 成人av网站在线观看免费| 成人欧美一区二区三区| 91福利在线观看| 久久精品99久久久| 国产亚洲短视频| 91视频一区二区三区| 亚洲图片欧美视频| 日韩一卡二卡三卡四卡| 国产盗摄女厕一区二区三区| 国产精品国模大尺度视频| 色综合天天视频在线观看| 亚洲va欧美va人人爽| 日韩精品一区二区三区视频| 福利一区二区在线| 亚洲国产精品一区二区尤物区| 日韩一区二区麻豆国产| 不卡影院免费观看| 天天综合网天天综合色| 久久综合久久鬼色| 在线亚洲人成电影网站色www| 日韩精品午夜视频| 国产日产精品1区| 欧美电影在线免费观看| 国产a久久麻豆| 香蕉久久一区二区不卡无毒影院| 精品日韩在线一区| 色婷婷久久久久swag精品| 免费成人美女在线观看.| 国产精品美女www爽爽爽| 911国产精品| 色偷偷成人一区二区三区91| 精品一区二区久久| 亚洲一区二区精品视频| 欧美精彩视频一区二区三区| 欧美三区在线观看| av网站一区二区三区| 精品亚洲免费视频| 亚洲高清在线视频| 国产精品成人一区二区艾草 | 国产欧美久久久精品影院| 在线视频综合导航| 成人久久久精品乱码一区二区三区| 日韩国产欧美在线播放| 亚洲图片激情小说| 国产精品天天摸av网| 日韩欧美一级片| 欧美精品aⅴ在线视频| 91一区二区三区在线观看| 国产一区999| 久久成人麻豆午夜电影| 五月婷婷激情综合| 亚洲成人自拍偷拍| 亚洲六月丁香色婷婷综合久久 | 日本视频免费一区| 亚洲综合色成人| 一区二区三区精密机械公司| 国产精品女人毛片| 国产精品女人毛片| 日本一区二区免费在线| 国产欧美精品一区二区三区四区| 欧美成人激情免费网| 日韩区在线观看| 精品免费国产一区二区三区四区| 欧美欧美午夜aⅴ在线观看| 色先锋资源久久综合| 色av成人天堂桃色av| 91美女视频网站| 色综合久久中文综合久久牛| 成人av在线资源网| 99久久精品国产精品久久| av综合在线播放| 日本高清视频一区二区| 欧洲国内综合视频| 欧美日韩一区二区三区四区| 欧美精品v日韩精品v韩国精品v| 欧美日韩国产免费| 精品精品欲导航| 欧美激情综合网| 亚洲老妇xxxxxx| 午夜伊人狠狠久久| 乱中年女人伦av一区二区| 寂寞少妇一区二区三区| 成人在线一区二区三区| 97久久超碰国产精品电影| 欧美网站一区二区| 日韩一区二区在线免费观看| 精品国产1区2区3区| 国产精品三级在线观看| 一区二区三区 在线观看视频| 蜜臀91精品一区二区三区| 精品一区二区三区在线播放视频 | 免费看欧美美女黄的网站| 激情小说亚洲一区| 99久久久国产精品| 欧美日韩卡一卡二| 久久久国产精品午夜一区ai换脸| 国产精品欧美一级免费| 性欧美大战久久久久久久久| 国产美女视频91| 欧洲av在线精品| 久久久久久免费网| 亚洲成人av一区二区三区| 久久99国内精品| 91国在线观看| 久久人人超碰精品| 亚洲小说春色综合另类电影| 国产精品中文字幕欧美| 日本韩国欧美一区二区三区| 日韩精品一区在线观看| 亚洲综合小说图片| 国产精品一区二区久久不卡 | 日韩精品每日更新| 99久免费精品视频在线观看|