📄 term.c
字号:
{
write_byte(0xff);
}
}
if(onoff==0)
{
for(i=0;i<16;i++)
{
write_byte(0x00);
}
}
sed1335_write(csrw,csradd,2);
}
//设置光标 X Y 位置,X以字节8bit为单位,Y以线为单位。
void set_cursor(unsigned int x, unsigned int y)
{
unsigned int addr;
X=x; Y=y;
addr=y*40+x;
if(addr>0x2580) return;
csradd[0]=(unsigned char)addr;
csradd[1]=(unsigned char)(addr>>8);
sed1335_write(csrw,csradd,2);
}
/*写任何大小的一块, high点高度,width*8点为宽度*/
void wr_any(unsigned int XX,unsigned int YY, unsigned char *word,unsigned int high,unsigned int width)
{
int k=0;
unsigned char xy[2];
unsigned int adr=0;
adr=YY*40+XX;
xy[0]=(unsigned char)adr;
xy[1]=(unsigned char)(adr>>8);
for( k=0;k<width;k++)
{
sed1335_write(csrw,xy,2);
sed1335_write(csrdir_down,null,1);
sed1335_write(mwrite,word+high*k,high);
xy[0]++;
if(xy[0]==0) xy[1]++;
}
}
void wr_anyb(unsigned int XX,unsigned int YY, unsigned char *word,unsigned int high,unsigned int width)
{
int k=0;
unsigned char xy[2];
unsigned int adr=0;
for( k=0;k<high;k++)
{
adr=YY*40+XX;
xy[0]=(unsigned char)adr;
xy[1]=(unsigned char)(adr>>8);
sed1335_write(csrw,xy,2);
sed1335_write(csrdir_right,null,1);
sed1335_write(mwrite,word+width*k,width);
YY++;
}
}
void Write_Buff(unsigned int x,unsigned int y,unsigned char const wrd[],unsigned int high,unsigned int width)
{
unsigned int i,j;
for(i=0;i<high;i++)
for(j=0;j<width;j++)
Row[y+i].Xbyte[x+j]=wrd[i*width+j];
}
unsigned int widen_dot(unsigned char chr)
{
unsigned int wdtmp;
unsigned char low_data,high_data,k,j;
low_data=0;
high_data=0;
wdtmp=0;
k=0x01;j=3;
while(k<=8){
if(chr&k) low_data|=j;
k=k<<1; j=j<<2;
}
k=0x10; j=3;
while(k!=0){
if(chr&k) high_data|=j;
k=k<<1; j=j<<2;
}
wdtmp=low_data;
wdtmp<<=8;
wdtmp+=high_data;
return(wdtmp);
}
void Write_GChar(unsigned int x,unsigned int y,unsigned char str)
{
unsigned int i,pPt,tmp,xx,xoffset;
uint16 tmpdot;
uint32 tmplong;
pPt=(str-0x20)*16;
xx=x/8;
xoffset=x%8;
if(W_font==0)
{
if(H_font==0)
{
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
Row[y+i].Xbyte[xx]=(Row[y+i].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i].Xbyte[xx+1]=(Row[y+i].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
}
}
else
{
if(y>208)y=208;
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
Row[y+i*2].Xbyte[xx]=(Row[y+i*2].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2].Xbyte[xx+1]=(Row[y+i*2].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx]=(Row[y+i*2+1].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2+1].Xbyte[xx+1]=(Row[y+i*2+1].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
}
}
X+=8;
if(X>(320-8))
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
else
{
if(H_font==0)
{
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i].Xbyte[xx]=(Row[y+i].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i].Xbyte[xx+2]=(Row[y+i].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
}
}
else
{
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i*2].Xbyte[xx]=(Row[y+i*2].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2].Xbyte[xx+2]=(Row[y+i*2].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx]=(Row[y+i*2+1].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2+1].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2+1].Xbyte[xx+2]=(Row[y+i*2+1].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
}
}
X+=16;
if(X>(320-16))
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
}
void Write_GHZ(unsigned int x,unsigned int y,unsigned char hz0,unsigned char hz1)
{
long offset;
unsigned int i,xx,xoffset;
unsigned tmp;
uint16 tmpdot;
uint32 tmplong;
if(hz0>0xf7) return;
if(hz0>=0xb0) hz0-=0xb0;
hz1-=0xa1;
offset=hz0*94+hz1;
offset=32*offset;
xx=x/8;
xoffset=x%8;
if(W_font==0)
{
if(H_font==0)
{
for(i=0;i<16;i++)
{
tmp=hzdot[offset+i*2];
Row[y+i].Xbyte[xx]=(Row[y+i].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i].Xbyte[xx+1]=(Row[y+i].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
tmp=hzdot[offset+i*2+1];
Row[y+i].Xbyte[xx+1]=(Row[y+i].Xbyte[xx+1]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i].Xbyte[xx+2]=(Row[y+i].Xbyte[xx+2]&(0xff>>xoffset))|(tmp<<(8-xoffset));
}
}
else
{
for(i=0;i<16;i++)
{
tmp=hzdot[offset+i*2];
Row[y+i*2].Xbyte[xx]=(Row[y+i*2].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2].Xbyte[xx+1]=(Row[y+i*2].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx]=(Row[y+i*2+1].Xbyte[xx]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2+1].Xbyte[xx+1]=(Row[y+i*2+1].Xbyte[xx+1]&(0xff>>xoffset))|(tmp<<(8-xoffset));
tmp=hzdot[offset+i*2+1];
Row[y+i*2].Xbyte[xx+1]=(Row[y+i*2].Xbyte[xx+1]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2].Xbyte[xx+2]=(Row[y+i*2].Xbyte[xx+2]&(0xff>>xoffset))|(tmp<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx+1]=(Row[y+i*2+1].Xbyte[xx+1]&(0xff<<(8-xoffset)))|(tmp>>xoffset);
Row[y+i*2+1].Xbyte[xx+2]=(Row[y+i*2+1].Xbyte[xx+2]&(0xff>>xoffset))|(tmp<<(8-xoffset));
}
}
X+=16;
if(X>304)
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
else
{
if(H_font==0)
{
for(i=0;i<16;i++)
{
tmp=hzdot[offset+i*2];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i].Xbyte[xx]=(Row[y+i].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i].Xbyte[xx+2]=(Row[y+i].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
tmp=hzdot[offset+i*2+1];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i].Xbyte[xx+2]=(Row[y+i].Xbyte[xx+2]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i].Xbyte[xx+3]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i].Xbyte[xx+4]=(Row[y+i].Xbyte[xx+4]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
}
}
else
{
for(i=0;i<16;i++)
{
tmp=hzdot[offset+i*2];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i*2].Xbyte[xx]=(Row[y+i*2].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2].Xbyte[xx+2]=(Row[y+i*2].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx]=(Row[y+i*2+1].Xbyte[xx]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2+1].Xbyte[xx+1]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2+1].Xbyte[xx+2]=(Row[y+i*2+1].Xbyte[xx+2]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
tmp=hzdot[offset+i*2+1];
tmpdot=widen_dot(tmp);
tmplong=tmpdot;
Row[y+i*2].Xbyte[xx+2]=(Row[y+i*2].Xbyte[xx+2]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2].Xbyte[xx+3]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2].Xbyte[xx+4]=(Row[y+i*2].Xbyte[xx+4]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
Row[y+i*2+1].Xbyte[xx+2]=(Row[y+i*2+1].Xbyte[xx+2]&(0xff<<(8-xoffset)))|(((unsigned char)tmplong)>>xoffset);
Row[y+i*2+1].Xbyte[xx+3]=(((unsigned char)tmplong)<<(8-xoffset))|(((unsigned char)(tmplong>>8))>>xoffset);
Row[y+i*2+1].Xbyte[xx+4]=(Row[y+i*2+1].Xbyte[xx+4]&(0xff>>xoffset))|(((unsigned char)(tmplong>>8))<<(8-xoffset));
}
}
X+=32;
if(X>(320-32))
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
}
void Write_Char(unsigned int x,unsigned int y,unsigned char str)
{
unsigned int i,pPt,tmp;
uint16 tmpdot;
pPt=(str-0x20)*16;
if(W_font==0)
{
if(H_font==0)
{
for(i=0;i<16;i++)
Row[y+i].Xbyte[x]=chardot[pPt+i];
}
else
{
if(y>208)y=208;
for(i=0;i<16;i++)
{
Row[y+i*2].Xbyte[x]=chardot[pPt+i];
Row[y+i*2+1].Xbyte[x]=chardot[pPt+i];
}
}
X++;
if(X>39)
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
else
{ if(x>38)x=38;
if(H_font==0)
{
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
tmpdot=widen_dot(tmp);
Row[y+i].Xbyte[x]=(tmpdot&0xff);
Row[y+i].Xbyte[x+1]=((tmpdot&0xff00)>>8);
}
}
else
{
for(i=0;i<16;i++)
{
tmp=chardot[pPt+i];
tmpdot=widen_dot(tmp);
Row[y+i*2].Xbyte[x]=(tmpdot&0xff);
Row[y+i*2+1].Xbyte[x]=(tmpdot&0xff);
Row[y+i*2].Xbyte[x+1]=((tmpdot&0xff00)>>8);
Row[y+i*2+1].Xbyte[x+1]=((tmpdot&0xff00)>>8);
}
}
X+=2;
if(X>38)
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
}
void Write_HZ(unsigned int x,unsigned int y,unsigned char hz0,unsigned char hz1)
{
long offset;
unsigned int i,j;
unsigned tmp;
uint16 tmpdot;
if(hz0>0xf7) return;
if(hz0>=0xb0) hz0-=0xb0;
hz1-=0xa1;
offset=hz0*94+hz1;
offset=32*offset;
if(W_font==0)
{
if(X>38)X=38;
if(H_font==0)
{
for(i=0;i<16;i++)
for(j=0;j<2;j++)
Row[y+i].Xbyte[x+j]=hzdot[offset+i*2+j];
}
else
{
if(Y>217) Y=217;
for(i=0;i<16;i++)
for(j=0;j<2;j++)
{
Row[y+i*2].Xbyte[x+j]=hzdot[offset+i*2+j];
Row[y+i*2+1].Xbyte[x+j]=hzdot[offset+i*2+j];
}
}
X+=2;
if(X>38)
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
else
{
if(X>36)X=36;
if(H_font==0)
{
for(i=0;i<16;i++)
for(j=0;j<2;j++)
{
tmp=hzdot[offset+i*2+j];
tmpdot=widen_dot(tmp);
Row[y+i].Xbyte[x+j*2]=tmpdot&0xff;
Row[y+i].Xbyte[x+j*2+1]=((tmpdot&0xff00)>>8);
}
}
else
{
if(Y>217) Y=217;
for(i=0;i<16;i++)
for(j=0;j<2;j++)
{
tmp=hzdot[offset+i*2+j];
tmpdot=widen_dot(tmp);
Row[y+i*2].Xbyte[x+j*2]=(tmpdot&0xff);
Row[y+i*2+1].Xbyte[x+j*2]=(tmpdot&0xff);
Row[y+i*2].Xbyte[x+j*2+1]=((tmpdot&0xff00)>>8);
Row[y+i*2+1].Xbyte[x+j*2+1]=((tmpdot&0xff00)>>8);
}
}
X+=4;
if(X>36)
{
Y=Y+16*(1+H_font);
if(Y>(240-16*(1+H_font))) Y=0;
X=0;
}
}
}
void Write_StringHZ(unsigned int x,unsigned int y, char *strhz)
{
unsigned char hz[2];
while(1)
{
hz[0]=*strhz++;
if(hz[0]=='\0')break;
hz[1]=*strhz;
if(hz[1]=='\0')break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -