Exemple #1
0
void extcl_cpu_wr_mem_CPROM(WORD address, BYTE value) {
	DBWORD bank;

	/* bus conflict */
	value &= prg_rom_rd(address);

	control_bank_with_AND(0x03, info.chr.rom.max.banks_4k)
	bank = value << 12;
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x0C00);
}
Exemple #2
0
void extcl_cpu_wr_mem_200(WORD address, BYTE value) {
	BYTE save = (address & 0xFF);
	DBWORD bank;

	value = save;
	control_bank(info.prg.rom.max.banks_16k)
	map_prg_rom_8k(2, 0, value);
	map_prg_rom_8k(2, 2, value);
	map_prg_rom_8k_update();

	value = save;
	control_bank(info.chr.rom.max.banks_8k)
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);

	if (address & 0x0008) {
		mirroring_H();
	} else {
		mirroring_V();
	}
}
void extcl_cpu_wr_mem_74x161x161x32(WORD address, BYTE value) {
	/* bus conflict */
	const BYTE save = value &= prg_rom_rd(address);
	DBWORD bank;

	if (type == IC74X161X161X32B) {
		if (value & 0x80) {
			mirroring_SCR1();
		} else {
			mirroring_SCR0();
		}
	}

	control_bank_with_AND(0x0F, info.chr.rom[0].max.banks_8k)
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);

	value = save >> 4;
	control_bank(info.prg.rom[0].max.banks_16k)
	map_prg_rom_8k(2, 0, value);
	map_prg_rom_8k_update();
}
Exemple #4
0
void extcl_cpu_wr_mem_EH8813A(WORD address, BYTE value) {
	if ((eh88131a.address & 0x100) == 0) {
		DBWORD bank;

		eh88131a.address = address & 0x01FF;

		value &= 0x0F;
		control_bank(info.chr.rom[0].max.banks_8k)
		bank = value << 13;
		chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
		chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
		chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
		chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
		chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
		chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
		chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);

		value = eh88131a.address & 0x07;

		if (eh88131a.address & 0x80) {
			control_bank(info.prg.rom[0].max.banks_16k)
			map_prg_rom_8k(2, 0, value);
			map_prg_rom_8k(2, 2, value);
		} else {
			value >>= 1;
			control_bank(info.prg.rom[0].max.banks_32k)
			map_prg_rom_8k(4, 0, value);
		}
		map_prg_rom_8k_update();
	}
Exemple #5
0
void extcl_cpu_wr_mem_CNROM(WORD address, BYTE value) {
	DBWORD bank;

	/* bus conflict */
	if (info.mapper.submapper == CNROM_CNFL) {
		value &= prg_rom_rd(address);
	}

	if (mask) {
		if ((value & mask) == state) {
			cnrom_2627.chr_rd_enable = FALSE;
		} else {
			cnrom_2627.chr_rd_enable = TRUE;
		}
		value &= ~mask;
	}

	control_bank(info.chr.rom.max.banks_8k)
	bank = value << 13;

	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #6
0
void extcl_cpu_wr_mem_BB(WORD address, BYTE value) {
	BYTE save = value;
	DBWORD bank;

	if ((address & 0x9000) == 0x8000) {
		value = value & 0x03;
		control_bank(info.prg.rom[0].max.banks_8k)
		bb_prg_6000 = prg_chip_byte_pnt(0, value << 13);
		bb.reg = value;
		value = save;
	} else {
		value = value & 0x01;
	}

	control_bank(info.chr.rom[0].max.banks_8k);
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #7
0
void extcl_cpu_wr_mem_Irem_LROG017(WORD address, BYTE value) {
	/* bus conflict */
	const BYTE save = value &= prg_rom_rd(address);
	DBWORD bank;

	control_bank_with_AND(0x0F, info.prg.rom[0].max.banks_32k)
	map_prg_rom_8k(4, 0, value);
	map_prg_rom_8k_update();

	value = save >> 4;
	control_bank(info.chr.rom[0].max.banks_2k)
	bank = value << 11;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
}
Exemple #8
0
void extcl_cpu_wr_mem_Irem_G101(WORD address, BYTE value) {
	if (address >= 0xC000) {
		return;
	}

	switch (address & 0xF000) {
		case 0x8000:
			irem_G101.prg_reg = value;
			irem_G101_prg_rom_update();
			break;
		case 0x9000:
			if (info.mapper.submapper != G101B) {
				if (value & 0x01) {
					mirroring_H();
				} else {
					mirroring_V();
				}
			}
			irem_G101.prg_mode = value & 0x02;
			value = irem_G101.prg_reg;
			irem_G101_prg_rom_update();
			break;
		case 0xA000:
			control_bank(info.prg.rom[0].max.banks_8k)
			map_prg_rom_8k(1, 1, value);
			map_prg_rom_8k_update();
			break;
		case 0xB000:
			control_bank(info.chr.rom[0].max.banks_1k)
			chr.bank_1k[address & 0x0007] = chr_chip_byte_pnt(0, value << 10);
			break;
	}
}
Exemple #9
0
static void INLINE sl1632_update(void) {
	BYTE i, value;

	value = sl1632.prg_map[0];
	control_bank(info.prg.rom[0].max.banks_8k)
	map_prg_rom_8k(1, 0, value);
	value = sl1632.prg_map[1];
	control_bank(info.prg.rom[0].max.banks_8k)
	map_prg_rom_8k(1, 1, value);
	value = 0xFE;
	control_bank(info.prg.rom[0].max.banks_8k)
	map_prg_rom_8k(1, 2, value);
	value = 0xFF;
	control_bank(info.prg.rom[0].max.banks_8k)
	map_prg_rom_8k(1, 3, value);
	map_prg_rom_8k_update();

	for (i = 0; i < 8; i++) {
		value = sl1632.chr_map[i];
		control_bank(info.chr.rom[0].max.banks_1k)
		chr.bank_1k[i] = chr_chip_byte_pnt(0, value << 10);
	}

	sl1632_mirroring(sl1632.mirroring)
}
Exemple #10
0
void map_init_CPROM(void) {
	/* forzo i numeri di banchi della chr rom */
	info.chr.rom.banks_8k = 2;
	info.chr.rom.banks_4k = 4;
	info.chr.rom.banks_1k = 16;
	/* quindi setto nuovamente i valori massimi dei banchi */
	map_set_banks_max_prg_and_chr();

	if (info.reset >= HARD) {
		chr.bank_1k[4] = chr_chip_byte_pnt(0, 0x0000);
		chr.bank_1k[5] = chr_chip_byte_pnt(0, 0x0400);
		chr.bank_1k[6] = chr_chip_byte_pnt(0, 0x0800);
		chr.bank_1k[7] = chr_chip_byte_pnt(0, 0x0C00);
	}

	EXTCL_CPU_WR_MEM(CPROM);
}
Exemple #11
0
void extcl_cpu_wr_mem_BMC70IN1(WORD address, BYTE value) {
	if (address & 0x4000) {
		bmc70in1.reg[0] = address & 0x30;
		bmc70in1.reg[1] = address & 0x07;
	} else {
		if (address & 0x20) {
			mirroring_H();
		} else {
			mirroring_V();
		}

		if (bmc70in1_type == BMC70IN1B) {
			bmc70in1.reg[2] = (address & 0x03) << 3;
		} else {
			DBWORD bank;

			value = address & 0x07;
			control_bank(info.chr.rom[0].max.banks_8k)
			bank = value << 13;
			chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
			chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
			chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
			chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
			chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
			chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
			chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
			chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
		}
	}

	switch (bmc70in1.reg[0]) {
		case 0x00:
		case 0x10:
			value = bmc70in1.reg[2] | bmc70in1.reg[1];
			control_bank(info.prg.rom[0].max.banks_16k)
			map_prg_rom_8k(2, 0, value);

			value = bmc70in1.reg[2] | 0x07;
			control_bank(info.prg.rom[0].max.banks_16k)
			map_prg_rom_8k(2, 2, value);
			break;
		case 0x20:
			value = (bmc70in1.reg[2] | bmc70in1.reg[1]) >> 1;
			control_bank(info.prg.rom[0].max.banks_32k)
			map_prg_rom_8k(4, 0, value);
			break;
		case 0x30:
			value = bmc70in1.reg[2] | bmc70in1.reg[1];
			control_bank(info.prg.rom[0].max.banks_16k)
			map_prg_rom_8k(2, 0, value);
			map_prg_rom_8k(2, 2, value);
			break;
	}
	map_prg_rom_8k_update();
}
Exemple #12
0
void extcl_cpu_wr_mem_91(WORD address, BYTE value) {
	if (address < 0x6000) {
		return;
	}
	if (address <= 0x6FFF) {
		DBWORD bank;

		control_bank(info.chr.rom[0].max.banks_2k)
		bank = value << 11;

		switch (address & 0x0003) {
			case 0:
				chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
				chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
				return;
			case 1:
				chr.bank_1k[2] = chr_chip_byte_pnt(0, bank);
				chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0400);
				return;
			case 2:
				chr.bank_1k[4] = chr_chip_byte_pnt(0, bank);
				chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x0400);
				return;
			case 3:
				chr.bank_1k[6] = chr_chip_byte_pnt(0, bank);
				chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x0400);
				return;
		}
	}
	if (address < 0x7FFF) {
		switch (address & 0x0003) {
			case 0:
				control_bank(info.prg.rom[0].max.banks_8k)
				map_prg_rom_8k(1, 0, value);
				map_prg_rom_8k_update();
				return;
			case 1:
				control_bank(info.prg.rom[0].max.banks_8k)
				map_prg_rom_8k(1, 1, value);
				map_prg_rom_8k_update();
				return;
			case 2:
				m91.irq.active = 0;
				m91.irq.count = 0;
				irq.high &= ~EXT_IRQ;
				return;
			case 3:
				m91.irq.active = 1;
				irq.high &= ~EXT_IRQ;
				return;
		}
	}
}
Exemple #13
0
void extcl_cpu_wr_mem_Bandai_FCGX(WORD address, BYTE value) {
    if (address < 0x6000) {
        return;
    }

    if (!info.prg.ram.banks_8k_plus) {
        address |= 0x8000;
    }

    switch (address & 0x800F) {
    case 0x8000:
    case 0x8001:
    case 0x8002:
    case 0x8003:
    case 0x8004:
    case 0x8005:
    case 0x8006:
    case 0x8007: {
        const BYTE slot = address & 0x000F;

        if (info.prg.rom[0].banks_16k >= 32) {
            BYTE i;

            FCGX.reg[slot] = value;
            value = 0;
            for (i = 0; i < 8; i++) {
                value |= (FCGX.reg[i] << 4) & 0x10;
            }
            value |= ((mapper.rom_map_to[0] >> 1) & 0x0F);
            control_bank(info.prg.rom[0].max.banks_16k)
            map_prg_rom_8k(2, 0, value);

            value |= 0x0F;
            control_bank(info.prg.rom[0].max.banks_16k)
            map_prg_rom_8k(2, 2, value);

            map_prg_rom_8k_update();

            value = FCGX.reg[slot];
        }
        if (type == DATACH) {
            datach_set_scl((value << 2) & 0x20);
        }
        if (!mapper.write_vram) {
            control_bank(info.chr.rom[0].max.banks_1k)
            chr.bank_1k[slot] = chr_chip_byte_pnt(0, value << 10);
        }
        return;
    }
    case 0x8008:
        if (info.prg.rom[0].banks_16k >= 32) {
            value = ((mapper.rom_map_to[0] >> 1) & 0x10) | (value & 0x0F);
        }
Exemple #14
0
void extcl_cpu_wr_mem_Sachen_sa0036(WORD address, BYTE value) {
	DBWORD bank;

	value >>= 7;
	control_bank(info.chr.rom.max.banks_8k)
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #15
0
void extcl_cpu_wr_mem_Irem_H3000(WORD address, BYTE value) {
	switch (address & 0xF000) {
		case 0x8000:
			control_bank(info.prg.rom[0].max.banks_8k)
			map_prg_rom_8k(1, 0, value);
			map_prg_rom_8k_update();
			break;
		case 0x9000: {
			switch (address & 0x0007) {
				case 1:
					if (value & 0x80) {
						mirroring_H();
					} else {
						mirroring_V();
					}
					break;
				case 3:
					irem_H3000.enable = value & 0x80;
					irq.high &= ~EXT_IRQ;
					break;
				case 4:
					irem_H3000.count = irem_H3000.reload;
					irq.high &= ~EXT_IRQ;
					break;
				case 5:
					irem_H3000.reload = (irem_H3000.reload & 0x00FF) | (value << 8);
					break;
				case 6:
					irem_H3000.reload = (irem_H3000.reload & 0xFF00) | value;
					break;
			}
			break;
		}
		case 0xB000:
			control_bank(info.chr.rom[0].max.banks_1k)
			chr.bank_1k[address & 0x0007] = chr_chip_byte_pnt(0, value << 10);
			break;
		case 0xA000:
			control_bank(info.prg.rom[0].max.banks_8k)
			map_prg_rom_8k(1, 1, value);
			map_prg_rom_8k_update();
			break;
		case 0xC000:
			control_bank(info.prg.rom[0].max.banks_8k)
			map_prg_rom_8k(1, 2, value);
			map_prg_rom_8k_update();
			break;
	}
}
Exemple #16
0
void extcl_cpu_wr_mem_Ntdec_fhero(WORD address, BYTE value) {
	if ((address < 0x6000) || (address > 0x7FFF)) {
		return;
	}

	switch (address & 0x0003) {
		case 0: {
			DBWORD bank;

			value >>= 2;
			control_bank(info.chr.rom.max.banks_4k)
			bank = value << 12;
			chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
			chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
			chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
			chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
			return;
		}
		case 1: {
			DBWORD bank;

			value >>= 1;
			control_bank(info.chr.rom.max.banks_2k)
			bank = value << 11;
			chr.bank_1k[4] = chr_chip_byte_pnt(0, bank);
			chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x0400);
			return;
		}
		case 2: {
			DBWORD bank;

			value >>= 1;
			control_bank(info.chr.rom.max.banks_2k)
			bank = value << 11;
			chr.bank_1k[6] = chr_chip_byte_pnt(0, bank);
			chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x0400);
			return;
		}
		case 3:
			control_bank(info.prg.rom.max.banks_8k)
			map_prg_rom_8k(1, 0, value);
			map_prg_rom_8k_update();
			return;
	}
}
Exemple #17
0
void extcl_cpu_wr_mem_NovelDiamond(WORD address, BYTE value) {
    DBWORD bank;

    value = address & 0x03;
    control_bank(info.prg.rom[0].max.banks_32k)
    map_prg_rom_8k(4, 0, value);
    map_prg_rom_8k_update();

    value = address & 0x07;
    control_bank(info.chr.rom[0].max.banks_8k)
    bank = value << 13;
    chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
    chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
    chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
    chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
    chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
    chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
    chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
    chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #18
0
void extcl_cpu_wr_mem_Magic(WORD address, BYTE value) {
	const BYTE save = value;
	DBWORD bank;

	value >>= 1;
	control_bank(info.prg.rom[0].max.banks_32k)
	map_prg_rom_8k(4, 0, value);
	map_prg_rom_8k_update();

	value = save;
	control_bank(info.chr.rom[0].max.banks_8k)
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #19
0
void extcl_cpu_wr_mem_240(WORD address, BYTE value) {
	if ((address >= 0x4020) && (address < 0x6000)) {
		DBWORD bank;
		BYTE save = value;

		value >>= 4;
		control_bank(info.prg.rom.max.banks_32k)
		map_prg_rom_8k(4, 0, value);
		map_prg_rom_8k_update();

		value = save;
		control_bank(info.chr.rom.max.banks_8k)
		bank = value << 13;
		chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
		chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
		chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
		chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
		chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
		chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
		chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
	}
Exemple #20
0
void extcl_cpu_wr_mem_GxROM(WORD address, BYTE value) {
    /* bus conflict */
    BYTE save = value &= prg_rom_rd(address);
    DBWORD bank;

    value >>= 4;
    control_bank_with_AND(0x03, info.prg.rom.max.banks_32k)
    map_prg_rom_8k(4, 0, value);
    map_prg_rom_8k_update();

    value = save;
    control_bank_with_AND(0x03, info.chr.rom.max.banks_8k)
    bank = value << 13;
    chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
    chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
    chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
    chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
    chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
    chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
    chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
    chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}
Exemple #21
0
static void INLINE sl1632_update_chr_mmc3(void) {
	BYTE i;
	WORD value;

	value = ((sl1632.mode & 0x08) << 5);
	sl1632_change_page_chr_1k_mmc3(mmc3.chr_rom_cfg | 0x00);
	sl1632_change_page_chr_1k_mmc3(mmc3.chr_rom_cfg | 0x01);
	sl1632_change_page_chr_1k_mmc3(mmc3.chr_rom_cfg | 0x02);
	sl1632_change_page_chr_1k_mmc3(mmc3.chr_rom_cfg | 0x03);
	value = (sl1632.mode & 0x20) << 3;
	sl1632_change_page_chr_1k_mmc3((mmc3.chr_rom_cfg ^ 0x04) | 0x00);
	sl1632_change_page_chr_1k_mmc3((mmc3.chr_rom_cfg ^ 0x04) | 0x01);
	value = (sl1632.mode & 0x80) << 1;
	sl1632_change_page_chr_1k_mmc3((mmc3.chr_rom_cfg ^ 0x04) | 0x02);
	sl1632_change_page_chr_1k_mmc3((mmc3.chr_rom_cfg ^ 0x04) | 0x03);

	for (i = 0; i < 8; i++) {
		value = sl1632.mmc3.chr_map[i];
		control_bank(info.chr.rom[0].max.banks_1k)
		chr.bank_1k[i] = chr_chip_byte_pnt(0, value << 10);
	}
}
Exemple #22
0
void extcl_cpu_wr_mem_SC_127(WORD address, BYTE value) {
	switch (address) {
		case 0x8000:
		case 0x8001:
		case 0x8002:
			control_bank(info.prg.rom[0].max.banks_8k)
			map_prg_rom_8k(1, address & 0x03, value);
			map_prg_rom_8k_update();
			return;
		case 0x9000:
		case 0x9001:
		case 0x9002:
		case 0x9003:
		case 0x9004:
		case 0x9005:
		case 0x9006:
		case 0x9007:
			control_bank(info.chr.rom[0].max.banks_1k)
			chr.bank_1k[address & 0x07] = chr_chip_byte_pnt(0, value << 10);
			return;
		case 0xC002:
			sc127.irq.active = 0;
			irq.high &= ~EXT_IRQ;
			return;
		case 0xC003:
			sc127.irq.active = 1;
			return;
		case 0xC005:
			sc127.irq.count = value;
			return;
		case 0xD001:
			if (value & 0x01) {
				mirroring_H();
			} else {
				mirroring_V();
			}
			return;
	}
}
Exemple #23
0
static void INLINE sync_83(void) {
	WORD value;

	switch (m83.mode & 0x03) {
		case 0:
			mirroring_V();
			break;
		case 1:
			mirroring_H();
			break;
		case 2:
			mirroring_SCR0();
			break;
		case 3:
			mirroring_SCR1();
			break;
	}

	if (m83.is2kbank && !m83.isnot2kbank) {
		SDBWORD bank;

		value = m83.reg[0];
		control_bank(info.chr.rom.max.banks_2k)
		bank = value << 11;
		chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
		value = m83.reg[1];
		control_bank(info.chr.rom.max.banks_2k)
		bank = value << 11;
		chr.bank_1k[2] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0400);
		value = m83.reg[6];
		control_bank(info.chr.rom.max.banks_2k)
		bank = value << 11;
		chr.bank_1k[4] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x0400);
		value = m83.reg[7];
		control_bank(info.chr.rom.max.banks_2k)
		bank = value << 11;
		chr.bank_1k[6] = chr_chip_byte_pnt(0, bank);
		chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x0400);
	} else {
		BYTE i;

		for (i = 0; i < 8; i++) {
			value = ((m83.bank << 4) & 0x0300) | m83.reg[i];
			control_bank(info.chr.rom.max.banks_1k)
			chr.bank_1k[i] = chr_chip_byte_pnt(0, value << 10);
		}
	}
	if (m83.mode & 0x40) {
		value = (m83.bank & 0x3F);
		control_bank(info.prg.rom.max.banks_16k)
		map_prg_rom_8k(2, 0, value);
		value = (m83.bank & 0x30) | 0x0F;
		control_bank(info.prg.rom.max.banks_16k)
		map_prg_rom_8k(2, 2, value);
	} else {
		value = m83.reg[8];
		control_bank(info.prg.rom.max.banks_8k)
		map_prg_rom_8k(1, 0, value);
		value = m83.reg[9];
		control_bank(info.prg.rom.max.banks_8k)
		map_prg_rom_8k(1, 1, value);
		value = m83.reg[10];
		control_bank(info.prg.rom.max.banks_8k)
		map_prg_rom_8k(1, 2, value);
		map_prg_rom_8k(1, 3, info.prg.rom.max.banks_8k);
	}
	map_prg_rom_8k_update();
}
Exemple #24
0
void extcl_cpu_wr_mem_Sachen_sa0037(WORD address, BYTE value) {
	/* bus conflict */
	const BYTE save = value &= prg_rom_rd(address);
	DBWORD bank;

	if (info.prg.rom.max.banks_32k != 0xFFFF) {
		value >>= 3;
		control_bank(info.prg.rom.max.banks_32k)
		map_prg_rom_8k(4, 0, value);
		map_prg_rom_8k_update();
		value = save;
	}

	control_bank(info.chr.rom.max.banks_8k)
	bank = value << 13;
	chr.bank_1k[0] = chr_chip_byte_pnt(0, bank);
	chr.bank_1k[1] = chr_chip_byte_pnt(0, bank | 0x0400);
	chr.bank_1k[2] = chr_chip_byte_pnt(0, bank | 0x0800);
	chr.bank_1k[3] = chr_chip_byte_pnt(0, bank | 0x0C00);
	chr.bank_1k[4] = chr_chip_byte_pnt(0, bank | 0x1000);
	chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x1400);
	chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x1800);
	chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x1C00);
}

void extcl_cpu_wr_mem_Sachen_sa8259x(WORD address, BYTE value) {
	if ((address < 0x4100) || (address > 0x7FFF)) {
		return;
	}

	switch (address & 0x0101) {
Exemple #25
0
void extcl_cpu_wr_mem_182(WORD address, BYTE value) {
	switch (address & 0xE001) {
		case 0x8001:
			extcl_cpu_wr_mem_MMC3(0xA000, value);
			return;
		case 0xA000:
			extcl_cpu_wr_mem_MMC3(0x8000, value);
			return;
		case 0xC000: {
			switch (mmc3.bank_to_update) {
				case 0: {
					DBWORD bank;

					value >>= 1;
					control_bank(info.chr.rom[0].max.banks_2k)
					bank = value << 11;
					chr.bank_1k[mmc3.chr_rom_cfg] = chr_chip_byte_pnt(0, bank);
					chr.bank_1k[mmc3.chr_rom_cfg | 0x01] = chr_chip_byte_pnt(0, bank | 0x0400);
					break;
				}
				case 1:
					control_bank(info.chr.rom[0].max.banks_1k)
					chr.bank_1k[(mmc3.chr_rom_cfg ^ 0x04) | 0x01] = chr_chip_byte_pnt(0, value << 10);
					break;
				case 2: {
					DBWORD bank;

					value >>= 1;
					control_bank(info.chr.rom[0].max.banks_2k)
					bank = value << 11;
					chr.bank_1k[mmc3.chr_rom_cfg | 0x02] = chr_chip_byte_pnt(0, bank);
					chr.bank_1k[mmc3.chr_rom_cfg | 0x03] = chr_chip_byte_pnt(0, bank | 0x0400);
					break;
				}
				case 3:
					control_bank(info.chr.rom[0].max.banks_1k)
					chr.bank_1k[(mmc3.chr_rom_cfg ^ 0x04) | 0x03] = chr_chip_byte_pnt(0, value << 10);
					break;
				case 4:
					control_bank(info.prg.rom[0].max.banks_8k)
					map_prg_rom_8k(1, mmc3.prg_rom_cfg, value);
					map_prg_rom_8k_update();
					break;
				case 5:
					control_bank(info.prg.rom[0].max.banks_8k)
					map_prg_rom_8k(1, 1, value);
					map_prg_rom_8k_update();
					break;
				case 6:
					control_bank(info.chr.rom[0].max.banks_1k)
					chr.bank_1k[mmc3.chr_rom_cfg ^ 0x04] = chr_chip_byte_pnt(0, value << 10);
					break;
				case 7:
					control_bank(info.chr.rom[0].max.banks_1k)
					chr.bank_1k[(mmc3.chr_rom_cfg ^ 0x04) | 0x02] = chr_chip_byte_pnt(0, value << 10);
					break;
			}
			return;
		}
		case 0xC001:
			irqA12.latch = value;
			irqA12.reload = TRUE;
			irqA12.counter = 0;
			return;
		case 0xE000:
		case 0xE001:
			extcl_cpu_wr_mem_MMC3(address, value);
			return;
	}
}
Exemple #26
0
void map_init_Sachen(BYTE model) {
	switch (model) {
		case SA0036:
			EXTCL_CPU_WR_MEM(Sachen_sa0036);
			break;
		case SA0037:
			EXTCL_CPU_WR_MEM(Sachen_sa0037);

			if (info.reset >= HARD) {
				if (info.prg.rom.max.banks_32k != 0xFFFF) {
					map_prg_rom_8k(4, 0, 0);
				}
			}
			break;
		case SA8259A:
		case SA8259B:
		case SA8259C:
		case SA8259D: {
			EXTCL_CPU_WR_MEM(Sachen_sa8259x);
			EXTCL_SAVE_MAPPER(Sachen_sa8259x);
			mapper.internal_struct[0] = (BYTE *) &sa8259;
			mapper.internal_struct_size[0] = sizeof(sa8259);

			info.mapper.extend_wr = TRUE;

			if (info.reset >= HARD) {
				memset(&sa8259, 0x00, sizeof(sa8259));

				if (info.prg.rom.max.banks_32k != 0xFFFF) {
					map_prg_rom_8k(4, 0, 0);
				}
			}

			switch (model) {
				case SA8259A:
					shift = 1;
					ored[0] = 1;
					ored[1] = 0;
					ored[2] = 1;
					break;
				case SA8259B:
					shift = 0;
					ored[0] = 0;
					ored[1] = 0;
					ored[2] = 0;
					break;
				case SA8259C:
					shift = 2;
					ored[0] = 1;
					ored[1] = 2;
					ored[2] = 3;
					break;
				case SA8259D:
					if (!mapper.write_vram) {
						const DBWORD bank = info.chr.rom.max.banks_4k << 12;

						chr.bank_1k[4] = chr_chip_byte_pnt(0, bank);
						chr.bank_1k[5] = chr_chip_byte_pnt(0, bank | 0x0400);
						chr.bank_1k[6] = chr_chip_byte_pnt(0, bank | 0x0800);
						chr.bank_1k[7] = chr_chip_byte_pnt(0, bank | 0x0C00);
					}
					break;
			}
			break;
		}
		case TCA01:
			EXTCL_CPU_WR_MEM(Sachen_tca01);
			EXTCL_CPU_RD_MEM(Sachen_tca01);
			break;
		case TCU01:
			EXTCL_CPU_WR_MEM(Sachen_tcu01);

			info.mapper.extend_wr = TRUE;

			if (info.reset >= HARD) {
				if (info.prg.rom.max.banks_32k != 0xFFFF) {
					map_prg_rom_8k(4, 0, 0);
				}
			}
			break;
		case TCU02:
			EXTCL_CPU_WR_MEM(Sachen_tcu02);
			EXTCL_CPU_RD_MEM(Sachen_tcu02);
			EXTCL_SAVE_MAPPER(Sachen_tcu02);
			mapper.internal_struct[0] = (BYTE *) &tcu02;
			mapper.internal_struct_size[0] = sizeof(tcu02);

			info.mapper.extend_wr = TRUE;

			if (info.reset >= HARD) {
				memset(&tcu02, 0x00, sizeof(tcu02));
			}
			break;
		case SA72007:
			EXTCL_CPU_WR_MEM(Sachen_sa72007);

			info.mapper.extend_wr = TRUE;
			break;
		case SA72008:
			EXTCL_CPU_WR_MEM(Sachen_sa72008);

			info.mapper.extend_wr = TRUE;
			break;
		case SA74374A:
		case SA74374B: {
			BYTE i;

			for (i = 0; i < LENGTH(pokeriiichr); i++) {
				if (!(memcmp(pokeriiichr[i], info.sha1sum.chr.string, 40))) {
					if (i == 0) {
						/* Poker III 5-in-1 (Sachen) [!].nes */
						info.mapper.id = 150;
						model = SA74374B;
					} else {
						/* Poker III [!].nes */
						info.mapper.id = 243;
						model = SA74374A;
					}
				}
			}

			if (model == SA74374A) {
				EXTCL_CPU_WR_MEM(Sachen_sa74374a);
			} else {
				EXTCL_CPU_WR_MEM(Sachen_sa74374b);
			}
			EXTCL_SAVE_MAPPER(Sachen_sa74374x);
			mapper.internal_struct[0] = (BYTE *) &sa74374x;
			mapper.internal_struct_size[0] = sizeof(sa74374x);

			info.mapper.extend_wr = TRUE;

			if (info.reset >= HARD) {
				memset(&sa74374x, 0x00, sizeof(sa74374x));
				map_prg_rom_8k(4, 0, 0);
			}
			break;
		}
	}

	type = model;
}