www.pudn.com > GSM-M51.rar > ziku.c
/************************************* 文件名:ziku.c 功 能:处理编码转换和与字库相关的操作 *************************************/ #include#include #include "hal.h" #include "ziku.h" #include "unicode.h" //把unicode码转换为其在GB2312字库中的地址 ulong UNI2CBSP(uint hanzi) {ulong abspad; uchar x,y; for(y=0;y<72;y++) {for(x=0;x<96;x++) {if(hanzi==Unicode[y][x]) {break;} } if(hanzi==Unicode[y][x]) break; } abspad=((ulong)(((y+0x0f)*94)+(x-1)))*32; return(abspad); } //两个ASCII码转为单字节 uchar DoubleAscii2Byte(uchar ValH,uchar ValL) { uchar cHigh,cLow; if(ValH >= '0' && ValH <= '9') { cHigh = (ValH-'0')<<4; } else if(ValH >= 'A' && ValH <= 'F') { cHigh = (ValH-'A'+10)<<4; } else if(ValH >= 'a' && ValH <= 'f') { cHigh = (ValH-'a'+10)<<4; } else cHigh = 0; if(ValL >= '0' && ValL <= '9') { cLow = (ValL-'0'); } else if(ValL >= 'A' && ValL <= 'F') { cLow = (ValL-'A'+10); } else if(ValL >= 'a' && ValL <= 'f') { cLow = (ValL-'a'+10); } else cLow = 0; return ((cHigh & 0xf0)+(cLow & 0x0f)); } //设置分页,获取总线地址 uint DEAL_BANK(ulong zkad) {PAGE0 = zkad&0x008000; PAGE1 = zkad&0x010000; PAGE2 = zkad&0x020000; return((uint)zkad&0x7f); } //计算出最终的显示数据 void GET_DISDATA(void) {uint i; uchar j; for(i=0;i