eluosifangkuai.rar

  • songjie_he
    了解作者
  • Visual C++
    开发工具
  • 117KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 2
    下载次数
  • 2015-04-16 13:06
    上传日期
俄罗斯方块的源码和仿真,可以自行修改和使用,用51单片机开发的,有兴趣的可以看看
eluosifangkuai.rar
  • 俄罗斯方块
  • sch.OBJ
    5.9KB
  • 俄罗斯方块.IAB
    4KB
  • LCD_Disp.c
    21.9KB
  • LCD_Driver.c
    1.5KB
  • main.LST
    2.6KB
  • 俄罗斯方块.IMB
    4KB
  • LCD_Disp.LST
    40.7KB
  • 俄罗斯方块.PO
    776B
  • 俄罗斯方块.IAD
    368B
  • 俄罗斯方块.IMD
    368B
  • 俄罗斯方块.Uv2
    2.1KB
  • LCD.DSN
    125.5KB
  • main.c
    769B
  • main.OBJ
    6.5KB
  • LCD_PortConfig.h
    584B
  • Last Loaded LCD.DBK
    125.5KB
  • sch.c
    1.2KB
  • STARTUP.LST
    13.7KB
  • 俄罗斯方块_Uv2.Bak
    1.9KB
  • 俄罗斯方块.Opt
    1.7KB
  • 俄罗斯方块
    50.7KB
  • 俄罗斯方块.lnp
    94B
  • STC89C52RC.H
    3.6KB
  • 俄罗斯方块.PRI
    12.4KB
  • sch.h
    563B
  • LCD.PWI
    1.7KB
  • 俄罗斯方块_Opt.Bak
    1.7KB
  • LCD_Driver.LST
    3.7KB
  • STARTUP.A51
    6.2KB
  • 俄罗斯方块.plg
    185B
  • 俄罗斯方块.WK3
    24.2KB
  • STARTUP.OBJ
    758B
  • LCD_Disp.OBJ
    45.1KB
  • LCD_Driver.h
    406B
  • 俄罗斯方块.hex
    11.5KB
  • 俄罗斯方块.M51
    49KB
  • LCD_Disp.h
    1.8KB
  • 俄罗斯方块.PR
    2.3KB
  • 俄罗斯方块.PS
    14.3KB
  • 俄罗斯方块.PFI
    16B
  • sch.LST
    3.1KB
  • LCD_Driver.OBJ
    3.4KB
内容介绍
/***************************************************** *文件名称:LCD_Disp.c *****************************************************/ #include "lCD_PortConfig.h" #include "LCD_Driver.h" #include "LCD_Disp.h" #include "stdlib.h" #include "sch.h" uchar Figure_Date [4]={0x00,0x0e,0x04,0x00}; //存放从ROM中读取的基本形状显示代码 uchar Figure_Date_New[4]={0x00,0x00,0x00,0x00}; uchar Figure_Date_Old[4]={0x00,0x0e,0x04,0x00}; uchar Game_Over=1; // 1游戏正常运行,0游戏结束 ulong idata Disp_Buff[32]; //定义显示缓存 uchar X_Coor=25,Y_Coor=0; //存放X Y坐标 uchar Fig_Type=4; uchar Clr_Preview[4]={0,0,0,0}; //用于清除预览框 uchar SUM=0; //存储总分 uchar speed=0; //速度寄存器 uchar code a[4]={0,0x06,0x06,0}; //"田"字形 uchar code b[4]={0x04,0x04,0x04,0x04};//"|"字形 uchar code c[4]={0x00,0x00,0x0f,0x00};//"一"字形 uchar code d[4]={0x00,0x0e,0x04,0x00}; uchar code e[4]={0x04,0x0c,0x04,0x00}; uchar code f[4]={0x04,0x0e,0x00,0x00}; uchar code g[4]={0x04,0x06,0x04,0x00}; uchar code h[4]={0x00,0x0c,0x06,0x00}; uchar code i[4]={0x02,0x06,0x04,0x00}; uchar code j[4]={0x00,0x06,0x0c,0x00}; uchar code k[4]={0x08,0x0c,0x04,0x00}; uchar code fen[]={0x10,0x01,0x30,0x01,0x10,0x02,0x08,0x04,0x08,0x0C,0x04,0x18,0x02,0x70,0xF9,0x27, 0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x10,0x04,0x08,0x05,0x04,0x02,0x02,0x00}; /*"分",0*/ uchar code shu[]={0x10,0x04,0x92,0x0C,0x54,0x04,0x38,0x04,0xFF,0x7E,0x38,0x22,0xD4,0x22,0x12,0x23, 0x10,0x14,0xFF,0x14,0x48,0x08,0x2C,0x08,0x30,0x14,0x4C,0x72,0x03,0x21,0x00,0x00};/*"数",1*/ uchar code su[]={0x00,0x01,0x02,0x01,0xF4,0x3F,0x04,0x01,0x00,0x01,0xE0,0x1F,0x27,0x11,0x24,0x11, 0xE4,0x1F,0x84,0x05,0x44,0x19,0x34,0x11,0x04,0x01,0x0A,0x01,0xF1,0x7F,0x00,0x00};/*"速",2*/ uchar code du[]={0x80,0x00,0x00,0x01,0xFC,0x7F,0x44,0x04,0x44,0x04,0xF4,0x3F,0x44,0x04,0xC4,0x07, 0x04,0x00,0xE4,0x1F,0x44,0x08,0x84,0x04,0x04,0x03,0x82,0x0C,0x62,0x70,0x19,0x20};/*"度",3*/ uchar code you[]={0x22,0x04,0x44,0x04,0x44,0x04,0xF0,0x7D,0x21,0x02,0x2A,0x3D,0xEA,0x10,0xA4,0x08, 0xA4,0x08,0xA4,0x7E,0xA3,0x08,0x92,0x08,0x92,0x08,0x92,0x08,0xAA,0x0A,0x42,0x04};/*"游",4*/ uchar code xi[]={0x00,0x02,0x00,0x0A,0x7E,0x12,0x40,0x12,0x22,0x02,0xA4,0x7F,0x18,0x02,0x10,0x22, 0x30,0x14,0x28,0x0C,0x48,0x04,0x44,0x0A,0x82,0x49,0x60,0x50,0x00,0x60,0x00,0x40};/*"戏",5*/ uchar code jie[]={0x08,0x04,0x08,0x04,0x04,0x04,0xC4,0x7F,0x12,0x04,0x0F,0x04,0x88,0x3F,0x04,0x00, 0x02,0x00,0x9F,0x3F,0x80,0x20,0x80,0x20,0x98,0x20,0x87,0x3F,0x80,0x20,0x00,0x00};/*"结",6*/ uchar code shu1[]={0x80,0x00,0x80,0x00,0xFF,0x7F,0x80,0x00,0xFC,0x1F,0x84,0x10,0x84,0x10,0xFC,0x1F, 0xC4,0x10,0xA0,0x01,0xA0,0x02,0x90,0x0C,0x8C,0x70,0x83,0x20,0x80,0x00,0x80,0x00};/*"束",7*/ uchar code num[10][16]={ {0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00}, {0x00,0x00,0x00,0x08,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"1",0*/ {0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x20,0x20,0x10,0x08,0x04,0x42,0x7E,0x00,0x00},/*"2",1*/ {0x00,0x00,0x00,0x3C,0x42,0x42,0x20,0x18,0x20,0x40,0x40,0x42,0x22,0x1C,0x00,0x00},/*"3",2*/ {0x00,0x00,0x00,0x20,0x30,0x28,0x24,0x24,0x22,0x22,0x7E,0x20,0x20,0x78,0x00,0x00},/*"4",3*/ {0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x1A,0x26,0x40,0x40,0x42,0x22,0x1C,0x00,0x00},/*"5",4*/ {0x00,0x00,0x00,0x38,0x24,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x24,0x18,0x00,0x00},/*"6",5*/ {0x00,0x00,0x00,0x7E,0x22,0x22,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00},/*"7",6*/ {0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00},/*"8",7*/ {0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0x24,0x1C,0x00,0x00},/*"9",8*/ };/*"0",9*/ /*-------------------------------------------------- *函数名称:Write_OneDot *功 能:在屏幕任意坐标描绘一个点 *参 数:X 横坐标(0-63) Y 纵坐标(0-63) color 要填充的颜色 0:白色 1:黑色 *返 回:无 ---------------------------------------------------*/ void Write_OneDot(uchar X,uchar Y,uchar color) { uchar Column_H,Column_L ,Page,Offset, RamDate,temp; if(X<128&&Y<64) //坐标超出显示区域不显示 { Page=Y/8; //将坐标转换为相应的page,column以及位偏移量 Offset=Y%8; Column_L=X&0x0f; Column_H=X>>4; LCD_RegWrite(Page|0xb0); //设置地址 LCD_RegWrite(Column_H|0x10); LCD_RegWrite(Column_L); RamDate=LCD_DateRead(); //读取该地址对应的显示数据 if(color) //将XY坐标对应的位清零或置一,其余位保持不变 { switch (Offset) { case 0: temp=0x01; break; case 1: temp=0x02; break; case 2: temp=0x04; break; case 3: temp=0x08; break; case 4: temp=0x10; break; case 5: temp=0x20; break; case 6: temp=0x40; break; case 7: temp=0x80; break; } RamDate=RamDate|temp; LCD_DateWrite(RamDate); } else { switch(Offset) { case 0: temp=0xfe;break; case 1: temp=0xfd;break; case 2: temp=0xfb;break; case 3: temp=0xf7;break; case 4: temp=0xef;break; case 5: temp=0xdf;break; case 6: temp=0xbf;break; case 7: temp=0x7f;break; } RamDate=RamDate&temp; LCD_DateWrite(RamDate); } } } /*-------------------------------------------------- *函数名称:Write_OneLargeDot *功 能:预览框更新 *参 数:*p 指向要写入的内容 *返 回:无 ---------------------------------------------------*/ void Write_OneLargeDot(uchar X,uchar Y,uchar color) { X=X-10; Write_OneDot(2*X,2*Y,color); Write_OneDot(2*X+1,2*Y,color); Write_OneDot(2*X,2*Y+1,color); Write_OneDot(2*X+1,2*Y+1,color); } /*-------------------------------------------------- *函数名称:Write_Preview *功 能:预览框更新 *参 数:*p 指向要写入的内容 *返 回:无 ---------------------------------------------------*/ void Write_Preview(uchar *p) {uchar i,j,m,n,temp; uchar x,y; x=70; y=16; for(i=0;i<4;i++) { temp=*p; for(j=0;j<4;j++) { if(temp&0x01) { for(m=0;m<4;m++) { for(n=0;n<4;n++) Write_OneDot(x+n,y-m,1); } } else { for(m=0;m<4;m++) { for(n=0;n<4;n++) Write_OneDot(x+n,y-m,0); } } temp=temp>>1; x=x+4; } p++; x=70; y=y-4; } } /*-------------------------------------------------- *函数名称:Write_4x4Ram *功 能:在屏幕任意坐标处显示一个4X4区域, 以坐标点为起始向第一象限延伸 *参 数:X 横坐标(10-41) Y 纵坐标(1-31) *p 指向存放数据的数组 *返 回:无 ---------------------------------------------------*/ void Write_4x4Ram(char X,char Y,uchar *p) { uchar i,j,temp; for(i=0;i<4;i++) { temp=*p; for(j=0;j<4;j++) { if(temp&0x01) Write_OneLargeDot( X+j, Y-i, 1); //else //Write_OneLargeDot( X+j, Y-i, 0); temp=temp>>1; } p++; } } /*-------------------------------------------------- *函数名称:Write_One_Word *功 能:指定位置显示一个汉字(16X16) *参 数:x y *p *返 回:无 ---------------------------------------------------*/ void Write_One_Word(uchar x,uchar y,uchar code *p) { uchar i,j,k,temp; for(i=0;i<16;i++) { for(j=0;j<2;j++) { temp=*p; for(k=0;k<8;k++) { if(temp&0x01) Write_OneDot(x+k,y+i,1); else Write_OneDot(x+k,y+i,0); temp=temp>>1; } p++; x=x+8; } x=x-16; } } /*-------------------------------------------------- *函数名称:Disp_Over *功 能:显示游戏结束 *参 数:无 *返 回:无 ---------------------------------------------------*/ void Disp_Game_Over(void) { Write_One_Word(0,15,you); Write_One_Word(16,15,xi); Write_One_Word(32,15,jie); Write_One_Word(48,15,shu1); } /*-------------------------------------------------- *函数名称:Write_One_Byte *功 能:指定位置显示一�
评论
    相关推荐