diff --git a/src/mess/drivers/orion.c b/src/mess/drivers/orion.c index f8474c9f17e..579786384ab 100644 --- a/src/mess/drivers/orion.c +++ b/src/mess/drivers/orion.c @@ -12,15 +12,12 @@ #include "cpu/z80/z80.h" #include "cpu/i8085/i8085.h" #include "sound/ay8910.h" -#include "sound/speaker.h" #include "sound/wave.h" -#include "machine/mc146818.h" #include "imagedev/cassette.h" #include "imagedev/cartslot.h" #include "formats/smx_dsk.h" #include "formats/rk_cas.h" #include "includes/orion.h" -#include "machine/ram.h" /* Address maps */ diff --git a/src/mess/includes/orion.h b/src/mess/includes/orion.h index 1d6b503b82c..a9277ad9b04 100644 --- a/src/mess/includes/orion.h +++ b/src/mess/includes/orion.h @@ -10,14 +10,33 @@ #include "machine/wd_fdc.h" #include "includes/radio86.h" #include "machine/i8255.h" +#include "machine/ram.h" +#include "machine/mc146818.h" +#include "sound/speaker.h" + class orion_state : public radio86_state { public: orion_state(const machine_config &mconfig, device_type type, const char *tag) - : radio86_state(mconfig, type, tag), - m_fdc(*this, "fd1793") - { } + : radio86_state(mconfig, type, tag) + , m_fdc(*this, "fd1793") + , m_ram(*this, RAM_TAG) + , m_fd0(*this, "fd0") + , m_fd1(*this, "fd1") + , m_fd2(*this, "fd2") + , m_fd3(*this, "fd3") + , m_rtc(*this, "rtc") + , m_speaker(*this, SPEAKER_TAG) + , m_ay8912(*this, "ay8912") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_bank5(*this, "bank5") + , m_bank6(*this, "bank6") + , m_bank7(*this, "bank7") + , m_bank8(*this, "bank8") + { } UINT8 m_orion128_video_mode; UINT8 m_orion128_video_page; @@ -29,7 +48,7 @@ public: UINT8 m_orion128_memory_page; UINT8 m_orionz80_memory_page; UINT8 m_orionz80_dispatcher; - UINT8 m_speaker; + UINT8 m_speaker_data; UINT8 m_orionpro_ram0_segment; UINT8 m_orionpro_ram1_segment; UINT8 m_orionpro_ram2_segment; @@ -74,6 +93,27 @@ public: DECLARE_WRITE8_MEMBER(orion_romdisk_portb_w); DECLARE_WRITE8_MEMBER(orion_romdisk_portc_w); DECLARE_FLOPPY_FORMATS( orion_floppy_formats ); + +protected: + required_device m_ram; + required_device m_fd0; + required_device m_fd1; + required_device m_fd2; + required_device m_fd3; + optional_device m_rtc; + optional_device m_speaker; + optional_device m_ay8912; + required_memory_bank m_bank2; + optional_memory_bank m_bank3; + optional_memory_bank m_bank4; + optional_memory_bank m_bank5; + optional_memory_bank m_bank6; + optional_memory_bank m_bank7; + optional_memory_bank m_bank8; + + void orionz80_switch_bank(); + void orion_set_video_mode(int width); + void orionpro_bank_switch(); }; /*----------- defined in machine/orion.c -----------*/ diff --git a/src/mess/includes/radio86.h b/src/mess/includes/radio86.h index 52a17667e0f..9bc1d0e175c 100644 --- a/src/mess/includes/radio86.h +++ b/src/mess/includes/radio86.h @@ -10,12 +10,39 @@ #include "machine/i8255.h" #include "machine/8257dma.h" #include "video/i8275.h" +#include "imagedev/cassette.h" + class radio86_state : public driver_device { public: radio86_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cassette(*this, CASSETTE_TAG) + , m_dma8257(*this, "dma8257") + , m_ppi8255_1(*this, "ppi8255_1") + , m_ppi8255_2(*this, "ppi8255_2") + , m_region_maincpu(*this, "maincpu") + , m_bank1(*this, "bank1") + , m_io_line0(*this, "LINE0") + , m_io_line1(*this, "LINE1") + , m_io_line2(*this, "LINE2") + , m_io_line3(*this, "LINE3") + , m_io_line4(*this, "LINE4") + , m_io_line5(*this, "LINE5") + , m_io_line6(*this, "LINE6") + , m_io_line7(*this, "LINE7") + , m_io_line8(*this, "LINE8") + , m_io_cline0(*this, "CLINE0") + , m_io_cline1(*this, "CLINE1") + , m_io_cline2(*this, "CLINE2") + , m_io_cline3(*this, "CLINE3") + , m_io_cline4(*this, "CLINE4") + , m_io_cline5(*this, "CLINE5") + , m_io_cline6(*this, "CLINE6") + , m_io_cline7(*this, "CLINE7") + { } virtual void video_start(); @@ -46,6 +73,34 @@ public: DECLARE_WRITE8_MEMBER(radio86_romdisk_portb_w); DECLARE_WRITE8_MEMBER(radio86_romdisk_portc_w); DECLARE_WRITE8_MEMBER(mikrosha_8255_font_page_w); + +protected: + required_device m_maincpu; + required_device m_cassette; + optional_device m_dma8257; + required_device m_ppi8255_1; + optional_device m_ppi8255_2; + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_line8; + optional_ioport m_io_cline0; + optional_ioport m_io_cline1; + optional_ioport m_io_cline2; + optional_ioport m_io_cline3; + optional_ioport m_io_cline4; + optional_ioport m_io_cline5; + optional_ioport m_io_cline6; + optional_ioport m_io_cline7; + + void radio86_init_keyboard(); }; diff --git a/src/mess/machine/orion.c b/src/mess/machine/orion.c index cb362f3e87e..79034d94b31 100644 --- a/src/mess/machine/orion.c +++ b/src/mess/machine/orion.c @@ -11,12 +11,9 @@ #include "emu.h" #include "cpu/i8085/i8085.h" #include "imagedev/cassette.h" -#include "machine/mc146818.h" #include "sound/speaker.h" #include "sound/ay8910.h" #include "includes/orion.h" -#include "includes/radio86.h" -#include "machine/ram.h" #define SCREEN_WIDTH_384 48 #define SCREEN_WIDTH_480 60 @@ -24,11 +21,9 @@ - - READ8_MEMBER(orion_state::orion_romdisk_porta_r) { - UINT8 *romdisk = memregion("maincpu")->base() + 0x10000; + UINT8 *romdisk = m_region_maincpu->base() + 0x10000; return romdisk[m_romdisk_msb*256+m_romdisk_lsb]; } @@ -60,28 +55,28 @@ MACHINE_START_MEMBER(orion_state,orion128) READ8_MEMBER(orion_state::orion128_system_r) { - return machine().device("ppi8255_2")->read(space, offset & 3); + return m_ppi8255_2->read(space, offset & 3); } WRITE8_MEMBER(orion_state::orion128_system_w) { - machine().device("ppi8255_2")->write(space, offset & 3, data); + m_ppi8255_2->write(space, offset & 3, data); } READ8_MEMBER(orion_state::orion128_romdisk_r) { - return machine().device("ppi8255_1")->read(space, offset & 3); + return m_ppi8255_1->read(space, offset & 3); } WRITE8_MEMBER(orion_state::orion128_romdisk_w) { - machine().device("ppi8255_1")->write(space, offset & 3, data); + m_ppi8255_1->write(space, offset & 3, data); } -static void orion_set_video_mode(running_machine &machine, int width) +void orion_state::orion_set_video_mode(int width) { - rectangle visarea(0, width-1, 0, 255); - machine.primary_screen->configure(width, 256, visarea, machine.primary_screen->frame_period().attoseconds); + rectangle visarea(0, width-1, 0, 255); + machine().primary_screen->configure(width, 256, visarea, machine().primary_screen->frame_period().attoseconds); } WRITE8_MEMBER(orion_state::orion128_video_mode_w) @@ -93,18 +88,18 @@ WRITE8_MEMBER(orion_state::orion128_video_mode_w) if (m_video_mode_mask == 31) { m_orion128_video_width = SCREEN_WIDTH_512; - orion_set_video_mode(machine(),512); + orion_set_video_mode(512); } else { m_orion128_video_width = SCREEN_WIDTH_480; - orion_set_video_mode(machine(),480); + orion_set_video_mode(480); } } else { m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(machine(),384); + orion_set_video_mode(384); } } @@ -122,18 +117,18 @@ WRITE8_MEMBER(orion_state::orion128_video_page_w) if (m_video_mode_mask == 31) { m_orion128_video_width = SCREEN_WIDTH_512; - orion_set_video_mode(machine(),512); + orion_set_video_mode(512); } else { m_orion128_video_width = SCREEN_WIDTH_480; - orion_set_video_mode(machine(),480); + orion_set_video_mode(480); } } else { m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(machine(),384); + orion_set_video_mode(384); } } } @@ -145,7 +140,7 @@ WRITE8_MEMBER(orion_state::orion128_memory_page_w) { if (data!=m_orion128_memory_page ) { - membank("bank1")->set_base(machine().device(RAM_TAG)->pointer() + (data & 3) * 0x10000); + m_bank1->set_base(m_ram->pointer() + (data & 3) * 0x10000); m_orion128_memory_page = (data & 3); } } @@ -155,20 +150,17 @@ MACHINE_RESET_MEMBER(orion_state,orion128) m_orion128_video_page = 0; m_orion128_video_mode = 0; m_orion128_memory_page = -1; - membank("bank1")->set_base(memregion("maincpu")->base() + 0xf800); - membank("bank2")->set_base(machine().device(RAM_TAG)->pointer() + 0xf000); + m_bank1->set_base(m_region_maincpu->base() + 0xf800); + m_bank2->set_base(m_ram->pointer() + 0xf000); m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(machine(),384); - radio86_init_keyboard(machine()); + orion_set_video_mode(384); + radio86_init_keyboard(); } WRITE8_MEMBER(orion_state::orion_disk_control_w) { - static const char *names[] = { "fd0", "fd1", "fd2", "fd3"}; - floppy_image_device *floppy = NULL; - floppy_connector *con = machine().device(names[data & 3]); - if(con) - floppy = con->get_device(); + floppy_connector *names[] = { m_fd0, m_fd1, m_fd2, m_fd3}; + floppy_image_device *floppy = names[data & 3]->get_device(); m_fdc->set_floppy(floppy); floppy->mon_w(0); @@ -212,7 +204,7 @@ READ8_MEMBER(orion_state::orionz80_floppy_rtc_r) { if ((offset >= 0x60) && (offset <= 0x6f)) { - return machine().device("rtc")->read(space,offset-0x60); + return m_rtc->read(space,offset-0x60); } else { @@ -224,7 +216,7 @@ WRITE8_MEMBER(orion_state::orionz80_floppy_rtc_w) { if ((offset >= 0x60) && (offset <= 0x6f)) { - machine().device("rtc")->write(space,offset-0x60,data); + m_rtc->write(space,offset-0x60,data); } else { @@ -240,92 +232,89 @@ MACHINE_START_MEMBER(orion_state,orionz80) WRITE8_MEMBER(orion_state::orionz80_sound_w) { - device_t *speaker = machine().device(SPEAKER_TAG); - if (m_speaker == 0) + if (m_speaker_data == 0) { - m_speaker = data; + m_speaker_data = data; } else { - m_speaker = 0 ; + m_speaker_data = 0; } - speaker_level_w(speaker,m_speaker); + speaker_level_w(m_speaker,m_speaker_data); } WRITE8_MEMBER(orion_state::orionz80_sound_fe_w) { - device_t *speaker = machine().device(SPEAKER_TAG); - speaker_level_w(speaker,(data>>4) & 0x01); + speaker_level_w(m_speaker,(data>>4) & 0x01); } -static void orionz80_switch_bank(running_machine &machine) +void orion_state::orionz80_switch_bank() { - orion_state *state = machine.driver_data(); UINT8 bank_select; UINT8 segment_select; - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); - bank_select = (state->m_orionz80_dispatcher & 0x0c) >> 2; - segment_select = state->m_orionz80_dispatcher & 0x03; + bank_select = (m_orionz80_dispatcher & 0x0c) >> 2; + segment_select = m_orionz80_dispatcher & 0x03; space.install_write_bank(0x0000, 0x3fff, "bank1"); - if ((state->m_orionz80_dispatcher & 0x80)==0) + if ((m_orionz80_dispatcher & 0x80)==0) { // dispatcher on - state->membank("bank1")->set_base(machine.device(RAM_TAG)->pointer() + 0x10000 * bank_select + segment_select * 0x4000 ); + m_bank1->set_base(m_ram->pointer() + 0x10000 * bank_select + segment_select * 0x4000 ); } else { // dispatcher off - state->membank("bank1")->set_base(machine.device(RAM_TAG)->pointer() + 0x10000 * state->m_orionz80_memory_page); + m_bank1->set_base(m_ram->pointer() + 0x10000 * m_orionz80_memory_page); } - state->membank("bank2")->set_base(machine.device(RAM_TAG)->pointer() + 0x4000 + 0x10000 * state->m_orionz80_memory_page); + m_bank2->set_base(m_ram->pointer() + 0x4000 + 0x10000 * m_orionz80_memory_page); - if ((state->m_orionz80_dispatcher & 0x20) == 0) + if ((m_orionz80_dispatcher & 0x20) == 0) { - space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),state)); - space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),state)); - space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),state)); - space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),state)); - space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),state)); - space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),state)); + space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); + space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); + space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this)); + space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); + space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); + space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this)); - space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),state)); - space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),state)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),state)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),state)); + space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); + space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this)); space.unmap_write(0xfc00, 0xfeff); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - state->membank("bank3")->set_base(machine.device(RAM_TAG)->pointer() + 0xf000); - state->membank("bank5")->set_base(machine.root_device().memregion("maincpu")->base() + 0xf800); + m_bank3->set_base(m_ram->pointer() + 0xf000); + m_bank5->set_base(m_region_maincpu->base() + 0xf800); } else { /* if it is full memory access */ - state->membank("bank3")->set_base(machine.device(RAM_TAG)->pointer() + 0xf000 + 0x10000 * state->m_orionz80_memory_page); - state->membank("bank4")->set_base(machine.device(RAM_TAG)->pointer() + 0xf400 + 0x10000 * state->m_orionz80_memory_page); - state->membank("bank5")->set_base(machine.device(RAM_TAG)->pointer() + 0xf800 + 0x10000 * state->m_orionz80_memory_page); + m_bank3->set_base(m_ram->pointer() + 0xf000 + 0x10000 * m_orionz80_memory_page); + m_bank4->set_base(m_ram->pointer() + 0xf400 + 0x10000 * m_orionz80_memory_page); + m_bank5->set_base(m_ram->pointer() + 0xf800 + 0x10000 * m_orionz80_memory_page); } } WRITE8_MEMBER(orion_state::orionz80_memory_page_w) { m_orionz80_memory_page = data & 7; - orionz80_switch_bank(machine()); + orionz80_switch_bank(); } WRITE8_MEMBER(orion_state::orionz80_dispatcher_w) { m_orionz80_dispatcher = data; - orionz80_switch_bank(machine()); + orionz80_switch_bank(); } MACHINE_RESET_MEMBER(orion_state,orionz80) { - address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); space.unmap_write(0x0000, 0x3fff); space.install_write_bank(0x4000, 0xefff, "bank2"); @@ -346,20 +335,20 @@ MACHINE_RESET_MEMBER(orion_state,orionz80) space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0xf800); - membank("bank2")->set_base(machine().device(RAM_TAG)->pointer() + 0x4000); - membank("bank3")->set_base(machine().device(RAM_TAG)->pointer() + 0xf000); - membank("bank5")->set_base(memregion("maincpu")->base() + 0xf800); + m_bank1->set_base(m_region_maincpu->base() + 0xf800); + m_bank2->set_base(m_ram->pointer() + 0x4000); + m_bank3->set_base(m_ram->pointer() + 0xf000); + m_bank5->set_base(m_region_maincpu->base() + 0xf800); m_orion128_video_page = 0; m_orion128_video_mode = 0; m_orionz80_memory_page = 0; m_orionz80_dispatcher = 0; - m_speaker = 0; + m_speaker_data = 0; m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(machine(),384); - radio86_init_keyboard(machine()); + orion_set_video_mode(384); + radio86_init_keyboard(); } INTERRUPT_GEN_MEMBER(orion_state::orionz80_interrupt) @@ -374,7 +363,7 @@ READ8_MEMBER(orion_state::orionz80_io_r) { if (offset == 0xFFFD) { - return ay8910_r (machine().device("ay8912"), space, 0); + return ay8910_r(m_ay8912, space, 0); } return 0xff; } @@ -392,10 +381,10 @@ WRITE8_MEMBER(orion_state::orionz80_io_w) } switch(offset) { - case 0xfffd : ay8910_address_w(machine().device("ay8912"), space, 0, data); + case 0xfffd : ay8910_address_w(m_ay8912, space, 0, data); break; case 0xbffd : - case 0xbefd : ay8910_data_w(machine().device("ay8912"), space, 0, data); + case 0xbefd : ay8910_data_w(m_ay8912, space, 0, data); break; } } @@ -406,17 +395,16 @@ WRITE8_MEMBER(orion_state::orionz80_io_w) -static void orionpro_bank_switch(running_machine &machine) +void orion_state::orionpro_bank_switch() { - orion_state *state = machine.driver_data(); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); - int page = state->m_orionpro_page & 7; // we have only 8 pages - int is128 = (state->m_orionpro_dispatcher & 0x80) ? 1 : 0; - UINT8 *ram = machine.device(RAM_TAG)->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + int page = m_orionpro_page & 7; // we have only 8 pages + int is128 = (m_orionpro_dispatcher & 0x80) ? 1 : 0; + UINT8 *ram = m_ram->pointer(); if (is128==1) { - page = state->m_orionpro_128_page & 7; + page = m_orionpro_128_page & 7; } space.install_write_bank(0x0000, 0x1fff, "bank1"); space.install_write_bank(0x2000, 0x3fff, "bank2"); @@ -428,82 +416,82 @@ static void orionpro_bank_switch(running_machine &machine) space.install_write_bank(0xf800, 0xffff, "bank8"); - if ((state->m_orionpro_dispatcher & 0x01)==0x00) + if ((m_orionpro_dispatcher & 0x01)==0x00) { // RAM0 segment disabled - state->membank("bank1")->set_base(ram + 0x10000 * page); - state->membank("bank2")->set_base(ram + 0x10000 * page + 0x2000); + m_bank1->set_base(ram + 0x10000 * page); + m_bank2->set_base(ram + 0x10000 * page + 0x2000); } else { - state->membank("bank1")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000); - state->membank("bank2")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000); + m_bank1->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000); + m_bank2->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000); } - if ((state->m_orionpro_dispatcher & 0x10)==0x10) + if ((m_orionpro_dispatcher & 0x10)==0x10) { // ROM1 enabled space.unmap_write(0x0000, 0x1fff); - state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x20000); + m_bank1->set_base(m_region_maincpu->base() + 0x20000); } - if ((state->m_orionpro_dispatcher & 0x08)==0x08) + if ((m_orionpro_dispatcher & 0x08)==0x08) { // ROM2 enabled space.unmap_write(0x2000, 0x3fff); - state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x22000 + (state->m_orionpro_rom2_segment & 7) * 0x2000); + m_bank2->set_base(m_region_maincpu->base() + 0x22000 + (m_orionpro_rom2_segment & 7) * 0x2000); } - if ((state->m_orionpro_dispatcher & 0x02)==0x00) + if ((m_orionpro_dispatcher & 0x02)==0x00) { // RAM1 segment disabled - state->membank("bank3")->set_base(ram + 0x10000 * page + 0x4000); + m_bank3->set_base(ram + 0x10000 * page + 0x4000); } else { - state->membank("bank3")->set_base(ram + (state->m_orionpro_ram1_segment & 31) * 0x4000); + m_bank3->set_base(ram + (m_orionpro_ram1_segment & 31) * 0x4000); } - if ((state->m_orionpro_dispatcher & 0x04)==0x00) + if ((m_orionpro_dispatcher & 0x04)==0x00) { // RAM2 segment disabled - state->membank("bank4")->set_base(ram + 0x10000 * page + 0x8000); + m_bank4->set_base(ram + 0x10000 * page + 0x8000); } else { - state->membank("bank4")->set_base(ram + (state->m_orionpro_ram2_segment & 31) * 0x4000); + m_bank4->set_base(ram + (m_orionpro_ram2_segment & 31) * 0x4000); } - state->membank("bank5")->set_base(ram + 0x10000 * page + 0xc000); + m_bank5->set_base(ram + 0x10000 * page + 0xc000); if (is128) { - state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000); + m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); - space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),state)); - space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),state)); + space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); + space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); space.unmap_write(0xf600, 0xf6ff); - space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),state)); - space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),state)); - space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),state)); + space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),this)); + space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); + space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); space.unmap_read(0xf600, 0xf6ff); - space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),state)); + space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),this)); - space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),state)); - space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),state)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),state)); + space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); + space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); space.unmap_write(0xfb00, 0xfeff); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800); + m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); } else { - if ((state->m_orionpro_dispatcher & 0x40)==0x40) + if ((m_orionpro_dispatcher & 0x40)==0x40) { // FIX F000 enabled - state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000); - state->membank("bank7")->set_base(ram + 0x10000 * 0 + 0xf400); - state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800); + m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); + m_bank7->set_base(ram + 0x10000 * 0 + 0xf400); + m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); } else { - state->membank("bank6")->set_base(ram + 0x10000 * page + 0xf000); - state->membank("bank7")->set_base(ram + 0x10000 * page + 0xf400); - state->membank("bank8")->set_base(ram + 0x10000 * page + 0xf800); + m_bank6->set_base(ram + 0x10000 * page + 0xf000); + m_bank7->set_base(ram + 0x10000 * page + 0xf400); + m_bank8->set_base(ram + 0x10000 * page + 0xf800); } } } @@ -511,12 +499,12 @@ static void orionpro_bank_switch(running_machine &machine) WRITE8_MEMBER(orion_state::orionpro_memory_page_w) { m_orionpro_128_page = data; - orionpro_bank_switch(machine()); + orionpro_bank_switch(); } MACHINE_RESET_MEMBER(orion_state,orionpro) { - radio86_init_keyboard(machine()); + radio86_init_keyboard(); m_orion128_video_page = 0; m_orion128_video_mode = 0; @@ -529,11 +517,11 @@ MACHINE_RESET_MEMBER(orion_state,orionpro) m_orionpro_rom2_segment = 0; m_orionpro_dispatcher = 0x50; - orionpro_bank_switch(machine()); + orionpro_bank_switch(); - m_speaker = 0; + m_speaker_data = 0; m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(machine(),384); + orion_set_video_mode(384); m_video_mode_mask = 31; m_orionpro_pseudo_color = 0; @@ -566,7 +554,7 @@ READ8_MEMBER(orion_state::orionpro_io_r) } if (offset == 0xFFFD) { - return ay8910_r (machine().device("ay8912"), space, 0); + return ay8910_r(m_ay8912, space, 0); } return 0xff; } @@ -575,12 +563,12 @@ WRITE8_MEMBER(orion_state::orionpro_io_w) { switch (offset & 0xff) { - case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(machine()); break; - case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(machine()); break; - case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(machine()); break; - case 0x08 : m_orionpro_page = data; orionpro_bank_switch(machine()); break; - case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(machine()); break; - case 0x0a : m_orionpro_dispatcher = data; orionpro_bank_switch(machine()); break; + case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(); break; + case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(); break; + case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(); break; + case 0x08 : m_orionpro_page = data; orionpro_bank_switch(); break; + case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(); break; + case 0x0a : m_orionpro_dispatcher = data; orionpro_bank_switch(); break; case 0x10 : m_fdc->cmd_w(space, 0,data); break; case 0x11 : m_fdc->track_w(space, 0,data);break; case 0x12 : m_fdc->sector_w(space, 0,data);break; @@ -596,7 +584,7 @@ WRITE8_MEMBER(orion_state::orionpro_io_w) case 0x2a : orion128_romdisk_w(space,2,data); break; case 0x2b : orion128_romdisk_w(space,3,data); break; case 0xf8 : orion128_video_mode_w(space,0,data);break; - case 0xf9 : m_orionpro_128_page = data; orionpro_bank_switch(machine()); break; + case 0xf9 : m_orionpro_128_page = data; orionpro_bank_switch(); break; case 0xfa : orion128_video_page_w(space,0,data);break; case 0xfc : m_orionpro_pseudo_color = data;break; case 0xfe : orionz80_sound_fe_w(space,0,data);break; @@ -604,10 +592,10 @@ WRITE8_MEMBER(orion_state::orionpro_io_w) } switch(offset) { - case 0xfffd : ay8910_address_w(machine().device("ay8912"), space, 0, data); + case 0xfffd : ay8910_address_w(m_ay8912, space, 0, data); break; case 0xbffd : - case 0xbefd : ay8910_data_w(machine().device("ay8912"), space, 0, data); + case 0xbefd : ay8910_data_w(m_ay8912, space, 0, data); break; } } diff --git a/src/mess/machine/radio86.c b/src/mess/machine/radio86.c index a21fd7ea7a7..80b6af4e3ab 100644 --- a/src/mess/machine/radio86.c +++ b/src/mess/machine/radio86.c @@ -9,7 +9,6 @@ #include "emu.h" #include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" #include "machine/i8255.h" #include "machine/8257dma.h" #include "video/i8275.h" @@ -17,22 +16,21 @@ -void radio86_init_keyboard(running_machine &machine) +void radio86_state::radio86_init_keyboard() { - radio86_state *state = machine.driver_data(); - state->m_keyboard_mask = 0; - state->m_tape_value = 0x10; + m_keyboard_mask = 0; + m_tape_value = 0x10; } /* Driver initialization */ DRIVER_INIT_MEMBER(radio86_state,radio86) { /* set initialy ROM to be visible on first bank */ - UINT8 *RAM = memregion("maincpu")->base(); + UINT8 *RAM = m_region_maincpu->base(); memset(RAM,0x0000,0x1000); // make frist page empty by default - membank("bank1")->configure_entries(1, 2, RAM, 0x0000); - membank("bank1")->configure_entries(0, 2, RAM, 0xf800); - radio86_init_keyboard(machine()); + m_bank1->configure_entries(1, 2, RAM, 0x0000); + m_bank1->configure_entries(0, 2, RAM, 0xf800); + radio86_init_keyboard(); } DRIVER_INIT_MEMBER(radio86_state,radioram) @@ -44,21 +42,21 @@ DRIVER_INIT_MEMBER(radio86_state,radioram) READ8_MEMBER(radio86_state::radio86_8255_portb_r2) { UINT8 key = 0xff; - if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("LINE0")->read(); } - if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("LINE1")->read(); } - if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("LINE2")->read(); } - if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("LINE3")->read(); } - if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("LINE4")->read(); } - if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("LINE5")->read(); } - if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("LINE6")->read(); } - if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("LINE7")->read(); } + if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); } + if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); } + if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); } + if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); } + if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); } + if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); } + if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); } + if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); } return key; } READ8_MEMBER(radio86_state::radio86_8255_portc_r2) { - double level = (machine().device(CASSETTE_TAG)->input()); - UINT8 dat = ioport("LINE8")->read(); + double level = m_cassette->input(); + UINT8 dat = m_io_line8->read(); if (level < 0) { dat ^= m_tape_value; } @@ -72,7 +70,7 @@ WRITE8_MEMBER(radio86_state::radio86_8255_porta_w2) WRITE8_MEMBER(radio86_state::radio86_8255_portc_w2) { - machine().device(CASSETTE_TAG)->output(data & 0x01 ? 1 : -1); + m_cassette->output(data & 0x01 ? 1 : -1); } @@ -100,16 +98,16 @@ I8255A_INTERFACE( mikrosha_ppi8255_interface_1 ) READ8_MEMBER(radio86_state::rk7007_8255_portc_r) { - double level = (machine().device(CASSETTE_TAG)->input()); + double level = m_cassette->input(); UINT8 key = 0xff; - if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("CLINE0")->read(); } - if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("CLINE1")->read(); } - if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("CLINE2")->read(); } - if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("CLINE3")->read(); } - if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("CLINE4")->read(); } - if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("CLINE5")->read(); } - if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("CLINE6")->read(); } - if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("CLINE7")->read(); } + if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_cline0->read(); } + if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_cline1->read(); } + if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_cline2->read(); } + if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_cline3->read(); } + if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_cline4->read(); } + if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_cline5->read(); } + if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_cline6->read(); } + if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_cline7->read(); } key &= 0xe0; if (level < 0) { key ^= m_tape_value; @@ -130,10 +128,10 @@ I8255A_INTERFACE( rk7007_ppi8255_interface ) WRITE_LINE_MEMBER(radio86_state::hrq_w) { /* HACK - this should be connected to the BUSREQ line of Z80 */ - machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state); + m_maincpu->set_input_line(INPUT_LINE_HALT, state); /* HACK - this should be connected to the BUSACK line of Z80 */ - i8257_hlda_w(machine().device("dma8257"), state); + i8257_hlda_w(m_dma8257, state); } static UINT8 memory_read_byte(address_space &space, offs_t address, UINT8 mem_mask) { return space.read_byte(address); } @@ -152,7 +150,7 @@ I8257_INTERFACE( radio86_dma ) TIMER_CALLBACK_MEMBER(radio86_state::radio86_reset) { - membank("bank1")->set_entry(0); + m_bank1->set_entry(0); } @@ -163,18 +161,18 @@ READ8_MEMBER(radio86_state::radio_cpu_state_r) READ8_MEMBER(radio86_state::radio_io_r) { - return machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte((offset << 8) + offset); + return m_maincpu->space(AS_PROGRAM).read_byte((offset << 8) + offset); } WRITE8_MEMBER(radio86_state::radio_io_w) { - machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte((offset << 8) + offset,data); + m_maincpu->space(AS_PROGRAM).write_byte((offset << 8) + offset,data); } MACHINE_RESET_MEMBER(radio86_state,radio86) { machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(radio86_state::radio86_reset),this)); - membank("bank1")->set_entry(1); + m_bank1->set_entry(1); m_keyboard_mask = 0; m_disk_sel = 0; @@ -188,7 +186,7 @@ WRITE8_MEMBER(radio86_state::radio86_pagesel) READ8_MEMBER(radio86_state::radio86_romdisk_porta_r) { - UINT8 *romdisk = memregion("maincpu")->base() + 0x10000; + UINT8 *romdisk = m_region_maincpu->base() + 0x10000; if ((m_disk_sel & 0x0f) ==0) { return romdisk[m_romdisk_msb*256+m_romdisk_lsb]; } else { diff --git a/src/mess/video/orion.c b/src/mess/video/orion.c index fdbb66d980d..c254232142b 100644 --- a/src/mess/video/orion.c +++ b/src/mess/video/orion.c @@ -10,7 +10,6 @@ #include "emu.h" #include "includes/orion.h" -#include "machine/ram.h" VIDEO_START_MEMBER(orion_state,orion128) { @@ -24,7 +23,7 @@ UINT32 orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 & int part1addr = (3-((m_orion128_video_page & 3) | orionproshift)) * 0x4000; int part2addr = part1addr + 0x10000; int video_mode = m_orion128_video_mode & m_video_mode_mask; - UINT8 *ram = machine().device(RAM_TAG)->pointer(); + UINT8 *ram = m_ram->pointer(); for (x = 0; x < m_orion128_video_width; x++) {