Exemplo n.º 1
0
static unsigned int MyRead16 (unsigned int a) {
	unsigned int addr=a&0xFFFFF;
	unsigned int b=((a&0xF0000)>>16);
	//printf("read 32 %08x\n",a);
	a&=0xFFFFFF;

	switch((a&0xFF0000)>>20) {
	case 0x0:
		return (READ_WORD_ROM(memory.rom.cpu_m68k.p + addr))&0xFFFF;
		break;
	case 0x2:
		if (memory.bksw_unscramble)
			return mem68k_fetch_bk_normal_word(a);
		return (READ_WORD_ROM(memory.rom.cpu_m68k.p + bankaddress + addr))&0xFFFF;

		break;
	case 0x1:
		return (READ_WORD_ROM(memory.ram + (addr&0xFFFF)))&0xFFFF;
		break;
	case 0xC:
		if (b<=1) return (READ_WORD_ROM(memory.rom.bios_m68k.p + addr))&0xFFFF;
		break;

	case 0xd:
		if (b==0) return mem68k_fetch_sram_word(a)&0xFFFF;
		break;
	case 0x4:
		if (b==0) return mem68k_fetch_pal_word(a)&0xFFFF;
		break;
	case 0x3:
		if (b==0xC) return mem68k_fetch_video_word(a)&0xFFFF;
		if (b==0) return mem68k_fetch_ctl1_word(a)&0xFFFF;
		if (b==4) return mem68k_fetch_ctl2_word(a)&0xFFFF;
		if (b==8) return mem68k_fetch_ctl3_word(a)&0xFFFF;
		if (b==2) return mem68k_fetch_coin_word(a)&0xFFFF;
		break;
	case 0x8:
		if (b==0) return mem68k_fetch_memcrd_word(a)&0xFFFF;
		break;
	}

	return 0xF0F0;
}
Exemplo n.º 2
0
static unsigned int   MyRead32 (unsigned int a) {
	//int i;
	unsigned int addr=a&0xFFFFF;
	unsigned int b=((a&0xF0000)>>16);
	a&=0xFFFFFF;

	switch((a&0xFF0000)>>20) {
	case 0x0:
		//return mem68k_fetch_cpu_long(a);
		return ((READ_WORD_ROM(memory.rom.cpu_m68k.p + addr))<<16) | 
			(READ_WORD_ROM(memory.rom.cpu_m68k.p + (addr+2)));
		break;
	case 0x2:
		//return mem68k_fetch_bk_normal_long(a);
		if (memory.bksw_unscramble)
			return mem68k_fetch_bk_normal_long(a);
		return ((READ_WORD_ROM(memory.rom.cpu_m68k.p + bankaddress + addr))<<16) | 
			(READ_WORD_ROM(memory.rom.cpu_m68k.p + bankaddress + (addr+2)));
		break;
	case 0x1:
		//return mem68k_fetch_ram_long(a);
		addr&=0xFFFF;
		return ((READ_WORD_ROM(memory.ram + addr))<<16) | 
			(READ_WORD_ROM(memory.ram + (addr+2)));
		break;
	case 0xC:
		//return mem68k_fetch_bios_long(a);
		if (b<=1) return ((READ_WORD_ROM(memory.rom.bios_m68k.p + addr))<<16) | 
				 (READ_WORD_ROM(memory.rom.bios_m68k.p + (addr+2)));
		break;

	case 0xd:
		if (b==0) return mem68k_fetch_sram_long(a);
		break;
	case 0x4:
		if (b==0) return mem68k_fetch_pal_long(a);
		break;
	case 0x3:
		if (b==0xC) return mem68k_fetch_video_long(a);
		if (b==0) return mem68k_fetch_ctl1_long(a);
		if (b==4) return mem68k_fetch_ctl2_long(a);
		if (b==8) return mem68k_fetch_ctl3_long(a);
		if (b==2) return mem68k_fetch_coin_long(a);
		break;
	case 0x8:
		if (b==0) return mem68k_fetch_memcrd_long(a);
		break;
	}

	return 0xFF00FF00;
}
Exemplo n.º 3
0
void setup_misc_patch(char *name) {


	if (!strcmp(name, "ssideki")) {
		WRITE_WORD_ROM(&memory.rom.cpu_m68k.p[0x2240], 0x4e71);
	}

	//if (!strcmp(name, "fatfury3")) {
	//	WRITE_WORD_ROM(memory.rom.cpu_m68k.p, 0x0010);
	//}

	if (!strcmp(name, "mslugx")) {
		/* patch out protection checks */
		int i;
		Uint8 *RAM = memory.rom.cpu_m68k.p;
		for (i = 0; i < memory.rom.cpu_m68k.size; i += 2) {
			if ((READ_WORD_ROM(&RAM[i + 0]) == 0x0243)
					&& (READ_WORD_ROM(&RAM[i + 2]) == 0x0001) && /* andi.w  #$1, D3 */
			(READ_WORD_ROM(&RAM[i + 4]) == 0x6600)) { /* bne xxxx */

				WRITE_WORD_ROM(&RAM[i + 4], 0x4e71);
				WRITE_WORD_ROM(&RAM[i + 6], 0x4e71);
			}
		}

		WRITE_WORD_ROM(&RAM[0x3bdc], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3bde], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3be0], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3c0c], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3c0e], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3c10], 0x4e71);

		WRITE_WORD_ROM(&RAM[0x3c36], 0x4e71);
		WRITE_WORD_ROM(&RAM[0x3c38], 0x4e71);
	}

}
Exemplo n.º 4
0
Arquivo: emu.c Projeto: gillotte/gxgeo
void setup_misc_patch(char *name)
{
    sram_protection_hack = -1;
    if (!strcmp(name,"fatfury3") ||
            !strcmp(name,"samsho3") ||
            !strcmp(name,"samsho3a") ||
            !strcmp(name,"samsho4") ||
            !strcmp(name,"aof3") ||
            !strcmp(name,"rbff1") ||
            !strcmp(name,"rbffspec") ||
            !strcmp(name,"kof95") ||
            !strcmp(name,"kof96") ||
            !strcmp(name,"kof96h") ||
            !strcmp(name,"kof97") ||
            !strcmp(name,"kof97a") ||
            !strcmp(name,"kof97pls") ||
            !strcmp(name,"kof98") ||
            !strcmp(name,"kof98k") ||
            !strcmp(name,"kof98n") ||
            !strcmp(name,"kof99") ||
            !strcmp(name,"kof99a") ||
            !strcmp(name,"kof99e") ||
            !strcmp(name,"kof99n") ||
            !strcmp(name,"kof99p") ||
            !strcmp(name,"kof2000") ||
            !strcmp(name,"kof2000n") ||
            !strcmp(name,"kizuna") ||
            !strcmp(name,"lastblad") ||
            !strcmp(name,"lastblda") ||
            !strcmp(name,"lastbld2") ||
            !strcmp(name,"rbff2") ||
            !strcmp(name,"rbff2a") ||
            !strcmp(name,"mslug2") ||
            !strcmp(name,"mslug3") ||
            !strcmp(name,"garou") ||
            !strcmp(name,"garouo") ||
            !strcmp(name,"garoup"))
        sram_protection_hack = 0x100;



    if (!strcmp(name, "pulstar"))
        sram_protection_hack = 0x35a;


    if (!strcmp(name, "ssideki")) {
        WRITE_WORD_ROM(&memory.cpu[0x2240], 0x4e71);
    }


    if (!strcmp(name, "fatfury3")) {
        WRITE_WORD_ROM(memory.cpu, 0x0010);
    }


    /* Many mgd2 dump have a strange initial PC, so as some MVS */
    if ((!strcmp(name, "aodk")) ||
            (!strcmp(name, "bjourney")) ||
            (!strcmp(name, "maglord")) ||
            (!strcmp(name, "mosyougi")) ||
            (!strcmp(name, "twinspri")) ||
            (!strcmp(name, "whp")) ||
            (conf.rom_type == MGD2) ||
            (CF_BOOL(cf_get_item_by_name("forcepc"))) ) {
        Uint8 *RAM = memory.cpu;
        WRITE_WORD_ROM(&RAM[4], 0x00c0);
        WRITE_WORD_ROM(&RAM[6], 0x0402);
    }

    if (!strcmp(name, "mslugx")) {
        /* patch out protection checks */
        int i;
        Uint8 *RAM = memory.cpu;
        for (i = 0; i < memory.cpu_size; i += 2) {
            if ((READ_WORD_ROM(&RAM[i + 0]) == 0x0243) &&
                    (READ_WORD_ROM(&RAM[i + 2]) == 0x0001) &&  /* andi.w  #$1, D3 */
                    (READ_WORD_ROM(&RAM[i + 4]) == 0x6600)) {  /* bne xxxx */

                WRITE_WORD_ROM(&RAM[i + 4], 0x4e71);
                WRITE_WORD_ROM(&RAM[i + 6], 0x4e71);
            }
        }

        WRITE_WORD_ROM(&RAM[0x3bdc], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3bde], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3be0], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3c0c], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3c0e], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3c10], 0x4e71);

        WRITE_WORD_ROM(&RAM[0x3c36], 0x4e71);
        WRITE_WORD_ROM(&RAM[0x3c38], 0x4e71);
    }


}