Beispiel #1
0
MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde)
{
    int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
    address_space &space = m_maincpu->space(AS_PROGRAM);
    UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();
    space.unmap_readwrite(0x5000, 0xffff);  // unmap any previously installed expansion RAM

    get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference

    if (ram_expansion_installed == 1)
    {
        if (write_protect_on == 0)  // write protect off, so install memory normally
        {
            space.install_ram(expansion_ram_start, expansion_ram_end, expram);
            if (shadow_ram_end > expansion_ram_end)
                space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
        }
        else  // write protect on, so make memory read only
        {
            space.nop_write(expansion_ram_start, expansion_ram_end);
        }
    }
}
Beispiel #2
0
ADDRESS_MAP_END

INPUT_CHANGED_MEMBER(astrocde_mess_state::set_write_protect)  // run when RAM expansion write protect switch is changed
{
    int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
    address_space &space = m_maincpu->space(AS_PROGRAM);
    UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();

    get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference

    if (ram_expansion_installed == 1)
    {
        if (write_protect_on == 0)  // write protect off, so install memory normally
        {
            space.install_ram(expansion_ram_start, expansion_ram_end, expram);
            if (shadow_ram_end > expansion_ram_end)
                space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
        }
        else  // write protect on, so make memory read only
        {
            space.nop_write(expansion_ram_start, expansion_ram_end);
        }
    }
}
ADDRESS_MAP_END

static INPUT_CHANGED( set_write_protect )  // run when RAM expansion write protect switch is changed
{
	int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
	address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM);
	UINT8 *expram = ram_get_ptr(field.machine().device("ram_tag"));

	get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference

    if (ram_expansion_installed == 1)
    {
        if (write_protect_on == 0)  // write protect off, so install memory normally
        {
            space->install_ram(expansion_ram_start, expansion_ram_end, expram);
            if (shadow_ram_end > expansion_ram_end)
                space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
        }
        else  // write protect on, so make memory read only
        {
            space->nop_write(expansion_ram_start, expansion_ram_end);
        }
     }
}