📄 jumpgame.c
字号:
/* SCCSID @(#)jumpgame.c 1.21 2/27/98 */register volatile int *mvd asm("r27");#include "common.h"#include "mvd.h"#include "dsc.h"#include "timedef.h"#include "const.h"#include "panelcmd.h"#ifdef DRAM_GAME#include "util.h"#include "display.h"#include "ngame.h"#endif#ifdef JUMPGAME#define DEASSERT_DSC_STROBE SET_AUX5volatile int Jump_addr=0; #ifdef DRAM_GAME#define NGAME_MEM_OFFSET_0 0x00 /* MEM_OFFSET1 & MEM_OFFSET0 */#define NGAME_MEM_OFFSET_1 0x04 /* MEM_OFFSET1 & MEM_OFFSET0 */#define NGAME_MEM_OFFSET_2 0x08 /* MEM_OFFSET1 & MEM_OFFSET0 */#define NGAME_MEM_OFFSET_3 0x0c /* MEM_OFFSET1 & MEM_OFFSET0 */extern int regtable[];PRIVATE int save_irqmask, save_buscon_irqmask;PRIVATE void switch_to_game(void);#endif /* DRAM_GAME */JumpGame(){ extern void BB_jump30(); unsigned int timer; int i;#ifndef CUST3 addMicroRing(SHOW_MSG | SHOW_EVD30); for (i = 0; i < 40; i++) microEngine();#endif#ifdef JUMP_512K system_reset(); timer = glbTimer + EIGHTH_SECOND;#ifdef DSC DSC_cmd(dsc_watchdog, 0);#endif do {} while (glbTimer < timer); mvd[riface_irqmask]=0; DEASSERT_DSC_STROBE; Jump_addr >>=2; asm("ld _Jump_addr[r25],r2"); asm("addi r0,#0,r4"); asm("jspci r2,#0,r0"); asm("nop"); asm("nop");#else /* 256K JUMP */ /* Stop the CD */ /* * Switch to browser. First kill all DMA stuff. Wait a bit just to * be on the safe side. */ system_reset(); timer = glbTimer + EIGHTH_SECOND;#ifdef DSC DSC_cmd(dsc_watchdog, 0);#endif do {} while (glbTimer < timer);#ifdef DRAM_GAME /* Save registers before jump */ save_irqmask = mvd[riface_irqmask]; save_buscon_irqmask = gbl_buscon_irqmasks;#endif /* Disable interrupt */ mvd[riface_irqsuppress] = 0; asm("nop"); asm("nop"); mvd[riface_irqmask]=0;#ifdef DRAM_GAME#ifdef DISABLE_BOSCON /* Disable all DMA interrupts */ mvd[buscon_dma_irqmasks] = 0; /* Disable all BUSCON DMA */ mvd[buscon_dma_disable] = 0x3fffff;#endif#endif#ifdef DSC#ifndef DRAM_GAME DSC_cmd(dsc_dvectl3, 0x0); /* Power down video */#endif#endif #ifdef SHARE_DATA BB_jump30(T_uCode_EVD, T_uCode_EVD_SZ/sizeof(int));#endif#ifdef DRAM_GAME if (which_game == RUN_RAM_CLEAR) { which_game = RUN_REAL_GAME; *(int *)0x20 = RUN_RAM_CLEAR;#ifdef NGAME_PARALLEL_PORT /* Run game at offset 0x12030000 (mode 3) */ NGAME_control(1, NGAME_MEM_OFFSET_3);#endif } else { *(int *)0x20 = RUN_REAL_GAME;#ifdef NGAME_PARALLEL_PORT *(int *)0x24 = mirroring; /* Run game at offset 0x12030000 (mode 3) */ NGAME_control(1, NGAME_MEM_OFFSET_3 | mapper);#else *(int *)0x24 = (mirroring >> 3) | (mapper << 1);#endif /* DRAM_GAME */ } switch_to_game();#else /* jump to the other appliaction */ /* r22 => jump_addr / 4 */ asm("addi r0,#0x33f,r22"); asm("lsl r22,r22,#16"); asm("addi r22,#0xff00,r22"); asm("jspci r22,#0,r0"); asm("nop"); asm("nop");#endif#endif /* JUMP_512K */}#ifdef DRAM_GAMEPRIVATE void switch_to_game(void){ /* Save all registers before jump */ asm("st _regtable+1*4[r0],r1"); asm("st _regtable+2*4[r0],r2"); asm("st _regtable+3*4[r0],r3"); asm("st _regtable+4*4[r0],r4"); asm("st _regtable+5*4[r0],r5"); asm("st _regtable+6*4[r0],r6"); asm("st _regtable+7*4[r0],r7"); asm("st _regtable+8*4[r0],r8"); asm("st _regtable+9*4[r0],r9"); asm("st _regtable+10*4[r0],r10"); asm("st _regtable+11*4[r0],r11"); asm("st _regtable+12*4[r0],r12"); asm("st _regtable+13*4[r0],r13"); asm("st _regtable+14*4[r0],r14"); asm("st _regtable+15*4[r0],r15"); asm("st _regtable+16*4[r0],r16"); asm("st _regtable+17*4[r0],r17"); asm("st _regtable+18*4[r0],r18"); asm("st _regtable+19*4[r0],r19"); asm("st _regtable+20*4[r0],r20"); asm("st _regtable+21*4[r0],r21"); asm("st _regtable+22*4[r0],r22"); asm("st _regtable+23*4[r0],r23"); asm("st _regtable+24*4[r0],r24"); asm("st _regtable+25*4[r0],r25"); asm("st _regtable+26*4[r0],r26"); asm("st _regtable+27*4[r0],r27"); asm("st _regtable+28*4[r0],r28"); asm("st _regtable+29*4[r0],r29"); asm("st _regtable+30*4[r0],r30"); asm("st _regtable+31*4[r0],r31"); /* Jump */ asm("addi r0,#0x33f,r22"); asm("lsl r22,r22,#16"); asm("addi r22,#0xff00,r22"); asm("jspci r22,#0,r31"); asm("nop"); asm("nop"); /* restore registers */ asm("ld _regtable+1*4[r0],r1"); asm("ld _regtable+2*4[r0],r2"); asm("ld _regtable+3*4[r0],r3"); asm("ld _regtable+4*4[r0],r4"); asm("ld _regtable+5*4[r0],r5"); asm("ld _regtable+6*4[r0],r6"); asm("ld _regtable+7*4[r0],r7"); asm("ld _regtable+8*4[r0],r8"); asm("ld _regtable+9*4[r0],r9"); asm("ld _regtable+10*4[r0],r10"); asm("ld _regtable+11*4[r0],r11"); asm("ld _regtable+12*4[r0],r12"); asm("ld _regtable+13*4[r0],r13"); asm("ld _regtable+14*4[r0],r14"); asm("ld _regtable+15*4[r0],r15"); asm("ld _regtable+16*4[r0],r16"); asm("ld _regtable+17*4[r0],r17"); asm("ld _regtable+18*4[r0],r18"); asm("ld _regtable+19*4[r0],r19"); asm("ld _regtable+20*4[r0],r20"); asm("ld _regtable+21*4[r0],r21"); asm("ld _regtable+22*4[r0],r22"); asm("ld _regtable+23*4[r0],r23"); asm("ld _regtable+24*4[r0],r24"); asm("ld _regtable+25*4[r0],r25"); asm("ld _regtable+26*4[r0],r26"); asm("ld _regtable+27*4[r0],r27"); asm("ld _regtable+28*4[r0],r28"); asm("st 0x4028[r27],r0"); /* irqsupress */ asm("ld _regtable+29*4[r0],r29"); asm("ld _regtable+30*4[r0],r30"); asm("ld _regtable+31*4[r0],r31"); /* reinstall interrupt vector for VCD code */ install_interrupt_vectors(); /* restore interrupt mask */ mvd[riface_irqsuppress] = 0; asm("nop"); asm("nop"); mvd[riface_irqmask] = save_irqmask; mvd[buscon_dma_irqmasks] = save_buscon_irqmask; if (*(int *)0x24) process_power_off_key(); /* Initialize remote control */ IR_init(); { /* do_blank was set before loading game, now clear it */ extern int do_blank; do_blank = 0; } /* Hide garbage */ fill_screen(COLOR_BLACK);}#endif#endif /* JUMPGAME */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -