mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
alto2: Use callback for reading keyboard (nw)
This commit is contained in:
parent
8ae2eeb09e
commit
e1bda20205
@ -16,21 +16,7 @@
|
||||
*/
|
||||
READ16_MEMBER( alto2_cpu_device::kbd_ad_r )
|
||||
{
|
||||
uint16_t data = 0177777;
|
||||
switch (offset & 3) {
|
||||
case 0:
|
||||
data = machine().root_device().ioport("ROW0")->read();
|
||||
break;
|
||||
case 1:
|
||||
data = machine().root_device().ioport("ROW1")->read();
|
||||
break;
|
||||
case 2:
|
||||
data = machine().root_device().ioport("ROW2")->read();
|
||||
break;
|
||||
case 3:
|
||||
data = machine().root_device().ioport("ROW3")->read();
|
||||
break;
|
||||
}
|
||||
uint16_t data = m_kb_read_callback(offset & 3);
|
||||
m_kbd.matrix[offset & 03] = data;
|
||||
if (!machine().side_effects_disabled()) {
|
||||
LOG((this,LOG_KBD,2," read KBDAD+%o (%#o)\n", offset & 3, data));
|
||||
|
@ -127,6 +127,7 @@ void alto2_cpu_device::iomem_map(address_map &map)
|
||||
|
||||
alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
|
||||
cpu_device(mconfig, ALTO2, tag, owner, clock),
|
||||
m_kb_read_callback(*this),
|
||||
m_ucode_config("ucode", ENDIANNESS_BIG, 32, 12, -2 ),
|
||||
m_const_config("const", ENDIANNESS_BIG, 16, 8, -1 ),
|
||||
m_iomem_config("iomem", ENDIANNESS_BIG, 16, 17, -1 ),
|
||||
@ -813,6 +814,8 @@ device_memory_interface::space_config_vector alto2_cpu_device::memory_space_conf
|
||||
|
||||
void alto2_cpu_device::device_start()
|
||||
{
|
||||
m_kb_read_callback.resolve_safe(0177777);
|
||||
|
||||
// get a pointer to the IO address space
|
||||
m_iomem = &space(2);
|
||||
|
||||
|
@ -185,6 +185,8 @@ public:
|
||||
alto2_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~alto2_cpu_device();
|
||||
|
||||
auto kb_read_callback() { return m_kb_read_callback.bind(); }
|
||||
|
||||
//! driver interface to set diablo_hd_device
|
||||
void set_diablo(int unit, diablo_hd_device* ptr);
|
||||
|
||||
@ -244,6 +246,8 @@ private:
|
||||
|
||||
void fatal(int level, const char *format, ...);
|
||||
|
||||
devcb_read16 m_kb_read_callback;
|
||||
|
||||
address_space_config m_ucode_config;
|
||||
address_space_config m_const_config;
|
||||
address_space_config m_iomem_config;
|
||||
|
@ -20,14 +20,7 @@ public:
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_io_row0(*this, "ROW0"),
|
||||
m_io_row1(*this, "ROW1"),
|
||||
m_io_row2(*this, "ROW2"),
|
||||
m_io_row3(*this, "ROW3"),
|
||||
m_io_row4(*this, "ROW4"),
|
||||
m_io_row5(*this, "ROW5"),
|
||||
m_io_row6(*this, "ROW6"),
|
||||
m_io_row7(*this, "ROW7"),
|
||||
m_io_row(*this, "ROW%u", 0U),
|
||||
m_io_config(*this, "CONFIG")
|
||||
{ }
|
||||
|
||||
@ -38,17 +31,13 @@ public:
|
||||
void alto2_const_map(address_map &map);
|
||||
void alto2_iomem_map(address_map &map);
|
||||
void alto2_ucode_map(address_map &map);
|
||||
|
||||
protected:
|
||||
u16 kb_r(offs_t offset);
|
||||
|
||||
required_device<alto2_cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_ioport m_io_row0;
|
||||
required_ioport m_io_row1;
|
||||
required_ioport m_io_row2;
|
||||
required_ioport m_io_row3;
|
||||
required_ioport m_io_row4;
|
||||
required_ioport m_io_row5;
|
||||
required_ioport m_io_row6;
|
||||
required_ioport m_io_row7;
|
||||
required_ioport_array<8> m_io_row;
|
||||
optional_ioport m_io_config;
|
||||
static const device_timer_id TIMER_VBLANK = 0;
|
||||
emu_timer* m_vblank_timer;
|
||||
@ -254,6 +243,11 @@ static INPUT_PORTS_START( alto2 )
|
||||
PORT_DIPSETTING( 0374, "ID 374") PORT_DIPSETTING( 0375, "ID 375")
|
||||
INPUT_PORTS_END
|
||||
|
||||
u16 alto2_state::kb_r(offs_t offset)
|
||||
{
|
||||
return m_io_row[offset]->read();
|
||||
}
|
||||
|
||||
/* ROM */
|
||||
ROM_START( alto2 )
|
||||
// dummy region for the maincpu - this is not used in any way
|
||||
@ -289,6 +283,7 @@ void alto2_state::alto2(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &alto2_state::alto2_ucode_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &alto2_state::alto2_const_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &alto2_state::alto2_iomem_map);
|
||||
m_maincpu->kb_read_callback().set(FUNC(alto2_state::kb_r));
|
||||
|
||||
// Video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
|
Loading…
Reference in New Issue
Block a user