原代码如下:
#include<bios.h>
#include<dos.h>
#include<stdlib.h>
#include<stdio.h>
#include<graphics.h>
#define LEFT
0x4b00
#define RIGHT 0x4d00
#define BS
8
#define F1
0x3b00
#define TAB
0xf09
#define ESC
0x011b
#define DOWN
0x5000
#define UP
0x4800
#define ENTER 0x1c0d
#define C 1046.5
#define D 1174.7
#define E 1318.5
#define HD 587.3
#define HE 659.3
#define HF 698.5
#define HG 784
#define HA 880
#define HB 987.8
#define HC 523.3
#define TIMER 0x1c
int queue[4],rear;
int TimerCounter,tab,codeshow,sign,j,count[8]={1,2,4,8,16,32,64,128};
unsigned char ch;
union KeyIn
{
int x;
char h;
}accept;
void CodeCut()
{
setfillstyle(0,0);
bar(0,280,640,380);
codeshow=0;
_SoundKey();
}
void Enqueue(int value)
{
rear=(rear+1)%4;
queue[rear]=value;
}
void Compare()
{
int value=(rear+1)%4;
if(queue[value]==UP&&queue[(value+1)%4]==UP&&queue[(value+2)%4]==DOWN&&queue[(value+3)%4]==DOWN)
{ tab=1; SoundErr(); }
}
void interrupt (*OldTimer)();
void interrupt NewTimer()
{ TimerCounter++; OldTimer(); }
void SetTimer(void interrupt (*faddr)())
{
OldTimer=getvect(TIMER);
disable();
setvect(TIMER,faddr);
enable();
}
void KillTimer()
{
disable();
setvect(TIMER,OldTimer);
enable();
}
void CodeGraph()
{
int i,t,k,n;
unsigned char a[36],b[2],s;
b[1]='\0';
KillTimer();
setcolor(RED);
for(k=0,i=48;i<58;i++,k++)a[k]=i;
for(i=65;i<91;i++,k++)a[k]=i;
t=284;
k=0;
for(i=170;i<410;i+=24)
{
b[0]=a[k++];
outtextxy(i,t,b);
}
n=k;
for(;i<483;i+=32)
{
s=itoa(n++,b,10);
outtextxy(i,t,b);
}
t+=15; b[1]='\0';
for(i=170;i<386;i+=24)
{
b[0]=a[k++];
outtextxy(i,t,b);
}
for(;i<495;i+=30)
{
b[0]=a[k++];
outtextxy(i,t,b);
}
t+=15;
for(i=476;i>386;i-=30)
{
b[0]=a[k++];
outtextxy(i,t,b);
}
for(;i>151;i-=24)
{
b[0]=a[k++];
outtextxy(i,t,b);
}
t+=15;
for(i=476;i>386;i-=30)
{
s=itoa(n++,b,10);
outtextxy(i,t,b);
}
for(;i>151;i-=24)
{
s=itoa(n++,b,10);
outtextxy(i,t,b);
}
codeshow=1;
SoundKey();
SetTimer(NewTimer);
}
void Help(int value)
{
unsigned char mat[9][24][3]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,
0x00,0x02,0x01,0xE0,0x02,0x1E,0x60,0x02,
0x10,0x60,0x02,0x17,0x40,0x02,0x08,0x40,
0x07,0x88,0x40,0x3E,0x0F,0x80,0x02,0x08,
0x00,0x02,0x81,0xF8,0x03,0x3E,0x00,0x06,
/*提0*/
0x02,0x00,0x0E,0x22,0x00,0x3A,0x33,0xC0,
0xE2,0x32,0x00,0x42,0x6E,0x00,0x02,0x43,
0x00,0x02,0x81,0xC0,0x0F,0x00,0x7C,0x06,
0x00,0x3E,0x04,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x01,
0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xF8,0x01,0xFF,
/*示1*/
0xFC,0x3F,0x18,0x00,0x00,0x18,0x00,0x00,
0x08,0x00,0x02,0x08,0xC0,0x06,0x08,0x60,
0x06,0x08,0x30,0x0C,0x08,0x10,0x04,0x18,
0x00,0x00,0x78,0x00,0x00,0x18,0x00,0x00,
0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x18,
0x00,0x00,0x08,0x00,0x00,0x00,0x70,0x04,
0xFF,0x98,0x0F,0x00,0x30,0x08,0x02,0x20,
0x18,0x32,0x00,0x00,0x06,0x60,0x04,0x8C,
/*密2*/
0x38,0x0C,0x98,0x18,0x08,0x70,0x80,0x08,
0x7D,0xE0,0x00,0x8F,0x80,0x03,0x10,0x00,
0x0C,0x18,0x00,0x10,0x08,0xC0,0x01,0x08,
0x40,0x01,0x08,0x40,0x01,0x0B,0xC0,0x03,
0xF4,0x40,0x03,0x00,0x40,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0xE0,0x00,0x0E,0x60,0x03,
0xC0,0x60,0x1E,0x08,0x40,0x03,0x04,0x40,
0x03,0x04,0x40,0x02,0x04,0x40,0x06,0x04,
/*码3*/
0x40,0x0D,0xCC,0x98,0x0E,0xCF,0xFE,0x0C,
0xCC,0x04,0x14,0x80,0x04,0x37,0xC0,0x4C,
0x24,0x0F,0xEC,0x44,0x78,0x0C,0x00,0x00,
0x0C,0x00,0x00,0x08,0x00,0x00,0x38,0x00,
0x00,0x18,0x00,0x00,0x10,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,
0x00,0x01,0xF1,0x80,0x00,0x81,0x00,0x00,
0x99,0x00,0x00,0xE3,0x00,0x00,0x42,0x00,
0x00,0x4E,0x00,0x00,0x72,0x00,0x00,0x01,
0xE0,0x00,0x3F,0x00,0x07,0xD8,0x00,0x08,
/*是4*/
0x18,0x00,0x01,0x19,0x80,0x03,0x1E,0x00,
0x03,0x10,0x00,0x06,0xD0,0x00,0x0C,0x30,
0x00,0x08,0x0C,0x00,0x30,0x07,0xC0,0x40,
0x01,0xFF,0x00,0x00,0x78,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x01,0x81,0x00,0x01,0x10,0x80,0x01,
0x11,0x80,0x05,0x21,0x80,0x07,0x01,0x00,
0x01,0xF3,0x00,0x1F,0x02,0xFC,0x03,0x67,
0x80,0x05,0x28,0x80,0x09,0x08,0xC0,0x11,
0x08,0x80,0x21,0x24,0x80,0x03,0xE3,0x80,
/*数5*/
0x7E,0x61,0x00,0x02,0x43,0x80,0x03,0x82,
0x40,0x01,0xC4,0x70,0x02,0x78,0x3C,0x0C,
0x00,0x1E,0x30,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x38,
0x00,0x00,0x18,0x00,0x00,0x01,0xE0,0x04,
0xFE,0x70,0x0F,0x00,0x60,0x0C,0x00,0x80,
0x18,0x3E,0x00,0x01,0xC6,0x00,0x00,0x0C,
/*字6*/
0x00,0x00,0x28,0x00,0x00,0x10,0x60,0x00,
0x3F,0xF8,0x3F,0xC8,0x00,0x18,0x08,0x00,
0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x0C,
0x00,0x00,0x0C,0x00,0x00,0x48,0x00,0x00,
0x38,0x00,0x00,0x18,0x00,0x00,0x10,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x03,
0x80,0x00,0x0C,0xC0,0x00,0x00,0xC0,0x00,
0x00,0x80,0x00,0x00,0xF8,0x18,0x0F,0x8F,
0xFE,0x31,0x84,0x0C,0x03,0x86,0x08,0x02,
/*和7*/
0xE2,0x08,0x06,0xB2,0x18,0x0C,0x82,0xF8,
0x18,0x83,0x00,0x30,0x82,0x00,0x40,0x80,
0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x01,0xBF,0x80,0x00,0xC1,0x80,0x00,
0x81,0x80,0x00,0x91,0x80,0x01,0x99,0x80,
0x01,0x01,0x80,0x01,0x07,0xFE,0x07,0xF9,
/*母8*/
0x80,0x79,0x01,0x80,0x03,0x11,0x80,0x02,
0x19,0x80,0x02,0x01,0x00,0x06,0x01,0x00,
0x0F,0xFF,0xF0,0x08,0x01,0x30,0x00,0x03,
0x00,0x00,0x1B,0x00,0x00,0x06,0x00,0x00,
0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x00}
};
int x,y,a,i,k,n;
KillTimer();
if(codeshow)CodeCut();
setfillstyle(1,BLUE);
bar(150,290,500,370);
setcolor(RED);
rectangle(150,290,500,370);
/* 字模 -1 数字 0 字母 1 数字+字母 */
x=160; y=300;
for(a=0;a<2;a++)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
y+=30;
x+=10;
for(;a<5;a++)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
switch(value)
{
case -1:for(a=5;a<7;a++)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
break;
case 0:for(a=6;a<9;a+=2)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
break;
case 1:for(a=5;a<8;a++)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
for(a=6;a<9;a+=2)
{
for(i=0;i<24;i++)
for(k=0;k<3;k++)
for(n=0;n<8;n++)
{
if(mat[a][i][k]&(0x80>>n))putpixel(x+k*8+n,y+i,RED);
}
x+=30;
}
break;
}
SoundErr();
delay(650000);
delay(650000);
delay(650000);
delay(650000);
setfillstyle(0,0);
bar(150,290,500,370);
SetTimer(NewTimer);
}
void SoundTime()
{
/*1568*/
/*5000*/
sound(784);delay(1000);nosound();
}
void _SoundTime()
{
sound(1568);delay(1000);nosound();
}
SoundKey()
{
int i;
/*1500*/
for(i=400;i<1200;i+=120)
{ sound(i);delay(1000);nosound(); }
}
_SoundKey()
{
int i;
for(i=1500;i>400;i-=120)
{
/*10000*/
sound(i);delay(1000);nosound();
}
}
SoundErr()
{
sound(1200);delay(75000);nosound();
}
void _SoundErr()
{
sound(1200);delay(30000);nosound();
sound(1200);delay(75000);nosound();
sound(1200);delay(75000);nosound();
}
void Sound_Err()
{
int i;
for(i=0;i<3;i++)
{ sound(1200);delay(75000);nosound(); }
}
void TimeGraph()
{
int x=111,i;
setfillstyle(1,BLUE);
for(i=0;i<30;i++)
{
bar(x,400,x+5,450);
x+=7;
}
setfillstyle(1,YELLOW);
for(i=0;i<20;i++)
{
bar(x,400,x+5,450);
x+=7;
}
setfillstyle(1,RED);
for(i=0;i<10;i++)
{
bar(x,400,x+5,450);
x+=7;
}
}
void _TimeGraph()
{
setfillstyle(1,BLUE);
bar(170,400,320,450);
setfillstyle(1,YELLOW);
bar(320,400,420,450);
setfillstyle(1,RED);
bar(420,400,470,450);
}
void CutTime(int x)
{
setfillstyle(0,0);
bar(x,399,x+7,451);
}
void _CutTime(int x)
{
setcolor(BLACK);
line(x,399,x,451);
}
void PutStage(char *s)
{
setcolor(WHITE);
settextstyle(0,0,3);
outtextxy(220,50,"STAGE");
outtextxy(380,50,s);
}
void Eraser(int y)
{
setfillstyle(0,0);
bar(y,230,y+10,240);
}
void DelCode()
{
setfillstyle(0,0);
bar(219,229,359,239);
_SoundKey();
}
void translate(char *s)
{
int i;
for(i=0;s[i];i++)s[i]-=4;
}