From 36d2db7b0e5dd07c5d10e1d0f3f3a3f6c0bde01c Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 3 Apr 2023 13:31:24 +0200 Subject: m68000: some variables were missing from savestate/zerofill --- src/devices/bus/electron/mc68k.cpp | 2 +- src/devices/bus/vme/vme_hcpu30.cpp | 2 +- src/devices/cpu/m68000/m68000.cpp | 53 +++++++++++++++++++++++-------------- src/devices/cpu/m68000/m68kcommon.h | 10 +++---- src/devices/sound/k053260.cpp | 32 +++++++++++----------- src/devices/sound/k053260.h | 5 ++-- src/mame/atari/toobin.cpp | 2 +- src/mame/capcom/cps2.cpp | 2 +- src/mame/fidelity/eag68k.cpp | 8 +++--- src/mame/handheld/hh_tms1k.cpp | 5 ++-- src/mame/layout/litelrn.lay | 2 +- src/mame/layout/mmarvin.lay | 2 +- src/mame/novag/diablo.cpp | 2 +- src/mame/sega/sega16sp.h | 4 +-- src/mame/sega/segaic16.cpp | 20 +++----------- src/mame/sega/segaic16.h | 3 --- src/mame/sega/segaybd.h | 20 +++++--------- src/mame/snk/miconkit.cpp | 2 ++ 18 files changed, 86 insertions(+), 90 deletions(-) diff --git a/src/devices/bus/electron/mc68k.cpp b/src/devices/bus/electron/mc68k.cpp index 06e39350977..cddba9c49c2 100644 --- a/src/devices/bus/electron/mc68k.cpp +++ b/src/devices/bus/electron/mc68k.cpp @@ -84,7 +84,7 @@ void electron_mc68k_device::device_add_mconfig(machine_config &config) { M68000(config, m_maincpu, 10_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &electron_mc68k_device::mem_map); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); INPUT_MERGER_ANY_HIGH(config, "irq_ipl0").output_handler().set_inputline(m_maincpu, M68K_IRQ_IPL0); INPUT_MERGER_ANY_HIGH(config, "irq_ipl1").output_handler().set_inputline(m_maincpu, M68K_IRQ_IPL1); diff --git a/src/devices/bus/vme/vme_hcpu30.cpp b/src/devices/bus/vme/vme_hcpu30.cpp index a68cdb319f2..35bdddf7b02 100644 --- a/src/devices/bus/vme/vme_hcpu30.cpp +++ b/src/devices/bus/vme/vme_hcpu30.cpp @@ -175,7 +175,7 @@ void vme_hcpu30_card_device::device_add_mconfig(machine_config &config) M68020(config, m_maincpu, 16670000); m_maincpu->set_addrmap(AS_PROGRAM, &vme_hcpu30_card_device::hcpu30_mem); m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &vme_hcpu30_card_device::cpu_space_map); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); // FIXME: functional test expects dtr->dcd, rts->cts connections on both ports and tx->rx connection on port B DUSCC68562(config, m_dusccterm, DUSCC_CLOCK); diff --git a/src/devices/cpu/m68000/m68000.cpp b/src/devices/cpu/m68000/m68000.cpp index f4f1680898c..ab633e6db1e 100644 --- a/src/devices/cpu/m68000/m68000.cpp +++ b/src/devices/cpu/m68000/m68000.cpp @@ -195,9 +195,13 @@ void m68000_device::device_start() save_item(NAME(m_au)); save_item(NAME(m_at)); save_item(NAME(m_aob)); - save_item(NAME(m_sp)); save_item(NAME(m_dt)); save_item(NAME(m_int_vector)); + save_item(NAME(m_sp)); + save_item(NAME(m_bcount)); + save_item(NAME(m_count_before_instruction_step)); + save_item(NAME(m_t)); + save_item(NAME(m_movems)); save_item(NAME(m_isr)); save_item(NAME(m_sr)); save_item(NAME(m_dbin)); @@ -206,27 +210,28 @@ void m68000_device::device_start() save_item(NAME(m_irc)); save_item(NAME(m_ir)); save_item(NAME(m_ird)); - save_item(NAME(m_irdi)); save_item(NAME(m_ftu)); save_item(NAME(m_aluo)); save_item(NAME(m_alue)); - save_item(NAME(m_dcr)); - save_item(NAME(m_movems)); + save_item(NAME(m_alub)); save_item(NAME(m_movemr)); + save_item(NAME(m_irdi)); + save_item(NAME(m_base_ssw)); + save_item(NAME(m_ssw)); + save_item(NAME(m_dcr)); + save_item(NAME(m_virq_state)); save_item(NAME(m_nmi_pending)); save_item(NAME(m_int_level)); save_item(NAME(m_int_next_state)); - save_item(NAME(m_next_state)); + save_item(NAME(m_nmi_uses_generic)); + save_item(NAME(m_last_vpa_time)); + save_item(NAME(m_inst_state)); save_item(NAME(m_inst_substate)); - save_item(NAME(m_count_before_instruction_step)); - save_item(NAME(m_bcount)); - save_item(NAME(m_t)); + save_item(NAME(m_next_state)); save_item(NAME(m_post_run)); save_item(NAME(m_post_run_cycles)); - save_item(NAME(m_nmi_uses_generic)); - save_item(NAME(m_last_vpa_time)); memset(m_da, 0, sizeof(m_da)); m_ipc = 0; @@ -234,8 +239,13 @@ void m68000_device::device_start() m_au = 0; m_at = 0; m_aob = 0; - m_sp = 0; m_dt = 0; + m_int_vector = 0; + m_sp = 0; + m_bcount = 0; + m_count_before_instruction_step = 0; + m_t = 0; + m_movems = 0; m_isr = 0; m_sr = 0; m_dbin = 0; @@ -244,26 +254,29 @@ void m68000_device::device_start() m_irc = 0; m_ir = 0; m_ird = 0; - m_irdi = 0; m_ftu = 0; m_aluo = 0; m_alue = 0; - m_dcr = 0; + m_alub = 0; m_movemr = 0; - m_movems = 0; + m_irdi = 0; + m_base_ssw = 0; + m_ssw = 0; + m_dcr = 0; + m_virq_state = 0; m_nmi_pending = 0; m_int_level = 0; m_int_next_state = 0; - m_next_state = 0; - m_inst_state = 0; - m_inst_substate = 0; - m_count_before_instruction_step = 0; - m_bcount = 0; - m_t = 0; m_nmi_uses_generic = false; m_last_vpa_time = 0; + m_inst_state = 0; + m_inst_substate = 0; + m_next_state = 0; + m_post_run = 0; + m_post_run_cycles = 0; + state_add(STATE_GENPCBASE, "PC", m_ipc).callimport(); state_add(STATE_GENPC, "rPC", m_pc); state_add(M68K_IR, "IR", m_ir); diff --git a/src/devices/cpu/m68000/m68kcommon.h b/src/devices/cpu/m68000/m68kcommon.h index b11101e2545..86cb0bc18e6 100644 --- a/src/devices/cpu/m68000/m68kcommon.h +++ b/src/devices/cpu/m68000/m68kcommon.h @@ -9,7 +9,7 @@ /* There are 7 levels of interrupt to the 68K. * A transition from < 7 to 7 will cause a non-maskable interrupt (NMI). * - * If disable_interrupt_mixer() has been called, the 3 interrupt lines + * If set_interrupt_mixer(false) has been called, the 3 interrupt lines * are modeled instead, as numbers 0-2. */ constexpr int M68K_IRQ_NONE = 0; @@ -27,7 +27,7 @@ constexpr int M68K_IRQ_IPL2 = 2; enum { - /* NOTE: M68K_SP fetches the current SP, be it USP, ISP, or MSP */ + // NOTE: M68K_SP fetches the current SP, be it USP, ISP, or MSP M68K_PC = STATE_GENPC, M68K_SP = 1, M68K_ISP, M68K_USP, M68K_MSP, M68K_SR, M68K_VBR, M68K_SFC, M68K_DFC, M68K_CACR, M68K_CAAR, M68K_IR, M68K_PREF_ADDR, M68K_PREF_DATA, M68K_D0, M68K_D1, M68K_D2, M68K_D3, M68K_D4, M68K_D5, M68K_D6, M68K_D7, @@ -51,7 +51,7 @@ public: void autovectors_map(address_map &map); void set_cpu_space(int space_id) { m_cpu_space_id = space_id; } - void disable_interrupt_mixer() { m_interrupt_mixer = false; } + void set_interrupt_mixer(bool enable) { m_interrupt_mixer = enable; } auto reset_cb() { return m_reset_cb.bind(); } virtual u32 execute_input_lines() const noexcept override { return m_interrupt_mixer ? 8 : 3; } // number of input lines @@ -61,8 +61,8 @@ public: virtual u16 get_fc() const noexcept = 0; protected: - bool m_interrupt_mixer = true; /* Indicates whether to put a virtual 8->3 priority mixer on the input lines */ - int m_cpu_space_id = AS_CPU_SPACE; /* CPU space address space id */ + bool m_interrupt_mixer; // Indicates whether to put a virtual 8->3 priority mixer on the input lines + int m_cpu_space_id; // CPU space address space id devcb_write_line m_reset_cb; m68000_base_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, u32 clock) : diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 8f7bc7923c1..c8d99d18d55 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -256,28 +256,24 @@ void k053260_device::write(offs_t offset, u8 data) for (int i = 0; i < 4; i++) { + m_voice[i].set_reverse(BIT(data, i | 4)); + if (BIT(rising_edge, i)) m_voice[i].key_on(); else if (!BIT(data, i)) m_voice[i].key_off(); } m_keyon = data; - - for (auto & voice : m_voice) - { - voice.set_reverse(data >> 4); - data >>= 1; - } break; } // 0x29 is a read register case 0x2a: // loop and pcm/adpcm select - for (auto & voice : m_voice) + for (int i = 0; i < 4; i++) { - voice.set_loop_kadpcm(data); - data >>= 1; + m_voice[i].set_loop(BIT(data, i)); + m_voice[i].set_kadpcm(BIT(data, i | 4)); } break; @@ -320,7 +316,7 @@ void k053260_device::sound_stream_update(sound_stream &stream, std::vectorset_addrmap(AS_PROGRAM, &cps2_state::cps2_map); m_maincpu->set_addrmap(AS_OPCODES, &cps2_state::decrypted_opcodes_map); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); TIMER(config, "scantimer").configure_scanline(FUNC(cps2_state::cps2_interrupt), "screen", 0, 1); diff --git a/src/mame/fidelity/eag68k.cpp b/src/mame/fidelity/eag68k.cpp index 12179fae710..1f48559bc99 100644 --- a/src/mame/fidelity/eag68k.cpp +++ b/src/mame/fidelity/eag68k.cpp @@ -607,7 +607,7 @@ void eag_state::eag_base(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 16_MHz_XTAL); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); m_maincpu->set_addrmap(AS_PROGRAM, &eag_state::eag_map); auto &irq_clock(CLOCK(config, "irq_clock", 4.9152_MHz_XTAL / 0x2000)); // 4060 Q13, 600Hz @@ -678,7 +678,7 @@ void eag_state::eagv7(machine_config &config) /* basic machine hardware */ M68020(config.replace(), m_maincpu, 20_MHz_XTAL); // also seen with 25MHz XTAL - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); m_maincpu->set_addrmap(AS_PROGRAM, &eag_state::eagv7_map); } @@ -688,7 +688,7 @@ void eag_state::eagv9(machine_config &config) /* basic machine hardware */ M68030(config.replace(), m_maincpu, 32_MHz_XTAL); // also seen with 40MHz XTAL - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); m_maincpu->set_addrmap(AS_PROGRAM, &eag_state::eagv7_map); } @@ -698,7 +698,7 @@ void eag_state::eagv10(machine_config &config) /* basic machine hardware */ M68040(config.replace(), m_maincpu, 25_MHz_XTAL); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); m_maincpu->set_addrmap(AS_PROGRAM, &eag_state::eagv10_map); } diff --git a/src/mame/handheld/hh_tms1k.cpp b/src/mame/handheld/hh_tms1k.cpp index 400cb8a490a..d740d1ef763 100644 --- a/src/mame/handheld/hh_tms1k.cpp +++ b/src/mame/handheld/hh_tms1k.cpp @@ -3316,7 +3316,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(litelrn_state::speaker_decay_sim) m_volume->flt_volume_set_volume(m_speaker_volume); // volume decays when speaker is off, rate is determined by tone knob - m_speaker_volume /= 1.002 + (double)(u8)m_inputs[2]->read() * 0.0035; // approximation + const double div[3] = { 1.002, 1.004, 1.008 }; // approximation + m_speaker_volume /= div[m_inputs[2]->read() % 3]; } void litelrn_state::write_r(u32 data) @@ -3377,7 +3378,7 @@ static INPUT_PORTS_START( litelrn ) PORT_CONFNAME( 0x03, 0x00, "Tone" ) PORT_CONFSETTING( 0x00, "Organ" ) PORT_CONFSETTING( 0x01, "Harpsichord" ) - PORT_CONFSETTING( 0x03, "Banjo" ) + PORT_CONFSETTING( 0x02, "Banjo" ) INPUT_PORTS_END // config diff --git a/src/mame/layout/litelrn.lay b/src/mame/layout/litelrn.lay index d350b39b13a..102ba02b369 100644 --- a/src/mame/layout/litelrn.lay +++ b/src/mame/layout/litelrn.lay @@ -44,7 +44,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/mmarvin.lay b/src/mame/layout/mmarvin.lay index 514a54e2166..7adfa050424 100644 --- a/src/mame/layout/mmarvin.lay +++ b/src/mame/layout/mmarvin.lay @@ -41,7 +41,7 @@ license:CC0-1.0 - + ]]> diff --git a/src/mame/novag/diablo.cpp b/src/mame/novag/diablo.cpp index 32326189569..c7042d9ec61 100644 --- a/src/mame/novag/diablo.cpp +++ b/src/mame/novag/diablo.cpp @@ -276,7 +276,7 @@ void diablo_state::diablo68k(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 16_MHz_XTAL); - m_maincpu->disable_interrupt_mixer(); + m_maincpu->set_interrupt_mixer(false); m_maincpu->set_addrmap(AS_PROGRAM, &diablo_state::diablo68k_map); auto &irq_clock(CLOCK(config, "irq_clock", 32.768_kHz_XTAL/128)); // 256Hz diff --git a/src/mame/sega/sega16sp.h b/src/mame/sega/sega16sp.h index 48a7f812892..eb9c6cd49a2 100644 --- a/src/mame/sega/sega16sp.h +++ b/src/mame/sega/sega16sp.h @@ -67,8 +67,8 @@ protected: virtual void device_start() override; // internal state - bool m_flip; // screen flip? - uint8_t m_bank[16]; // banking redirection + bool m_flip; // screen flip? + uint8_t m_bank[16]; // banking redirection int m_xoffs = 0; int m_yoffs = 0; int m_xoffs_flipped = 0; diff --git a/src/mame/sega/segaic16.cpp b/src/mame/sega/segaic16.cpp index 5039ff145dd..52eb685e11b 100644 --- a/src/mame/sega/segaic16.cpp +++ b/src/mame/sega/segaic16.cpp @@ -370,9 +370,6 @@ Quick review of the system16 hardware: - - - //************************************************************************** // PALETTE HELPERS //************************************************************************** @@ -591,7 +588,6 @@ void draw_virtual_tilemap(screen_device &screen, segaic16_video_device::tilemap_ rectangle pageclip; int page; - if (info->flip) { pages = bitswap<16>(pages, @@ -1207,14 +1203,12 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int struct tilemap_info *info = &m_bg_tilemap[which]; tilemap_get_info_delegate get_text_info(*this); tilemap_get_info_delegate get_tile_info(*this); - int pagenum; - int i; /* reset the tilemap info */ memset(info, 0, sizeof(*info)); info->index = which; info->type = type; - for (i = 0; i < numbanks; i++) + for (int i = 0; i < numbanks; i++) info->bank[i] = i; info->banksize = 0x2000 / numbanks; info->xoffs = xoffs; @@ -1288,7 +1282,7 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int info->textmap->set_scrolldy(0, 0); /* create the tilemaps for the tile pages */ - for (pagenum = 0; pagenum < info->numpages; pagenum++) + for (int pagenum = 0; pagenum < info->numpages; pagenum++) { /* each page is 64x32 */ info->tilemaps[pagenum] = &machine().tilemap().create(*m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); @@ -1381,7 +1375,6 @@ void segaic16_video_device::tilemap_set_bank(int which, int banknum, int offset) void segaic16_video_device::tilemap_set_flip(int which, int flip) { struct tilemap_info *info = &m_bg_tilemap[which]; - int pagenum; flip = (flip != 0); if (info->flip != flip) @@ -1389,7 +1382,7 @@ void segaic16_video_device::tilemap_set_flip(int which, int flip) screen().update_partial(screen().vpos()); info->flip = flip; info->textmap->set_flip(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); - for (pagenum = 0; pagenum < info->numpages; pagenum++) + for (int pagenum = 0; pagenum < info->numpages; pagenum++) info->tilemaps[pagenum]->set_flip(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); } } @@ -1473,10 +1466,6 @@ void segaic16_video_device::textram_w(offs_t offset, uint16_t data, uint16_t mem - - - - /************************************* * * General rotation initialization @@ -1600,10 +1589,9 @@ uint16_t segaic16_video_device::rotate_control_r() { uint32_t *src = (uint32_t *)info->rotateram; uint32_t *dst = (uint32_t *)info->buffer.get(); - int i; /* swap the halves of the rotation RAM */ - for (i = 0; i < info->ramsize/4; i++) + for (int i = 0; i < info->ramsize/4; i++) { uint32_t temp = *src; *src++ = *dst; diff --git a/src/mame/sega/segaic16.h b/src/mame/sega/segaic16.h index 7cf8706416b..0959fb3320d 100644 --- a/src/mame/sega/segaic16.h +++ b/src/mame/sega/segaic16.h @@ -69,14 +69,11 @@ public: static constexpr unsigned TILEMAP_TEXT = 2; - /* rotation systems */ static constexpr unsigned MAX_ROTATE = 1; - static constexpr unsigned ROTATE_YBOARD = 0; - struct tilemap_callback_info { uint16_t * rambase; /* base of RAM for this tilemap page */ diff --git a/src/mame/sega/segaybd.h b/src/mame/sega/segaybd.h index 6074bf35cdf..bab61e4c631 100644 --- a/src/mame/sega/segaybd.h +++ b/src/mame/sega/segaybd.h @@ -37,12 +37,6 @@ public: , m_ysprites(*this, "ysprites") , m_segaic16vid(*this, "segaic16vid") , m_adc_ports(*this, "ADC.%u", 0) - , m_pdrift_bank(0) - , m_scanline_timer(nullptr) - , m_irq2_scanline(0) - , m_timer_irq_state(0) - , m_vblank_irq_state(0) - , m_misc_io_data(0) { } @@ -70,7 +64,7 @@ private: uint16_t link_r(); uint16_t link2_r(); void link2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); -// uint8_t link_portc0_r(); + //uint8_t link_portc0_r(); // input helpers ioport_value analog_mux(); @@ -129,12 +123,12 @@ private: output_delegate m_output_cb2; // internal state - uint16_t m_pdrift_bank = 0; - emu_timer * m_scanline_timer = nullptr; - int m_irq2_scanline = 0; - uint8_t m_timer_irq_state = 0; - uint8_t m_vblank_irq_state = 0; - uint8_t m_misc_io_data = 0; + uint16_t m_pdrift_bank = 0; + emu_timer *m_scanline_timer = nullptr; + int m_irq2_scanline = 0; + uint8_t m_timer_irq_state = 0; + uint8_t m_vblank_irq_state = 0; + uint8_t m_misc_io_data = 0; }; #endif // MAME_SEGA_SEGAYBD_H diff --git a/src/mame/snk/miconkit.cpp b/src/mame/snk/miconkit.cpp index 09b75598ef7..64f2a53fb0d 100644 --- a/src/mame/snk/miconkit.cpp +++ b/src/mame/snk/miconkit.cpp @@ -272,8 +272,10 @@ void miconkit_state::micon2(machine_config &config) I8255(config, m_ppi); m_ppi->in_pa_callback().set(FUNC(miconkit_state::paddle_r)); m_ppi->out_pb_callback().set(FUNC(miconkit_state::sound_w)); + m_ppi->tri_pb_callback().set_constant(0); m_ppi->out_pc_callback().set(FUNC(miconkit_state::select_w)); m_ppi->in_pc_callback().set(FUNC(miconkit_state::vblank_r)); + m_ppi->tri_pc_callback().set_constant(0); // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); -- cgit v1.2.3