?? msosd.lst
字號(hào):
232 3 }
233 2 }
234 1
235 1 if (_minus && len>=0)// add sign
C51 COMPILER V8.01 MSOSD 11/28/2006 08:08:09 PAGE 5
236 1 Osd_DrawChar(xPos+(len--), yPos, (BYTE)'-');
237 1
238 1 _minus=(_minus)?(0):(1);
239 1 for (; _minus<=len; _minus++)
240 1 Osd_DrawChar(xPos+_minus, yPos, (BYTE)' ');
241 1 }
242
243 void Osd_DrawNum(BYTE xPos, BYTE yPos, WORD value)
244 {
245 1 DrawNum(xPos, yPos, 3, value);
246 1 }
247
248 //===================================================================================
249 #define GuageFontStart 0xF0
250 #define GuageFontEnd 0xF1
251 #define GuageFont0_4 0x12
252 #define GuageFont1_4 0x13
253 #define GuageFont2_4 0x14
254 #define GuageFont3_4 0x15
255 #define GuageFont4_4 0x16
256
257 void Osd_DrawGuage(BYTE xPos, BYTE yPos, BYTE length, BYTE value)
258 {
259 1 BYTE leadPtr;
260 1 WORD tempValue;
261 1 BYTE ucBank;
262 1
263 1 ucBank=msReadByte(BK0_00_REGBK);
264 1
265 1 if (xPos==0xF0)
266 1 {
267 2 Osd_DrawChar(0, yPos, '-');
268 2 Osd_DrawChar(length+1, yPos, '+');
269 2 xPos=0;
270 2 }
271 1
272 1 leadPtr=(WORD)value*length/10; // resver 0.1
273 1
274 1 #define i value
275 1
276 1 tempValue=(WORD)yPos*OsdWindowWidth+(xPos+1); // get real address
277 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
278 1 msWriteWord(BK0_A9_DISPAA_H, tempValue); // display font attribute
279 1 msWriteWord(BK0_A6_DISPCA_H, tempValue); // dispaly font code
280 1
281 1 tempValue=leadPtr/10;
282 1 if (tempValue==length && value<100)
283 1 tempValue--;
284 1
285 1 for (i=1; i<=tempValue; i++) // fill font with value
286 1 {
287 2 msWriteByte(BK0_A7_DISPCD, tASCII2FONT[GuageFont4_4]);
288 2 msWriteByte(BK0_AA_DISPAD, OsdFontColor);
289 2 }
290 1
291 1 i=i+1;
292 1
293 1 if (i<=length) // fill font without value
294 1 {
295 2 tempValue=(WORD)yPos*OsdWindowWidth+(xPos+i); // get real address
296 2 msWriteWord(BK0_A9_DISPAA_H, tempValue); // display font attribute
297 2 msWriteWord(BK0_A6_DISPCA_H, tempValue); // dispaly font code
C51 COMPILER V8.01 MSOSD 11/28/2006 08:08:09 PAGE 6
298 2
299 2 for (; i<=length; i++)
300 2 {
301 3 msWriteByte(BK0_A7_DISPCD, tASCII2FONT[GuageFont0_4]);
302 3 msWriteByte(BK0_AA_DISPAD, OsdFontColor);
303 3 }
304 2 }
305 1 #undef i
306 1
307 1 if (leadPtr<length*10)
308 1 {
309 2 value=leadPtr%10;
310 2 xPos+=leadPtr/10+1;
311 2 leadPtr=((WORD)value*12+5)/10;
312 2 if (leadPtr<3 && value)
313 2 leadPtr=3;
314 2 Osd_DrawChar(xPos, yPos, GuageFont0_4+leadPtr/3);
315 2 }
316 1 msWriteByte(BK0_00_REGBK, ucBank);
317 1 }
318
319 void Osd_Show(void)
320 {
321 1 BYTE ucBank;
322 1 ucBank=msReadByte(BK0_00_REGBK);
323 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
324 1
325 1 msWriteOSDByte(OSD_0C_IOSDC1, (DoubleXSize<<4)|(DoubleYSize<<6)|MWIN_B);
326 1 msWriteByte(BK0_00_REGBK, ucBank);
327 1 }
328
329 void Osd_Hide(void)
330 {
331 1 BYTE ucBank;
332 1 ucBank=msReadByte(BK0_00_REGBK);
333 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
334 1
335 1 msWriteOSDByte(OSD_0C_IOSDC1, 0x00);
336 1 msWriteByte( BK0_00_REGBK, ucBank);
337 1 }
338
339 void msWriteOSDByte(BYTE address, BYTE value)
340 {
341 1 BYTE ucBank;
342 1 ucBank=msReadByte(BK0_00_REGBK);
343 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
344 1
345 1 msWriteByte(BK0_A1_OSDRA, address);
346 1 msWriteByte(BK0_A2_OSDRD, value);
347 1 msWriteByte( BK0_00_REGBK, ucBank);
348 1 }
349
350 BYTE msReadOSDByte(BYTE address)
351 {
352 1 BYTE UcTemp,ucBank;
353 1 ucBank=msReadByte(BK0_00_REGBK);
354 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
355 1
356 1 msWriteByte(BK0_A1_OSDRA, address);
357 1 UcTemp=msReadByte(BK0_A2_OSDRD);
358 1 msWriteByte( BK0_00_REGBK, ucBank);
359 1 return UcTemp;
C51 COMPILER V8.01 MSOSD 11/28/2006 08:08:09 PAGE 7
360 1 }
361
362
363 // ============================
364 // Draw Hex for DEBUG
365 BYTE Hex2ASCII(BYTE Num)
366 {
367 1 return (Num<10)?(Num+0x30):(Num+0x37);
368 1 }
369
370
371 void DrawHex(BYTE xPos, BYTE yPos, WORD value)
372 {
373 1 char len=3;
374 1 while (value && len>=0)
375 1 {
376 2 Osd_DrawChar(xPos+(len--), yPos, (BYTE)Hex2ASCII(value%0x10));
377 2 value/=0x10;
378 2 }
379 1
380 1 if (len>0)
381 1 {
382 2 for (value=0; value<=len; value++)
383 2 Osd_DrawChar(xPos+value, yPos, (BYTE)'0');
384 2 }
385 1 }
386
387 void Osd_DrawHex(BYTE xPos, BYTE yPos, WORD value)
388 {
389 1 DrawHex(xPos, yPos, value);
390 1 }
391
392 void msWriteInvertMonoCompressTblBurst(BYTE ucReg, BYTE *pTable, WORD wNum)
393 { BYTE ucLineCnt;
394 1 BYTE ucTmp1, ucTmp2;
395 1 BYTE ucData[3];
396 1 BOOL bOdd = TRUE;
397 1 BYTE uc1, uc2;
398 1 while(wNum)
399 1 {
400 2 WatchDogClear();
401 2 // Get data
402 2 ucTmp1 = *(pTable++);
403 2 ucLineCnt = (ucTmp1 >> 4) + 1;
404 2 ucTmp1 &= 0x0f;
405 2 ucTmp2 = *(pTable++);
406 2 wNum -= 2;
407 2
408 2 for( uc1 = 0; uc1 < ucLineCnt; uc1++ )
409 2 {
410 3 if( bOdd )
411 3 { // Odd line
412 4 bOdd = FALSE;
413 4 ucData[0] = ucTmp1;
414 4 ucData[1] = ucTmp2;
415 4 }
416 3 else
417 3 { // Even line
418 4 bOdd = TRUE;
419 4 ucData[0] |= (ucTmp1<<4);
420 4 ucData[2] = ucTmp2;
421 4
C51 COMPILER V8.01 MSOSD 11/28/2006 08:08:09 PAGE 8
422 4 for( uc2 = 0; uc2 < 3; uc2++ ) // Write 3 bytes to chip
423 4 msWriteByte(ucReg, ucData[uc2]);
424 4
425 4 }
426 3 }
427 2 }
428 1
429 1 }
430
431 void Osd_LoadInvertFont(BYTE ucType, BYTE ucAddr, BYTE *pFont, WORD wNum)
432 {
433 1 BOOL bCompress=FALSE;
434 1 BYTE ucBank;
435 1 ucBank=msReadByte(BK0_00_REGBK);
436 1 if(ucType&InvertCOMPRESS_DATA)
437 1 {
438 2 bCompress = TRUE;
439 2 ucType &= (~InvertCOMPRESS_DATA);
440 2 }
441 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
442 1 msWriteByte(BK0_A3_RAMFA, ucAddr); // OSD RAM font address
443 1 //msWriteByte(BK0_A0_OSDIOA, ucType | InvertOSD_IO_BURST_MODE | InvertOSD_IO_AUTO_INCREASE); // write
-enable
444 1 WatchDogClear();
445 1 msWriteInvertMonoCompressTblBurst(BK0_A4_RAMFD, pFont, wNum);
446 1 //msWriteByte(BK0_A0_OSDIOA, InvertOSD_IO_WRITE_END | InvertOSD_IO_BURST_MODE | InvertOSD_IO_AUTO_INCR
-EASE); // write end
447 1 msWriteByte(BK0_00_REGBK, ucBank);
448 1 }
449
450 #ifdef Multi_language
void Osd_LoadDymaticFont(void)
{
Osd_Hide();
msWriteByte(BK0_A0_OSDIOA, 0x9E);
if(g_VideoSetting.Language==LANG_SChinese)
{
putstr("enter china");
Osd_LoadInvertFont(InvertDRAM_MONO_FONT_BUS|InvertCOMPRESS_DATA, 0, &tCompressChinaFontData, sizeof(t
-CompressChinaFontData));
}
else
{
putstr("enter east");
Osd_LoadInvertFont(InvertDRAM_MONO_FONT_BUS|InvertCOMPRESS_DATA, 0,&tCompressMonoFontData,sizeof(tCom
-pressMonoFontData));
}
Osd_LoadFont(ColorFontStart, &tOSDFont1, sizeof(tOSDFont1));
Delay1ms(30);
}
#endif
C51 COMPILATION COMPLETE. 1 WARNING(S), 2 ERROR(S)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -