程序是这个但是老是出错
出现这个ACTION: PARSING SOURCE-FILE; ERROR: PREPROCESSOR: MACROS TOO NESTED
#include<intrins.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<lcd_160128.h>
extern void LCD_Initialise();
extern uchar LCD_Write_Command(uchar cmd);
extern uchar LCD_Write_Command_P1(uchar cmd,uchar para1);
extern uchar LCD_Write_Command_P2(uchar cmd,uchar para1,uchar para2);
extern uchar LCD_Write_Data(uchar dat);
extern void Set_LCD_POS(uchar row,uchar co1) reentrant;
extern void Line(uchar x1,uchar y1,uchar x2,uchar y2,uchar Mode) reentrant;
extern void Draw_Image(uchar*G_Buffer,uchar Start_Row,uchar Start_Co1) reentrant;
extern void Display_Str_at_xy(uchar x,uchar y,char *Buffer,uchar wb) reentrant;
extern void Cls();
void Show_Score_and_Bullet() reentrant;
sbit K1=P1^4; //上移
sbit K2=P1^5; //下移
sbit K3=P1^6; //发射
sbit K4=P1^7; //重新开始
sbit BEEP=P1^0; //蜂鸣器
code uchar const Game_Surface[] = //游戏封面图像160*110
{ 160,110,
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,0x0F,0xFC,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0E,0x1F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xDF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFC,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x7F,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xFF,0xFF,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0x7F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x7F,0xFF,0xF0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFC,0xFF,
0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xFC,0x3F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xFF,0xFC,0x07,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x80,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF0,
0x1F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFE,0x03,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xC0,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF8,0x0F,0xFF,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x01,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0xFF,0xE0,0x3F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFC,0x0F,0xFF,0xF0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x01,0xFF,
0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xE0,0x3F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xFF,0xFC,0x07,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x80,0xFF,0xFE,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF0,
0x1F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0xFF,0xFE,0x03,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xC0,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF8,0x0F,0xFF,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x000x00,0xFF,
0xFE,0x03,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0xFF,0xC0,0x7F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xF0,0x0F,0xFF,0xE0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x01,0xFF,
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xC0,0x7F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x01,0xFF,0xFE,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE0,
0x3F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0xFF,0xFC,0x07,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x83,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x7F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE7,0xFF,0xFF,0xFF,
0x07,0x80,0x00,0x00,0x00,0x03,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,
0xFF,0xFF,0xFF,0xFF,0xCF,0xC0,0x00,0x00,0x00,0x07,0xFF,0xFF,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x1F,0xFF,0xFF,
0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,
0x00,0x3F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x03,0xFF,
0xFF,0xE0,0x00,0x00,0x00,0x7F,0xC0,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0xFF,0xC0,0x7F,0xFF,0xE0,0x00,0x00,0x00,0xFF,0x00,0x03,0xFC,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x00,0x01,0xFC,0x00,0x00,
0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0x01,0xFF,0xFE,0x00,0x00,
0x01,0xF8,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x9F,0xFF,0xC0,
0x3F,0xFF,0x80,0x00,0x03,0xF0,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1F,0x03,0xFF,0xF8,0x0F,0xFF,0xF0,0x00,0x07,0xE0,0x00,0x00,0x1F,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x3F,0x00,0x7F,0xFF,0x07,0xFF,0xFE,0x00,0x07,0xE0,0x00,0x00,
0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x0F,0xFF,0xE7,0xFF,0xFE,0x00,
0x07,0xC0,0x00,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x01,0xFF,
0xFF,0xFF,0xFE,0x00,0x0F,0xC0,0x00,0x00,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x3E,0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x00,0x0F,0x80,0x00,0x00,0x07,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x0F,0xFF,0xFF,0x9E,0x00,0x0F,0x80,0x00,0x00,
0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x01,0xFF,0xFF,0x82,0x00,
0x0F,0x80,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,
0x3F,0xFF,0xC0,0x00,0x1F,0x80,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x1F,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x0F,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x80,0x00,0x00,0x1F,0xFF,0xFE,0x00,0x0F,0x80,0x00,0x00,
0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xC0,0x00,0x00,0x3F,0xFF,0xFE,0x00,
0x0F,0x80,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x00,
0x7F,0xFB,0xFE,0x00,0x0F,0x80,0x00,0x00,0x07,0xC0,0x03,0xFF,0xC0,0x00,0x00,0x00,
0x07,0xF8,0x00,0x01,0xFE,0xFF,0xFE,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x1F,0xFF,
0xF8,0x00,0x00,0x00,0x03,0xFE,0x00,0x07,0xFC,0xFF,0xFE,0x00,0x07,0xC0,0x00,0x00,
0x0F,0x80,0x3F,0xFF,0xFC,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xF8,0xFF,0xFE,0x00,
0x07,0xE0,0x00,0x00,0x1F,0x80,0x7F,0xFF,0xFE,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,
0xF0,0xFF,0xFE,0x00,0x07,0xE0,0x00,0x00,0x1F,0x80,0xFF,0xFF,0xFF,0x00,0x00,0x00,
0x00,0x3F,0xFF,0xFF,0xC0,0xFF,0xFE,0x00,0x03,0xF0,0x00,0x00,0x3F,0x01,0xFE,0x00,
0x7F,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0xFF,0xFF,0x00,0x01,0xF8,0x00,0x00,
0x7E,0x01,0xF8,0x00,0x1F,0x00,0x00,0x00,0x00,0x03,0xFF,0xF8,0x00,0xFF,0xFF,0x00,
0x01,0xFC,0x00,0x00,0xFE,0x01,0xF0,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0xFF,0x80,0x00,0xFF,0x00,0x03,0xFC,0x01,0xF0,0x00,0x0F,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xC0,0x00,0x7F,0xC0,0x07,0xF8,0x01,0xF8,0x00,
0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xC0,0x00,0x3F,0xFF,0xFF,
0xF0,0x01,0xFE,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xE0,
0x00,0x1F,0xFF,0xFF,0xE0,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0xFF,0xE0,0x00,0x07,0xFF,0xFF,0x80,0x00,0x7F,0xFF,0xFE,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xF0,0x00,0x03,0xFF,0xFF,0x00,0x00,0x3F,0xFF,
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xF8,0x00,0x00,0x7F,0xF0,
0x00,0x00,0x1F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFC,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0xF8,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,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,0x60,0x30,0x00,0x30,0x00,0x30,0xC1,0x80,0x20,0x30,
0x00,0x21,0x80,0x00,0x0C,0xC0,0x00,0x00,0x00,0x00,0x40,0x30,0x00,0x30,0x00,0x38,
0xC9,0x80,0x33,0xFF,0x06,0x31,0x80,0x00,0x0D,0xC0,0x00,0x00,0x00,0x01,0xFC,0x30,
0x07,0xFF,0x00,0x06,0xC9,0x80,0x63,0xFE,0x03,0x89,0xF8,0x0F,0xCE,0x00,0x00,0x00,
0x00,0x01,0xFB,0xF8,0x07,0xB0,0x00,0x00,0xC9,0x80,0x88,0x40,0x00,0x7E,0x80,0x18,
0xDF,0xE0,0x00,0x00,0x00,0x01,0x8F,0x3E,0x00,0x30,0x00,0xF8,0xC9,0x81,0xFB,0xF0,
0x08,0x35,0xF8,0x0C,0xBE,0x00,0x00,0x00,0x00,0x01,0xF9,0x30,0x3F,0xFF,0xF8,0xC8,
0xC9,0x81,0x25,0xB0,0x0F,0x3C,0x70,0x0F,0xAC,0xC0,0x00,0x00,0x00,0x07,0xF9,0xB0,
0x3C,0x33,0xF8,0x08,0xC9,0x80,0xCB,0xFE,0x00,0x24,0x60,0x03,0x8D,0x80,0x00,0x00,
0x00,0x07,0xB8,0xB0,0x02,0x31,0x30,0x18,0xC9,0x81,0xF3,0x30,0x00,0x6F,0xFE,0x03,
0x87,0x80,0x00,0x00,0x00,0x00,0xE8,0x30,0x02,0x30,0x80,0x1E,0xC9,0x80,0x01,0xB4,
0x07,0x48,0x20,0x0E,0x47,0x00,0x00,0x00,0x00,0x03,0x88,0x30,0x06,0x30,0x80,0x1D,
0xC9,0x80,0xFB,0xB3,0x0E,0xC8,0x20,0x3C,0x1F,0x80,0x00,0x00,0x00,0x0F,0x58,0x70,
0x07,0xFF,0x80,0x3B,0x89,0x83,0xC6,0x31,0xC1,0x98,0x60,0x10,0xFB,0xF8,0x00,0x00,
0x00,0x00,0x79,0xE0,0x07,0xFF,0xC0,0x37,0x09,0x82,0x19,0xF1,0x82,0x77,0xE0,0x00,
0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xE0,
0x00,0x00,0xC0,0x00,0x00,0x20,0x00,0x00
};
uchar code Gun_Image[] = //枪支图像24*12
{ 24,12,
0x03,0x00,0x00,0x07,0x80,0x00,0x70,0x80,0x00,0x7F,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFC,0x7F,0xFF,0xFC,0x00,0x01,0xFC,0x00,0x01,0xFC,0x00,0x00,0x7F,0x00,0x00,
0x7F,0x00,0x00,0x1F
};
uchar tCount=0;
uchar HCount,LCount;
uchar Score=0,Bullet_Count=20; //得分,剩余弹药数
uchar Target_x=0,Target_y=0; //目标物体位置
uchar Pre_Target_y=0; //目标物体上次所在纵坐标位置
uchar gun_y=20; //枪支纵坐标,横坐标固定为16*8
//------------------------------------------------------------------------
//延时
//------------------------------------------------------------------------
void Delay(uint ms)
{
uchar i;
while (--ms) for (i=0;i<120;i++);
}
//------------------------------------------------------------------------
//键盘中断(INT0?
//------------------------------------------------------------------------
void EX_INT0() interrupt 0
{
//枪支位置上移
if(K1==0)
{
if(gun_y!=0) Display_Str_at_xy(16*8,gun_y," ",0);
gun_y-=8;
if(gun_y<20) gun_y=20;
Draw_Image(Gun_Image,gun_y,16);
}
else
//枪支位置下移
if(K2==0)
{
if(gun_y!=0) Display_Str_at_xy(16*8,gun_y," ",0);
gun_y+=8;
if(gun_y>100) gun_y=100;
Draw_Image(Gun_Image,gun_y,16);
}
else
//发射,模拟枪声,判断成绩
if(K3==0)
{
//如果有剩余弹药则启动T1,模拟枪声并发射
if(Bullet_Count!=0) TR1 =1;else return;
//绘制弹道线条
Line(10,gun_y+4,125,gun_y+4,1);
Delay(150);
Line(10,gun_y+4,125,gun_y+4,0);
//弹药递减
if(Bullet_Count!=0)
{
Bullet_Count--;
//判断成绩,Pre_Target_y用于保存目标物体上次所在纵坐标位置,
//避免物体在同一位置被反复多次击中而多次得分
if ( (gun_y+4)>Target_y&&(gun_y+4 )<Target_y+11&&Pre_Target_y!=Target_y )
{
Score++;pre_Target_y=Target_y ;
}
}
//刷新显示成绩与弹药数
Show_Score_and_Bullet();
}
else
//成绩与弹药数复位
if (K4==0)
{
Score=0;Bullet_Count=20;
Show_Score_and_Bullet();
}
}
//------------------------------------------------------------------------
//定时器0控制目标物体随机移动
//------------------------------------------------------------------------
void To_INT() interrupt 1
{
TH0=-50000/256;
TL0=-50000%256;
if(++tCount!=70) return;
tCount=0;
//清除原位置目标
if (Target_x!=0&&Target_y!=0)
Display_Str_at_xy(Target_x,Target_y," ",0);
Target_x=rand()%60+8;
Target_y=rand()%80+20;
while(abs(Pre_Target_y-Target_y)<4) Target_y=rand()%80+20;
//在新位置绘制目标物体
Display_Str_at_xy(Target_x,Target_y,"■",0);
}
//------------------------------------------------------------------------
//定时器1模拟枪声
//------------------------------------------------------------------------
void T1_INT() interrupt 3
{
BEEP=~BEEP;
if(LCount!=0)
{
TH1=HCount;TL1=--LCount;
}
else
if(--LCount!=0xFB)
{
TH1=HCount;TL1=--LCount;
}
else
{
TH1=HCount=-420/256;
TL1=LCount=-420%256;
BEEP=1;
TR1=0;
}
}
//------------------------------------------------------------------------
//显示成绩与剩余弹药
//------------------------------------------------------------------------
void Show_Score_and_Bullet() reentrant
{
char dat_str[4]={' ',0,0,0};
dat_str[1]=Score/10+'0';
dat_str[2]=Score%10+'0';
Display_Str_at_xy(37,117,dat_str,1);
dat_str[1]=Bullett_Count/10+'0';
dat_str[2]=Bullett_Count%10+'0';
Display_Str_at_xy(134,117,dat_str,1);
}
//------------------------------------------------------------------------
//主程序
//------------------------------------------------------------------------
void main
{
LED_Initialise(); //液晶初始化
Cls();
Draw_Image(Game_Surface,6,0); //显示游戏封面
Delay(5000);
Cls(); //显示固定文字
Display_Str_at_xy(12,1,"★★射击训练游戏★★",1);
Display_Str_at_xy(2,117,"得分:",0);
Display_Str_at_xy(75,117,"剩余弹药:",0);//显示成绩与剩余弹药
Show_Score_and_Bullet();
//绘制游戏区边框
Line(0,18,159,18,1);
Line(159,18,159,112,1);
Line(159,112,0,112,1);
Line(0,112,0,18,1);
//在初始位置绘制枪支
Draw_Image(Gun_Image,gun_y,16);
//允许T0,T1,INT0中断
IE=0x8B;
IP=0x01;
IT0=0x01;
TMOD=0x11;
TH0=-50000/256;
TL0=-50000%256;
TH1=Hcount=-420/256;
TL1=Lcount=-420%256;
TR0=1;
while(1);
}
|