C_and_CPP °æ (¾«»ªÇø)
·¢ÐÅÈË: ghl (Á¿×Ó), ÐÅÇø: C_and_CPP
±ê Ìâ: Re: ÇóÖú£ºCÓïÑÔ±à³ÌÖÐʱ£¬ÔõÑù¶¨Ê±£¿
·¢ÐÅÕ¾: ¹þ¹¤´ó×϶¡Ïã (Sat May 22 21:06:19 2004), Õ¾ÄÚ
//CÓïÑÔ±àµÄÒ»¸öСʱÖÓ£¬×Ô¼ºÑо¿Ò»Ï°ɡ£
//TCÏÂÔËÐÐ
//The is a program for clock in the technology of TSR
#include<dos.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#define INTR 0X1C
#define MAXTIME '1'
#define MENU_X 1
#define MENU_Y 1
#define BORD 0XBA
#define NORM GREEN<<4|WHITE
#define HIGH RED<<4|WHITE
extern unsigned _heaplen=1024;
extern unsigned _stklen=512;
void interrupt(*oldhandler)(void);
char far *screen=MK_FP(0XB800,0X0);
char far *warn="It's time to lunch!";
void draw_bord(int high,int width,char *head)
{
int i;
gotoxy(MENU_X,MENU_Y);
putch(0xC9);
putch('[');putch('þ');putch(']');
for(i=MENU_X+4;i<(MENU_X+width);i++)
{
putch(0xCD);
}
putch(0xBB);
for(i=MENU_Y+1;i<(MENU_Y+high+1);i++)
{
gotoxy(MENU_X,i);
putch(BORD);
gotoxy(MENU_X+width,i);
putch(BORD);
}
gotoxy(MENU_X,MENU_Y+high+1);
putch(0xC8);
for(i=MENU_X+1;i<(MENU_X+width);i++)
{
putch(0xCD);
}
putch(0xBC);
if(head[0]!=NULL)
{
gotoxy(MENU_X+width/2-strlen(head)/2,MENU_Y);
cprintf("%s",head);
}
}
void interrupt my1c(void)
{
static long count=1;
int i,second,minute;
count++;
second=(int)(count/CLK_TCK);
minute=second/60;
for(i=0;i<5;i++)
{
screen[151+i*2]=0x4f;
}
screen[158]=second%60%10+48;
screen[156]=second%60/10+48;
screen[154]=':';
screen[152]=minute%60%10+48;
screen[150]=minute%60/10+48;
if(screen[152]>=MAXTIME)//1 minute
{
for(i=1600+60;*warn!='\0';i+=2)
{
screen[i]=*warn++;
screen[i+1]=0xcf;
draw_bord(HIGH,1,"sdfasd");
}
}
oldhandler();
}
int main()
{
clrscr();
oldhandler=getvect(INTR);
setvect(INTR,my1c);
while(!kbhit()) ;
setvect(INTR,oldhandler);
printf("over");
getch();
keep(0,(_SS+((_SP+128)/16)-_psp));
return 0;
}
¡¾ ÔÚ wyflying (ÄþΪÆòؤ) µÄ´ó×÷ÖÐÌáµ½: ¡¿
: ÒªÇóÒ»ºÁÃë ÏìÓ¦Ò»´Î¡£
--
/*²»ÅÊ ²»ÀÁ ²»Ì°*/
¡ù À´Ô´:¡¤¹þ¹¤´ó×϶¡Ïã bbs.hit.edu.cn¡¤[FROM: 202.118.235.57]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º4.347ºÁÃë