mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
z8000: Register save state; misc. cleanup
This commit is contained in:
parent
ab914cd099
commit
4ef8ba4786
@ -448,13 +448,13 @@ void z8002_device::Interrupt()
|
||||
|
||||
if (m_irq_req & Z8000_NVI)
|
||||
{
|
||||
int type = standard_irq_callback(0);
|
||||
int type = standard_irq_callback(NVI_LINE);
|
||||
set_irq(type | Z8000_NVI);
|
||||
}
|
||||
|
||||
if (m_irq_req & Z8000_VI)
|
||||
{
|
||||
int type = standard_irq_callback(1);
|
||||
int type = standard_irq_callback(VI_LINE);
|
||||
set_irq(type | Z8000_VI);
|
||||
}
|
||||
|
||||
@ -636,6 +636,28 @@ void z8002_device::state_string_export(const device_state_entry &entry, std::str
|
||||
}
|
||||
}
|
||||
|
||||
void z8002_device::register_save_state()
|
||||
{
|
||||
save_item(NAME(m_op));
|
||||
save_item(NAME(m_ppc));
|
||||
save_item(NAME(m_pc));
|
||||
save_item(NAME(m_psapseg));
|
||||
save_item(NAME(m_psapoff));
|
||||
save_item(NAME(m_fcw));
|
||||
save_item(NAME(m_refresh));
|
||||
save_item(NAME(m_nspseg));
|
||||
save_item(NAME(m_nspoff));
|
||||
save_item(NAME(m_irq_req));
|
||||
save_item(NAME(m_irq_vec));
|
||||
save_item(NAME(m_op_valid));
|
||||
save_item(NAME(m_regs.Q));
|
||||
save_item(NAME(m_nmi_state));
|
||||
save_item(NAME(m_irq_state));
|
||||
save_item(NAME(m_mi));
|
||||
save_item(NAME(m_icount));
|
||||
save_item(NAME(m_vector_mult));
|
||||
}
|
||||
|
||||
void z8002_device::init_tables()
|
||||
{
|
||||
/* set up the zero, sign, parity lookup table */
|
||||
@ -671,6 +693,7 @@ void z8001_device::device_start()
|
||||
init_tables();
|
||||
|
||||
register_debug_state();
|
||||
register_save_state();
|
||||
|
||||
set_icountptr(m_icount);
|
||||
m_mo_out.resolve_safe();
|
||||
@ -694,6 +717,7 @@ void z8002_device::device_start()
|
||||
init_tables();
|
||||
|
||||
register_debug_state();
|
||||
register_save_state();
|
||||
|
||||
set_icountptr(m_icount);
|
||||
m_mo_out.resolve_safe();
|
||||
@ -756,7 +780,7 @@ void z8002_device::execute_run()
|
||||
|
||||
void z8002_device::execute_set_input(int irqline, int state)
|
||||
{
|
||||
if (irqline == INPUT_LINE_NMI)
|
||||
if (irqline == NMI_LINE)
|
||||
{
|
||||
if (m_nmi_state == state)
|
||||
return;
|
||||
@ -772,7 +796,7 @@ void z8002_device::execute_set_input(int irqline, int state)
|
||||
else if (irqline < 2)
|
||||
{
|
||||
m_irq_state[irqline] = state;
|
||||
if (irqline == 0)
|
||||
if (irqline == NVI_LINE)
|
||||
{
|
||||
if (state == CLEAR_LINE)
|
||||
{
|
||||
|
@ -19,19 +19,27 @@ enum
|
||||
Z8000_R12, Z8000_R13, Z8000_R14, Z8000_R15
|
||||
};
|
||||
|
||||
/* Interrupt Types that can be generated by outside sources */
|
||||
#define Z8000_EPU 0x8000 /* extended instruction trap */
|
||||
#define Z8000_TRAP 0x4000 /* privileged instruction trap */
|
||||
#define Z8000_NMI 0x2000 /* non maskable interrupt */
|
||||
#define Z8000_SEGTRAP 0x1000 /* segment trap (Z8001) */
|
||||
#define Z8000_NVI 0x0800 /* non vectored interrupt */
|
||||
#define Z8000_VI 0x0400 /* vectored interrupt (LSB is vector) */
|
||||
#define Z8000_SYSCALL 0x0200 /* system call (lsb is vector) */
|
||||
#define Z8000_HALT 0x0100 /* halted flag */
|
||||
|
||||
class z8002_device : public cpu_device, public z8000_disassembler::config
|
||||
{
|
||||
protected:
|
||||
/* Interrupt Types that can be generated by outside sources */
|
||||
static constexpr uint16_t Z8000_EPU = 0x8000; /* extended instruction trap */
|
||||
static constexpr uint16_t Z8000_TRAP = 0x4000; /* privileged instruction trap */
|
||||
static constexpr uint16_t Z8000_NMI = 0x2000; /* non maskable interrupt */
|
||||
static constexpr uint16_t Z8000_SEGTRAP = 0x1000; /* segment trap (Z8001) */
|
||||
static constexpr uint16_t Z8000_NVI = 0x0800; /* non vectored interrupt */
|
||||
static constexpr uint16_t Z8000_VI = 0x0400; /* vectored interrupt (LSB is vector) */
|
||||
static constexpr uint16_t Z8000_SYSCALL = 0x0200; /* system call (lsb is vector) */
|
||||
static constexpr uint16_t Z8000_HALT = 0x0100; /* halted flag */
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
NVI_LINE = 0,
|
||||
VI_LINE = 1,
|
||||
NMI_LINE = INPUT_LINE_NMI
|
||||
};
|
||||
|
||||
// construction/destruction
|
||||
z8002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~z8002_device();
|
||||
@ -101,6 +109,7 @@ protected:
|
||||
|
||||
void clear_internal_state();
|
||||
void register_debug_state();
|
||||
void register_save_state();
|
||||
virtual bool get_segmented_mode() const override;
|
||||
static inline uint32_t addr_add(uint32_t addr, uint32_t addend);
|
||||
static inline uint32_t addr_sub(uint32_t addr, uint32_t subtrahend);
|
||||
|
@ -236,7 +236,7 @@ WRITE_LINE_MEMBER( m20_state::timer_tick_w )
|
||||
*/
|
||||
if(m_apb)
|
||||
m_apb->nvi_w(state);
|
||||
m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? HOLD_LINE /*ASSERT_LINE*/ : CLEAR_LINE);
|
||||
m_maincpu->set_input_line(z8001_device::NVI_LINE, state ? HOLD_LINE /*ASSERT_LINE*/ : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -744,7 +744,7 @@ WRITE_LINE_MEMBER(m20_state::int_w)
|
||||
{
|
||||
if(m_apb && !m_apb->halted())
|
||||
m_apb->vi_w(state);
|
||||
m_maincpu->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_maincpu->set_input_line(z8001_device::VI_LINE, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
void m20_state::machine_start()
|
||||
|
@ -369,7 +369,7 @@ void p8k_state::p8k_16_iomap(address_map &map)
|
||||
|
||||
WRITE_LINE_MEMBER( p8k_state::p8k_16_daisy_interrupt )
|
||||
{
|
||||
m_maincpu->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_maincpu->set_input_line(z8001_device::VI_LINE, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +311,7 @@ template<bool sub1> WRITE16_MEMBER(polepos_state::z8002_nvi_enable_w)
|
||||
|
||||
m_sub_irq_mask = data;
|
||||
if (!data)
|
||||
(sub1 ? m_subcpu : m_subcpu2)->set_input_line(0, CLEAR_LINE);
|
||||
(sub1 ? m_subcpu : m_subcpu2)->set_input_line(z8002_device::NVI_LINE, CLEAR_LINE);
|
||||
}
|
||||
|
||||
CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r)
|
||||
@ -388,8 +388,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(polepos_state::scanline)
|
||||
|
||||
if (scanline == 240 && m_sub_irq_mask) // VBLANK
|
||||
{
|
||||
m_subcpu->set_input_line(0, ASSERT_LINE);
|
||||
m_subcpu2->set_input_line(0, ASSERT_LINE);
|
||||
m_subcpu->set_input_line(z8002_device::NVI_LINE, ASSERT_LINE);
|
||||
m_subcpu2->set_input_line(z8002_device::NVI_LINE, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,9 +407,6 @@ void polepos_state::machine_start()
|
||||
|
||||
void polepos_state::machine_reset()
|
||||
{
|
||||
/* set the interrupt vectors (this shouldn't be needed) */
|
||||
m_subcpu->set_input_line_vector(0, Z8000_NVI); // Z8002
|
||||
m_subcpu2->set_input_line_vector(0, Z8000_NVI); // Z8002
|
||||
}
|
||||
|
||||
|
||||
|
@ -784,7 +784,7 @@ void wicat_state::wicat(machine_config &config)
|
||||
m_videocpu->set_addrmap(AS_PROGRAM, &wicat_state::video_mem);
|
||||
m_videocpu->set_addrmap(AS_IO, &wicat_state::video_io);
|
||||
|
||||
INPUT_MERGER_ANY_HIGH(config, m_videoirq).output_handler().set_inputline(m_videocpu, INPUT_LINE_IRQ0);
|
||||
INPUT_MERGER_ANY_HIGH(config, m_videoirq).output_handler().set_inputline(m_videocpu, z8002_device::NVI_LINE);
|
||||
|
||||
LS259(config, m_videoctrl);
|
||||
m_videoctrl->q_out_cb<0>().set(FUNC(wicat_state::crtc_irq_clear_w));
|
||||
@ -799,7 +799,7 @@ void wicat_state::wicat(machine_config &config)
|
||||
m_videodma->out_memw_callback().set(FUNC(wicat_state::vram_w));
|
||||
m_videodma->out_iow_callback<0>().set(m_crtc, FUNC(i8275_device::dack_w));
|
||||
|
||||
INPUT_MERGER_ALL_HIGH(config, "dmairq").output_handler().set_inputline(m_videocpu, INPUT_LINE_NMI);
|
||||
INPUT_MERGER_ALL_HIGH(config, "dmairq").output_handler().set_inputline(m_videocpu, z8002_device::NMI_LINE);
|
||||
|
||||
IM6402(config, m_videouart, 0);
|
||||
m_videouart->set_rrc(0);
|
||||
|
@ -187,7 +187,7 @@ IRQ_CALLBACK_MEMBER(m24_z8000_device::int_cb)
|
||||
{
|
||||
if (!irqline)
|
||||
{
|
||||
m_z8000->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
|
||||
m_z8000->set_input_line(z8001_device::NVI_LINE, CLEAR_LINE);
|
||||
return 0xff; // NVI, value ignored
|
||||
}
|
||||
else
|
||||
@ -227,5 +227,5 @@ WRITE_LINE_MEMBER(m24_z8000_device::mo_w)
|
||||
WRITE_LINE_MEMBER(m24_z8000_device::timer_irq_w)
|
||||
{
|
||||
m_timer_irq = state ? true : false;
|
||||
m_z8000->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_z8000->set_input_line(z8001_device::NVI_LINE, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user