summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2012-02-17 05:30:47 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2012-02-17 05:30:47 +0000
commit1fdead69f67e7693d5006b8cd465cbb7963b69a5 (patch)
tree5816fbbb2327f5b9d457668007d83dad9515c7c5
parent93648728b75bfb809d5a8628507ecd387a925922 (diff)
- Added warm reset support to N64 hardware [Ryan Holtz]
-rw-r--r--src/mame/includes/n64.h6
-rw-r--r--src/mame/machine/n64.c40
2 files changed, 45 insertions, 1 deletions
diff --git a/src/mame/includes/n64.h b/src/mame/includes/n64.h
index 8b80642af1e..454719ed253 100644
--- a/src/mame/includes/n64.h
+++ b/src/mame/includes/n64.h
@@ -80,6 +80,7 @@ public:
void ai_timer_tick();
void pi_dma_tick();
void vi_scanline_tick();
+ void reset_tick();
// Video Interface (VI) registers
UINT32 vi_width;
@@ -106,6 +107,8 @@ public:
bool dd_present;
+ void poll_reset_button(bool button);
+
protected:
// device-level overrides
virtual void device_start();
@@ -118,6 +121,9 @@ private:
void clear_rcp_interrupt(int interrupt);
+ bool reset_held;
+ emu_timer *reset_timer;
+
UINT8 is64_buffer[0x10000];
// Video interface (VI) registers and functions
diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c
index a1353b4b86e..148aa7e9fbf 100644
--- a/src/mame/machine/n64.c
+++ b/src/mame/machine/n64.c
@@ -25,12 +25,47 @@ n64_periphs::n64_periphs(const machine_config &mconfig, const char *tag, device_
{
}
+static TIMER_CALLBACK(reset_timer_callback)
+{
+ n64_periphs *periphs = machine.device<n64_periphs>("rcp");
+ periphs->reset_tick();
+}
+
+void n64_periphs::reset_tick()
+{
+ reset_timer->adjust(attotime::never);
+ cputag_set_input_line(machine(), "maincpu", INPUT_LINE_IRQ2, CLEAR_LINE);
+ machine().device("maincpu")->reset();
+ machine().device("rsp")->reset();
+ machine().device("rcp")->reset();
+ cputag_set_input_line(machine(), "rsp", INPUT_LINE_HALT, ASSERT_LINE);
+ reset_held = false;
+}
+
+void n64_periphs::poll_reset_button(bool button)
+{
+ bool old_held = reset_held;
+ reset_held = button;
+ if(!old_held && reset_held)
+ {
+ cputag_set_input_line(machine(), "maincpu", INPUT_LINE_IRQ2, ASSERT_LINE);
+ }
+ else if(old_held && reset_held)
+ {
+ reset_timer->adjust(attotime::never);
+ }
+ else if(old_held && !reset_held)
+ {
+ reset_timer->adjust(attotime::from_hz(1));
+ }
+}
void n64_periphs::device_start()
{
ai_timer = machine().scheduler().timer_alloc(FUNC(ai_timer_callback));
pi_dma_timer = machine().scheduler().timer_alloc(FUNC(pi_dma_callback));
vi_scanline_timer = machine().scheduler().timer_alloc(FUNC(vi_scanline_callback));
+ reset_timer = machine().scheduler().timer_alloc(FUNC(reset_timer_callback));
}
void n64_periphs::device_reset()
@@ -121,6 +156,9 @@ void n64_periphs::device_reset()
cic_status = 0;
+ reset_held = false;
+ reset_timer->adjust(attotime::never);
+
// bootcode differs between CIC-chips, so we can use its checksum to detect the CIC-chip
UINT64 boot_checksum = 0;
for(int i = 0x40; i < 0x1000; i+=4)
@@ -2092,7 +2130,7 @@ READ32_MEMBER( n64_periphs::dd_reg_r )
WRITE32_MEMBER( n64_periphs::dd_reg_w )
{
- logerror("dd_reg_w: %08X, %08X, %08X\n", data, offset << 2, mem_mask);
+ //logerror("dd_reg_w: %08X, %08X, %08X\n", data, offset << 2, mem_mask);
if(offset < 0x400/4)
{