i8155: Eliminate unnecessary memory interface for internal RAM (nw)

This commit is contained in:
AJR 2018-08-22 20:51:56 -04:00
parent 71759a512d
commit 5fdb046407
3 changed files with 14 additions and 39 deletions

View File

@ -105,18 +105,6 @@ enum
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// default address map
void i8155_device::i8155(address_map &map)
{
map(0x00, 0xff).ram();
}
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@ -272,7 +260,6 @@ i8155_device::i8155_device(const machine_config &mconfig, const char *tag, devic
i8155_device::i8155_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_in_pa_cb(*this),
m_in_pb_cb(*this),
m_in_pc_cb(*this),
@ -286,8 +273,7 @@ i8155_device::i8155_device(const machine_config &mconfig, device_type type, cons
m_count_loaded(0),
m_counter(0),
m_count_extra(false),
m_to(0),
m_space_config("ram", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(), address_map_constructor(FUNC(i8155_device::i8155), this))
m_to(0)
{
}
@ -317,6 +303,9 @@ void i8155_device::device_start()
m_out_pc_cb.resolve_safe();
m_out_to_cb.resolve_safe();
// allocate RAM
m_ram = make_unique_clear<uint8_t[]>(256);
// allocate timers
m_timer = timer_alloc();
@ -326,6 +315,7 @@ void i8155_device::device_start()
save_item(NAME(m_command));
save_item(NAME(m_status));
save_item(NAME(m_output));
save_pointer(NAME(m_ram), 256);
save_item(NAME(m_count_length));
save_item(NAME(m_count_loaded));
save_item(NAME(m_count_extra));
@ -412,19 +402,6 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param,
}
//-------------------------------------------------
// memory_space_config - return a description of
// any address spaces owned by this device
//-------------------------------------------------
device_memory_interface::space_config_vector i8155_device::memory_space_config() const
{
return space_config_vector {
std::make_pair(0, &m_space_config)
};
}
//-------------------------------------------------
// io_r - register read
//-------------------------------------------------
@ -574,7 +551,7 @@ WRITE8_MEMBER( i8155_device::io_w )
READ8_MEMBER( i8155_device::memory_r )
{
return this->space().read_byte(offset);
return m_ram[offset & 0xff];
}
@ -584,7 +561,7 @@ READ8_MEMBER( i8155_device::memory_r )
WRITE8_MEMBER( i8155_device::memory_w )
{
this->space().write_byte(offset, data);
m_ram[offset & 0xff] = data;
}

View File

@ -41,8 +41,7 @@
// ======================> i8155_device
class i8155_device : public device_t,
public device_memory_interface
class i8155_device : public device_t
{
public:
// construction/destruction
@ -74,8 +73,6 @@ protected:
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual space_config_vector memory_space_config() const override;
private:
devcb_read8 m_in_pa_cb;
devcb_read8 m_in_pb_cb;
@ -97,6 +94,9 @@ private:
uint8_t m_status; // status register
uint8_t m_output[3]; // output latches
// RAM
std::unique_ptr<uint8_t[]> m_ram;
// counter
uint16_t m_count_length; // count length register (assigned)
uint16_t m_count_loaded; // count length register (loaded)
@ -118,8 +118,6 @@ private:
inline void write_port(int port, uint8_t data);
void register_w(int offset, uint8_t data);
void i8155(address_map &map);
};

View File

@ -244,7 +244,7 @@ void cp1_state::machine_reset()
QUICKLOAD_LOAD_MEMBER( cp1_state, quickload )
{
uint8_t *dest = (uint8_t*)m_i8155->space().get_read_ptr(0);
address_space &space = machine().dummy_space();
char line[0x10];
int addr = 0;
while (image.fgets(line, 10) && addr < 0x100)
@ -252,8 +252,8 @@ QUICKLOAD_LOAD_MEMBER( cp1_state, quickload )
int op = 0, arg = 0;
if (sscanf(line, "%d.%d", &op, &arg) == 2)
{
dest[addr++] = op;
dest[addr++] = arg;
m_i8155->memory_w(space, addr++, op);
m_i8155->memory_w(space, addr++, arg);
}
else
{