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

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

?? nvemul.c

?? _計算實用教程Visual C++6.0實用教程
?? C
字號:
 /* nvemul.c */

/*
EPROM Emulator using NVRAM module.
32Kbyte capacity.
Dhananjay V. Gadre
12th July 1997
*/

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<process.h>
#include<time.h>
#include<alloc.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>

/*port addresses of the parallel adapter*/
unsigned int dport, sport, cport;

/*these ports control data, voltage to the ZIF socket,*/
/*control the tri-state buffers respectively*/
unsigned char port_0, port_1, port_2, port_3, error_byte;



#define MEMORY 32768 /*last address of the target controller memory*/

/*the Intelhex file has lines of code. each line begins with a : */
/*next is number of bytes in the line*/
#define LL 1 /*offset in the hex file where the line length is stored*/
#define ADDR 3 /*offset in the hex file where the destination address is stored*/
#define ZEROS 7
#define CODE_ST 9 /*offset of the beginning of the code*/


/*local global variables*/
unsigned char  ram[MEMORY+10];
unsigned int curr_address;
FILE *fp1;


/*defines for port1*/
#define ENB_DATA 0x80
#define DIS_DATA 0x7F
#define ENB_LOW  0x40
#define ENB_HIGH 0xbf
#define ENB_WR   0x20
#define ENB_OE   0x10
#define ENB_CS   0x09

/* local routines */
int initialze(void); /* initialzes the external hardware */
int fill_buffer(void); /*read the intelhex format file & fill up the internal buffer */
int chk_writer(void); /*check if the programmer is connected and if +12V is ON*/
int write_verify_bytes(void);

/*routines to generate pulse on each of the 4 control port pins*/
void pulse_c0(void);
void pulse_c1(void);
void pulse_c2(void);
void pulse_c3(void);

void pulse_c0(void)
{
unsigned char temp;

temp=inportb(cport);
temp=temp & 0xfe;
outportb(cport, temp);
outportb(cport, temp);
outportb(cport, temp);
temp=temp | 0x01;
outportb(cport, temp);
}

void pulse_c1(void)
{
unsigned char temp;

temp=inportb(cport);
temp=temp | 0x02;
outportb(cport, temp);
outportb(cport, temp);
outportb(cport, temp);
temp=temp & 0xfd;
outportb(cport, temp);
}

void pulse_c2(void)
{
unsigned char temp;

temp=inportb(cport);
temp=temp & 0xfb;
outportb(cport, temp);
outportb(cport, temp);
outportb(cport, temp);
temp=temp | 0x04;
outportb(cport, temp);
}

void pulse_c3(void)
{
unsigned char temp;

temp=inportb(cport);
temp=temp | 0x08;
outportb(cport, temp);
outportb(cport, temp);
outportb(cport, temp);
temp=temp & 0xf7;
outportb(cport, temp);
}



char chartoi(char val)
{
unsigned char temp;
temp = toupper(val);
if(temp>0x39) {temp = temp -0x37;}
else {temp=temp-0x30;}
return temp;
}

int initialize(void)
{

dport = peek(0x40, 8);
sport=dport+1;
cport=dport+2;
if(dport ==0) return 0;

outportb(dport, 0);
outportb(cport, 0x05); /*all cport outputs high, except C0*/
outportb(cport, 0x0a); /*all cport pins are low, except C0*/
outportb(cport, 0x05); /*all cport outputs high, except C0*/
port_0=0;
port_1=0;
port_2=0;
port_3=0;

return 1;
}



int fill_buffer(void) /*read the intelhex format file & fill up the
internal buffer */
{
unsigned char ch, temp4, temp1, temp2, temp3;
unsigned char chk_sum=0, buf[600], num[10];
unsigned int line_length, address, line_temp, tempx, count=0;


count=0;
while(!feof(fp1) )
{
chk_sum=0;

/* check if start of line = ':' */

fgets(buf, 600, fp1);
tempx=strlen(buf);
/*printf("\n\nString length=%d\n", tempx);*/
/*printf("\n\n%s", buf);*/

if( buf[0] != ':') {printf("\nError... Source file not in Intelhex format. Aborting");
		fclose(fp1);
		return 0;
		}

/* convert the next 2 characters to a byte which equals line length */
temp1=buf[LL];
temp2=buf[LL+1];
	if( !isxdigit(temp1) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
				}

	if( !isxdigit(temp2) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
			}

temp4 = chartoi(temp1);
chk_sum=chk_sum + 16*temp4;
line_length=(int)temp4;

temp4=chartoi(temp2);
chk_sum=chk_sum + temp4;
line_length = 16*line_length + (int)temp4;

/*printf("Entries=%d  ", line_length);*/

if(line_length ==0)	{
			return count;
			}


temp1=buf[ADDR];
temp2=buf[ADDR+1];
temp3=buf[ADDR+2];
temp4=buf[ADDR+3];

	if( !isxdigit(temp1) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
				}

	if( !isxdigit(temp2) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
			}


	if( !isxdigit(temp3) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
				}

	if( !isxdigit(temp4) ) {
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
			}

ch = chartoi(temp1);
temp1=ch;


ch = chartoi(temp2);
temp2=ch;

chk_sum = chk_sum + 16*temp1 + temp2;

ch = chartoi(temp3);
temp3=ch;

ch = chartoi(temp4);
temp4=ch;

chk_sum = chk_sum + 16*temp3 + temp4;

address = 0x1000 * (int)temp1 + 0x100 * (int)temp2 + 0x10*(int)temp3 + (int)temp4;
/*printf("Start Address=%x hex\n", address);*/
if(address > MEMORY)
{
		printf("\nError in source file. Bad address. Aborting");
				fclose(fp1);
				return 0;
}
/*check for the next byte. It has to be 00 **/
temp1=buf[ZEROS];
temp2=buf[ZEROS+1];

	if( !isxdigit(temp1) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}

	if( !isxdigit(temp2) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}


ch = chartoi(temp1);
temp1=ch;
ch=chartoi(temp2);
temp2=ch;
ch = 16*temp1 + temp2;
if(ch != 0)
					{
	printf("\nError... Source file not in Intelhex format. Aborting");
				fclose(fp1);
				return 0;
					}

		/* now read bytes from the file & put it in buffer*/

for(line_temp=0; line_temp<line_length; line_temp++)
			{
			temp1=buf[2*line_temp+CODE_ST];
			temp2=buf[2*line_temp+CODE_ST+1];

	if( !isxdigit(temp1) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}

	if( !isxdigit(temp2) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}
			ch = chartoi(temp1);
			temp1=ch;
			ch=chartoi(temp2);
			temp2=ch;
			ch = 16*temp1 + temp2;

			chk_sum=chk_sum + ch;
if(address > MEMORY)
{
		printf("\nError in source file. Bad address. Aborting");
				fclose(fp1);
				return 0;
}
/*	printf("%X ",ch);*/
			ram[address]=ch;
			address++;
			count++;
				}


/*get the next byte. this is the chksum */

			temp1=buf[2*line_length+CODE_ST];
			temp2=buf[2*line_length+CODE_ST+1];

	if( !isxdigit(temp1) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}

	if( !isxdigit(temp2) ) 		{
				printf("\nError in source file. Aborting");
				fclose(fp1);
				return 0;
					}
			ch = chartoi(temp1);
			temp1=ch;
			ch=chartoi(temp2);
			temp2=ch;
			ch = 16*temp1 + temp2;
chk_sum=chk_sum + ch;
/*printf("csum=%x", chk_sum);*/
if(chk_sum !=0)
				{
				printf("\nChecksum Error... Aborting");
				fclose(fp1);
				return 0;
				}

}



return count;

}



int write_verify_bytes(void)
{
unsigned char temp, low_temp, high_temp, low_addr, high_addr;
long program_length;

for(program_length=0; program_length < MEMORY; program_length++)
{
curr_address=program_length;

/*generate the address for the NVRAM*/


/*this puts the data into the data latch but the latch is yet to
be enabled*/
port_0=ram[program_length];
outportb(dport, port_0);
pulse_c0();



/*enable the data on the data pins*/
port_1=port_1 | ENB_DATA;
outportb(dport, port_1);
pulse_c1();

/*write data to the NVRAM*/
low_addr=(unsigned char)program_length;
high_addr=(unsigned char) ((program_length>>8) & 0x00ff);

port_2=high_addr;
outportb(dport, port_2);
pulse_c2();

port_3=low_addr;
outportb(dport, port_3);
pulse_c3();


/*generate chip select*/
port_1=port_1 | ENB_CS;
outportb(dport, port_1);
pulse_c1();

/*generate write strobe*/
port_1=port_1 | ENB_WR;
outportb(dport, port_1);
pulse_c1();

/*disable write strobe*/
port_1=port_1 & ~ENB_WR;
outportb(dport, port_1);
pulse_c1();

/*disable data from the data output pin of the source*/
port_1=port_1 & DIS_DATA;
outportb(dport, port_1);
pulse_c1();


/*now enable read strobe to read back the data*/

port_1=port_1 | ENB_OE;
outportb(dport, port_1);
pulse_c1();

/*read low nibble*/
port_1=port_1 | ENB_LOW;
outportb(dport, port_1);
pulse_c1();
low_temp=inportb(sport);

/*read high nibble*/
port_1=port_1 & ENB_HIGH;
outportb(dport, port_1);
pulse_c1();
high_temp=inportb(sport);


/*disable cs strobe*/
port_1=port_1 & ~ENB_CS;
outportb(dport, port_1);
pulse_c1();


temp= (high_temp & 0xf0) | ( (low_temp >>4) & 0x0f);
temp=temp ^ 0x88;
/*printf("%X ", temp);*/
if(temp != ram[program_length])
{
error_byte=temp;
printf("\nError in program verify at address %X (hex). Aborting...", program_length);
printf("\nProgram data %X, read back data %X\n", ram[program_length], temp);
return 0;
}


}



for(program_length=0; program_length < MEMORY; program_length++)
{
curr_address=program_length;

/*generate the address for the NVRAM*/



/*write data to the NVRAM*/
low_addr=(unsigned char)program_length;
high_addr=(unsigned char) ((program_length>>8) & 0x00ff);

port_2=high_addr;
outportb(dport, port_2);
pulse_c2();

port_3=low_addr;
outportb(dport, port_3);
pulse_c3();


/*generate chip select*/
port_1=port_1 | ENB_CS;
outportb(dport, port_1);
pulse_c1();

/*now enable read strobe to read back the data*/

port_1=port_1 | ENB_OE;
outportb(dport, port_1);
pulse_c1();

/*read low nibble*/
port_1=port_1 | ENB_LOW;
outportb(dport, port_1);
pulse_c1();
low_temp=inportb(sport);

/*read high nibble*/
port_1=port_1 & ENB_HIGH;
outportb(dport, port_1);
pulse_c1();
high_temp=inportb(sport);


/*disable cs strobe*/
port_1=port_1 & ~ENB_CS;
outportb(dport, port_1);
pulse_c1();


temp= (high_temp & 0xf0) | ( (low_temp >>4) & 0x0f);
temp=temp ^ 0x88;
printf("%X ", temp);
if(temp != ram[program_length])
{
error_byte=temp;
printf("\nError in program verify at address %X (hex). Aborting...", program_length);
printf("\nProgram data %X, read back data %X\n", ram[program_length], temp);
return 0;
}


}

return 1;

}

main(argc, argv)
int argc;
char *argv[];
{
time_t start, endt;
unsigned long temp;
int byte_value, return_val, total_bytes;

printf("\n\n\n\tEPROM Emulator using NVRAM module Ver: 1.0\n");
printf("\t------------------------------------------\n");
printf("\t\t    Dhananjay V. Gadre");
printf("\n\t\t       July  1997.\n"); /* 12th July  1997*/

if(argc != 2)
		{printf("\nError... Specify Intelhex source filename. Aborting");
		printf("\nFormat: AtmelP intelhex_sourcefile");
		exit(-1);
		}

if((fp1=fopen(argv[1], "r")) == NULL)
		{printf("\nError...Cannot open source file. Aborting");
		exit(-1);
		}

return_val=initialize(); /*Initialize the printer adapter port*/
if(return_val == 0) {printf("\nLPT1 not available. Aborting...");
fclose(fp1);
exit(-1);
}
printf("\nLPT1 DATA port address = %X (hex)", dport);

printf("\nChecking internal memory buffer...");
for(temp=0; temp < MEMORY; temp++)
{
ram[temp]=(unsigned char) temp;
}

for(temp=0; temp < MEMORY; temp++)
{
if( ram[temp] != (unsigned char) temp)
{
printf("\nError in internal memory allocation...Aborting.");
fclose(fp1);
exit(-1);
}

}

printf("\nInternal memory buffer OK.");

printf("\nReading Intelhex source file...:");

return_val=fill_buffer();
if(return_val == 0)
		{
		exit(0);
		}
printf("\nIntel hex file %s read successful. Total bytes read =%d", argv[1], return_val);

fclose(fp1);

printf("\nStoring data in NVRAM module and Verifying...\n");

return_val=write_verify_bytes();

if(return_val == 0)

{printf("\nFailed to store data in NVRAM at address: %X (hex)\n", curr_address);
printf("Program value: %X\n", ram[curr_address]);
printf("Verify value: %X\n", error_byte);
exit(-1);
     }

printf("\nData stored in NVRAM  and verified");

printf("\nPower Off the RAMWriter and remove the NVRAM module");

return 1;

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成a人片亚洲日本久久| 高清久久久久久| 国产精品理论在线观看| 欧美日韩精品一区二区三区蜜桃| 韩国欧美国产1区| 午夜久久电影网| 中文字幕欧美国产| 欧美mv日韩mv亚洲| 在线免费观看成人短视频| 国产一区二区调教| 日韩成人午夜电影| 亚洲综合在线第一页| 亚洲欧洲性图库| 久久精品亚洲麻豆av一区二区| 51精品国自产在线| 在线视频综合导航| 99国产欧美久久久精品| 国产伦精一区二区三区| 美女在线观看视频一区二区| 亚洲成人福利片| 亚洲综合丝袜美腿| 亚洲色图欧美偷拍| 日本一区二区高清| 欧美激情在线看| 国产偷国产偷精品高清尤物| 日韩精品一区在线观看| 欧美巨大另类极品videosbest | 国产偷国产偷精品高清尤物 | 91视频.com| 懂色av中文字幕一区二区三区 | 国产精品影音先锋| 国内外精品视频| 国产在线播精品第三| 日韩二区三区四区| 日日噜噜夜夜狠狠视频欧美人| 亚洲精品福利视频网站| 日韩一区欧美一区| 亚洲少妇最新在线视频| 最新国产成人在线观看| 亚洲欧美在线另类| 中文字幕在线视频一区| 国产精品成人一区二区艾草| 自拍偷拍欧美激情| 亚洲欧美日韩在线播放| 一区二区三区精品视频| 亚洲午夜av在线| 亚洲第一综合色| 舔着乳尖日韩一区| 免费三级欧美电影| 国内成人免费视频| 床上的激情91.| 色综合咪咪久久| 欧美日本在线看| 欧美一级精品大片| 亚洲精品一区在线观看| 久久久亚洲精华液精华液精华液| 久久久国产综合精品女国产盗摄| 中文字幕国产一区二区| 一区二区三区四区国产精品| 亚洲成av人在线观看| 老鸭窝一区二区久久精品| 国产成人免费视频网站| 91在线视频在线| 欧美日韩亚洲另类| 日韩欧美在线123| 国产蜜臀av在线一区二区三区| 国产精品欧美一区喷水| 亚洲国产成人tv| 美女一区二区在线观看| caoporm超碰国产精品| 欧美日韩成人综合天天影院 | 国产成人丝袜美腿| 色综合天天狠狠| 欧美一区二区三区的| 久久蜜桃一区二区| 伊人性伊人情综合网| 蜜臀av性久久久久蜜臀aⅴ| 国产麻豆视频一区二区| 一本在线高清不卡dvd| 日韩一区二区免费高清| 国产精品久久久久久一区二区三区| 悠悠色在线精品| 国产精品66部| 欧美日韩久久不卡| 欧美经典三级视频一区二区三区| 亚洲综合成人在线| 国产精品一区二区在线观看不卡 | 日日夜夜免费精品| av一二三不卡影片| 欧美一级免费观看| 亚洲人亚洲人成电影网站色| 麻豆精品一二三| 在线精品视频小说1| 欧美激情综合五月色丁香小说| 香蕉乱码成人久久天堂爱免费| 国产91在线观看丝袜| 欧美日韩亚洲国产综合| 精品国产伦一区二区三区观看方式 | 日韩电影网1区2区| 成人激情校园春色| 欧美精品一区男女天堂| 亚洲高清免费在线| 99国产一区二区三精品乱码| 26uuu亚洲| 麻豆成人91精品二区三区| 色哟哟欧美精品| 日本一区二区三区在线观看| 免费人成在线不卡| 欧美日韩电影一区| 亚洲自拍偷拍av| 99久久婷婷国产精品综合| 久久夜色精品一区| 另类小说色综合网站| 欧美日韩国产综合视频在线观看| 中文字幕五月欧美| 成人综合婷婷国产精品久久免费| 欧美videofree性高清杂交| 午夜电影久久久| 欧美视频中文一区二区三区在线观看| **性色生活片久久毛片| 亚洲免费在线观看视频| 丝袜美腿亚洲一区| 欧美视频自拍偷拍| 亚洲自拍偷拍网站| 91蝌蚪porny九色| 国产精品少妇自拍| 成人国产一区二区三区精品| 国产性天天综合网| 国产一区二区三区四区五区入口| 日韩精品一区二区三区在线| 久久精品国产秦先生| 欧美电视剧在线观看完整版| 久久精品国内一区二区三区| 日韩一区二区精品葵司在线| 日本在线不卡一区| 日韩欧美中文字幕制服| 一区二区三区欧美视频| 国产目拍亚洲精品99久久精品| 亚洲欧美一区二区三区久本道91| 日本不卡一二三| 欧美丰满少妇xxxxx高潮对白| 午夜伦理一区二区| 日韩女优av电影| 国产一区二区三区久久悠悠色av| 国产欧美一区二区三区网站 | 国产精品综合一区二区三区| 国产欧美日韩在线| 波多野结衣亚洲| 91小视频免费观看| 久久久久国产精品人| 国产成人精品www牛牛影视| 国产日韩三级在线| 97精品超碰一区二区三区| 亚洲欧美乱综合| 欧美体内she精高潮| 三级久久三级久久| 久久综合色8888| 成人app在线观看| 夜夜亚洲天天久久| 日韩欧美中文一区二区| 国产91精品露脸国语对白| 中文字幕在线不卡国产视频| 欧美午夜寂寞影院| 蜜桃一区二区三区在线| 久久精品网站免费观看| 一本色道久久综合亚洲精品按摩| 日韩主播视频在线| 精品女同一区二区| av毛片久久久久**hd| 亚洲大片精品永久免费| 26uuu亚洲| 色狠狠一区二区| 另类小说图片综合网| 中文字幕国产一区| 欧美精品免费视频| 成人app在线观看| 日本亚洲视频在线| 国产精品久久久久久久第一福利 | 国产精品美女久久久久久久| 欧美亚洲一区二区在线| 国产一区二区三区不卡在线观看| 亚洲免费色视频| 日韩午夜激情av| 99久久精品情趣| 日本不卡一区二区| 亚洲青青青在线视频| 欧美本精品男人aⅴ天堂| 色综合一区二区三区| 青青草精品视频| 亚洲综合无码一区二区| 国产日韩欧美一区二区三区乱码| 欧美老女人在线| 99re这里都是精品| 国产一区二区三区黄视频 | 亚洲男人的天堂av| 久久精品亚洲麻豆av一区二区| 欧美三级电影在线看| 成人18视频日本| 国产一区三区三区| 秋霞国产午夜精品免费视频|