From 1168ab8b17ee0b4fe3bbfa4fd468a431b3b54f35 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 1 Mar 2023 18:19:26 +0100 Subject: svision/svision.cpp: split into subclasses --- src/mame/kaneko/snowbros.cpp | 9 +- src/mame/svision/svision.cpp | 378 +++++++++++++++++++++++++------------------ 2 files changed, 228 insertions(+), 159 deletions(-) diff --git a/src/mame/kaneko/snowbros.cpp b/src/mame/kaneko/snowbros.cpp index d737d2c0f0c..2db2b89eff5 100644 --- a/src/mame/kaneko/snowbros.cpp +++ b/src/mame/kaneko/snowbros.cpp @@ -2144,12 +2144,13 @@ ROM_START( wintbob ) /* The wb03.bin below is bad, the set has a different copyright message (IN KOREA is replaced with 1990) but also clearly suffers from bitrot at the following addresses 4FC2, 5F02, 6642, D6C2, D742 - in all cases bit 0x20 is incorrectly set in the bad rom + in all cases bit 0x20 is incorrectly set in the bad ROM + ROM_LOAD16_BYTE( "wb03.bin", 0x00000, 0x10000, CRC(df56e168) SHA1(20dbabdd97e6f3d4bf6500bf9e8476942cb48ae3) ) + ROM_LOAD16_BYTE( "wb01.bin", 0x00001, 0x10000, CRC(05722f17) SHA1(9356e2488ea35e0a2978689f2ca6dfa0d57fd2ed) ) + A dump from a different PCB confirmed the above. Correct ROM for this copyright message hack is + ROM_LOAD16_BYTE( "wb03.bin", 0x00000, 0x10000, CRC(e2ae422b) SHA1(526abf88747a00527047ec578a20be36f25af257) ) */ -// ROM_LOAD16_BYTE( "wb03.bin", 0x00000, 0x10000, CRC(df56e168) SHA1(20dbabdd97e6f3d4bf6500bf9e8476942cb48ae3) ) -// ROM_LOAD16_BYTE( "wb01.bin", 0x00001, 0x10000, CRC(05722f17) SHA1(9356e2488ea35e0a2978689f2ca6dfa0d57fd2ed) ) - ROM_LOAD16_BYTE( "wb04.bin", 0x20000, 0x10000, CRC(53be758d) SHA1(56cf85ba23fe699031d73e8f367a1b8ac837d5f8) ) ROM_LOAD16_BYTE( "wb02.bin", 0x20001, 0x10000, CRC(fc8e292e) SHA1(857cfeb0be121e64e6117120514ae1f2ffeae4d6) ) diff --git a/src/mame/svision/svision.cpp b/src/mame/svision/svision.cpp index 817944f782c..cdf811e779a 100644 --- a/src/mame/svision/svision.cpp +++ b/src/mame/svision/svision.cpp @@ -48,26 +48,18 @@ public: , m_videoram(*this, "videoram") , m_screen(*this, "screen") , m_joy(*this, "JOY") - , m_joy2(*this, "JOY2") , m_palette(*this, "palette") , m_bank(*this, "bank%u", 1U) { } void svisionp(machine_config &config); - void svisions(machine_config &config); - void tvlinkp(machine_config &config); void svision(machine_config &config); void svisionn(machine_config &config); - void svision_base(machine_config &config); - - void init_svisions(); - void init_svision(); protected: virtual void machine_start() override; virtual void machine_reset() override; -private: required_device m_maincpu; required_device m_sound; required_device m_cart; @@ -75,7 +67,6 @@ private: required_shared_ptr m_videoram; required_device m_screen; required_ioport m_joy; - optional_ioport m_joy2; required_device m_palette; required_memory_bank_array<2> m_bank; @@ -90,94 +81,119 @@ private: BANK = 0x26, }; - struct svision_t - { - emu_timer *timer1 = nullptr; - uint8_t timer_shot = 0; - }; - - struct svision_pet_t - { - uint8_t state = 0; - uint8_t on = 0, clock = 0, data = 0; - uint8_t input = 0; - emu_timer *timer = nullptr; - }; - - struct tvlink_t - { - uint32_t palette[4]; // 0x40? rgb8 - uint8_t palette_on; - }; - - svision_t m_svision; - svision_pet_t m_pet; - tvlink_t m_tvlink; + emu_timer *m_timer1 = nullptr; + uint8_t m_timer_shot = 0; bool m_dma_finished = false; DECLARE_WRITE_LINE_MEMBER(sound_irq_w); uint8_t regs_r(offs_t offset); void regs_w(offs_t offset, uint8_t data); - uint8_t tvlink_r(offs_t offset); - void tvlink_w(offs_t offset, uint8_t data); - uint32_t screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(frame_int_w); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load); void svision_palette(palette_device &palette) const; void svisionp_palette(palette_device &palette) const; void svisionn_palette(palette_device &palette) const; - DECLARE_MACHINE_RESET(tvlink); - uint32_t make8_rgb32(uint8_t red3, uint8_t green3, uint8_t blue2) { return (red3 << (16 + 5)) | (green3 << (8 + 5)) | (blue2 << (0 + 6)); } - uint32_t make9_rgb32(uint8_t red3, uint8_t green3, uint8_t blue3) { return (red3 << (16 + 5)) | (green3 << (8 + 5)) | (blue3 << (0 + 5)); } - uint32_t make12_rgb32(uint8_t red4, uint8_t green4, uint8_t blue4) { return (red4 << (16 + 4)) | (green4 << (8 + 4)) | (blue4 << (0 + 4)); } - uint32_t make24_rgb32(uint8_t red8, uint8_t green8, uint8_t blue8) { return ((red8 & 0xf8) << 16) | ((green8 & 0xf8) << 8) | (blue8 & 0xf8); } + [[maybe_unused]] static constexpr uint32_t make8_rgb32(uint8_t red3, uint8_t green3, uint8_t blue2) { return (red3 << (16 + 5)) | (green3 << (8 + 5)) | (blue2 << (0 + 6)); } + static constexpr uint32_t make9_rgb32(uint8_t red3, uint8_t green3, uint8_t blue3) { return (red3 << (16 + 5)) | (green3 << (8 + 5)) | (blue3 << (0 + 5)); } + static constexpr uint32_t make12_rgb32(uint8_t red4, uint8_t green4, uint8_t blue4) { return (red4 << (16 + 4)) | (green4 << (8 + 4)) | (blue4 << (0 + 4)); } + static constexpr uint32_t make24_rgb32(uint8_t red8, uint8_t green8, uint8_t blue8) { return ((red8 & 0xf8) << 16) | ((green8 & 0xf8) << 8) | (blue8 & 0xf8); } void check_irq(); - TIMER_CALLBACK_MEMBER(svision_pet_timer); - TIMER_CALLBACK_MEMBER(svision_timer); - TIMER_DEVICE_CALLBACK_MEMBER(svision_pet_timer_dev); + TIMER_CALLBACK_MEMBER(timer); + + void program_map(address_map &map); + + void svision_base(machine_config &config); +}; + +class svisions_state : public svision_state +{ +public: + svisions_state(const machine_config &mconfig, device_type type, const char *tag) + : svision_state(mconfig, type, tag) + , m_joy2(*this, "JOY2") + { } + + void svisions(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + required_ioport m_joy2; + + uint8_t m_state = 0; + uint8_t m_clock = 0, m_data = 0; + uint8_t m_input = 0; + emu_timer *m_timer = nullptr; - void svision_mem(address_map &map); - void tvlink_mem(address_map &map); + uint8_t regs_r(offs_t offset); + + TIMER_CALLBACK_MEMBER(pet_timer); + TIMER_DEVICE_CALLBACK_MEMBER(pet_timer_dev); + + void program_map(address_map &map); }; -TIMER_CALLBACK_MEMBER(svision_state::svision_pet_timer) +class tvlink_state : public svision_state { - switch (m_pet.state) +public: + tvlink_state(const machine_config &mconfig, device_type type, const char *tag) + : svision_state(mconfig, type, tag) + { } + + void tvlinkp(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + uint32_t m_tvlink_palette[4]{}; // 0x40? rgb8 + uint8_t m_palette_on = 0; + + uint8_t regs_r(offs_t offset); + void regs_w(offs_t offset, uint8_t data); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void program_map(address_map &map); +}; + +TIMER_CALLBACK_MEMBER(svisions_state::pet_timer) +{ + switch (m_state) { case 0x00: - if (m_joy2.found()) - { - m_pet.input = m_joy2->read(); - } + m_input = m_joy2->read(); [[fallthrough]]; case 0x02: case 0x04: case 0x06: case 0x08: case 0x0a: case 0x0c: case 0x0e: - m_pet.clock = m_pet.state & 2; - m_pet.data = m_pet.input & 1; - m_pet.input >>= 1; - m_pet.state++; + m_clock = m_state & 2; + m_data = m_input & 1; + m_input >>= 1; + m_state++; break; case 0x1f: - m_pet.state = 0; + m_state = 0; break; default: - m_pet.state++; + m_state++; break; } } -TIMER_DEVICE_CALLBACK_MEMBER(svision_state::svision_pet_timer_dev) +TIMER_DEVICE_CALLBACK_MEMBER(svisions_state::pet_timer_dev) { - svision_pet_timer(param); + pet_timer(param); } WRITE_LINE_MEMBER(svision_state::sound_irq_w) @@ -188,16 +204,16 @@ WRITE_LINE_MEMBER(svision_state::sound_irq_w) void svision_state::check_irq() { - bool irq = m_svision.timer_shot && BIT(m_reg[BANK], 1); + bool irq = m_timer_shot && BIT(m_reg[BANK], 1); irq = irq || (m_dma_finished && BIT(m_reg[BANK], 2)); m_maincpu->set_input_line(M65C02_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE); } -TIMER_CALLBACK_MEMBER(svision_state::svision_timer) +TIMER_CALLBACK_MEMBER(svision_state::timer) { - m_svision.timer_shot = true; - m_svision.timer1->enable(false); + m_timer_shot = true; + m_timer1->enable(false); check_irq(); } @@ -212,22 +228,62 @@ uint8_t svision_state::regs_r(offs_t offset) case 0x21: data &= ~0xf; data |= m_reg[0x22] & 0xf; - if (m_pet.on) + break; + + case 0x27: + data &= ~3; + if (m_timer_shot) { - if (!m_pet.clock) - { - data &= ~4; - } - if (!m_pet.data) - { - data &= ~8; - } + data |= 1; + } + if (m_dma_finished) + { + data |= 2; + } + break; + + case 0x24: + m_timer_shot = false; + check_irq(); + break; + + case 0x25: + m_dma_finished = false; + check_irq(); + break; + + default: + LOGREGS("%.6f svision read %04x %02x\n", machine().time().as_double(), offset, data); + break; + } + + return data; +} + +uint8_t svisions_state::regs_r(offs_t offset) +{ + int data = m_reg[offset]; + switch (offset) + { + case 0x20: + return m_joy->read(); + + case 0x21: + data &= ~0xf; + data |= m_reg[0x22] & 0xf; + if (!m_clock) + { + data &= ~4; + } + if (!m_data) + { + data &= ~8; } break; case 0x27: data &= ~3; - if (m_svision.timer_shot) + if (m_timer_shot) { data |= 1; } @@ -238,7 +294,7 @@ uint8_t svision_state::regs_r(offs_t offset) break; case 0x24: - m_svision.timer_shot = false; + m_timer_shot = false; check_irq(); break; @@ -278,8 +334,8 @@ void svision_state::regs_w(offs_t offset, uint8_t data) { int delay = (data == 0) ? 0x100 : data; delay *= (BIT(m_reg[BANK], 4)) ? 0x4000 : 0x100; - m_svision.timer1->enable(true); - m_svision.timer1->reset(m_maincpu->cycles_to_attotime(delay)); + m_timer1->enable(true); + m_timer1->reset(m_maincpu->cycles_to_attotime(delay)); break; } @@ -305,7 +361,7 @@ void svision_state::regs_w(offs_t offset, uint8_t data) } } -uint8_t svision_state::tvlink_r(offs_t offset) +uint8_t tvlink_state::regs_r(offs_t offset) { switch(offset) { @@ -313,41 +369,41 @@ uint8_t svision_state::tvlink_r(offs_t offset) if (offset >= 0x800 && offset < 0x840) { // strange effects when modifying palette - return regs_r(offset); + return svision_state::regs_r(offset); } else { - return regs_r(offset); + return svision_state::regs_r(offset); } } } -void svision_state::tvlink_w(offs_t offset, uint8_t data) +void tvlink_state::regs_w(offs_t offset, uint8_t data) { switch (offset) { case 0x0e: m_reg[offset] = data; - m_tvlink.palette_on = data & 1; - if (m_tvlink.palette_on) + m_palette_on = data & 1; + if (m_palette_on) { // hack, normally initialising with palette from RAM - m_tvlink.palette[0] = make12_rgb32(163 / 16, 172 / 16, 115 / 16); // these are the tron colors measured from screenshot - m_tvlink.palette[1] = make12_rgb32(163 / 16, 155 / 16, 153 / 16); - m_tvlink.palette[2] = make12_rgb32(77 / 16, 125 / 16, 73 / 16); - m_tvlink.palette[3] = make12_rgb32(59 / 16, 24 / 16, 20 / 16); + m_tvlink_palette[0] = make12_rgb32(163 / 16, 172 / 16, 115 / 16); // these are the tron colors measured from screenshot + m_tvlink_palette[1] = make12_rgb32(163 / 16, 155 / 16, 153 / 16); + m_tvlink_palette[2] = make12_rgb32(77 / 16, 125 / 16, 73 / 16); + m_tvlink_palette[3] = make12_rgb32(59 / 16, 24 / 16, 20 / 16); } else { // cleaner to use colors from compile time palette, or compose from "fixed" palette values - m_tvlink.palette[0] = make12_rgb32(0, 0, 0); - m_tvlink.palette[1] = make12_rgb32(5 * 16 / 256, 18 * 16 / 256, 9 * 16 / 256); - m_tvlink.palette[2] = make12_rgb32(48 * 16 / 256, 76 * 16 / 256, 100 * 16 / 256); - m_tvlink.palette[3] = make12_rgb32(190 * 16 / 256, 190 * 16 / 256, 190 * 16 / 256); + m_tvlink_palette[0] = make12_rgb32(0, 0, 0); + m_tvlink_palette[1] = make12_rgb32(5 * 16 / 256, 18 * 16 / 256, 9 * 16 / 256); + m_tvlink_palette[2] = make12_rgb32(48 * 16 / 256, 76 * 16 / 256, 100 * 16 / 256); + m_tvlink_palette[3] = make12_rgb32(190 * 16 / 256, 190 * 16 / 256, 190 * 16 / 256); } break; default: - regs_w(offset, data); + svision_state::regs_w(offset, data); if (offset >= 0x800 && offset < 0x840) { if (offset == 0x803 && data == 0x07) @@ -359,13 +415,13 @@ void svision_state::tvlink_w(offs_t offset, uint8_t data) m_reg[0x0807] = 0x00; } uint16_t c = m_reg[0x800] | (m_reg[0x804] << 8); - m_tvlink.palette[0] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); + m_tvlink_palette[0] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); c = m_reg[0x801] | (m_reg[0x805] << 8); - m_tvlink.palette[1] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); + m_tvlink_palette[1] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); c = m_reg[0x802] | (m_reg[0x806]<<8); - m_tvlink.palette[2] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); + m_tvlink_palette[2] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); c = m_reg[0x803] | (m_reg[0x807]<<8); - m_tvlink.palette[3] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); + m_tvlink_palette[3] = make9_rgb32((c >> 0) & 7, (c >> 3) & 7, (c >> 6) & 7); /* writes to palette effect video color immediately some writes modify other registers, encoding therefor not known (rgb8 or rgb9) */ @@ -373,7 +429,7 @@ void svision_state::tvlink_w(offs_t offset, uint8_t data) } } -void svision_state::svision_mem(address_map &map) +void svision_state::program_map(address_map &map) { map(0x0000, 0x1fff).ram(); map(0x2000, 0x3fff).rw(FUNC(svision_state::regs_r), FUNC(svision_state::regs_w)).share(m_reg); @@ -383,14 +439,18 @@ void svision_state::svision_mem(address_map &map) map(0xc000, 0xffff).bankr(m_bank[1]); } -void svision_state::tvlink_mem(address_map &map) +void svisions_state::program_map(address_map &map) { - map(0x0000, 0x1fff).ram(); - map(0x2000, 0x3fff).rw(FUNC(svision_state::tvlink_r), FUNC(svision_state::tvlink_w)).share(m_reg); - map(0x4000, 0x5fff).ram().share(m_videoram); - map(0x6000, 0x7fff).noprw(); - map(0x8000, 0xbfff).bankr(m_bank[0]); - map(0xc000, 0xffff).bankr(m_bank[1]); + svision_state::program_map(map); + + map(0x2000, 0x3fff).rw(FUNC(svisions_state::regs_r), FUNC(svisions_state::regs_w)).share(m_reg); +} + +void tvlink_state::program_map(address_map &map) +{ + svision_state::program_map(map); + + map(0x2000, 0x3fff).rw(FUNC(tvlink_state::regs_r), FUNC(tvlink_state::regs_w)).share(m_reg); } static INPUT_PORTS_START( svision ) @@ -415,6 +475,7 @@ static INPUT_PORTS_START( svisions ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_PLAYER(1) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") PORT_PLAYER(1) + PORT_START("JOY2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) @@ -478,7 +539,7 @@ void svision_state::svisionp_palette(palette_device &palette) const palette.set_pen_colors(0, svisionp_pens); } -uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t svision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if (BIT(m_reg[BANK], 3)) { @@ -510,7 +571,7 @@ uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind1 return 0; } -uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t tvlink_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { if (BIT(m_reg[BANK], 3)) { @@ -525,7 +586,7 @@ uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 uint8_t b = m_videoram[j + i]; for (int pix = 0; pix < 4; pix++) { - *line = m_tvlink.palette[b & 3]; + *line = m_tvlink_palette[b & 3]; b >>= 2; line++; } @@ -553,22 +614,7 @@ WRITE_LINE_MEMBER(svision_state::frame_int_w) m_sound->sound_decrement(); } -void svision_state::init_svision() -{ - m_svision.timer1 = timer_alloc(FUNC(svision_state::svision_timer), this); - m_dma_finished = false; - m_pet.on = false; -} - -void svision_state::init_svisions() -{ - m_svision.timer1 = timer_alloc(FUNC(svision_state::svision_timer), this); - m_dma_finished = false; - m_pet.on = true; - m_pet.timer = timer_alloc(FUNC(svision_state::svision_pet_timer), this); -} - -DEVICE_IMAGE_LOAD_MEMBER( svision_state::cart_load ) +DEVICE_IMAGE_LOAD_MEMBER(svision_state::cart_load) { uint32_t size = m_cart->common_get_size("rom"); @@ -586,6 +632,9 @@ DEVICE_IMAGE_LOAD_MEMBER( svision_state::cart_load ) void svision_state::machine_start() { + m_timer1 = timer_alloc(FUNC(svision_state::timer), this); + m_dma_finished = false; + std::string region_tag(m_cart->tag()); region_tag.append(GENERIC_ROM_REGION_TAG); m_cart_rom = memregion(region_tag.c_str()); @@ -597,39 +646,50 @@ void svision_state::machine_start() m_bank[1]->set_base(m_cart_rom->base() + (num_banks - 1) * 0x4000); // bank2 is set to the last bank } - save_item(STRUCT_MEMBER(m_svision, timer_shot)); + save_item(NAME(m_timer_shot)); + save_item(NAME(m_dma_finished)); +} - save_item(STRUCT_MEMBER(m_pet, state)); - save_item(STRUCT_MEMBER(m_pet, on)); - save_item(STRUCT_MEMBER(m_pet, clock)); - save_item(STRUCT_MEMBER(m_pet, data)); - save_item(STRUCT_MEMBER(m_pet, input)); +void svisions_state::machine_start() +{ + svision_state::machine_start(); - save_item(STRUCT_MEMBER(m_tvlink, palette)); - save_item(STRUCT_MEMBER(m_tvlink, palette_on)); + m_timer = timer_alloc(FUNC(svisions_state::pet_timer), this); - save_item(NAME(m_dma_finished)); + save_item(NAME(m_state)); + save_item(NAME(m_clock)); + save_item(NAME(m_data)); + save_item(NAME(m_input)); +} + +void tvlink_state::machine_start() +{ + svision_state::machine_start(); + + save_item(NAME(m_tvlink_palette)); + save_item(NAME(m_palette_on)); } void svision_state::machine_reset() { - m_svision.timer_shot = false; + m_timer_shot = false; m_dma_finished = false; } -MACHINE_RESET_MEMBER(svision_state,tvlink) +void tvlink_state::machine_reset() { svision_state::machine_reset(); - m_tvlink.palette_on = false; + + m_palette_on = false; memset(m_reg + 0x800, 0xff, 0x40); // normally done from m_tvlink microcontroller m_reg[0x82a] = 0xdf; - m_tvlink.palette[0] = make24_rgb32(svisionp_pens[0].r(), svisionp_pens[0].g(), svisionp_pens[0].b()); - m_tvlink.palette[1] = make24_rgb32(svisionp_pens[1].r(), svisionp_pens[1].g(), svisionp_pens[1].b()); - m_tvlink.palette[2] = make24_rgb32(svisionp_pens[2].r(), svisionp_pens[2].g(), svisionp_pens[2].b()); - m_tvlink.palette[3] = make24_rgb32(svisionp_pens[3].r(), svisionp_pens[3].g(), svisionp_pens[3].b()); + m_tvlink_palette[0] = make24_rgb32(svisionp_pens[0].r(), svisionp_pens[0].g(), svisionp_pens[0].b()); + m_tvlink_palette[1] = make24_rgb32(svisionp_pens[1].r(), svisionp_pens[1].g(), svisionp_pens[1].b()); + m_tvlink_palette[2] = make24_rgb32(svisionp_pens[2].r(), svisionp_pens[2].g(), svisionp_pens[2].b()); + m_tvlink_palette[3] = make24_rgb32(svisionp_pens[3].r(), svisionp_pens[3].g(), svisionp_pens[3].b()); } void svision_state::svision_base(machine_config &config) @@ -638,6 +698,7 @@ void svision_state::svision_base(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); + SVISION_SND(config, m_sound, 4'000'000, m_maincpu, m_bank[0]); m_sound->add_route(0, "lspeaker", 0.50); m_sound->add_route(1, "rspeaker", 0.50); @@ -655,23 +716,26 @@ void svision_state::svision(machine_config &config) svision_base(config); M65C02(config, m_maincpu, 4'000'000); - m_maincpu->set_addrmap(AS_PROGRAM, &svision_state::svision_mem); + m_maincpu->set_addrmap(AS_PROGRAM, &svision_state::program_map); SCREEN(config, m_screen, SCREEN_TYPE_LCD); m_screen->set_refresh_hz(61); m_screen->set_size(3+160+3, 160); m_screen->set_visarea(3+0, 3+160-1, 0, 160-1); - m_screen->set_screen_update(FUNC(svision_state::screen_update_svision)); + m_screen->set_screen_update(FUNC(svision_state::screen_update)); m_screen->set_palette(m_palette); m_screen->screen_vblank().set(FUNC(svision_state::frame_int_w)); PALETTE(config, m_palette, FUNC(svision_state::svision_palette), std::size(svision_pens)); } -void svision_state::svisions(machine_config &config) +void svisions_state::svisions(machine_config &config) { svision(config); - TIMER(config, "pet_timer").configure_periodic(FUNC(svision_state::svision_pet_timer_dev), attotime::from_seconds(8)); + + m_maincpu->set_addrmap(AS_PROGRAM, &svisions_state::program_map); + + TIMER(config, "pet_timer").configure_periodic(FUNC(svisions_state::pet_timer_dev), attotime::from_seconds(8)); } void svision_state::svisionp(machine_config &config) @@ -679,27 +743,31 @@ void svision_state::svisionp(machine_config &config) svision(config); m_maincpu->set_clock(4'430'000); + m_screen->set_refresh(HZ_TO_ATTOSECONDS(50)); + m_palette->set_init(FUNC(svision_state::svisionp_palette)); } void svision_state::svisionn(machine_config &config) { svision(config); + m_maincpu->set_clock(3'560'000); // ? + m_screen->set_refresh(HZ_TO_ATTOSECONDS(60)); + m_palette->set_init(FUNC(svision_state::svisionn_palette)); } -void svision_state::tvlinkp(machine_config &config) +void tvlink_state::tvlinkp(machine_config &config) { svisionp(config); - m_maincpu->set_addrmap(AS_PROGRAM, &svision_state::tvlink_mem); - m_screen->set_no_palette(); - m_screen->set_screen_update(FUNC(svision_state::screen_update_tvlink)); + m_maincpu->set_addrmap(AS_PROGRAM, &tvlink_state::program_map); - MCFG_MACHINE_RESET_OVERRIDE(svision_state, tvlink) + m_screen->set_no_palette(); + m_screen->set_screen_update(FUNC(tvlink_state::screen_update)); } ROM_START(svision) @@ -709,7 +777,7 @@ ROM_END ROM_START(tvlinkp) ROM_REGION(0x80000, "maincpu", ROMREGION_ERASE00) - ROM_REGION(0x10000, "bezel", 0 ) + ROM_REGION(0x10000, "bezel", 0) ROM_LOAD( "9307md_512d.glob", 0x00000, 0x10000, CRC(bc8b981b) SHA1(3328da4fd9462286e8cefe4372ffd17c8f5a229e) ) ROM_END @@ -726,14 +794,14 @@ ROM_END #define rom_svisionn rom_svision #define rom_svisionp rom_svision -// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS +// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS // marketed under a ton of firms and names -CONS(1992, svision, 0, 0, svision, svision, svision_state, init_svision, "Watara", "Super Vision", MACHINE_SUPPORTS_SAVE ) +CONS(1992, svision, 0, 0, svision, svision, svision_state, empty_init, "Watara", "Super Vision", MACHINE_SUPPORTS_SAVE ) // svdual 2 connected via communication port -CONS( 1992, svisions, svision, 0, svisions, svisions, svision_state, init_svisions, "Watara", "Super Vision (PeT Communication Simulation)", MACHINE_SUPPORTS_SAVE ) +CONS( 1992, svisions, svision, 0, svisions, svisions, svisions_state, empty_init, "Watara", "Super Vision (PeT Communication Simulation)", MACHINE_SUPPORTS_SAVE ) -CONS( 1993, svisionp, svision, 0, svisionp, svision, svision_state, init_svision, "Watara", "Super Vision (PAL TV Link Colored)", MACHINE_SUPPORTS_SAVE ) -CONS( 1993, svisionn, svision, 0, svisionn, svision, svision_state, init_svision, "Watara", "Super Vision (NTSC TV Link Colored)", MACHINE_SUPPORTS_SAVE ) +CONS( 1993, svisionp, svision, 0, svisionp, svision, svision_state, empty_init, "Watara", "Super Vision (PAL TV Link Colored)", MACHINE_SUPPORTS_SAVE ) +CONS( 1993, svisionn, svision, 0, svisionn, svision, svision_state, empty_init, "Watara", "Super Vision (NTSC TV Link Colored)", MACHINE_SUPPORTS_SAVE ) // svtvlink (2 supervisions) // tvlink (pad supervision simulated) -CONS( 199?, tvlinkp, svision, 0, tvlinkp, svision, svision_state, init_svision, "Watara", "TV Link PAL", MACHINE_SUPPORTS_SAVE ) +CONS( 199?, tvlinkp, svision, 0, tvlinkp, svision, tvlink_state, empty_init, "Watara", "TV Link PAL", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3