📄 osd.c
字号:
// f/w 0.46 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// begin by Sunny
// define OSD mode. Please type the number you choose.
// OSD_FONT_HEITI 0
// OSD_FONT_WEIBEI 1
#define OSD_FONT 1
// OSD_BAR_0 0 ==========
// OSD_BAR_1 1 |||||:::::
// OSD_BAR_2 2 ||||||||||
#define OSD_BAR 2
//end by Sunny $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// define it, the number part OSD will display as reversed
//#define OSD_VERSION2
// define the max. display chars in screen
#define MAX_DISPLAY 128
#define MAX_DIGEST_PALLETE 18
// assume each char take 20 bits(align at col 20.)
// use guide pointer 1
#define OSD_GUIDE1 0x0002
// the outline effect
#define OUTLINE_UPPER_LEFT 0x0800 // bit 11
#define OUTLINE_LOWER_RIGHT 0x1000 // bit 12
#define OUTLINE_WHOLE 0x1800
#define OUTLINE_NONE 0x2000 // bit 13=1 will turn off all outline
// the ratio between OSD and picture
#define TFACTOR_0 0x0000 //1/2 OSD + 1/2 PIC
#define TFACTOR_1 0x0100 //1/4 OSD + 3/4 PIC
#define TFACTOR_2 0x0200 //1/8 OSD + 7/8 PIC
#define TFACTOR_3 0x0300 //1/16 OSD + 15/16 PIC
#define TFACTOR_4 0x0400 //1/2 OSD + 1/2 PIC
#define TFACTOR_5 0x0500 //3/4 OSD + 1/4 PIC
#define TFACTOR_6 0x0600 //7/8 OSD + 1/8 PIC
#define TFACTOR_7 0x0700 //15/16 OSD+ 1/16 PIC
// enable the OSD display
#define OSD_ENABLE 1 // bit 0
#define OLCTL_VALUE OUTLINE_WHOLE
#define TFACTOR_VALUE TFACTOR_7 // bit 10-8
// the display ram bank
#define ONE_BANK 0xC000
#define BANK_1 0x8000
#define BANK_0 0x4000
// bit 19-18
#define COLOR_INDEX_0 0x00000 // can not be used
#define COLOR_INDEX_1 0x40000 // red
#define COLOR_INDEX_2 0x80000 // yellow
#define COLOR_INDEX_3 0xC0000 // green
// right upper message color
#define COLOR_FOR_RU COLOR_INDEX_3
// left bottom message color
#define COLOR_FOR_LB COLOR_INDEX_1
// the reverse effect
#define OSD_REVERSE_ON 0x100000 // bit 20
#define OSD_REVERSE_OFF 0x000000
// the BC5380 OSD bitmap font size is 20*20
#define CHAR_HEIGHT 20
// each row will need 3 bytes(max to 24 bits) to present
#define CHAR_BYTES 3
// each english OSD will take 4 columns
#define ENGLISH_COLUMNS 4 //16/4
// each chinese OSD will take 5 columns
#define CHINESE_COLUMNS 5 //20/4
#define EXTERN_FONT_INDEX 0x60
#define BITMAP0_MAX_FONTS 0x0B
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the first row, column for PROGRAM mode
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
// the first row of PROGRAM mode
#define PROGRAM_START_ROW 4
// the start col of PROGRAM mode
#define PROGRAM_START_COL (5*ENGLISH_COLUMNS)
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the first row, column of BOOKMARK mode
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
// the first row of BOOKMARK mode
#define BOOKMARK_START_ROW 2
// the start col of BOOKMARK mode
#define BOOKMARK_START_COL (7*ENGLISH_COLUMNS)
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the right alignment column for right upper message
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
#define ALIGN_RIGHT_COLUMN (20*ENGLISH_COLUMNS)
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the first row, column of DISPLAY mode 1
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
#define DISPLAY_START_ROW 1
#define DISPLAY_START_COL (ENGLISH_COLUMNS*2)
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the bitmap index for each status of
// E---DISPLAY mode 1(only for Chinese OSD)
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
#ifndef ENGLISH_OSD
#define ITEM1_START 0
#define ITEM1_LENGTH 3 //PBC
#define MOUHOW_START (ITEM1_START+ITEM1_LENGTH)
#define ITEM2_START (MOUHOW_START+1)
#define ITEM2_LENGTH 2 //TRACK
#define ITEM3_START (ITEM2_START+ITEM2_LENGTH)
#define ITEM3_LENGTH 2 //MODE
#define ITEM4_START (ITEM3_START+ITEM3_LENGTH)
#define ITEM4_LENGTH 2 //TIME
// the start bitmap font index PBC status use
#define STATUS1_START 0
#define STATUS1_LENGTH (1)
// the start bitmap font index TRACK number use
#define STATUS2_START (STATUS1_START+STATUS1_LENGTH)
#define STATUS2_LENGTH (2)
// the start bitmap font index MODE status use
#define STATUS3_START (STATUS2_START+STATUS2_LENGTH)
#define STATUS3_LENGTH (4)
// the start bitmap font index TIME status use
#define STATUS4_START (STATUS3_START+STATUS3_LENGTH)
#define STATUS4_LENGTH1 (2)
#define STATUS4_LENGTH2 (2)
#endif //#ifdef ENGLISH_OSD
//ENGLISH_OSD end
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the first row, column of DISPLAY mode 2
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
#define DISPLAY_MODE2_START_ROW 1
#define DISPLAY_MODE2_1ST_COL 6
#define DISPLAY_MODE2_2ND_COL 30
#define DISPLAY_MODE2_3RD_COL 66
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the bitmap index start for each status of
// M---DISPLAY mode 2
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
// these status do not need use bitmap RAM
#define MODE2_TRACK_START 0
#define MODE2_TRACK_LENGTH 0
#define MODE2_TIME_START 0
#define MODE2_TIME_LENGTH 0
#define MODE2_TV_START 0
#define MODE2_TV_LENGTH 0
#define MODE2_PBC_START 0
#define MODE2_PBC_LENGTH 0
// these status will use bitmap RAM 0(0-11)
#define MODE2_SPECIAL_START 0
#define MODE2_SPECIAL_LENGTH 4
#define MODE2_SPECIAL_RAM 0
#define MODE2_VOLUME_START (MODE2_SPECIAL_START+MODE2_SPECIAL_LENGTH)
#define MODE2_VOLUME_LENGTH 2
#define MODE2_VOLUME_RAM 0
#define MODE2_SURROUND_START (MODE2_VOLUME_START+MODE2_VOLUME_LENGTH)
#define MODE2_SURROUND_LENGTH 4
#define MODE2_SURROUND_RAM 0
#define MODE2_AUDIO_START (MODE2_SURROUND_START+MODE2_SURROUND_LENGTH)
#define MODE2_AUDIO_LENGTH 1
#define MODE2_AUDIO_RAM 0
// these status will use bitmap RAM 1(12-25)
#define MODE2_DISC_START 0
#define MODE2_DISC_LENGTH 4
#define MODE2_DISC_RAM 1
#define MODE2_PLAY_START (MODE2_DISC_START+MODE2_DISC_LENGTH)
#define MODE2_PLAY_LENGTH 4
#define MODE2_PLAY_RAM 1
#define MODE2_TRACKS_START (MODE2_PLAY_START+MODE2_PLAY_LENGTH)
#define MODE2_TRACKS_LENGTH 1
#define MODE2_TRACKS_RAM 1
#define MODE2_ECHO_START (MODE2_TRACKS_START+MODE2_TRACKS_LENGTH)
#define MODE2_ECHO_LENGTH 2
#define MODE2_ECHO_RAM 1
#define MODE2_KEY_START (MODE2_ECHO_START+MODE2_ECHO_LENGTH)
#define MODE2_KEY_LENGTH 2
#define MODE2_KEY_RAM 1
// R---rem---rem---rem---rem---rem---rem---rem---rem---rem
// E---define the message corner ID
// M---rem---rem---rem---rem---rem---rem---rem---rem---rem
#define LEFT_UPPER 0x00
#define LEFT_BOTTOM 0x01
#define RIGHT_UPPER 0x80
#define RIGHT_BOTTOM 0x81
#define CENTER_CORNER 0x82
#include <string.h>
#include "vcd25.h"
#include "osd.h"
#include "cc.h"
#include "pio.h"
#include "utl.h"
#include "w9925.h"
#include "cdinfo.h"
#include "digest.h"
void _OSD_ShowDigestNumber(WORD wValue);
BYTE _OSD_ShowLogo();
//!!! Can't use __wTemp, __bTemp as temp variable,
//main F/W may still use it after calling OSD_Output
//white
/*
WORD w1=0xEB;
WORD w2=0x80;
WORD w3=0x80;
*/
DWORD _dwColorIndex=COLOR_FOR_RU;
DWORD _dwReverseEffect=OSD_REVERSE_OFF;
WORD _wReverseFrom=0xFFFF; // means no inverse for all
BYTE _bReAssignIndex=FALSE; // true means use external OSD font
BYTE _bInternalIndex; // internal OSD fonts index
WORD _wOSDEffect = 0; // outline, factor
WORD _wOSDDEMO = OLCTL_VALUE|TFACTOR_VALUE;
BIT _btREVERSEON = FALSE;
BIT _btDisplayMode2 = 0;
//WORD _wZoomParam;
// for storing the EA state temporarily
BYTE _bEA;
// the bitmap RAM or display RAM address for accessing
WORD _wAddress;
// the offset to the Chinese array
WORD _wOffsetTemp;
// index to the bitmap RAM for building the bitmap font
BYTE _bIndexOffset;
// to control access bitmap RAM 0 or 1
BIT _btBitmapRAM;
// the last time update the DISPLAY information(in trigger function)
WORD _wPreTime;
// no of bitmap fonts to build of number of display char to write
BYTE _bNoChars;
// flag for forcing to update the DISPLAY information
BIT _btForceDisplay=FALSE;
// extern BIT __btInputProgram;
// current show the right upper message status
BYTE _bShowRUForever=FALSE;
// current show the left bottom message status
BYTE _bShowLBForever=FALSE;
// current show the center message status
BYTE _bShowCEForever=FALSE;
// current message show on right upper
BYTE _bShowRUMessage=NULL;
// current message show on left bottom
BYTE _bShowLBMessage=NULL;
// current message show on center
BYTE _bShowCEMessage=NULL;
// the group type for message
BYTE _bMessageGroup=NULL;
// the array store the bitmap fonts index that right upper message will use
BYTE _bRMessageArray[13];
// the array store the bitmap fonts index that left bottom message will use
BYTE _bLMessageArray[13];
// flag TRUE indicate that need build the _bRMessageArray data to bitmap RAM
BIT _btBuildRBitmap=FALSE;
// flag TRUE indicate that need build the _bLMessageArray data to bitmap RAM
BIT _btBuildLBitmap=FALSE;
WORD _wIgnoreOSD=NULL; // the incoming next N OSD messages to be discarded
typedef struct
{
BYTE bMessage;
WORD wParam;
BYTE bType;
} MESSAGESTACK;
// pointer to a message array
MESSAGESTACK *_OSDStatcks;
// pointer to current stack deep
BYTE *_bStackDeep;
BYTE *_gbHoldSec;
BYTE *_bShowMessage;
BYTE *_bForeverMessage;
// array for storing the right upper messages
MESSAGESTACK _bOSDRStacks[4];
// the right upper messages
BYTE _bRStackDeep=0;
// array for storing the left bottom upper messages
MESSAGESTACK _bOSDLStacks[4];
// the left bottom messages
BYTE _bLStackDeep=0;
// array for storing the center messages
MESSAGESTACK _bOSDCStacks[4];
// the center messages
BYTE _bCStackDeep=0;
BIT _OSD_RecoverMessage(BYTE bCorner);
// the last message need show again
BYTE _bRecoverMessage;
// the parameter for the recover message
WORD _wRecoverParam;
// pointer to the __bProgramData array
BYTE *_bpProgram=NULL;
// pointer to a bitmap font array
BYTE *_bIndexArray=NULL;
// current number of programmed tracks
BYTE _bProgramIndex=0;
// flag TRUE indicate that need program bitmap index into the _wDisplayArray first
BIT _btPrepareData=TRUE;
extern DWORD data __dwCountSystem;
// the display time for right upper message
BYTE _gbRUHoldSec=0;
// the display time for center message
BYTE _gbCEHoldSec=0;
// the display time for left bottom message
BYTE _gbLBHoldSec=0;
// the start show time for the message
DWORD _dwStartShowTime;
// _bTimeIndex can be used only of GOTOTIME
BYTE _bTimeIndex=0xff; // record current gotime input digits
BIT _bOSDInitial=FALSE; // OSD intial is successful,
// so can start display OSD
BYTE k,l; // for initial array
BYTE _bLOGO=FALSE; // current is not show LOGO
// for bookmark(5*6)+2
// max. is 32
// the array for storing data to write to Display RAM
// the WORD[0] store the number of chars to display
// the first data to write to display RAM is from WORD[1]
// BC5380
// each display data will occupy 21 bits
// total 256 chars
DWORD _dwDisplayArray[MAX_DISPLAY];
int __iRow=10,__iCol=10; // row, col position for display char
STATUS gcShowStatus;
// record the Scan or slow factor
BYTE _bSpeedFactor;
// the number of display chars to display
// BC5380
// total 256 chars(use one bank)
// each back max. can display to 128 chars
WORD _wDisplayChars=0;
BYTE code aMsgSpace[]= {1, CHAR_SPACE};
BYTE code aMsg3D1[] = {4,CHAR_SPACE,CHAR_N_3DL1,CHAR_N_3DR1,CHAR_SPACE};
BYTE code aMsg3D2[] = {4,CHAR_SPACE,CHAR_N_3DL2,CHAR_N_3DR2,CHAR_SPACE};
BYTE code aMsg3D3[] = {4,CHAR_SPACE,CHAR_N_3DL3,CHAR_N_3DR3,CHAR_SPACE};
BYTE code aMsg3D4[] = {4,CHAR_N_3DL4 ,CHAR_N_3DL3 ,CHAR_N_3DR3 ,CHAR_N_3DR4 };
BYTE code aMsg3D5[] = {4,CHAR_N_3DL5 ,CHAR_N_3DL3,CHAR_N_3DR3,CHAR_N_3DR5};
BYTE code aMsg3D6[] = {4,CHAR_N_3DL6 ,CHAR_N_3DL3,CHAR_N_3DR3,CHAR_N_3DR6};
#ifdef ENGLISH_OSD
BYTE code aMsgZoom1[] ={8, CHAR_O, CHAR_R, CHAR_I, CHAR_G, CHAR_I, CHAR_N, CHAR_A, CHAR_L};
BYTE code aMsgZoom2[] ={6, CHAR_Z, CHAR_O, CHAR_O, CHAR_M, CHAR_X, CHAR_2};
BYTE code aMsgZoom4[] ={6, CHAR_Z, CHAR_O, CHAR_O, CHAR_M, CHAR_X, CHAR_4};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -