feat(MCU课设): 一系列交互优化
This commit is contained in:
parent
9e30899376
commit
b774eb6b4f
8 changed files with 182 additions and 520 deletions
BIN
MCU/MCU_REAL_FINAL/IMG/amadeus.png
Normal file
BIN
MCU/MCU_REAL_FINAL/IMG/amadeus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
|
@ -19,6 +19,31 @@ void blockInit()
|
|||
|
||||
void blockDestroy()
|
||||
{
|
||||
//дÈëÅÅÐаñ
|
||||
if(addBest(score))
|
||||
{
|
||||
IapEraseSector(IAP_ADDRESS);
|
||||
IapProgramByte(IAP_ADDRESS + 0, bestScore[0] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 1, bestScore[0] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 2, bestScore[1] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 3, bestScore[1] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 4, bestScore[2] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 5, bestScore[2] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 6, bestScore[3] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 7, bestScore[3] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 8, bestScore[4] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 9, bestScore[4] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 10, bestScore[5] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 11, bestScore[5] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 12, bestScore[6] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 13, bestScore[6] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 14, bestScore[7] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 15, bestScore[7] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 16, bestScore[8] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 17, bestScore[8] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 18, bestScore[9] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 19, bestScore[9] % 256);
|
||||
}
|
||||
memset(base, 0, sizeof(base));
|
||||
blockGameStatus = over;
|
||||
}
|
||||
|
@ -262,7 +287,7 @@ void blockGameOver()
|
|||
//дÈëÅÅÐаñ
|
||||
if(addBest(score))
|
||||
{
|
||||
IapEraseSector(IAP_ADDRESS);
|
||||
IapEraseSector(IAP_ADDRESS);
|
||||
IapProgramByte(IAP_ADDRESS + 0, bestScore[0] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 1, bestScore[0] % 256);
|
||||
IapProgramByte(IAP_ADDRESS + 2, bestScore[1] >> 8);
|
||||
|
@ -309,24 +334,3 @@ unsigned int addBest(unsigned int s)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void saveBest()
|
||||
{
|
||||
unsigned int i;
|
||||
IapEraseSector(IAP_ADDRESS);
|
||||
delayms(20);
|
||||
for(i = 0; i++; i < 10)
|
||||
{
|
||||
IapProgramByte(IAP_ADDRESS + 2 * i, bestScore[i] >> 8);
|
||||
IapProgramByte(IAP_ADDRESS + 2 * i + 1, bestScore[i] - (bestScore[i] >> 4) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
void readBest()
|
||||
{
|
||||
unsigned int i;
|
||||
for(i = 0; i++; i < 10)
|
||||
{
|
||||
bestScore[i] = (unsigned int)IapReadByte(IAP_ADDRESS + 2 * i) << 8 + (unsigned int)IapReadByte(IAP_ADDRESS + 2 * i + 1);
|
||||
}
|
||||
}
|
|
@ -10,235 +10,113 @@ sbit E = P2 ^ 2;
|
|||
sbit CSA = P2 ^ 4;
|
||||
sbit CSB = P2 ^ 5;
|
||||
|
||||
|
||||
void drawNUMBER()
|
||||
void drawFONT(unsigned char x, unsigned char y, unsigned char len, unsigned char re,
|
||||
unsigned char FONT0[], unsigned char FONT1[])
|
||||
{
|
||||
unsigned int j;
|
||||
for(j = 0 ; j < 64; j++)
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 2;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³2ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NUMBER_PAGE0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 3;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³3ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NUMBER_PAGE1[j];
|
||||
write();
|
||||
|
||||
}
|
||||
for(j = 0 ; j < 16; j++)
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
x = x - 63;
|
||||
}
|
||||
|
||||
for(j = 0; j < len; j++)
|
||||
{
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 2;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³2ÁÐjÆÁB
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NUMBER_RPAGE0[j];
|
||||
if(!re)
|
||||
P1 = FONT0[j];
|
||||
else
|
||||
P1 = ~FONT0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 3;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³3ÁÐjÆÁB
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NUMBER_RPAGE1[j];
|
||||
if(!re)
|
||||
P1 = FONT1[j];
|
||||
else
|
||||
P1 = ~FONT1[j];
|
||||
write();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void drawNAME()
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
for(j = 0; j < 48; j++)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 0;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³0ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NAME_PAGE0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 1;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³1ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = NAME_PAGE1[j];
|
||||
write();
|
||||
}
|
||||
drawFONT(5, 0, 48, 0, NAME_PAGE0, NAME_PAGE1);
|
||||
}
|
||||
|
||||
void drawNUMBER()
|
||||
{
|
||||
drawSUPNUM(0, 2, 2);
|
||||
drawSUPNUM(8, 2, 0);
|
||||
drawSUPNUM(16, 2, 2);
|
||||
drawSUPNUM(24, 2, 0);
|
||||
drawSUPNUM(32, 2, 1);
|
||||
drawSUPNUM(40, 2, 1);
|
||||
drawSUPNUM(48, 2, 4);
|
||||
drawSUPNUM(56, 2, 4);
|
||||
drawSUPNUM(64, 2, 9);
|
||||
drawSUPNUM(72, 2, 0);
|
||||
}
|
||||
|
||||
void drawMAINMENU(unsigned char i)
|
||||
{
|
||||
unsigned int j;
|
||||
drawFONT(2, 0, 32, 0, MAINMANU_PAGE0, MAINMANU_PAGE1);
|
||||
drawFONT(22, 2, 32, i == 1, MAINMANU_PAGE2, MAINMANU_PAGE3);
|
||||
drawFONT(22, 4, 32, i == 2, MAINMANU_PAGE4, MAINMANU_PAGE5);
|
||||
drawFONT(22, 6, 32, i == 3, MAINMANU_PAGE6, MAINMANU_PAGE7);
|
||||
}
|
||||
void drawBLOCKSCORE()
|
||||
{
|
||||
drawFONT(66, 0, 32, 0, FONT_SCORE0, FONT_SCORE1);
|
||||
}
|
||||
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
void drawGAME(unsigned char x, unsigned char y)
|
||||
{
|
||||
drawFONT(x, y, 32, 0, FONT_GAME0, FONT_GAME1);
|
||||
}
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 0;
|
||||
write();
|
||||
P1 = 0X40 + 31 + j;
|
||||
write(); //Ò³0ÁÐ31+jÆÁB
|
||||
void drawOVER(unsigned char x, unsigned char y)
|
||||
{
|
||||
drawFONT(x, y, 32, 0, FONT_OVER0, FONT_OVER1);
|
||||
}
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = MAINMANU_PAGE0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 1;
|
||||
write();
|
||||
P1 = 0X40 + 31 + j;
|
||||
write(); //Ò³1ÁÐ31+jÆÁB
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = MAINMANU_PAGE1[j];
|
||||
write();
|
||||
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 2;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³2ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 1)
|
||||
P1 = ~MAINMANU_PAGE2[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE2[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 3;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³3ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 1)
|
||||
P1 = ~MAINMANU_PAGE3[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE3[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 4;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³4ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 2)
|
||||
P1 = ~MAINMANU_PAGE4[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE4[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 5;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³5ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 2)
|
||||
P1 = ~MAINMANU_PAGE5[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE5[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 6;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³6ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 3)
|
||||
P1 = ~MAINMANU_PAGE6[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE6[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 7;
|
||||
write();
|
||||
P1 = 0X40 + j;
|
||||
write(); //Ò³7ÁÐjÆÁA
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
if(i == 3)
|
||||
P1 = ~MAINMANU_PAGE7[j];
|
||||
else
|
||||
P1 = MAINMANU_PAGE7[j];
|
||||
write();
|
||||
}
|
||||
void drawGOOD(unsigned char x, unsigned char y)
|
||||
{
|
||||
drawFONT(x, y, 40, 0, FONT_GOOD0, FONT_GOOD1);
|
||||
}
|
||||
|
||||
void drawBEST(unsigned char x, unsigned char y)
|
||||
{
|
||||
drawFONT(x, y, 32, 0, FONT_BEST0, FONT_BEST1);
|
||||
}
|
||||
void drawVER(unsigned char x, unsigned char y)
|
||||
{
|
||||
drawFONT(x, y, 32, 0, FONT_VER0, FONT_VER1);
|
||||
}
|
||||
void placeIMG_BLOCK(unsigned char x, unsigned char y)
|
||||
{
|
||||
|
@ -319,40 +197,6 @@ void drawVerticalDottedLine(char x)
|
|||
}
|
||||
}
|
||||
|
||||
void drawBLOCKSCORE()
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 0;
|
||||
write();
|
||||
P1 = 0X40 + 5 + j;
|
||||
write(); //Ò³0ÁÐ5+jÆÁB
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_SCORE0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + 1;
|
||||
write();
|
||||
P1 = 0X40 + 5 + j;
|
||||
write(); //Ò³1ÁÐ5+jÆÁB
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_SCORE1[j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawSUPNUM(unsigned char x, unsigned char y, unsigned char num)
|
||||
{
|
||||
unsigned int j;
|
||||
|
@ -380,7 +224,7 @@ void drawSUPNUM(unsigned char x, unsigned char y, unsigned char num)
|
|||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = SUPER_NUM0[8*num+j];
|
||||
P1 = SUPER_NUM0[8 * num + j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
|
@ -392,145 +236,14 @@ void drawSUPNUM(unsigned char x, unsigned char y, unsigned char num)
|
|||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = SUPER_NUM1[8*num+j];
|
||||
P1 = SUPER_NUM1[8 * num + j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawGAME(unsigned char x, unsigned char y)
|
||||
void drawVOID8(unsigned char x, unsigned char y, unsigned char len)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x - 63;
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
}
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_GAME0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_GAME1[j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawOVER(unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x - 63;
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
}
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_OVER0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_OVER1[j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawGOOD(unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x - 63;
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
}
|
||||
for(j = 0; j < 40; j++)
|
||||
{
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_GOOD0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_GOOD1[j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
void drawVOID8(unsigned char x,unsigned char y,unsigned char len)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
|
@ -571,91 +284,3 @@ void drawVOID8(unsigned char x,unsigned char y,unsigned char len)
|
|||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawBEST(unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x - 63;
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
}
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_BEST0[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = FONT_BEST1[j];
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
void drawRECORD(unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned int j;
|
||||
if(x < 0 || x > 127)
|
||||
return;
|
||||
else if(x < 64)
|
||||
{
|
||||
CSA = 1;
|
||||
CSB = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x - 63;
|
||||
CSA = 0;
|
||||
CSB = 1;
|
||||
}
|
||||
for(j = 0; j < 32; j++)
|
||||
{
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³yÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 =MAINMANU_PAGE4[j];
|
||||
write();
|
||||
|
||||
RS = 0;
|
||||
RW = 0;
|
||||
P1 = 0xb8 + y + 1;
|
||||
write();
|
||||
P1 = 0X40 + x + j;
|
||||
write(); //Ò³y+1ÁÐx+j
|
||||
|
||||
RS = 1;
|
||||
RW = 0;
|
||||
P1 = MAINMANU_PAGE5[j];
|
||||
write();
|
||||
}
|
||||
}
|
|
@ -6,6 +6,9 @@ void drawNUMBER();
|
|||
void drawMAINMENU(unsigned char);
|
||||
void drawSUPNUM(unsigned char x,unsigned char y,unsigned char num);
|
||||
void drawVOID8(unsigned char x,unsigned char y,unsigned char len);
|
||||
void drawFONT(unsigned char x,unsigned char y,unsigned char len,
|
||||
unsigned char re,unsigned char FONT0[],unsigned char FONT1[]);
|
||||
void drawVER(unsigned char x, unsigned char y);
|
||||
////=================== 方块 ==================
|
||||
|
||||
void placeIMG_BLOCK(unsigned char x,unsigned char y);
|
||||
|
@ -16,7 +19,6 @@ void drawOVER(unsigned char x, unsigned char y);
|
|||
void drawBLOCKSCORE();
|
||||
|
||||
////=================== 记录 ==================
|
||||
void drawRECORD(unsigned char x, unsigned char y);
|
||||
void drawBEST(unsigned char x, unsigned char y);
|
||||
|
||||
////=================== 几何 ==================
|
||||
|
|
|
@ -14,38 +14,6 @@ code unsigned char NAME_PAGE1[] ={
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x08, 0x06, 0x01, 0xFF, 0x01, 0x06, 0x00, 0x00, 0x3F, 0x10, 0x10, 0x10, 0x3F, 0x00, 0x00
|
||||
};
|
||||
//ѧºÅ ×ó
|
||||
code unsigned char NUMBER_PAGE0[]={
|
||||
|
||||
0x00,0x70,0x08,0x08,0x08,0x08,0xF0,0x00,
|
||||
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
|
||||
0x00,0x70,0x08,0x08,0x08,0x08,0xF0,0x00,
|
||||
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
|
||||
0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,
|
||||
0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,
|
||||
0x00,0x00,0x80,0x40,0x30,0xF8,0x00,0x00,
|
||||
0x00,0x00,0x80,0x40,0x30,0xF8,0x00,0x00,
|
||||
};
|
||||
code unsigned char NUMBER_PAGE1[]={
|
||||
0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
|
||||
0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
|
||||
0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
|
||||
0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
|
||||
0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,
|
||||
0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,
|
||||
0x00,0x06,0x05,0x24,0x24,0x3F,0x24,0x24,
|
||||
0x00,0x06,0x05,0x24,0x24,0x3F,0x24,0x24,
|
||||
};
|
||||
//ѧºÅ ÓÒ
|
||||
code unsigned char NUMBER_RPAGE0[]={
|
||||
0x00,0xF0,0x08,0x08,0x08,0x10,0xE0,0x00,
|
||||
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
|
||||
};
|
||||
code unsigned char NUMBER_RPAGE1[]={
|
||||
0x00,0x01,0x12,0x22,0x22,0x11,0x0F,0x00,
|
||||
0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
|
||||
};
|
||||
|
||||
|
||||
//=================== 菜单字库 ==================
|
||||
//第一行:菜单
|
||||
|
@ -85,6 +53,16 @@ code unsigned char MAINMANU_PAGE7[]={
|
|||
0x81,0x81,0x41,0x41,0x21,0x11,0x0D,0x03,0x0D,0x11,0x21,0x41,0x41,0x81,0x81,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
code unsigned char FONT_VER0[]={
|
||||
0x00,0xFE,0x20,0x20,0x3F,0x20,0x00,0xFC,0x24,0xE4,0x24,0x22,0x23,0xE2,0x00,0x00,
|
||||
0x00,0x10,0x10,0x10,0x10,0xD0,0x30,0xFF,0x30,0xD0,0x10,0x10,0x10,0x10,0x00,0x00,
|
||||
};
|
||||
code unsigned char FONT_VER1[]={
|
||||
0x80,0x7F,0x01,0x01,0xFF,0x80,0x60,0x1F,0x80,0x41,0x26,0x18,0x26,0x41,0x80,0x00,
|
||||
0x10,0x08,0x04,0x02,0x09,0x08,0x08,0xFF,0x08,0x08,0x09,0x02,0x04,0x08,0x10,0x00,
|
||||
};
|
||||
|
||||
code unsigned char SUPER_NUM0[]={
|
||||
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
|
||||
0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#include "main.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
//#define WIPE_BEST
|
||||
|
||||
#define RELOAD (65535-9216) //定时器填充值(1ms)
|
||||
unsigned char TH, TL;
|
||||
|
||||
extern Menu *NOW; //菜单指针
|
||||
extern enum OPR opr; //按键状态
|
||||
extern unsigned int bestScore[];
|
||||
extern unsigned int ver;
|
||||
|
||||
void int0() interrupt 0 //外部中断:检测左右旋钮
|
||||
{
|
||||
|
@ -39,8 +42,12 @@ void time() interrupt 1 //
|
|||
{
|
||||
delayms(15);
|
||||
if(PIN_4 == 0)
|
||||
{
|
||||
opr = confirm;
|
||||
delayms(20);
|
||||
}
|
||||
}
|
||||
|
||||
EA = 1;
|
||||
}
|
||||
|
||||
|
@ -68,6 +75,29 @@ int main()
|
|||
clear();
|
||||
menuInit(); //菜单初始化
|
||||
|
||||
//Èô¶¨Ò壬Çå³ýÅÅÐаñ
|
||||
#ifdef WIPE_BEST
|
||||
IapProgramByte(IAP_ADDRESS + 0, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 1, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 2, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 3, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 4, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 5, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 6, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 7, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 8, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 9, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 10, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 11, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 12, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 13, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 14, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 15, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 16, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 17, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 18, 0);
|
||||
IapProgramByte(IAP_ADDRESS + 19, 0);
|
||||
#endif
|
||||
//读取排行榜
|
||||
bestScore[0] = ((unsigned int)IapReadByte(IAP_ADDRESS + 0)) * 256
|
||||
+ (unsigned int)IapReadByte(IAP_ADDRESS + 1);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "button.h"
|
||||
#include "delay.h"
|
||||
|
||||
#define VER_ADDRESS 0xaa00
|
||||
|
||||
sbit RS = P2 ^ 0;
|
||||
sbit RW = P2 ^ 1;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "block.h"
|
||||
#include <absacc.h>
|
||||
|
||||
//便于调试的预编译命令
|
||||
//#define DEBUG_MODE
|
||||
|
@ -21,6 +22,7 @@ Menu M_ABOUT; //
|
|||
Menu* NOW; //当前菜单指针
|
||||
Menu* LAST = NULL; //上一个状态的菜单
|
||||
|
||||
code unsigned int ver _at_ 0x7ffe;
|
||||
enum OPR opr = idle;
|
||||
static unsigned char local[2] = {0};
|
||||
unsigned int score;
|
||||
|
@ -35,6 +37,20 @@ void m_mainmenu(struct _menu* this)
|
|||
{
|
||||
LAST = &M_MAINMENU;
|
||||
drawMAINMENU(local[0]);
|
||||
|
||||
if(!local[1])
|
||||
{
|
||||
local[1] = 1;
|
||||
drawVER(90, 4);
|
||||
drawSUPNUM(80, 6, ver / 10000); //绘制版本
|
||||
drawSUPNUM(89, 6, (ver % 10000) / 1000);
|
||||
drawSUPNUM(98, 6, (ver % 1000) / 100);
|
||||
drawSUPNUM(107, 6, (ver % 100) / 10);
|
||||
drawSUPNUM(116, 6, ver % 10);
|
||||
delayms(1000);
|
||||
drawVOID8(90, 4, 32);
|
||||
drawVOID8(80, 6, 46);
|
||||
}
|
||||
}
|
||||
|
||||
if(opr == right)
|
||||
|
@ -48,7 +64,7 @@ void m_mainmenu(struct _menu* this)
|
|||
}
|
||||
if(opr == left)
|
||||
{
|
||||
if(local[0] != 0)
|
||||
if(local[0] > 1)
|
||||
local[0]--;
|
||||
|
||||
opr = idle;
|
||||
|
@ -72,7 +88,6 @@ void m_mainmenu(struct _menu* this)
|
|||
break;
|
||||
}
|
||||
|
||||
local[0] = 0;
|
||||
clear();
|
||||
opr = idle;
|
||||
}
|
||||
|
@ -152,6 +167,14 @@ void m_about(struct _menu* this)
|
|||
drawNAME(); //绘制名字
|
||||
delayms(2000);
|
||||
drawNUMBER(); //绘制学号
|
||||
delayms(3000);
|
||||
|
||||
drawVER(5, 4);
|
||||
drawSUPNUM(2, 6, ver / 10000); //绘制版本
|
||||
drawSUPNUM(11, 6, (ver % 10000) / 1000);
|
||||
drawSUPNUM(20, 6, (ver % 1000) / 100);
|
||||
drawSUPNUM(29, 6, (ver % 100) / 10);
|
||||
drawSUPNUM(38, 6, ver % 10);
|
||||
}
|
||||
|
||||
if(opr == confirm)
|
||||
|
@ -177,37 +200,37 @@ void m_best(struct _menu* this)
|
|||
drawSUPNUM(29, 2, (bestScore[0] % 100) / 10);
|
||||
drawSUPNUM(38, 2, bestScore[0] % 10);
|
||||
|
||||
drawSUPNUM(2, 4, bestScore[1] / 10000); //绘制分数
|
||||
drawSUPNUM(2, 4, bestScore[1] / 10000); //绘制分数
|
||||
drawSUPNUM(11, 4, (bestScore[1] % 10000) / 1000);
|
||||
drawSUPNUM(20, 4, (bestScore[1] % 1000) / 100);
|
||||
drawSUPNUM(29, 4, (bestScore[1] % 100) / 10);
|
||||
drawSUPNUM(38, 4, bestScore[1] % 10);
|
||||
|
||||
drawSUPNUM(2, 6, bestScore[2] / 10000); //绘制分数
|
||||
drawSUPNUM(2, 6, bestScore[2] / 10000); //绘制分数
|
||||
drawSUPNUM(11, 6, (bestScore[2] % 10000) / 1000);
|
||||
drawSUPNUM(20, 6, (bestScore[2] % 1000) / 100);
|
||||
drawSUPNUM(29, 6, (bestScore[2] % 100) / 10);
|
||||
drawSUPNUM(38, 6, bestScore[2] % 10);
|
||||
|
||||
drawSUPNUM(72, 0, bestScore[3] / 10000); //绘制分数
|
||||
drawSUPNUM(72, 0, bestScore[3] / 10000); //绘制分数
|
||||
drawSUPNUM(81, 0, (bestScore[3] % 10000) / 1000);
|
||||
drawSUPNUM(90, 0, (bestScore[3] % 1000) / 100);
|
||||
drawSUPNUM(99, 0, (bestScore[3] % 100) / 10);
|
||||
drawSUPNUM(108, 0, bestScore[3] % 10);
|
||||
|
||||
drawSUPNUM(72, 2, bestScore[4] / 10000); //绘制分数
|
||||
drawSUPNUM(72, 2, bestScore[4] / 10000); //绘制分数
|
||||
drawSUPNUM(81, 2, (bestScore[4] % 10000) / 1000);
|
||||
drawSUPNUM(90, 2, (bestScore[4] % 1000) / 100);
|
||||
drawSUPNUM(99, 2, (bestScore[4] % 100) / 10);
|
||||
drawSUPNUM(108, 2, bestScore[4] % 10);
|
||||
|
||||
drawSUPNUM(72, 4, bestScore[5] / 10000); //绘制分数
|
||||
drawSUPNUM(72, 4, bestScore[5] / 10000); //绘制分数
|
||||
drawSUPNUM(81, 4, (bestScore[5] % 10000) / 1000);
|
||||
drawSUPNUM(90, 4, (bestScore[5] % 1000) / 100);
|
||||
drawSUPNUM(99, 4, (bestScore[5] % 100) / 10);
|
||||
drawSUPNUM(108, 4, bestScore[5] % 10);
|
||||
|
||||
drawSUPNUM(72, 6, bestScore[6] / 10000); //绘制分数
|
||||
drawSUPNUM(72, 6, bestScore[6] / 10000); //绘制分数
|
||||
drawSUPNUM(81, 6, (bestScore[6] % 10000) / 1000);
|
||||
drawSUPNUM(90, 6, (bestScore[6] % 1000) / 100);
|
||||
drawSUPNUM(99, 6, (bestScore[6] % 100) / 10);
|
||||
|
@ -224,7 +247,6 @@ void m_best(struct _menu* this)
|
|||
|
||||
void menuInit()
|
||||
{
|
||||
|
||||
M_MAINMENU.f = m_mainmenu;
|
||||
M_BLOCK.f = m_block;
|
||||
M_ABOUT.f = m_about;
|
||||
|
|
Reference in a new issue