- Added warm reset support to N64 hardware [Ryan Holtz]

This commit is contained in:
Ryan Holtz 2012-02-17 05:30:47 +00:00
parent 93648728b7
commit 1fdead69f6
2 changed files with 45 additions and 1 deletions

View File

@ -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

View File

@ -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)
{