fix(MCU课设): 不知道修好了没

This commit is contained in:
iridiumR 2022-06-07 14:46:17 +08:00
parent c1e8bcc7cf
commit 8bba16abe2
3 changed files with 4 additions and 3 deletions

View file

@ -259,7 +259,6 @@ void blockGameOver()
if(blockGameStatus == over) if(blockGameStatus == over)
{ {
addBest(score); addBest(score);
saveBest();
for(j = 0; j < MAX_Y; j++) for(j = 0; j < MAX_Y; j++)
for(i = 0; i < MAX_X; i++) for(i = 0; i < MAX_X; i++)
{ {

View file

@ -98,6 +98,7 @@ void addBest(unsigned int s)
bestScore[j]=bestScore[j-1]; bestScore[j]=bestScore[j-1];
bestScore[i]=s; bestScore[i]=s;
saveBest();
return; return;
} }
@ -111,8 +112,9 @@ void saveBest()
for(i=0;i++;i<10) for(i=0;i++;i<10)
{ {
IapProgramByte(IAP_ADDRESS+2*i, bestScore[i]/256); IapProgramByte(IAP_ADDRESS+2*i, bestScore[i]/256);
delayms(15);
IapProgramByte(IAP_ADDRESS+2*i+1, bestScore[i]%256); IapProgramByte(IAP_ADDRESS+2*i+1, bestScore[i]%256);
delayms(15);
} }
} }

View file

@ -22,7 +22,7 @@ sfr IAP_CONTR = 0xE7; //Flash
//#define ENABLE_IAP 0x83 //if SYSCLK<5MHz //#define ENABLE_IAP 0x83 //if SYSCLK<5MHz
//Start address for STC89C58xx EEPROM //Start address for STC89C58xx EEPROM
#define IAP_ADDRESS 0x08000 #define IAP_ADDRESS 0xF200
typedef unsigned char BYTE; typedef unsigned char BYTE;
typedef unsigned int WORD; typedef unsigned int WORD;