俄罗斯方块89c52的12864液晶设计Word文档格式.docx
- 文档编号:17291124
- 上传时间:2022-11-30
- 格式:DOCX
- 页数:30
- 大小:33.86KB
俄罗斯方块89c52的12864液晶设计Word文档格式.docx
《俄罗斯方块89c52的12864液晶设计Word文档格式.docx》由会员分享,可在线阅读,更多相关《俄罗斯方块89c52的12864液晶设计Word文档格式.docx(30页珍藏版)》请在冰豆网上搜索。
unsignedcharcodeBlock[28][2]={
/*
*口 口口口 口口
*口口 口口
*口口 口口口口
*/
{0x88,0xc0},{0xe8,0x00},{0x62,0x20},{0x02,0xe0},
/*
* 口 口口口口口
* 口 口 口口
* 口口口口口口
*/
{0x22,0x60},{0x08,0xe0},{0xc8,0x80},{0xe2,0x00},
/*
*口
*口口 口口
* 口 口口
*/
{0x8c,0x40},{0x6c,0x00},{0x8c,0x40},{0x6c,0x00},
/*
*口 口口
* 口口 口口
*口
*/
{0x4c,0x80},{0xc6,0x00},{0x4c,0x80},{0xc6,0x00},
/*
* 口 口
* 口口口口口口 口口
*口口口口 口 口
{0x04,0xe0},{0x8c,0x80},{0xe4,0x00},{0x26,0x20},
/*口
*口 口口口口
*口
{0x44,0x44},{0x0f,0x00},{0x44,0x44},{0x0f,0x00},
* 口口
*口口
{0x06,0x60},{0x06,0x60},{0x06,0x60},{0x06,0x60}
ucharcodestart[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0C,0x08,0x00,0x3F,0xFF,0x00,0x22,0x00,0x00,0x02,0x00,0x00,0x41,0x00,0x00,
0x00,0x08,0x6A,0x00,0x22,0x21,0x00,0x22,0x3F,0x00,0x01,0x00,0x00,0x41,0x00,0x00,
0x00,0x09,0xC9,0x00,0x22,0x21,0x00,0x22,0xE0,0x00,0x01,0x00,0x00,0x41,0x00,0x00,
0x00,0x10,0x89,0x80,0x22,0x21,0x00,0xFF,0x20,0x00,0xFF,0xFF,0x00,0x41,0x08,0x00,
0x00,0x10,0x88,0x00,0x22,0x21,0x00,0x22,0x20,0x00,0x02,0x00,0x00,0x47,0xF8,0x00,
0x00,0x37,0xFF,0xC0,0x3F,0xFF,0x00,0x3E,0x20,0x00,0x02,0x00,0x03,0xF9,0x08,0x00,
0x00,0x30,0x88,0x00,0x21,0x80,0x00,0x22,0x3F,0x00,0x02,0x00,0x00,0x41,0x08,0x00,
0x00,0x50,0x88,0x80,0x03,0x44,0x00,0x22,0x26,0x00,0x07,0xF8,0x00,0x41,0x08,0x00,
0x00,0x10,0xA9,0x00,0x06,0x3C,0x00,0x3E,0x22,0x00,0x04,0x18,0x00,0x41,0x08,0x00,
0x00,0x10,0xC9,0x00,0x0C,0x08,0x00,0x22,0x22,0x00,0x04,0x10,0x00,0x5F,0xFE,0x00,
0x00,0x17,0x86,0x00,0x12,0x18,0x00,0xFF,0xA2,0x00,0x0C,0x10,0x00,0x41,0x40,0x00,
0x00,0x10,0x84,0x00,0x01,0x30,0x00,0x00,0x22,0x00,0x08,0x10,0x00,0x79,0x40,0x00,
0x00,0x10,0x8C,0x40,0x00,0x60,0x00,0x12,0x42,0x00,0x10,0x10,0x01,0xC2,0x20,0x00,
0x00,0x10,0x92,0x40,0x00,0x80,0x00,0x21,0x42,0x00,0x10,0x10,0x03,0x04,0x10,0x00,
0x00,0x10,0x81,0xC0,0x07,0x00,0x00,0x40,0x82,0x00,0x61,0x30,0x00,0x08,0x08,0x00,
0x00,0x11,0x80,0xC0,0x38,0x00,0x00,0x81,0x02,0x00,0x80,0xE0,0x00,0x30,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x1F,0xC7,0xF0,0x0F,0xE3,0xF8,0xFE,0x00,0xFE,0x3F,0x8F,0xE0,0x00,0x07,0xF1,0xFC,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x0F,0xE7,0xF0,0x00,
0x1F,0xC7,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0x00,0x07,0xFF,0x80,0xFF,0x80,0x08,0x40,0x00,0x80,0x40,0x22,0x00,0x00,
0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x80,0x08,0x80,0x04,0x80,0xC0,0x26,0x00,0x00,
0x00,0x08,0x10,0x00,0x80,0x00,0x20,0x80,0x11,0x0C,0x04,0x82,0x40,0x44,0x18,0x00,
0x00,0x30,0x08,0x01,0xFE,0x00,0x20,0x80,0x13,0xFE,0x0F,0xF2,0x40,0x47,0xF8,0x00,
0x00,0x3F,0xFC,0x06,0x82,0x00,0x20,0x80,0x30,0x02,0x08,0x82,0x40,0xC9,0x00,0x00,
0x00,0x01,0x02,0x08,0xFE,0x00,0x20,0x80,0x31,0x04,0x0F,0xFA,0x40,0xD9,0x00,0x00,
0x00,0x11,0x00,0x00,0x00,0x00,0x60,0x90,0x52,0x42,0x00,0x82,0x41,0x51,0xF0,0x00,
0x00,0x37,0xE0,0x0F,0xDF,0xC0,0x7F,0xF0,0x14,0xF8,0x0F,0xF2,0x40,0x41,0x00,0x00,
0x00,0x21,0x00,0x02,0x04,0x00,0x00,0x10,0x11,0x08,0x08,0x92,0x40,0x41,0x00,0x00,
0x00,0x41,0x00,0x04,0x04,0x00,0x01,0x90,0x12,0x98,0x08,0x92,0x40,0x41,0x00,0x00,
0x00,0xBF,0xFC,0x07,0xCF,0x81,0xFF,0x90,0x14,0x50,0x08,0x92,0x40,0x41,0xF8,0x00,
0x00,0x01,0x00,0x0C,0x58,0x80,0x00,0x30,0x10,0x20,0x08,0xB0,0x40,0x41,0x00,0x00,
0x00,0x01,0x00,0x04,0x48,0x80,0x00,0x20,0x10,0x50,0x08,0xA0,0x40,0x41,0x00,0x00,
0x00,0x01,0x00,0x07,0xCF,0x80,0x01,0xE0,0x11,0x8E,0x00,0x81,0xC0,0x41,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x80,0x41,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
#definePASSSCORE20
structJimu
{
unsigned intdat;
ﻩcharx;
unsignedchary;
unsigned chartype;
ﻩunsignedchar change;
}Sign[3];
//积木结构体
unsignedcharSysFlag=0;
#defineNEWSIGNFLAG0
#defineDEADFLAG1
#definePAUSEFLAG2
unsignedcharScore=0;
unsignedcharLevel=1;
unsigned charDelayCnt=5;
/*********************************************************/
#defineN25
/************************************伪随机数发生器
*************************************/
doubleRandom(void)
{
longTmpSeed;
TmpSeed=A*(Seed%Q)-R*(Seed/Q);
if(TmpSeed>
=0)
ﻩSeed=TmpSeed;
else
Seed=TmpSeed+M;
ﻩreturn (double)Seed/M;
}
/************************************** 为伪随机数发生器播种
***************************************/
voidInitRandom(unsigned longInitVal)
Seed=InitVal;
}
//延时子程序
void Delay(unsignedintt)
unsignedinti,j;
ﻩfor(i=0;
i<t;
i++)
for(j=0;
j<
10;
j++);
}
/*********************************初始化 MPU
**********************************/
voidInitCpu(void)
ﻩTMOD=0x0;
TH0=0;
ﻩTL0=0;
ﻩTR0=1;
ﻩET0=1;
EX1=1;
EA=1;
ﻩTCON|=0x04;
/****************************welcome 游戏选择界面
/**********************/
void welcome()
ﻩDisplayImage(start);
while(change==1);
/*************俄罗斯方块部分
/******************************画墙壁,初始化界面
*******************************/
void DrawBoard(void)
{
unsignedcharn;
ﻩfor(n=0;
n<
12;
n++)
{
ﻩﻩLcd_Rectangle(3*n,0,3*n+2,2,1);
ﻩﻩLcd_Rectangle(3*n,60,3*n+2,62,1);
ﻩ}
for(n=0;
20;
n++)
ﻩ{
Lcd_Rectangle(0,3*n,2,3*n+2,1);
Lcd_Rectangle(33,3*n,35,3*n+2,1);
}
Lcd_WriteStr(4,0,"
下个方块");
ﻩLcd_WriteStr(3,2,"
分"
);
Lcd_WriteCmd(0x8c);
Lcd_WriteData(0xca);
Lcd_WriteData(0xfd);
ﻩLcd_WriteStr(5,2,"
:
"
);
Lcd_WriteStr(3,3,"
级别:
/***********************************游戏结束处理
************************************/
voidGameOver(void)
ﻩLcd_WriteStr(3,1,"
"
ﻩif((SysFlag&(1<<DEADFLAG))!
=0)
{ﻩ
ﻩﻩLcd_WriteStr(3,1,"失败"
Score=0;
}
else
ﻩ{ﻩ
//ﻩLcd_WriteStr(3,1,"
升级啦"
ﻩLcd_WriteStr(3,1,"
成功!
!
");
Level++;
ﻩﻩScore=0;
while(change==1);
}
unsignedint codeMaskTab[16]={
0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,
0x0100,0x0200,0x0400,0x0800,0x1000,0x2000,0x4000,0x8000
};
/**********************************根据积木图标左下坐标X,Y来画出积木图标
***********************************/
voidDrawSign(structJimuTemp,unsigned charDrawMode)
ﻩunsignedcharm,n;
ﻩfor(m=0;
m<
4;
m++)
ﻩfor(n=0;
4;
ﻩ{
ﻩﻩif((Temp.dat&
MaskTab[4*m+n])!
=0)
ﻩﻩﻩLcd_Rectangle(Temp.x+n*3,Temp.y-2-3*m,Temp.x+n*3+2,Temp.y-3*m,DrawMode);
ﻩ}
/******************************** 将积木图标值融入num数据中 也即把积木图标固定,无法再下降
*********************************/
FixSign(void)
unsignedcharm,n;
m<4;
m++)//行循环
for(n=0;
4;
n++)// 列循环
ﻩif((Sign[0].dat&
MaskTab[4*m+n])!
=0)
ﻩ{
ﻩﻩnum[20-(Sign[0].y-2)/3+m]|=MaskTab[11-Sign[0].x/3-n];
}
ﻩ}
/********************************判断积木图标中方块是否与障碍方块重合
*********************************/
unsignedcharCheckIf(void)
unsignedcharm,n;
for(m=0;
m<
m++)//行循环
ﻩfor(n=0;
n++)//列循环
{
ﻩif((Sign[1].dat&
MaskTab[4*m+n])!
ﻩﻩ{
ﻩif((num[20-(Sign[1].y-2)/3+m]&
MaskTab[11-Sign[1].x/3-n
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 俄罗斯方块 89 c52 12864 液晶 设计