mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
atm: Remove direct update handler. Still not working, but less badly [O. Galibert]
This commit is contained in:
parent
6ab16bfc90
commit
a970b50ed1
@ -6,9 +6,6 @@ MicroART ATM (clone of Spectrum)
|
||||
|
||||
Not working because of banking issues.
|
||||
|
||||
The direct_update_handler needs rewriting, because removing it allows the
|
||||
computer to boot up (with keyboard problems).
|
||||
|
||||
*******************************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
@ -33,7 +30,9 @@ public:
|
||||
{ }
|
||||
|
||||
DECLARE_WRITE8_MEMBER(atm_port_7ffd_w);
|
||||
DIRECT_UPDATE_MEMBER(atm_direct);
|
||||
DECLARE_READ8_MEMBER(beta_neutral_r);
|
||||
DECLARE_READ8_MEMBER(beta_enable_r);
|
||||
DECLARE_READ8_MEMBER(beta_disable_r);
|
||||
DECLARE_MACHINE_RESET(atm);
|
||||
|
||||
protected:
|
||||
@ -44,48 +43,11 @@ protected:
|
||||
required_device<beta_disk_device> m_beta;
|
||||
|
||||
private:
|
||||
address_space *m_program;
|
||||
uint8_t *m_p_ram;
|
||||
void atm_update_memory();
|
||||
};
|
||||
|
||||
|
||||
DIRECT_UPDATE_MEMBER(atm_state::atm_direct)
|
||||
{
|
||||
uint16_t pc = m_maincpu->state_int(STATE_GENPCBASE);
|
||||
|
||||
if (m_beta->started() && m_beta->is_active())
|
||||
{
|
||||
if (pc >= 0x4000)
|
||||
{
|
||||
m_ROMSelection = BIT(m_port_7ffd_data, 4);
|
||||
m_beta->disable();
|
||||
m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]);
|
||||
}
|
||||
}
|
||||
else if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1))
|
||||
{
|
||||
m_ROMSelection = 3;
|
||||
if (m_beta->started())
|
||||
m_beta->enable();
|
||||
|
||||
}
|
||||
if(address<=0x3fff)
|
||||
{
|
||||
if (m_ROMSelection == 3)
|
||||
{
|
||||
direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x18000]);
|
||||
m_bank1->set_base(&m_p_ram[0x18000]);
|
||||
}
|
||||
else
|
||||
{
|
||||
direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]);
|
||||
m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]);
|
||||
}
|
||||
return ~0;
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
void atm_state::atm_update_memory()
|
||||
{
|
||||
uint8_t *messram = m_ram->pointer();
|
||||
@ -117,6 +79,33 @@ WRITE8_MEMBER(atm_state::atm_port_7ffd_w)
|
||||
atm_update_memory();
|
||||
}
|
||||
|
||||
READ8_MEMBER(atm_state::beta_neutral_r)
|
||||
{
|
||||
return m_program->read_byte(offset);
|
||||
}
|
||||
|
||||
READ8_MEMBER(atm_state::beta_enable_r)
|
||||
{
|
||||
if(m_ROMSelection == 1) {
|
||||
m_ROMSelection = 3;
|
||||
if (m_beta->started()) {
|
||||
m_beta->enable();
|
||||
m_bank1->set_base(&m_p_ram[0x18000]);
|
||||
}
|
||||
}
|
||||
return m_program->read_byte(offset + 0x3d00);
|
||||
}
|
||||
|
||||
READ8_MEMBER(atm_state::beta_disable_r)
|
||||
{
|
||||
if (m_beta->started() && m_beta->is_active()) {
|
||||
m_ROMSelection = BIT(m_port_7ffd_data, 4);
|
||||
m_beta->disable();
|
||||
m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]);
|
||||
}
|
||||
return m_program->read_byte(offset + 0x4000);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START (atm_io, AS_IO, 8, atm_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00)
|
||||
@ -130,20 +119,20 @@ static ADDRESS_MAP_START (atm_io, AS_IO, 8, atm_state )
|
||||
AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START (atm_switch, AS_DECRYPTED_OPCODES, 8, atm_state)
|
||||
AM_RANGE(0x3d00, 0x3dff) AM_READ(beta_enable_r)
|
||||
AM_RANGE(0x0000, 0x3fff) AM_READ(beta_neutral_r) // Overlap with previous because we want real addresses on the 3e00-3fff range
|
||||
AM_RANGE(0x4000, 0xffff) AM_READ(beta_disable_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
MACHINE_RESET_MEMBER(atm_state,atm)
|
||||
{
|
||||
uint8_t *messram = m_ram->pointer();
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
m_program = &m_maincpu->space(AS_PROGRAM);
|
||||
m_p_ram = memregion("maincpu")->base();
|
||||
|
||||
space.install_read_bank(0x0000, 0x3fff, "bank1");
|
||||
space.unmap_write(0x0000, 0x3fff);
|
||||
|
||||
if (m_beta->started())
|
||||
{
|
||||
m_beta->enable();
|
||||
}
|
||||
space.set_direct_update_handler(direct_update_delegate(&atm_state::atm_direct, this));
|
||||
|
||||
memset(messram,0,128*1024);
|
||||
|
||||
@ -185,6 +174,7 @@ GFXDECODE_END
|
||||
static MACHINE_CONFIG_DERIVED_CLASS( atm, spectrum_128, atm_state )
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_IO_MAP(atm_io)
|
||||
MCFG_CPU_DECRYPTED_OPCODES_MAP(atm_switch)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(atm_state, atm )
|
||||
|
||||
MCFG_BETA_DISK_ADD(BETA_DISK_TAG)
|
||||
|
Loading…
Reference in New Issue
Block a user