// filename: SHAKE.cpp
// maker: ShiLin #include #include #include #include void MoveView(int x,int y); void main(void){ int gdriver,gmode; gdriver=DETECT,gmode=0; initgraph(&gdriver,&gmode,"\BORLANDC\BGI"); rectangle(100,100,200,200); outtextxy(100,250,"Press Any Key to SHAKE ..."); getch(); for(int i=0;i<20;i++){ MoveView(10-random(20),5-random(10)); delay(50); } MoveView(0,0); getch(); closegraph(); } void MoveView(int x,int y){ union{ unsigned int whole; char low; }adr; unsigned char high,low; adr.whole=y*80+x/8, low=adr.low, high=(unsigned char)(adr.whole>>8); outportb(0x3D4,0X0C); outportb(0x3D5,high); outportb(0x3D4,0x0D); outportb(0x3D5,low); } |