?? chf.c
字號:
#include "buffer.h"
#include "const.h"
#include "dsa.h"
#include "dsc.h"
/*
#include "memmap.h"
*/
#include "fsosd.h"
#include "vcxi.h"
#include "echo.h"
#include "play.h"
#include "font.h"
#include "chf.h"
unsigned short download_time;
/*,game_flag = 0;*/
/*int echo_old = -1;*/
void debugOsd1(int, unsigned short);
void PANA_GAME_send_data(unsigned char);
void select_vcd();
void download_data(int dst, unsigned int *srcp, int n);
void delay_one_second();
void MDC_GAME_rst()
{
RESET_USE;
delay_one_second();
RESET_NO_USE;
PANA_GAME_send_data(0x0f);
;
LATCH_LOW;
LATCH_HIGH;
RESET_USE;
delay_one_second();
RESET_NO_USE;
}
void PANA_GAME_send_data(unsigned char data)
{
*(unsigned char *)0x18000000=data;
}
void delay_one_second()
{
int i,j;
for (i=0; i<8500; i++) {
for (j=0; j<50; j++) {
;
;
}
}
}
void MDC_GAME_stopgame()
{
/*
if (game_flag == 1) {
vcx_echo = echo_old;
if (vcx_echo == -1){
MIC_stop_take_in();
}
if (vcx_echo == 0) {
MIC_init();
MIC_start_take_in();
}
}
*/
AVSEL_VCD;
MDC_GAME_rst();
/* game_flag = 0; */
#ifdef HUASHENG_REMOTE
VFD_icon(VFDICON_game_off);
#endif
}
void MDC_play_game(play_item,play_size)
{
unsigned int * ptr;
unsigned char * pVcd;
unsigned int *pTk;
int sector_num,time,time1,n,size,retry_cnt = 0;
/* echo_old = vcx_echo;*/
vcx_echo = -1;
MIC_stop_take_in();
/* game_flag = 1; */
vcx_audio_volume = 0;
/* retry_cnt = 0;*/
game_retry:
sector_num = 0;
time = play_item;
time1 = 0x00;
size = play_size/2 /10 + 1;
for (sector_num = 0;sector_num < size;sector_num ++) {
if (!getSectors(time + time1, 10, 2048)) {
return;
}
if (((sector_num + 0x01) * 10) >= 75) {
if ((time & 0xf00) == 0x0900)
time1 = hex2bcd[(sector_num + 0x01) * 10 - 75] & 0xff | 0x700;
else {
if (((sector_num + 0x01) * 10) >= (75 * 2))
time1 = hex2bcd[(sector_num + 0x01) * 10 - 75 - 75] & 0xff | 0x200;
else
time1 = hex2bcd[(sector_num + 0x01) * 10 - 75] & 0xff | 0x100;
}
}
else
time1 = hex2bcd[(sector_num + 0x01) * 10] & 0xff;
if (sector_num >= 1)
debugOsd1(5, hex2bcd[size - sector_num]);
pVcd = (unsigned char *) dram(VBV_start);
ptr = (unsigned int *) pVcd;
if (sector_num == 0) {
if (((*ptr >> 16) & 0xffff)!= 0x4d59) { /* MY */
return ;
}
RESET_USE;
delay_one_second();
RESET_NO_USE;
delay_one_second();
RESET_USE;
delay_one_second();
RESET_NO_USE;
delay_one_second();
RESET_USE;
delay_one_second();
RESET_NO_USE;
}
if ((BUSY_HIGH) && (retry_cnt < 3)) {
retry_cnt ++;
goto game_retry;
}
download_data(0, ptr, 2048 * 10 /4);
}
if ((BUSY_HIGH) || (retry_cnt >= 3))
select_vcd();
else {
retry_cnt ++;
goto game_retry;
}
vcx_audio_volume = 0x1010;
dsa_stop();
OSD_clear_all();
}
void download_data(dst, srcp, n)
unsigned int *srcp; /* source ptr in SRAM */
int n; /* block size in dwords */
{
int i;
while (n--) {
for (i=0; i<20000; i++) {
if (BUSY_LOW) goto l1;
}
l1: PANA_GAME_send_data((*srcp >> 24) & 0xff);
/* if (n == 2048 * 10 /4 - 1) debugOsd(10,(*srcp >> 24) & 0xff);*/
;
;
LATCH_LOW;
LATCH_HIGH;
for (i=0; i<20000; i++) {
if (BUSY_LOW) goto l2;
if (i == 0x10000 ){
select_vcd();
return;
}
}
l2: PANA_GAME_send_data((*srcp >> 16) & 0xff);
;
;
LATCH_LOW;
LATCH_HIGH;
for (i=0; i<20000; i++) {
if (BUSY_LOW) goto l3;
if (i == 10000 ){
select_vcd();
return;
}
}
l3: PANA_GAME_send_data((*srcp >> 8) & 0xff);
;
;
LATCH_LOW;
LATCH_HIGH;
for (i=0; i<20000; i++) {
if (BUSY_LOW) goto l4;
if (i == 10000 ){
select_vcd();
return;
}
}
l4: PANA_GAME_send_data(*srcp & 0xff);
;
;
LATCH_LOW;
LATCH_HIGH;
srcp ++;
/* for (i=0; i<2000; i++) ;*/
}
}
char hex2ascii1[]={
'0','1','2','3',
'4','5','6','7',
'8','9','A','B',
'C','D','E','F'
};
void debugOsd1(i,code)
unsigned short code;
int i;
{
char array[9];
array[8]=0;
array[0]= ' ';
array[1]= CN_SHENG4;
array[2]= CN_YU2;
array[3]= ' ';
array[4]= ' ';
array[7]= ' ';
array[5]=hex2ascii1[(code>>4) & 0xf ];
array[6]=hex2ascii1[ code & 0xf];
OUTOSD(i,array,array,2);
}
void select_vcd( )
{
AVSEL_GAME;
vcx_echo = 0;
MIC_init();
MIC_start_take_in();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -