diff options
author | 2014-03-15 18:30:11 +0000 | |
---|---|---|
committer | 2014-03-15 18:30:11 +0000 | |
commit | ee71c023b4801615da7b249f9b5418be37d31bd7 (patch) | |
tree | fe8b8991e74b6aadf55086d12bf4874a1eadf5d0 /src/mess/machine/genpc.c | |
parent | b8c9ffb097e628d4049b9bae25e0c7df26104839 (diff) |
some cleanup (nw)
Diffstat (limited to 'src/mess/machine/genpc.c')
-rw-r--r-- | src/mess/machine/genpc.c | 83 |
1 files changed, 16 insertions, 67 deletions
diff --git a/src/mess/machine/genpc.c b/src/mess/machine/genpc.c index 8599dbce187..93492def546 100644 --- a/src/mess/machine/genpc.c +++ b/src/mess/machine/genpc.c @@ -34,25 +34,24 @@ * *************************************************************************/ -READ8_DEVICE_HANDLER(pc_page_r) +READ8_MEMBER( ibm5160_mb_device::pc_page_r) { - return 0xFF; + return 0xff; } -WRITE8_DEVICE_HANDLER(pc_page_w) +WRITE8_MEMBER( ibm5160_mb_device::pc_page_w) { - ibm5160_mb_device *board = downcast<ibm5160_mb_device *>(device); switch(offset % 4) { case 1: - board->m_dma_offset[2] = data; + m_dma_offset[2] = data; break; case 2: - board->m_dma_offset[3] = data; + m_dma_offset[3] = data; break; case 3: - board->m_dma_offset[0] = board->m_dma_offset[1] = data; + m_dma_offset[0] = m_dma_offset[1] = data; break; } } @@ -453,13 +452,10 @@ static const pc_kbdc_interface pc_kbdc_intf_ec1841 = * **********************************************************/ -static WRITE8_DEVICE_HANDLER( nmi_enable_w ) +WRITE8_MEMBER( ibm5160_mb_device::nmi_enable_w ) { - ibm5160_mb_device *board = downcast<ibm5160_mb_device *>(device); - - board->m_nmi_enabled = BIT(data,7); - board->m_isabus->set_nmi_state(board->m_nmi_enabled); - + m_nmi_enabled = BIT(data,7); + m_isabus->set_nmi_state(m_nmi_enabled); } //************************************************************************** // GLOBAL VARIABLES @@ -570,50 +566,18 @@ ibm5160_mb_device::ibm5160_mb_device(const machine_config &mconfig, const char * { } -void ibm5160_mb_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0); - break; - case 16: - m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff); - break; - default: - fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); - break; - } -} - -void ibm5160_mb_device::install_device_write(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_device_func whandler, const char *whandler_name) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - m_maincpu->space(AS_IO).install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name,0); - break; - case 16: - m_maincpu->space(AS_IO).install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name, 0xffff); - break; - default: - fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); - break; - } -} - void ibm5160_mb_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) { int buswidth = m_maincpu->space_config(AS_IO)->m_databus_width; switch(buswidth) { case 8: - m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); + if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0); + if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0); break; case 16: - m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); + if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0xffff); + if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0xffff); break; default: fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); @@ -631,24 +595,9 @@ void ibm5160_mb_device::device_start() install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); - - // install_device(m_ppi8255, 0x0060, 0x0063, 0, 0, FUNC(i8255a_r), FUNC(i8255a_w) ); - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - m_maincpu->space(AS_IO).install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0); - break; - case 16: - m_maincpu->space(AS_IO).install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0xffff); - break; - default: - fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); - break; - } - - install_device(this, 0x0080, 0x0087, 0, 0, FUNC(pc_page_r), FUNC(pc_page_w) ); - install_device_write(this, 0x00a0, 0x00a1, 0, 0, FUNC(nmi_enable_w)); + install_device(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255) ); + install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); + install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); /* MESS managed RAM */ if ( m_ram->pointer() ) membank( "bank10" )->set_base( m_ram->pointer() ); |