diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index d95fad28c8c..453a67d492b 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Robbbert -/*************************************************************************** +/********************************************************************************************** Vegas 6809 @@ -37,16 +37,13 @@ ToDo: - Find the missing character generator rom. - - Enable sound, when what seems to be a 6840 bug is fixed. + - Schematic is almost useless, riddled with omissions and errors. All documents are in + French. The parts list only has half of the parts. - - Schematic is almost useless, riddled with omissions and errors. - All documents are in French, so no help there. The parts list - only has half of the parts. - - - Need software + - Need software (there are floppy images, but they are not yet in a supported format) -****************************************************************************/ +*******************************************************************************************/ #include "emu.h" #include "cpu/m6809/m6809.h" @@ -76,44 +73,45 @@ public: , m_crtc(*this, "crtc") , m_fdc(*this, "fdc") , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") , m_speaker(*this, "speaker") , m_palette(*this, "palette") - , m_p_videoram(*this, "videoram") , m_p_chargen(*this, "chargen") - { - } + { } void v6809(machine_config &config); private: virtual void machine_reset() override; + virtual void machine_start() override; DECLARE_WRITE_LINE_MEMBER(speaker_en_w); DECLARE_WRITE_LINE_MEMBER(speaker_w); - uint8_t pb_r(); - void pa_w(uint8_t data); - DECLARE_WRITE8_MEMBER(videoram_w); - DECLARE_WRITE8_MEMBER(v6809_address_w); - DECLARE_WRITE8_MEMBER(v6809_register_w); + u8 pb_r(); + void pa_w(u8 data); + void videoram_w(u8 data); + void v6809_address_w(u8 data); + void v6809_register_w(u8 data); void kbd_put(u8 data); MC6845_UPDATE_ROW(crtc_update_row); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); void v6809_mem(address_map &map); - uint16_t m_video_address; + u16 m_video_address; bool m_speaker_en; - uint8_t m_video_index; - uint8_t m_term_data; - uint8_t m_vidbyte; + u8 m_video_index; + u8 m_term_data; + u8 m_vidbyte; + std::unique_ptr m_vram; required_device m_pia0; required_device m_maincpu; required_device m_crtc; required_device m_fdc; required_device m_floppy0; + required_device m_floppy1; required_device m_speaker; required_device m_palette; - required_region_ptr m_p_videoram; required_region_ptr m_p_chargen; }; @@ -132,7 +130,7 @@ void v6809_state::v6809_mem(address_map &map) map(0xf680, 0xf683).mirror(0x3c).rw(m_pia0, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); map(0xf6c0, 0xf6c7).mirror(0x08).rw("ptm", FUNC(ptm6840_device::read), FUNC(ptm6840_device::write)); map(0xf6d0, 0xf6d3).mirror(0x0c).rw("pia1", FUNC(pia6821_device::read), FUNC(pia6821_device::write)); - map(0xf800, 0xffff).rom(); + map(0xf800, 0xffff).rom().region("maincpu", 0); } @@ -140,6 +138,17 @@ void v6809_state::v6809_mem(address_map &map) static INPUT_PORTS_START( v6809 ) INPUT_PORTS_END +void v6809_state::machine_start() +{ + m_vram = make_unique_clear(0x0800); + save_pointer(NAME(m_vram), 0x0800); + save_item(NAME(m_speaker_en)); + save_item(NAME(m_term_data)); + save_item(NAME(m_video_address)); + save_item(NAME(m_video_index)); + save_item(NAME(m_vidbyte)); +} + void v6809_state::machine_reset() { m_term_data = 0; @@ -169,14 +178,14 @@ GFXDECODE_END MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + u8 chr,gfx; + u16 mem,x; + u32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + chr = m_vram[mem]; gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ @@ -197,24 +206,24 @@ MC6845_ON_UPDATE_ADDR_CHANGED( v6809_state::crtc_update_addr ) m_video_address = address & 0x7ff; } -WRITE8_MEMBER( v6809_state::videoram_w ) +void v6809_state::videoram_w(u8 data) { m_vidbyte = data; } -WRITE8_MEMBER( v6809_state::v6809_address_w ) +void v6809_state::v6809_address_w(u8 data) { m_crtc->address_w(data); m_video_index = data & 0x1f; if (m_video_index == 31) - m_p_videoram[m_video_address] = m_vidbyte; + m_vram[m_video_address] = m_vidbyte; } -WRITE8_MEMBER( v6809_state::v6809_register_w ) +void v6809_state::v6809_register_w(u8 data) { - uint16_t temp = m_video_address; + u16 temp = m_video_address; m_crtc->register_w(data); @@ -235,19 +244,19 @@ void v6809_state::kbd_put(u8 data) m_pia0->cb1_w(1); } -uint8_t v6809_state::pb_r() +u8 v6809_state::pb_r() { - uint8_t ret = m_term_data; + u8 ret = m_term_data; m_term_data = 0; return ret; } // can support 4 drives -void v6809_state::pa_w(uint8_t data) +void v6809_state::pa_w(u8 data) { floppy_image_device *floppy = nullptr; if ((data & 3) == 0) floppy = m_floppy0->get_device(); - //if ((data & 3) == 1) floppy = m_floppy1->get_device(); + if ((data & 3) == 1) floppy = m_floppy1->get_device(); //if ((data & 3) == 2) floppy = m_floppy2->get_device(); //if ((data & 3) == 3) floppy = m_floppy3->get_device(); @@ -262,8 +271,6 @@ void v6809_state::pa_w(uint8_t data) } } -// this should output 1 to enable sound, then output 0 after a short time -// however it continuously outputs 1 WRITE_LINE_MEMBER( v6809_state::speaker_en_w ) { m_speaker_en = state; @@ -271,8 +278,8 @@ WRITE_LINE_MEMBER( v6809_state::speaker_en_w ) WRITE_LINE_MEMBER( v6809_state::speaker_w ) { -// if (m_speaker_en) -// m_speaker->level_w(data); + if (m_speaker_en) + m_speaker->level_w(state); } static void v6809_floppies(device_slot_interface &device) @@ -314,23 +321,22 @@ void v6809_state::v6809(machine_config &config) generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0)); keyboard.set_keyboard_callback(FUNC(v6809_state::kbd_put)); -// port A = drive select and 2 control lines ; port B = keyboard -// CB2 connects to the interrupt pin of the RTC (the rtc code doesn't support it) + // port A = drive select and 2 control lines ; port B = keyboard PIA6821(config, m_pia0, 0); m_pia0->readpb_handler().set(FUNC(v6809_state::pb_r)); m_pia0->writepa_handler().set(FUNC(v6809_state::pa_w)); m_pia0->irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); m_pia0->irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); -// no idea what this does + // no idea what this does pia6821_device &pia1(PIA6821(config, "pia1", 0)); pia1.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE); pia1.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE); ptm6840_device &ptm(PTM6840(config, "ptm", 16_MHz_XTAL / 4)); ptm.set_external_clocks(4000000/14, 4000000/14, 4000000/14/8); - ptm.o1_callback().set(FUNC(v6809_state::speaker_w)); - ptm.o2_callback().set(FUNC(v6809_state::speaker_en_w)); + ptm.o1_callback().set(FUNC(v6809_state::speaker_en_w)); + ptm.o2_callback().set(FUNC(v6809_state::speaker_w)); ptm.irq_callback().set_inputline("maincpu", M6809_IRQ_LINE); ACIA6850(config, "acia0", 0); @@ -344,17 +350,17 @@ void v6809_state::v6809(machine_config &config) acia_clock.signal_handler().append("acia1", FUNC(acia6850_device::write_rxc)); MM58174(config, "rtc", 0); + //rtc.irq_handler().set(m_pia0, FUNC(pia6821_device::cb2_w)); // unsupported by RTC emulation MB8876(config, m_fdc, 16_MHz_XTAL / 16); FLOPPY_CONNECTOR(config, "fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "fdc:1", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); } /* ROM definition */ ROM_START( v6809 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "v6809.rom", 0xf800, 0x0800, CRC(54bf5f32) SHA1(10d1d70f0b51e2b90e5c29249d3eab4c6b0033a1) ) - - ROM_REGION( 0x800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "v6809.rom", 0x0000, 0x0800, CRC(54bf5f32) SHA1(10d1d70f0b51e2b90e5c29249d3eab4c6b0033a1) ) /* character generator not dumped, using the one from 'h19' for now */ ROM_REGION( 0x1000, "chargen", 0 ) @@ -365,4 +371,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1982, v6809, 0, 0, v6809, v6809, v6809_state, empty_init, "Microkit", "Vegas 6809", MACHINE_NOT_WORKING ) +COMP( 1982, v6809, 0, 0, v6809, v6809, v6809_state, empty_init, "Microkit", "Vegas 6809", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )