summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2013-02-20 19:44:17 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2013-02-20 19:44:17 +0000
commit9135db5400785f5594384d25f8840dc8f4d5c906 (patch)
treed5c480d90e6bdc8061f591b9a8e15d6194f64431 /src
parent24987390dceecd74a611cadb2122658d67f47908 (diff)
SH-2: watchdog i/f is quite exotic, implement it so it can be debugged properly
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/sh2/sh2comn.c37
-rw-r--r--src/emu/cpu/sh2/sh2comn.h2
-rw-r--r--src/emu/machine/stvcd.c2
3 files changed, 41 insertions, 0 deletions
diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c
index 52ef041c16f..4cf88e2e455 100644
--- a/src/emu/cpu/sh2/sh2comn.c
+++ b/src/emu/cpu/sh2/sh2comn.c
@@ -571,6 +571,38 @@ WRITE32_HANDLER( sh2_internal_w )
// Watchdog
case 0x20: // WTCNT, RSTCSR
+ if((sh2->m[0x20] & 0xff000000) == 0x5a000000)
+ sh2->wtcnt = (sh2->m[0x20] >> 16) & 0xff;
+
+ if((sh2->m[0x20] & 0xff000000) == 0xa5000000)
+ {
+ /*
+ WTCSR
+ x--- ---- Overflow in IT mode
+ -x-- ---- Timer mode (0: IT 1: watchdog)
+ --x- ---- Timer enable
+ ---1 1---
+ ---- -xxx Clock select
+ */
+
+ sh2->wtcsr = (sh2->m[0x20] >> 16) & 0xff;
+ }
+
+ if((sh2->m[0x20] & 0x0000ff00) == 0x00005a00)
+ {
+ // -x-- ---- RSTE (1: resets wtcnt when overflows 0: no reset)
+ // --x- ---- RSTS (0: power-on reset 1: Manual reset)
+ // ...
+ }
+
+ if((sh2->m[0x20] & 0x0000ff00) == 0x0000a500)
+ {
+ // clear WOVF
+ // ...
+ }
+
+
+
break;
// Standby and cache
@@ -729,6 +761,9 @@ READ32_HANDLER( sh2_internal_r )
case 0x06: // ICR
return sh2->icr << 16;
+ case 0x20:
+ return (((sh2->wtcsr | 0x18) & 0xff) << 24) | ((sh2->wtcnt & 0xff) << 16);
+
case 0x24: // SBYCR, CCR
return sh2->m[0x24] & ~0x3000; /* bit 4-5 of CCR are always zero */
@@ -1029,4 +1064,6 @@ void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_ackno
device->save_item(NAME(sh2->internal_irq_vector));
device->save_item(NAME(sh2->dma_timer_active));
device->save_item(NAME(sh2->dma_irq));
+ device->save_item(NAME(sh2->wtcnt));
+ device->save_item(NAME(sh2->wtcsr));
}
diff --git a/src/emu/cpu/sh2/sh2comn.h b/src/emu/cpu/sh2/sh2comn.h
index a4208079412..e2e374f72a9 100644
--- a/src/emu/cpu/sh2/sh2comn.h
+++ b/src/emu/cpu/sh2/sh2comn.h
@@ -146,6 +146,8 @@ struct sh2_state
UINT32 active_dma_src[2];
UINT32 active_dma_dst[2];
UINT32 active_dma_count[2];
+ UINT16 wtcnt;
+ UINT8 wtcsr;
int is_slave, cpu_type;
int (*dma_callback_kludge)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
diff --git a/src/emu/machine/stvcd.c b/src/emu/machine/stvcd.c
index 179fddd95d4..81746df381f 100644
--- a/src/emu/machine/stvcd.c
+++ b/src/emu/machine/stvcd.c
@@ -796,6 +796,8 @@ void saturn_state::cd_exec_command( void )
cr1 = cd_stat;
cr2 = 0;
cr3 = 0;
+ if(cr1 & 0xff || cr2 || cr3 & 0xff || cr4)
+ printf("Get # sectors used with params %04x %04x %04x %04x\n",cr1,cr2,cr3,cr4);
// is the partition empty?
if (partitions[bufnum].size == -1)