Previous 199869 Revisions Next

r35297 Thursday 26th February, 2015 at 15:11:29 UTC by Olivier Galibert
h8: Add watchdog, dma [O. Galibert]
h8: Disassembly fix [O. Galibert]
tmp68301: Add serial [O. Galibert]
[src/emu/cpu]cpu.mak
[src/emu/cpu/h8]h8.c h8.h h83002.c h83002.h h83006.c h83006.h h83008.c h83008.h h83048.c h83048.h h83337.c h83337.h h8_dma.c* h8_dma.h* h8_sci.c h8_watchdog.c* h8_watchdog.h* h8s2245.c h8s2245.h h8s2320.c h8s2320.h h8s2357.c h8s2357.h h8s2655.c h8s2655.h
[src/emu/machine]tmp68301.c tmp68301.h
[src/mame/drivers]csplayh5.c niyanpai.c realbrk.c seta2.c

trunk/src/emu/cpu/cpu.mak
r243808r243809
573573         $(CPUOBJ)/h8/h83048.o \
574574         $(CPUOBJ)/h8/h8s2245.o $(CPUOBJ)/h8/h8s2320.o $(CPUOBJ)/h8/h8s2357.o \
575575         $(CPUOBJ)/h8/h8s2655.o \
576         $(CPUOBJ)/h8/h8_adc.o $(CPUOBJ)/h8/h8_port.o $(CPUOBJ)/h8/h8_intc.o \
577         $(CPUOBJ)/h8/h8_timer8.o $(CPUOBJ)/h8/h8_timer16.o $(CPUOBJ)/h8/h8_sci.o
576         $(CPUOBJ)/h8/h8_adc.o $(CPUOBJ)/h8/h8_dma.o $(CPUOBJ)/h8/h8_port.o $(CPUOBJ)/h8/h8_intc.o \
577         $(CPUOBJ)/h8/h8_timer8.o $(CPUOBJ)/h8/h8_timer16.o $(CPUOBJ)/h8/h8_sci.o $(CPUOBJ)/h8/h8_watchdog.o
578
578579DASMOBJS +=
579580endif
580581
r243808r243809
608609                        $(CPUSRC)/h8/h8_port.h \
609610                        $(CPUSRC)/h8/h8_timer8.h \
610611                        $(CPUSRC)/h8/h8_timer16.h \
611                        $(CPUSRC)/h8/h8_sci.h
612                        $(CPUSRC)/h8/h8_sci.h \
613                        $(CPUSRC)/h8/h8_watchdog.h
612614
613615$(CPUOBJ)/h8/h83002.o:          $(CPUSRC)/h8/h83002.c \
614616                        $(CPUSRC)/h8/h83002.h \
r243808r243809
618620                        $(CPUSRC)/h8/h8_adc.h \
619621                        $(CPUSRC)/h8/h8_port.h \
620622                        $(CPUSRC)/h8/h8_timer16.h \
621                        $(CPUSRC)/h8/h8_sci.h
623                        $(CPUSRC)/h8/h8_sci.h \
624                        $(CPUSRC)/h8/h8_watchdog.h
622625
623626$(CPUOBJ)/h8/h83006.o:          $(CPUSRC)/h8/h83006.c \
624627                        $(CPUSRC)/h8/h83006.h \
r243808r243809
629632                        $(CPUSRC)/h8/h8_port.h \
630633                        $(CPUSRC)/h8/h8_timer8.h \
631634                        $(CPUSRC)/h8/h8_timer16.h \
632                        $(CPUSRC)/h8/h8_sci.h
635                        $(CPUSRC)/h8/h8_sci.h \
636                        $(CPUSRC)/h8/h8_watchdog.h
633637
634638$(CPUOBJ)/h8/h83008.o:          $(CPUSRC)/h8/h83008.c \
635639                        $(CPUSRC)/h8/h83008.h \
r243808r243809
640644                        $(CPUSRC)/h8/h8_port.h \
641645                        $(CPUSRC)/h8/h8_timer8.h \
642646                        $(CPUSRC)/h8/h8_timer16.h \
643                        $(CPUSRC)/h8/h8_sci.h
647                        $(CPUSRC)/h8/h8_sci.h \
648                        $(CPUSRC)/h8/h8_watchdog.h
644649
645650$(CPUOBJ)/h8/h83048.o:          $(CPUSRC)/h8/h83048.c \
646651                        $(CPUSRC)/h8/h83048.h \
r243808r243809
650655                        $(CPUSRC)/h8/h8_adc.h \
651656                        $(CPUSRC)/h8/h8_port.h \
652657                        $(CPUSRC)/h8/h8_timer16.h \
653                        $(CPUSRC)/h8/h8_sci.h
658                        $(CPUSRC)/h8/h8_sci.h \
659                        $(CPUSRC)/h8/h8_watchdog.h
654660
655661$(CPUOBJ)/h8/h8s2245.o:         $(CPUSRC)/h8/h8s2245.c \
656662                        $(CPUSRC)/h8/h8s2245.h \
r243808r243809
662668                        $(CPUSRC)/h8/h8_port.h \
663669                        $(CPUSRC)/h8/h8_timer8.h \
664670                        $(CPUSRC)/h8/h8_timer16.h \
665                        $(CPUSRC)/h8/h8_sci.h
671                        $(CPUSRC)/h8/h8_sci.h \
672                        $(CPUSRC)/h8/h8_watchdog.h
666673
667674$(CPUOBJ)/h8/h8s2320.o:         $(CPUSRC)/h8/h8s2320.c \
668675                        $(CPUSRC)/h8/h8s2320.h \
r243808r243809
671678                        $(CPUSRC)/h8/h8.h \
672679                        $(CPUSRC)/h8/h8_intc.h \
673680                        $(CPUSRC)/h8/h8_adc.h \
681                        $(CPUSRC)/h8/h8_dma.h \
674682                        $(CPUSRC)/h8/h8_port.h \
675683                        $(CPUSRC)/h8/h8_timer8.h \
676684                        $(CPUSRC)/h8/h8_timer16.h \
677                        $(CPUSRC)/h8/h8_sci.h
685                        $(CPUSRC)/h8/h8_sci.h \
686                        $(CPUSRC)/h8/h8_watchdog.h
678687
679688$(CPUOBJ)/h8/h8s2357.o:         $(CPUSRC)/h8/h8s2357.c \
680689                        $(CPUSRC)/h8/h8s2357.h \
r243808r243809
686695                        $(CPUSRC)/h8/h8_port.h \
687696                        $(CPUSRC)/h8/h8_timer8.h \
688697                        $(CPUSRC)/h8/h8_timer16.h \
689                        $(CPUSRC)/h8/h8_sci.h
698                        $(CPUSRC)/h8/h8_sci.h \
699                        $(CPUSRC)/h8/h8_watchdog.h
690700
691701$(CPUOBJ)/h8/h8s2655.o:         $(CPUSRC)/h8/h8s2655.c \
692702                        $(CPUSRC)/h8/h8s2655.h \
r243808r243809
699709                        $(CPUSRC)/h8/h8_port.h \
700710                        $(CPUSRC)/h8/h8_timer8.h \
701711                        $(CPUSRC)/h8/h8_timer16.h \
702                        $(CPUSRC)/h8/h8_sci.h
712                        $(CPUSRC)/h8/h8_sci.h \
713                        $(CPUSRC)/h8/h8_watchdog.h
703714
704715$(CPUOBJ)/h8/h8_intc.o:         $(CPUSRC)/h8/h8_intc.c \
705716                        $(CPUSRC)/h8/h8_intc.h \
r243808r243809
710721                        $(CPUSRC)/h8/h8_intc.h \
711722                        $(CPUSRC)/h8/h8.h
712723
724$(CPUOBJ)/h8/h8_dma.o:          $(CPUSRC)/h8/h8_dma.c \
725                        $(CPUSRC)/h8/h8_dma.h \
726                        $(CPUSRC)/h8/h8_intc.h \
727                        $(CPUSRC)/h8/h8.h
728
713729$(CPUOBJ)/h8/h8_port.o:         $(CPUSRC)/h8/h8_port.c \
714730                        $(CPUSRC)/h8/h8_port.h \
715731                        $(CPUSRC)/h8/h8.h
716732
733$(CPUOBJ)/h8/h8_timer8.o:       $(CPUSRC)/h8/h8_timer8.c \
734                        $(CPUSRC)/h8/h8_timer8.h \
735                        $(CPUSRC)/h8/h8_intc.h \
736                        $(CPUSRC)/h8/h8.h
737
717738$(CPUOBJ)/h8/h8_timer16.o:      $(CPUSRC)/h8/h8_timer16.c \
718739                        $(CPUSRC)/h8/h8_timer16.h \
719740                        $(CPUSRC)/h8/h8_intc.h \
r243808r243809
724745                        $(CPUSRC)/h8/h8_intc.h \
725746                        $(CPUSRC)/h8/h8.h
726747
748$(CPUOBJ)/h8/h8_watchdog.o:     $(CPUSRC)/h8/h8_watchdog.c \
749                        $(CPUSRC)/h8/h8_watchdog.h \
750                        $(CPUSRC)/h8/h8_intc.h \
751                        $(CPUSRC)/h8/h8.h
752
727753# rule to generate the C files
728754$(CPUOBJ)/h8/h8.inc: $(CPUSRC)/h8/h8make.py $(CPUSRC)/h8/h8.lst
729755   @echo Generating H8-300 source file...
trunk/src/emu/cpu/h8/h8.c
r243808r243809
295295   return 10;
296296}
297297
298void h8_device::disassemble_am(char *&buffer, int am, offs_t pc, const UINT8 *oprom, UINT32 opcode, int offset)
298void h8_device::disassemble_am(char *&buffer, int am, offs_t pc, const UINT8 *oprom, UINT32 opcode, int slot, int offset)
299299{
300300   static const char *const r8_names[16] = {
301301      "r0h", "r1h",  "r2h", "r3h",  "r4h", "r5h",  "r6h", "r7h",
r243808r243809
420420      break;
421421
422422   case DASM_abs32:
423      if(offset >= 8)
423      if(slot == 3)
424424         buffer += sprintf(buffer, "@%08x", (oprom[offset-6] << 24) | (oprom[offset-5] << 16) | (oprom[offset-4] << 8) | oprom[offset-3]);
425425      else
426426         buffer += sprintf(buffer, "@%08x", (oprom[offset-4] << 24) | (oprom[offset-3] << 16) | (oprom[offset-2] << 8) | oprom[offset-1]);
r243808r243809
520520
521521   if(e.am1 != DASM_none) {
522522      *buffer++ = ' ';
523      disassemble_am(buffer, e.am1, pc, oprom, slot[e.slot], e.flags & DASMFLAG_LENGTHMASK);
523      disassemble_am(buffer, e.am1, pc, oprom, slot[e.slot], e.slot, e.flags & DASMFLAG_LENGTHMASK);
524524   }
525525   if(e.am2 != DASM_none) {
526526      *buffer++ = ',';
527527      *buffer++ = ' ';
528      disassemble_am(buffer, e.am2, pc, oprom, slot[e.slot], e.flags & DASMFLAG_LENGTHMASK);
528      disassemble_am(buffer, e.am2, pc, oprom, slot[e.slot], e.slot, e.flags & DASMFLAG_LENGTHMASK);
529529   }
530530   return e.flags | DASMFLAG_SUPPORTED;
531531}
r243808r243809
556556
557557void h8_device::write8(UINT32 adr, UINT8 data)
558558{
559   //  logerror("W %06x %02x\n", adr & 0xffffff, data);
560559   icount--;
561560   program->write_byte(adr, data);
562561}
r243808r243809
569568
570569void h8_device::write16(UINT32 adr, UINT16 data)
571570{
572   //  logerror("W %06x %04x\n", adr & 0xfffffe, data);
573571   icount--;
574572   program->write_word(adr & ~1, data);
575573}
trunk/src/emu/cpu/h8/h8.h
r243808r243809
220220   static const disasm_entry disasm_entries[];
221221
222222   offs_t disassemble_generic(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options, const disasm_entry *table);
223   void disassemble_am(char *&buffer, int am, offs_t pc, const UINT8 *oprom, UINT32 opcode, int offset);
223   void disassemble_am(char *&buffer, int am, offs_t pc, const UINT8 *oprom, UINT32 opcode, int slot, int offset);
224224
225225   virtual void do_exec_full();
226226   virtual void do_exec_partial();
trunk/src/emu/cpu/h8/h83002.c
r243808r243809
2121   timer16_3(*this, "timer16:3"),
2222   timer16_4(*this, "timer16:4"),
2323   sci0(*this, "sci0"),
24   sci1(*this, "sci1")
24   sci1(*this, "sci1"),
25   watchdog(*this, "watchdog")
2526{
2627}
2728
r243808r243809
4344   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:4", 2, 2, "intc", 40)
4445   MCFG_H8_SCI_ADD("sci0", "intc", 52, 53, 54, 55)
4546   MCFG_H8_SCI_ADD("sci1", "intc", 56, 57, 58, 59)
47   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 20, h8_watchdog_device::H)
4648MACHINE_CONFIG_END
4749
4850DEVICE_ADDRESS_MAP_START(map, 16, h83002_device)
r243808r243809
8789   AM_RANGE(0xffff98, 0xffff9b) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tgr_r,   tgr_w          )
8890   AM_RANGE(0xffff9c, 0xffff9f) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tbr_r,   tbr_w          )
8991
92   AM_RANGE(0xffffa8, 0xffffa9) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
93   AM_RANGE(0xffffaa, 0xffffab) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
94
9095   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             smr_r,   smr_w,   0xff00)
9196   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
9297   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scr_r,   scr_w,   0xff00)
r243808r243809
189194   add_event(event_time, timer16_2->internal_update(current_time));
190195   add_event(event_time, timer16_3->internal_update(current_time));
191196   add_event(event_time, timer16_4->internal_update(current_time));
197   add_event(event_time, watchdog->internal_update(current_time));
192198
193199   recompute_bcount(event_time);
194200}
trunk/src/emu/cpu/h8/h83002.h
r243808r243809
4646#include "h8_adc.h"
4747#include "h8_port.h"
4848#include "h8_intc.h"
49#include "h8_timer16.h"
4950#include "h8_sci.h"
50#include "h8_timer16.h"
51#include "h8_watchdog.h"
5152
5253class h83002_device : public h8h_device {
5354public:
r243808r243809
7475   required_device<h8h_timer16_channel_device> timer16_4;
7576   required_device<h8_sci_device> sci0;
7677   required_device<h8_sci_device> sci1;
78   required_device<h8_watchdog_device> watchdog;
7779
7880   UINT8 syscr;
7981
trunk/src/emu/cpu/h8/h83006.c
r243808r243809
2626   timer16_2(*this, "timer16:2"),
2727   sci0(*this, "sci0"),
2828   sci1(*this, "sci1"),
29   sci2(*this, "sci2")
29   sci2(*this, "sci2"),
30   watchdog(*this, "watchdog")
3031{
3132}
3233
r243808r243809
5152   timer16_2(*this, "timer16:2"),
5253   sci0(*this, "sci0"),
5354   sci1(*this, "sci1"),
54   sci2(*this, "sci2")
55   sci2(*this, "sci2"),
56   watchdog(*this, "watchdog")
5557{
5658   ram_start = 0xfff720;
5759}
r243808r243809
8486   MCFG_H8_SCI_ADD("sci0", "intc", 52, 53, 54, 55)
8587   MCFG_H8_SCI_ADD("sci1", "intc", 56, 57, 58, 59)
8688   MCFG_H8_SCI_ADD("sci2", "intc", 60, 61, 62, 63)
89   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 20, h8_watchdog_device::H)
8790MACHINE_CONFIG_END
8891
8992DEVICE_ADDRESS_MAP_START(map, 16, h83006_device)
r243808r243809
130133   AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
131134   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
132135   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
136   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
137   AM_RANGE(0xffff8e, 0xffff8f) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
133138   AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_2",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0xff00)
134139   AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_3",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0x00ff)
135140   AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_2",  h8_timer8_channel_device,  tcsr_r,  tcsr_w,  0xff00)
r243808r243809
240245   add_event(event_time, timer16_0->internal_update(current_time));
241246   add_event(event_time, timer16_1->internal_update(current_time));
242247   add_event(event_time, timer16_2->internal_update(current_time));
248   add_event(event_time, watchdog->internal_update(current_time));
243249
244250   recompute_bcount(event_time);
245251}
trunk/src/emu/cpu/h8/h83006.h
r243808r243809
4646#include "h8_adc.h"
4747#include "h8_port.h"
4848#include "h8_intc.h"
49#include "h8_sci.h"
5049#include "h8_timer8.h"
5150#include "h8_timer16.h"
51#include "h8_sci.h"
52#include "h8_watchdog.h"
5253
5354class h83006_device : public h8h_device {
5455public:
r243808r243809
7980   required_device<h8_sci_device> sci0;
8081   required_device<h8_sci_device> sci1;
8182   required_device<h8_sci_device> sci2;
83   required_device<h8_watchdog_device> watchdog;
8284
8385   UINT8 syscr;
8486   UINT32 ram_start;
trunk/src/emu/cpu/h8/h83008.c
r243808r243809
2323   timer16_1(*this, "timer16:1"),
2424   timer16_2(*this, "timer16:2"),
2525   sci0(*this, "sci0"),
26   sci1(*this, "sci1")
26   sci1(*this, "sci1"),
27   watchdog(*this, "watchdog")
2728{
2829}
2930
r243808r243809
4748   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:2", 2, 2, "intc", 32)
4849   MCFG_H8_SCI_ADD("sci0", "intc", 52, 53, 54, 55)
4950   MCFG_H8_SCI_ADD("sci1", "intc", 56, 57, 58, 59)
51   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 20, h8_watchdog_device::H)
5052MACHINE_CONFIG_END
5153
5254DEVICE_ADDRESS_MAP_START(map, 16, h83008_device)
r243808r243809
9395   AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
9496   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
9597   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
98   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
99   AM_RANGE(0xffff8e, 0xffff8f) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
96100   AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_2",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0xff00)
97101   AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_3",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0x00ff)
98102   AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_2",  h8_timer8_channel_device,  tcsr_r,  tcsr_w,  0xff00)
r243808r243809
195199   add_event(event_time, timer16_0->internal_update(current_time));
196200   add_event(event_time, timer16_1->internal_update(current_time));
197201   add_event(event_time, timer16_2->internal_update(current_time));
202   add_event(event_time, watchdog->internal_update(current_time));
198203
199204   recompute_bcount(event_time);
200205}
trunk/src/emu/cpu/h8/h83008.h
r243808r243809
4646#include "h8_adc.h"
4747#include "h8_port.h"
4848#include "h8_intc.h"
49#include "h8_sci.h"
5049#include "h8_timer8.h"
5150#include "h8_timer16.h"
51#include "h8_sci.h"
52#include "h8_watchdog.h"
5253
5354class h83008_device : public h8h_device {
5455public:
r243808r243809
7879   required_device<h8h_timer16_channel_device> timer16_2;
7980   required_device<h8_sci_device> sci0;
8081   required_device<h8_sci_device> sci1;
82   required_device<h8_watchdog_device> watchdog;
8183
8284   UINT8 syscr;
8385
trunk/src/emu/cpu/h8/h83048.c
r243808r243809
2828   timer16_3(*this, "timer16:3"),
2929   timer16_4(*this, "timer16:4"),
3030   sci0(*this, "sci0"),
31   sci1(*this, "sci1")
31   sci1(*this, "sci1"),
32   watchdog(*this, "watchdog")
3233{
3334}
3435
r243808r243809
5455   timer16_3(*this, "timer16:3"),
5556   timer16_4(*this, "timer16:4"),
5657   sci0(*this, "sci0"),
57   sci1(*this, "sci1")
58   sci1(*this, "sci1"),
59   watchdog(*this, "watchdog")
5860{
5961   ram_start = 0xffef10;
6062}
r243808r243809
99101   MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:4", 2, 2, "intc", 40)
100102   MCFG_H8_SCI_ADD("sci0", "intc", 52, 53, 54, 55)
101103   MCFG_H8_SCI_ADD("sci1", "intc", 56, 57, 58, 59)
104   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 20, h8_watchdog_device::H)
102105MACHINE_CONFIG_END
103106
104107DEVICE_ADDRESS_MAP_START(map, 16, h83048_device)
r243808r243809
143146   AM_RANGE(0xffff98, 0xffff9b) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tgr_r,   tgr_w          )
144147   AM_RANGE(0xffff9c, 0xffff9f) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tbr_r,   tbr_w          )
145148
149   AM_RANGE(0xffffa8, 0xffffa9) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
150   AM_RANGE(0xffffaa, 0xffffab) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
151
146152   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             smr_r,   smr_w,   0xff00)
147153   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
148154   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scr_r,   scr_w,   0xff00)
r243808r243809
256262   add_event(event_time, timer16_2->internal_update(current_time));
257263   add_event(event_time, timer16_3->internal_update(current_time));
258264   add_event(event_time, timer16_4->internal_update(current_time));
265   add_event(event_time, watchdog->internal_update(current_time));
259266
260267   recompute_bcount(event_time);
261268}
trunk/src/emu/cpu/h8/h83048.h
r243808r243809
5454#include "h8_adc.h"
5555#include "h8_port.h"
5656#include "h8_intc.h"
57#include "h8_timer16.h"
5758#include "h8_sci.h"
58#include "h8_timer16.h"
59#include "h8_watchdog.h"
5960
6061class h83048_device : public h8h_device {
6162public:
r243808r243809
8788   required_device<h8h_timer16_channel_device> timer16_4;
8889   required_device<h8_sci_device> sci0;
8990   required_device<h8_sci_device> sci1;
91   required_device<h8_watchdog_device> watchdog;
9092
9193   UINT32 ram_start;
9294   UINT8 syscr;
trunk/src/emu/cpu/h8/h83337.c
r243808r243809
2424   timer16(*this, "timer16"),
2525   timer16_0(*this, "timer16:0"),
2626   sci0(*this, "sci0"),
27   sci1(*this, "sci1")
27   sci1(*this, "sci1"),
28   watchdog(*this, "watchdog")
2829{
2930}
3031
r243808r243809
4647   timer16(*this, "timer16"),
4748   timer16_0(*this, "timer16:0"),
4849   sci0(*this, "sci0"),
49   sci1(*this, "sci1")
50   sci1(*this, "sci1"),
51   watchdog(*this, "watchdog")
5052{
5153   ram_start = 0xf780;
5254}
r243808r243809
8183   MCFG_H8_TIMER16_CHANNEL_ADD("timer16:0", 4, 0, "intc", 32)
8284   MCFG_H8_SCI_ADD("sci0", "intc", 27, 28, 29, 30)
8385   MCFG_H8_SCI_ADD("sci1", "intc", 31, 32, 33, 34)
86   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 36, h8_watchdog_device::B)
8487MACHINE_CONFIG_END
8588
8689DEVICE_ADDRESS_MAP_START(map, 16, h83337_device)
r243808r243809
100103//  AM_RANGE(0xff96, 0xff97) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tocr_r,  tocr_w,  0x00ff)
101104   AM_RANGE(0xff98, 0xff9f) AM_DEVREAD(      "timer16:0", h8_timer16_channel_device, tgr_r                   )
102105
106   AM_RANGE(0xffa8, 0xffa9) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
103107   AM_RANGE(0xffac, 0xffad) AM_DEVREADWRITE8("port1",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
104108   AM_RANGE(0xffac, 0xffad) AM_DEVREADWRITE8("port2",     h8_port_device,            pcr_r,   pcr_w,   0x00ff)
105109   AM_RANGE(0xffae, 0xffaf) AM_DEVREADWRITE8("port3",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
r243808r243809
186190   add_event(event_time, timer8_0->internal_update(current_time));
187191   add_event(event_time, timer8_1->internal_update(current_time));
188192   add_event(event_time, timer16_0->internal_update(current_time));
193   add_event(event_time, watchdog->internal_update(current_time));
189194
190195   recompute_bcount(event_time);
191196}
trunk/src/emu/cpu/h8/h83337.h
r243808r243809
5050#define __H83337_H__
5151
5252#include "h8.h"
53#include "h8_intc.h"
5354#include "h8_adc.h"
5455#include "h8_port.h"
55#include "h8_intc.h"
5656#include "h8_timer8.h"
5757#include "h8_timer16.h"
5858#include "h8_sci.h"
59#include "h8_watchdog.h"
5960
6061class h83337_device : public h8_device {
6162public:
r243808r243809
8990   required_device<h8_timer16_channel_device> timer16_0;
9091   required_device<h8_sci_device> sci0;
9192   required_device<h8_sci_device> sci1;
93   required_device<h8_watchdog_device> watchdog;
9294
9395   UINT8 syscr;
9496   UINT32 ram_start;
trunk/src/emu/cpu/h8/h8_dma.c
r0r243809
1#include "emu.h"
2#include "h8_dma.h"
3
4const device_type H8_DMA         = &device_creator<h8_dma_device>;
5const device_type H8_DMA_CHANNEL = &device_creator<h8_dma_channel_device>;
6
7h8_dma_device::h8_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
8   device_t(mconfig, H8_DMA, "H8 DMA controller", tag, owner, clock, "h8_dma", __FILE__)
9{
10}
11
12void h8_dma_device::device_start()
13{
14}
15
16void h8_dma_device::device_reset()
17{
18   dmabcr = 0x0000;
19   dmawer = 0x00;
20}
21
22READ8_MEMBER(h8_dma_device::dmawer_r)
23{
24   logerror("%s: dmawer_r\n", tag());
25   return dmawer;
26}
27
28WRITE8_MEMBER(h8_dma_device::dmawer_w)
29{
30   dmawer = data;
31   logerror("%s: dmawer_w %02x\n", tag(), data);
32}
33
34READ8_MEMBER(h8_dma_device::dmatcr_r)
35{
36   logerror("%s: dmatcr_r\n", tag());
37   return dmatcr;
38}
39
40WRITE8_MEMBER(h8_dma_device::dmatcr_w)
41{
42   dmatcr = data;
43   logerror("%s: dmatcr_w %02x\n", tag(), data);
44}
45
46READ16_MEMBER(h8_dma_device::dmabcr_r)
47{
48   logerror("%s: dmabcr_r\n", tag());
49   return dmabcr;
50}
51
52WRITE16_MEMBER(h8_dma_device::dmabcr_w)
53{
54   COMBINE_DATA(&dmabcr);
55   logerror("%s: dmabcr_w %04x\n", tag(), dmabcr);
56   if(dmabcr & 0x40)
57      dmabcr &= ~0x40;
58}
59
60
61
62h8_dma_channel_device::h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
63   device_t(mconfig, H8_DMA_CHANNEL, "H8 DMA channel", tag, owner, clock, "h8_dma_channel", __FILE__)
64{
65}
66
67void h8_dma_channel_device::set_info(const char *intc, int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf)
68{
69}
70
71void h8_dma_channel_device::device_start()
72{
73}
74
75void h8_dma_channel_device::device_reset()
76{
77}
78
79READ16_MEMBER(h8_dma_channel_device::marah_r)
80{
81   logerror("%s: marah_r\n", tag());
82   return 0x0000;
83}
84
85WRITE16_MEMBER(h8_dma_channel_device::marah_w)
86{
87   logerror("%s: marah_w %04x\n", tag(), data);
88}
89
90READ16_MEMBER(h8_dma_channel_device::maral_r)
91{
92   logerror("%s: maral_r\n", tag());
93   return 0x0000;
94}
95
96WRITE16_MEMBER(h8_dma_channel_device::maral_w)
97{
98   logerror("%s: maral_w %04x\n", tag(), data);
99}
100
101READ16_MEMBER(h8_dma_channel_device::ioara_r)
102{
103   logerror("%s: iorar_r\n", tag());
104   return 0x0000;
105}
106
107WRITE16_MEMBER(h8_dma_channel_device::ioara_w)
108{
109   logerror("%s: ioara_w %04x\n", tag(), data);
110}
111
112READ16_MEMBER(h8_dma_channel_device::etcra_r)
113{
114   logerror("%s: etcra_r\n", tag());
115   return 0x0000;
116}
117
118WRITE16_MEMBER(h8_dma_channel_device::etcra_w)
119{
120   logerror("%s: etcra_w %04x\n", tag(), data);
121}
122
123READ16_MEMBER(h8_dma_channel_device::marbh_r)
124{
125   logerror("%s: marbh_r\n", tag());
126   return 0x0000;
127}
128
129WRITE16_MEMBER(h8_dma_channel_device::marbh_w)
130{
131   logerror("%s: marbh_w %04x\n", tag(), data);
132}
133
134READ16_MEMBER(h8_dma_channel_device::marbl_r)
135{
136   logerror("%s: marbl_r\n", tag());
137   return 0x0000;
138}
139
140WRITE16_MEMBER(h8_dma_channel_device::marbl_w)
141{
142   logerror("%s: marbl_w %04x\n", tag(), data);
143}
144
145READ16_MEMBER(h8_dma_channel_device::ioarb_r)
146{
147   logerror("%s: ioarb_r\n", tag());
148   return 0x0000;
149}
150
151WRITE16_MEMBER(h8_dma_channel_device::ioarb_w)
152{
153   logerror("%s: ioarb_w %04x\n", tag(), data);
154}
155
156READ16_MEMBER(h8_dma_channel_device::etcrb_r)
157{
158   logerror("%s: etcrb_r\n", tag());
159   return 0x0000;
160}
161
162WRITE16_MEMBER(h8_dma_channel_device::etcrb_w)
163{
164   logerror("%s: etcrb_w %04x\n", tag(), data);
165}
166
167READ8_MEMBER(h8_dma_channel_device::dmacr_r)
168{
169   logerror("%s: dmacr_r %d\n", tag(), offset);
170   return 0x00;
171}
172
173WRITE8_MEMBER(h8_dma_channel_device::dmacr_w)
174{
175   logerror("%s: dmacr_w %d, %02x\n", tag(), offset, data);
176}
trunk/src/emu/cpu/h8/h8_dma.h
r0r243809
1/***************************************************************************
2
3    h8_dma.h
4
5    H8 DMA
6
7****************************************************************************
8
9    Copyright Olivier Galibert
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
38***************************************************************************/
39
40#ifndef __H8_DMA_H__
41#define __H8_DMA_H__
42
43#include "h8.h"
44#include "h8_intc.h"
45
46#define MCFG_H8_DMA_ADD( _tag ) \
47   MCFG_DEVICE_ADD( _tag, H8_DMA, 0 )
48
49#define MCFG_H8_DMA_CHANNEL_ADD( _tag, intc, irq_base, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf )   \
50   MCFG_DEVICE_ADD( _tag, H8_DMA_CHANNEL, 0 )  \
51   downcast<h8_dma_channel_device *>(device)->set_info(intc, irq_base, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf);
52
53class h8_dma_device : public device_t {
54public:
55   h8_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56
57   DECLARE_READ8_MEMBER(dmawer_r);
58   DECLARE_WRITE8_MEMBER(dmawer_w);
59   DECLARE_READ8_MEMBER(dmatcr_r);
60   DECLARE_WRITE8_MEMBER(dmatcr_w);
61   DECLARE_READ16_MEMBER(dmabcr_r);
62   DECLARE_WRITE16_MEMBER(dmabcr_w);
63
64protected:
65   virtual void device_start();
66   virtual void device_reset();
67
68   UINT8 dmawer, dmatcr;
69   UINT16 dmabcr;
70};
71
72class h8_dma_channel_device : public device_t {
73public:
74   enum {
75      NONE       = -1,
76      DREQ_LEVEL = -2,
77      DREQ_EDGE  = -3
78   };
79
80   enum {
81      MODE8_MEM_MEM,
82      MODE8_DACK_MEM,
83      MODE8_MEM_DACK,
84      MODE16_MEM_MEM,
85      MODE16_DACK_MEM,
86      MODE16_MEM_DACK
87   };
88
89   h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
90
91   void set_info(const char *intc, int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf);
92
93   DECLARE_READ16_MEMBER(marah_r);
94   DECLARE_WRITE16_MEMBER(marah_w);
95   DECLARE_READ16_MEMBER(maral_r);
96   DECLARE_WRITE16_MEMBER(maral_w);
97   DECLARE_READ16_MEMBER(ioara_r);
98   DECLARE_WRITE16_MEMBER(ioara_w);
99   DECLARE_READ16_MEMBER(etcra_r);
100   DECLARE_WRITE16_MEMBER(etcra_w);
101   DECLARE_READ16_MEMBER(marbh_r);
102   DECLARE_WRITE16_MEMBER(marbh_w);
103   DECLARE_READ16_MEMBER(marbl_r);
104   DECLARE_WRITE16_MEMBER(marbl_w);
105   DECLARE_READ16_MEMBER(ioarb_r);
106   DECLARE_WRITE16_MEMBER(ioarb_w);
107   DECLARE_READ16_MEMBER(etcrb_r);
108   DECLARE_WRITE16_MEMBER(etcrb_w);
109   DECLARE_READ8_MEMBER(dmacr_r);
110   DECLARE_WRITE8_MEMBER(dmacr_w);
111
112protected:
113   virtual void device_start();
114   virtual void device_reset();
115};
116
117extern const device_type H8_DMA;
118extern const device_type H8_DMA_CHANNEL;
119
120#endif
trunk/src/emu/cpu/h8/h8_sci.c
r243808r243809
1414   external_clock_period = attotime::never;
1515}
1616
17void h8_sci_device::set_info(const char *_intc_tag,int eri, int rxi, int txi, int tei)
17void h8_sci_device::set_info(const char *_intc_tag, int eri, int rxi, int txi, int tei)
1818{
1919   intc_tag = _intc_tag;
2020   eri_int = eri;
trunk/src/emu/cpu/h8/h8_watchdog.c
r0r243809
1#include "emu.h"
2#include "h8_watchdog.h"
3
4const device_type H8_WATCHDOG = &device_creator<h8_watchdog_device>;
5
6const int h8_watchdog_device::div_bh[8] = { 1, 6, 7, 9, 11, 13, 15, 17 };
7const int h8_watchdog_device::div_s [8] = { 1, 5, 6, 7,  8,  9, 11, 12 };
8
9h8_watchdog_device::h8_watchdog_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
10   device_t(mconfig, H8_WATCHDOG, "H8 watchdog", tag, owner, clock, "h8_watchdog", __FILE__),
11   cpu(*this, DEVICE_SELF_OWNER)
12{
13}
14
15void h8_watchdog_device::set_info(const char *_intc_tag, int _irq, int _type)
16{
17   intc_tag = _intc_tag;
18   irq = _irq;
19   type = _type;
20}
21
22
23UINT64 h8_watchdog_device::internal_update(UINT64 current_time)
24{
25   tcnt_update(current_time);
26   if(tcsr & TCSR_TME) {
27      int shift = (type == S ? div_s : div_bh)[tcsr & TCSR_CKS];
28      UINT64 spos = tcnt_cycle_base >> shift;
29      return (spos + 0x100 - tcnt) << shift;
30     
31   } else
32      return 0;
33}
34
35void h8_watchdog_device::tcnt_update(UINT64 cur_time)
36{
37   if(tcsr & TCSR_TME) {
38      int shift = (type == S ? div_s : div_bh)[tcsr & TCSR_CKS];
39      if(!cur_time)
40         cur_time = cpu->total_cycles();
41      UINT64 spos = tcnt_cycle_base >> shift;
42      UINT64 epos = cur_time >> shift;
43
44      int next_tcnt = tcnt + int(epos - spos);
45      tcnt = next_tcnt;
46      tcnt_cycle_base = cur_time;
47      //      logerror("%s: %10lld tcnt %02x -> %03x shift=%d\n", tag(), cur_time, tcnt, next_tcnt, shift);
48
49      if(next_tcnt >= 0x100) {
50         if(tcsr & TCSR_WT) {
51            logerror("%s: watchdog triggered\n", tag());
52            if(type == B && !(tcsr & TCSR_NMI))
53               intc->internal_interrupt(3);
54            else
55               cpu->reset();
56
57         } else {
58            if(!(tcsr & TCSR_OVF)) {
59               tcsr |= TCSR_OVF;
60               intc->internal_interrupt(irq);
61            }           
62         }
63      }
64   } else
65      tcnt = 0;
66
67}
68
69READ16_MEMBER(h8_watchdog_device::wd_r)
70{
71   tcnt_update();
72
73   logerror("%s: read\n", tag());
74   return 0;
75}
76
77WRITE16_MEMBER(h8_watchdog_device::wd_w)
78{
79   if(mem_mask != 0xffff)
80      return;
81
82   if((data & 0xff00) == 0xa500) {
83      tcnt_update();
84      tcsr = data & 0xff;
85      tcsr |= type == B ? 0x10 : 0x18;
86      cpu->internal_update();
87   }
88
89   if((data & 0xff00) == 0x5a00) {
90      if(tcsr & TCSR_TME) {
91         tcnt = data & 0xff;
92         tcnt_cycle_base = cpu->total_cycles();
93         //         logerror("%s: %10lld tcnt = %02x\n", tag(), tcnt_cycle_base, tcnt);
94      }
95      cpu->internal_update();
96   }
97}
98
99READ16_MEMBER(h8_watchdog_device::rst_r)
100{
101   logerror("%s: rst_r\n", tag());
102   return 0;
103}
104
105WRITE16_MEMBER(h8_watchdog_device::rst_w)
106{
107   if((data & 0xff00) == 0xa500)
108      logerror("%s: wowf_w %02x\n", tag(), data & 0xff);
109   if((data & 0xff00) == 0x5a00)
110      logerror("%s: rtse_w %02x\n", tag(), data & 0xff);
111}
112
113void h8_watchdog_device::device_start()
114{
115   intc = siblingdevice<h8_intc_device>(intc_tag);
116}
117
118void h8_watchdog_device::device_reset()
119{
120   tcnt = 0x00;
121   tcnt_cycle_base = cpu->total_cycles();
122   tcsr = type == B ? 0x10 : 0x18;
123   rst = type == S ? 0x1f : 0x3f;
124}
trunk/src/emu/cpu/h8/h8_watchdog.h
r0r243809
1/***************************************************************************
2
3    h8_watchdog.h
4
5    H8 watchdog/timer
6
7****************************************************************************
8
9    Copyright Olivier Galibert
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
38***************************************************************************/
39
40#ifndef __H8_WATCHDOG_H__
41#define __H8_WATCHDOG_H__
42
43#include "h8.h"
44#include "h8_intc.h"
45
46#define MCFG_H8_WATCHDOG_ADD( _tag, intc, irq, type )   \
47   MCFG_DEVICE_ADD( _tag, H8_WATCHDOG, 0 ) \
48   downcast<h8_watchdog_device *>(device)->set_info(intc, irq, type);
49
50class h8_watchdog_device : public device_t {
51public:
52   enum { B, H, S };
53
54   h8_watchdog_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
55
56   void set_info(const char *intc, int irq, int type);
57
58   UINT64 internal_update(UINT64 current_time);
59
60   DECLARE_READ16_MEMBER(wd_r);
61   DECLARE_WRITE16_MEMBER(wd_w);
62   DECLARE_READ16_MEMBER(rst_r);
63   DECLARE_WRITE16_MEMBER(rst_w);
64
65protected:
66   virtual void device_start();
67   virtual void device_reset();
68
69private:
70   enum {
71      TCSR_CKS  = 0x07,
72      TCSR_NMI  = 0x08,
73      TCSR_TME  = 0x20,
74      TCSR_WT   = 0x40,
75      TCSR_OVF  = 0x80,
76
77      RST_RSTS  = 0x20,
78      RST_RSTE  = 0x40,
79      RST_RSTEO = 0x40,
80      RST_WRST  = 0x80
81   };
82
83   static const int div_bh[8];
84   static const int div_s[8];
85
86   required_device<h8_device> cpu;
87   h8_intc_device *intc;
88   const char *intc_tag;
89   int irq;
90   int type;
91   UINT8 tcnt, tcsr, rst;
92   UINT64 tcnt_cycle_base;
93
94   void tcnt_update(UINT64 current_time = 0);
95};
96
97extern const device_type H8_WATCHDOG;
98
99#endif
trunk/src/emu/cpu/h8/h8s2245.c
r243808r243809
3131   timer16_2(*this, "timer16:2"),
3232   sci0(*this, "sci0"),
3333   sci1(*this, "sci1"),
34   sci2(*this, "sci2")
34   sci2(*this, "sci2"),
35   watchdog(*this, "watchdog")
3536{
3637}
3738
r243808r243809
5960   timer16_2(*this, "timer16:2"),
6061   sci0(*this, "sci0"),
6162   sci1(*this, "sci1"),
62   sci2(*this, "sci2")
63   sci2(*this, "sci2"),
64   watchdog(*this, "watchdog")
6365{
6466   ram_start = 0xffec00;
6567}
r243808r243809
131133   MCFG_H8_SCI_ADD("sci0", "intc", 80, 81, 82, 83)
132134   MCFG_H8_SCI_ADD("sci1", "intc", 84, 85, 86, 87)
133135   MCFG_H8_SCI_ADD("sci2", "intc", 88, 89, 90, 91)
136   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 25, h8_watchdog_device::S)
134137MACHINE_CONFIG_END
135138
136139DEVICE_ADDRESS_MAP_START(map, 16, h8s2245_device)
r243808r243809
217220   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
218221   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
219222   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
223   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
224   AM_RANGE(0xffffbe, 0xffffbf) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
220225   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,  tstr_w,  0xff00)
221226   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,  tsyr_w,  0x00ff)
222227   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
r243808r243809
240245   AM_RANGE(0xfffff4, 0xfffff5) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
241246   AM_RANGE(0xfffff6, 0xfffff7) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
242247   AM_RANGE(0xfffff8, 0xfffffb) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r,   tgr_w          )
243
244248ADDRESS_MAP_END
245249
246250machine_config_constructor h8s2245_device::device_mconfig_additions() const
r243808r243809
317321   add_event(event_time, timer16_0->internal_update(current_time));
318322   add_event(event_time, timer16_1->internal_update(current_time));
319323   add_event(event_time, timer16_2->internal_update(current_time));
324   add_event(event_time, watchdog->internal_update(current_time));
320325
321326   recompute_bcount(event_time);
322327}
trunk/src/emu/cpu/h8/h8s2245.h
r243808r243809
5050#define __H8S2245_H__
5151
5252#include "h8s2000.h"
53#include "h8_intc.h"
5354#include "h8_adc.h"
5455#include "h8_port.h"
55#include "h8_intc.h"
56#include "h8_sci.h"
5756#include "h8_timer8.h"
5857#include "h8_timer16.h"
58#include "h8_sci.h"
59#include "h8_watchdog.h"
5960
6061class h8s2245_device : public h8s2000_device {
6162public:
r243808r243809
8990   required_device<h8_sci_device> sci0;
9091   required_device<h8_sci_device> sci1;
9192   required_device<h8_sci_device> sci2;
93   required_device<h8_watchdog_device> watchdog;
9294
9395   UINT32 ram_start;
9496   UINT8 syscr;
trunk/src/emu/cpu/h8/h8s2320.c
r243808r243809
1616   h8s2000_device(mconfig, type, name, tag, owner, clock, shortname, source, address_map_delegate(FUNC(h8s2320_device::map), this)),
1717   intc(*this, "intc"),
1818   adc(*this, "adc"),
19   dma(*this, "dma"),
20   dma0(*this, "dma:0"),
21   dma1(*this, "dma:1"),
1922   port1(*this, "port1"),
2023   port2(*this, "port2"),
2124   port3(*this, "port3"),
r243808r243809
4043   timer16_5(*this, "timer16:5"),
4144   sci0(*this, "sci0"),
4245   sci1(*this, "sci1"),
43   sci2(*this, "sci2")
46   sci2(*this, "sci2"),
47   watchdog(*this, "watchdog")
4448{
4549}
4650
r243808r243809
4852   h8s2000_device(mconfig, H8S2320, "H8S/2320", tag, owner, clock, "h8s2320", __FILE__, address_map_delegate(FUNC(h8s2320_device::map), this)),
4953   intc(*this, "intc"),
5054   adc(*this, "adc"),
55   dma(*this, "dma"),
56   dma0(*this, "dma:0"),
57   dma1(*this, "dma:1"),
5158   port1(*this, "port1"),
5259   port2(*this, "port2"),
5360   port3(*this, "port3"),
r243808r243809
7279   timer16_5(*this, "timer16:5"),
7380   sci0(*this, "sci0"),
7481   sci1(*this, "sci1"),
75   sci2(*this, "sci2")
82   sci2(*this, "sci2"),
83   watchdog(*this, "watchdog")
7684{
7785   ram_start = 0xffec00;
7886}
r243808r243809
128136static MACHINE_CONFIG_FRAGMENT(h8s2320)
129137   MCFG_H8S_INTC_ADD("intc")
130138   MCFG_H8_ADC_2320_ADD("adc", "intc", 28)
139   MCFG_H8_DMA_ADD("dma")
140   MCFG_H8_DMA_CHANNEL_ADD("dma:0", "intc", 72, h8_dma_channel_device::NONE, 28, h8_dma_channel_device::DREQ_EDGE, h8_dma_channel_device::DREQ_LEVEL, 82, 81, 86, 85, 32, 40, 44, 48, 56, 60, h8_dma_channel_device::NONE, h8_dma_channel_device::NONE)
141   MCFG_H8_DMA_CHANNEL_ADD("dma:1", "intc", 74, h8_dma_channel_device::NONE, 28, h8_dma_channel_device::DREQ_EDGE, h8_dma_channel_device::DREQ_LEVEL, 82, 81, 86, 85, 32, 40, 44, 48, 56, 60, h8_dma_channel_device::NONE, h8_dma_channel_device::NONE)
131142   MCFG_H8_PORT_ADD("port1", h8_device::PORT_1, 0x00, 0x00)
132143   MCFG_H8_PORT_ADD("port2", h8_device::PORT_2, 0x00, 0x00)
133144   MCFG_H8_PORT_ADD("port3", h8_device::PORT_3, 0xc0, 0xc0)
r243808r243809
203214   MCFG_H8_SCI_ADD("sci0", "intc", 80, 81, 82, 83)
204215   MCFG_H8_SCI_ADD("sci1", "intc", 84, 85, 86, 87)
205216   MCFG_H8_SCI_ADD("sci2", "intc", 88, 89, 90, 91)
217   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 25, h8_watchdog_device::S)
206218MACHINE_CONFIG_END
207219
208220DEVICE_ADDRESS_MAP_START(map, 16, h8s2320_device)
209221   AM_RANGE(ram_start, 0xfffbff) AM_RAM
210222
211   AM_RANGE(0xfffe80, 0xfffe81) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
212   AM_RANGE(0xfffe80, 0xfffe81) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
213   AM_RANGE(0xfffe82, 0xfffe83) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tior_r,  tior_w,  0xffff)
214   AM_RANGE(0xfffe84, 0xfffe85) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
215   AM_RANGE(0xfffe84, 0xfffe85) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
216   AM_RANGE(0xfffe86, 0xfffe87) AM_DEVREADWRITE( "timer16:3", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
217   AM_RANGE(0xfffe88, 0xfffe8f) AM_DEVREADWRITE( "timer16:3", h8_timer16_channel_device, tgr_r,   tgr_w          )
218   AM_RANGE(0xfffe90, 0xfffe91) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
219   AM_RANGE(0xfffe90, 0xfffe91) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
220   AM_RANGE(0xfffe92, 0xfffe93) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tior_r,  tior_w,  0xff00)
221   AM_RANGE(0xfffe94, 0xfffe95) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
222   AM_RANGE(0xfffe94, 0xfffe95) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
223   AM_RANGE(0xfffe96, 0xfffe97) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
224   AM_RANGE(0xfffe98, 0xfffe9b) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tgr_r,   tgr_w          )
225   AM_RANGE(0xfffea0, 0xfffea1) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
226   AM_RANGE(0xfffea0, 0xfffea1) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
227   AM_RANGE(0xfffea2, 0xfffea3) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tior_r,  tior_w,  0xff00)
228   AM_RANGE(0xfffea4, 0xfffea5) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
229   AM_RANGE(0xfffea4, 0xfffea5) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
230   AM_RANGE(0xfffea6, 0xfffea7) AM_DEVREADWRITE( "timer16:5", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
231   AM_RANGE(0xfffea8, 0xfffeab) AM_DEVREADWRITE( "timer16:5", h8_timer16_channel_device, tgr_r,   tgr_w          )
232   AM_RANGE(0xfffeb0, 0xfffeb1) AM_DEVWRITE8(    "port1",     h8_port_device,                     ddr_w,   0xff00)
233   AM_RANGE(0xfffeb0, 0xfffeb1) AM_DEVWRITE8(    "port2",     h8_port_device,                     ddr_w,   0x00ff)
234   AM_RANGE(0xfffeb2, 0xfffeb3) AM_DEVWRITE8(    "port3",     h8_port_device,                     ddr_w,   0xff00)
235   AM_RANGE(0xfffeb4, 0xfffeb5) AM_DEVWRITE8(    "port5",     h8_port_device,                     ddr_w,   0xff00)
236   AM_RANGE(0xfffeb4, 0xfffeb5) AM_DEVWRITE8(    "port6",     h8_port_device,                     ddr_w,   0x00ff)
237   AM_RANGE(0xfffeb8, 0xfffeb9) AM_DEVWRITE8(    "porta",     h8_port_device,                     ddr_w,   0x00ff)
238   AM_RANGE(0xfffeba, 0xfffebb) AM_DEVWRITE8(    "portb",     h8_port_device,                     ddr_w,   0xff00)
239   AM_RANGE(0xfffeba, 0xfffebb) AM_DEVWRITE8(    "portc",     h8_port_device,                     ddr_w,   0x00ff)
240   AM_RANGE(0xfffebc, 0xfffebd) AM_DEVWRITE8(    "portd",     h8_port_device,                     ddr_w,   0xff00)
241   AM_RANGE(0xfffebc, 0xfffebd) AM_DEVWRITE8(    "porte",     h8_port_device,                     ddr_w,   0x00ff)
242   AM_RANGE(0xfffebe, 0xfffebf) AM_DEVWRITE8(    "portf",     h8_port_device,                     ddr_w,   0xff00)
243   AM_RANGE(0xfffebe, 0xfffebf) AM_DEVWRITE8(    "portg",     h8_port_device,                     ddr_w,   0x00ff)
244   AM_RANGE(0xfffec0, 0xfffec1) AM_DEVREADWRITE8("intc",      h8s_intc_device,           icr_r,   icr_w,   0xffff)
245   AM_RANGE(0xfffec2, 0xfffec3) AM_DEVREADWRITE8("intc",      h8s_intc_device,           icrc_r,  icrc_w,  0xff00)
246   AM_RANGE(0xfffec4, 0xfffecd) AM_DEVREADWRITE8("intc",      h8s_intc_device,           ipr_r,   ipr_w,   0xffff)
247   AM_RANGE(0xfffece, 0xfffecf) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iprk_r,  iprk_w,  0xff00)
248   AM_RANGE(0xffff2c, 0xffff2d) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iscrh_r, iscrh_w, 0xff00)
249   AM_RANGE(0xffff2c, 0xffff2d) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iscrl_r, iscrl_w, 0x00ff)
250   AM_RANGE(0xffff2e, 0xffff2f) AM_DEVREADWRITE8("intc",      h8s_intc_device,           ier_r,   ier_w,   0xff00)
251   AM_RANGE(0xffff2e, 0xffff2f) AM_DEVREADWRITE8("intc",      h8s_intc_device,           isr_r,   isr_w,   0x00ff)
252   AM_RANGE(0xffff38, 0xffff39) AM_READWRITE8(                                           syscr_r, syscr_w, 0x00ff)
223   AM_RANGE(0xfffe80, 0xfffe81) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
224   AM_RANGE(0xfffe80, 0xfffe81) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
225   AM_RANGE(0xfffe82, 0xfffe83) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tior_r,   tior_w,   0xffff)
226   AM_RANGE(0xfffe84, 0xfffe85) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
227   AM_RANGE(0xfffe84, 0xfffe85) AM_DEVREADWRITE8("timer16:3", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
228   AM_RANGE(0xfffe86, 0xfffe87) AM_DEVREADWRITE( "timer16:3", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
229   AM_RANGE(0xfffe88, 0xfffe8f) AM_DEVREADWRITE( "timer16:3", h8_timer16_channel_device, tgr_r,    tgr_w           )
230   AM_RANGE(0xfffe90, 0xfffe91) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
231   AM_RANGE(0xfffe90, 0xfffe91) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
232   AM_RANGE(0xfffe92, 0xfffe93) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tior_r,   tior_w,   0xff00)
233   AM_RANGE(0xfffe94, 0xfffe95) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
234   AM_RANGE(0xfffe94, 0xfffe95) AM_DEVREADWRITE8("timer16:4", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
235   AM_RANGE(0xfffe96, 0xfffe97) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
236   AM_RANGE(0xfffe98, 0xfffe9b) AM_DEVREADWRITE( "timer16:4", h8_timer16_channel_device, tgr_r,    tgr_w           )
237   AM_RANGE(0xfffea0, 0xfffea1) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
238   AM_RANGE(0xfffea0, 0xfffea1) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
239   AM_RANGE(0xfffea2, 0xfffea3) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tior_r,   tior_w,   0xff00)
240   AM_RANGE(0xfffea4, 0xfffea5) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
241   AM_RANGE(0xfffea4, 0xfffea5) AM_DEVREADWRITE8("timer16:5", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
242   AM_RANGE(0xfffea6, 0xfffea7) AM_DEVREADWRITE( "timer16:5", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
243   AM_RANGE(0xfffea8, 0xfffeab) AM_DEVREADWRITE( "timer16:5", h8_timer16_channel_device, tgr_r,    tgr_w           )
244   AM_RANGE(0xfffeb0, 0xfffeb1) AM_DEVWRITE8(    "port1",     h8_port_device,                      ddr_w,    0xff00)
245   AM_RANGE(0xfffeb0, 0xfffeb1) AM_DEVWRITE8(    "port2",     h8_port_device,                      ddr_w,    0x00ff)
246   AM_RANGE(0xfffeb2, 0xfffeb3) AM_DEVWRITE8(    "port3",     h8_port_device,                      ddr_w,    0xff00)
247   AM_RANGE(0xfffeb4, 0xfffeb5) AM_DEVWRITE8(    "port5",     h8_port_device,                      ddr_w,    0xff00)
248   AM_RANGE(0xfffeb4, 0xfffeb5) AM_DEVWRITE8(    "port6",     h8_port_device,                      ddr_w,    0x00ff)
249   AM_RANGE(0xfffeb8, 0xfffeb9) AM_DEVWRITE8(    "porta",     h8_port_device,                      ddr_w,    0x00ff)
250   AM_RANGE(0xfffeba, 0xfffebb) AM_DEVWRITE8(    "portb",     h8_port_device,                      ddr_w,    0xff00)
251   AM_RANGE(0xfffeba, 0xfffebb) AM_DEVWRITE8(    "portc",     h8_port_device,                      ddr_w,    0x00ff)
252   AM_RANGE(0xfffebc, 0xfffebd) AM_DEVWRITE8(    "portd",     h8_port_device,                      ddr_w,    0xff00)
253   AM_RANGE(0xfffebc, 0xfffebd) AM_DEVWRITE8(    "porte",     h8_port_device,                      ddr_w,    0x00ff)
254   AM_RANGE(0xfffebe, 0xfffebf) AM_DEVWRITE8(    "portf",     h8_port_device,                      ddr_w,    0xff00)
255   AM_RANGE(0xfffebe, 0xfffebf) AM_DEVWRITE8(    "portg",     h8_port_device,                      ddr_w,    0x00ff)
256   AM_RANGE(0xfffec0, 0xfffec1) AM_DEVREADWRITE8("intc",      h8s_intc_device,           icr_r,    icr_w,    0xffff)
257   AM_RANGE(0xfffec2, 0xfffec3) AM_DEVREADWRITE8("intc",      h8s_intc_device,           icrc_r,   icrc_w,   0xff00)
258   AM_RANGE(0xfffec4, 0xfffecd) AM_DEVREADWRITE8("intc",      h8s_intc_device,           ipr_r,    ipr_w,    0xffff)
259   AM_RANGE(0xfffece, 0xfffecf) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iprk_r,   iprk_w,   0xff00)
253260
254   AM_RANGE(0xffff50, 0xffff51) AM_DEVREAD8(     "port1",     h8_port_device,            port_r,           0xff00)
255   AM_RANGE(0xffff50, 0xffff51) AM_DEVREAD8(     "port2",     h8_port_device,            port_r,           0x00ff)
256   AM_RANGE(0xffff52, 0xffff53) AM_DEVREAD8(     "port3",     h8_port_device,            port_r,           0xff00)
257   AM_RANGE(0xffff52, 0xffff53) AM_DEVREAD8(     "port4",     h8_port_device,            port_r,           0x00ff)
258   AM_RANGE(0xffff54, 0xffff55) AM_DEVREAD8(     "port5",     h8_port_device,            port_r,           0xff00)
259   AM_RANGE(0xffff54, 0xffff55) AM_DEVREAD8(     "port6",     h8_port_device,            port_r,           0x00ff)
260   AM_RANGE(0xffff58, 0xffff59) AM_DEVREAD8(     "porta",     h8_port_device,            port_r,           0x00ff)
261   AM_RANGE(0xffff5a, 0xffff5b) AM_DEVREAD8(     "portb",     h8_port_device,            port_r,           0xff00)
262   AM_RANGE(0xffff5a, 0xffff5b) AM_DEVREAD8(     "portc",     h8_port_device,            port_r,           0x00ff)
263   AM_RANGE(0xffff5c, 0xffff5d) AM_DEVREAD8(     "portd",     h8_port_device,            port_r,           0xff00)
264   AM_RANGE(0xffff5c, 0xffff5d) AM_DEVREAD8(     "porte",     h8_port_device,            port_r,           0x00ff)
265   AM_RANGE(0xffff5e, 0xffff5f) AM_DEVREAD8(     "portf",     h8_port_device,            port_r,           0xff00)
266   AM_RANGE(0xffff5e, 0xffff5f) AM_DEVREAD8(     "portg",     h8_port_device,            port_r,           0x00ff)
267   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("port1",     h8_port_device,            dr_r,    dr_w,    0xff00)
268   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("port2",     h8_port_device,            dr_r,    dr_w,    0x00ff)
269   AM_RANGE(0xffff62, 0xffff63) AM_DEVREADWRITE8("port3",     h8_port_device,            dr_r,    dr_w,    0xff00)
270   AM_RANGE(0xffff64, 0xffff65) AM_DEVREADWRITE8("port5",     h8_port_device,            dr_r,    dr_w,    0xff00)
271   AM_RANGE(0xffff64, 0xffff65) AM_DEVREADWRITE8("port6",     h8_port_device,            dr_r,    dr_w,    0x00ff)
272   AM_RANGE(0xffff68, 0xffff69) AM_DEVREADWRITE8("porta",     h8_port_device,            dr_r,    dr_w,    0x00ff)
273   AM_RANGE(0xffff6a, 0xffff6b) AM_DEVREADWRITE8("portb",     h8_port_device,            dr_r,    dr_w,    0xff00)
274   AM_RANGE(0xffff6a, 0xffff6b) AM_DEVREADWRITE8("portc",     h8_port_device,            dr_r,    dr_w,    0x00ff)
275   AM_RANGE(0xffff6c, 0xffff6d) AM_DEVREADWRITE8("portd",     h8_port_device,            dr_r,    dr_w,    0xff00)
276   AM_RANGE(0xffff6c, 0xffff6d) AM_DEVREADWRITE8("porte",     h8_port_device,            dr_r,    dr_w,    0x00ff)
277   AM_RANGE(0xffff6e, 0xffff6f) AM_DEVREADWRITE8("portf",     h8_port_device,            dr_r,    dr_w,    0xff00)
278   AM_RANGE(0xffff6e, 0xffff6f) AM_DEVREADWRITE8("portg",     h8_port_device,            dr_r,    dr_w,    0x00ff)
279   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("porta",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
280   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("portb",     h8_port_device,            pcr_r,   pcr_w,   0x00ff)
281   AM_RANGE(0xffff72, 0xffff73) AM_DEVREADWRITE8("portc",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
282   AM_RANGE(0xffff72, 0xffff73) AM_DEVREADWRITE8("portd",     h8_port_device,            pcr_r,   pcr_w,   0x00ff)
283   AM_RANGE(0xffff74, 0xffff75) AM_DEVREADWRITE8("porte",     h8_port_device,            pcr_r,   pcr_w,   0xff00)
284   AM_RANGE(0xffff76, 0xffff77) AM_DEVREADWRITE8("port3",     h8_port_device,            odr_r,   odr_w,   0xff00)
285   AM_RANGE(0xffff76, 0xffff77) AM_DEVREADWRITE8("porta",     h8_port_device,            odr_r,   odr_w,   0x00ff)
286   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("sci0",      h8_sci_device,             smr_r,   smr_w,   0xff00)
287   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("sci0",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
288   AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scr_r,   scr_w,   0xff00)
289   AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE8("sci0",      h8_sci_device,             tdr_r,   tdr_w,   0x00ff)
290   AM_RANGE(0xffff7c, 0xffff7d) AM_DEVREADWRITE8("sci0",      h8_sci_device,             ssr_r,   ssr_w,   0xff00)
291   AM_RANGE(0xffff7c, 0xffff7d) AM_DEVREAD8(     "sci0",      h8_sci_device,             rdr_r,            0x00ff)
292   AM_RANGE(0xffff7e, 0xffff7f) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scmr_r,  scmr_w,  0xff00)
293   AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("sci1",      h8_sci_device,             smr_r,   smr_w,   0xff00)
294   AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("sci1",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
295   AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scr_r,   scr_w,   0xff00)
296   AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("sci1",      h8_sci_device,             tdr_r,   tdr_w,   0x00ff)
297   AM_RANGE(0xffff84, 0xffff85) AM_DEVREADWRITE8("sci1",      h8_sci_device,             ssr_r,   ssr_w,   0xff00)
298   AM_RANGE(0xffff84, 0xffff85) AM_DEVREAD8(     "sci1",      h8_sci_device,             rdr_r,            0x00ff)
299   AM_RANGE(0xffff86, 0xffff87) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scmr_r,  scmr_w,  0xff00)
300   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("sci2",      h8_sci_device,             smr_r,   smr_w,   0xff00)
301   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("sci2",      h8_sci_device,             brr_r,   brr_w,   0x00ff)
302   AM_RANGE(0xffff8a, 0xffff8b) AM_DEVREADWRITE8("sci2",      h8_sci_device,             scr_r,   scr_w,   0xff00)
303   AM_RANGE(0xffff8a, 0xffff8b) AM_DEVREADWRITE8("sci2",      h8_sci_device,             tdr_r,   tdr_w,   0x00ff)
304   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREADWRITE8("sci2",      h8_sci_device,             ssr_r,   ssr_w,   0xff00)
305   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREAD8(     "sci2",      h8_sci_device,             rdr_r,            0x00ff)
306   AM_RANGE(0xffff8e, 0xffff8f) AM_DEVREADWRITE8("sci2",      h8_sci_device,             scmr_r,  scmr_w,  0xff00)
307   AM_RANGE(0xffff90, 0xffff97) AM_DEVREAD8(     "adc",       h8_adc_device,             addr8_r,          0xffff)
308   AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcsr_r, adcsr_w, 0xff00)
309   AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcr_r,  adcr_w,  0x00ff)
261   AM_RANGE(0xfffee0, 0xfffee1) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     marah_r,  marah_w         )
262   AM_RANGE(0xfffee2, 0xfffee3) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     maral_r,  maral_w         )
263   AM_RANGE(0xfffee4, 0xfffee5) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     ioara_r,  ioara_w         )
264   AM_RANGE(0xfffee6, 0xfffee7) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     etcra_r,  etcra_w         )
265   AM_RANGE(0xfffee8, 0xfffee9) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     marbh_r,  marbh_w         )
266   AM_RANGE(0xfffeea, 0xfffeeb) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     marbl_r,  marbl_w         )
267   AM_RANGE(0xfffeec, 0xfffeed) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     ioarb_r,  ioarb_w         )
268   AM_RANGE(0xfffeee, 0xfffeef) AM_DEVREADWRITE( "dma:0",     h8_dma_channel_device,     etcrb_r,  etcrb_w         )
269   AM_RANGE(0xfffef0, 0xfffef1) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     marah_r,  marah_w         )
270   AM_RANGE(0xfffef2, 0xfffef3) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     maral_r,  maral_w         )
271   AM_RANGE(0xfffef4, 0xfffef5) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     ioara_r,  ioara_w         )
272   AM_RANGE(0xfffef6, 0xfffef7) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     etcra_r,  etcra_w         )
273   AM_RANGE(0xfffef8, 0xfffef9) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     marbh_r,  marbh_w         )
274   AM_RANGE(0xfffefa, 0xfffefb) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     marbl_r,  marbl_w         )
275   AM_RANGE(0xfffefc, 0xfffefd) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     ioarb_r,  ioarb_w         )
276   AM_RANGE(0xfffefe, 0xfffeff) AM_DEVREADWRITE( "dma:1",     h8_dma_channel_device,     etcrb_r,  etcrb_w         )
277   AM_RANGE(0xffff00, 0xffff01) AM_DEVREADWRITE8("dma",       h8_dma_device,             dmawer_r, dmawer_w, 0xff00)
278   AM_RANGE(0xffff00, 0xffff01) AM_DEVREADWRITE8("dma",       h8_dma_device,             dmatcr_r, dmatcr_w, 0x00ff)
279   AM_RANGE(0xffff02, 0xffff03) AM_DEVREADWRITE8("dma:0",     h8_dma_channel_device,     dmacr_r,  dmacr_w,  0xffff)
280   AM_RANGE(0xffff04, 0xffff05) AM_DEVREADWRITE8("dma:1",     h8_dma_channel_device,     dmacr_r,  dmacr_w,  0xffff)
281   AM_RANGE(0xffff06, 0xffff07) AM_DEVREADWRITE( "dma",       h8_dma_device,             dmabcr_r, dmabcr_w        )
282   AM_RANGE(0xffff2c, 0xffff2d) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iscrh_r,  iscrh_w,  0xff00)
283   AM_RANGE(0xffff2c, 0xffff2d) AM_DEVREADWRITE8("intc",      h8s_intc_device,           iscrl_r,  iscrl_w,  0x00ff)
284   AM_RANGE(0xffff2e, 0xffff2f) AM_DEVREADWRITE8("intc",      h8s_intc_device,           ier_r,    ier_w,    0xff00)
285   AM_RANGE(0xffff2e, 0xffff2f) AM_DEVREADWRITE8("intc",      h8s_intc_device,           isr_r,    isr_w,    0x00ff)
286   AM_RANGE(0xffff38, 0xffff39) AM_READWRITE8(                                           syscr_r,  syscr_w,  0x00ff)
310287
311   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0xff00)
312   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcr_r,   tcr_w,   0x00ff)
313   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcsr_r,  tcsr_w,  0xff00)
314   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcsr_r,  tcsr_w,  0x00ff)
315   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0xff00)
316   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
317   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
318   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
288   AM_RANGE(0xffff50, 0xffff51) AM_DEVREAD8(     "port1",     h8_port_device,            port_r,             0xff00)
289   AM_RANGE(0xffff50, 0xffff51) AM_DEVREAD8(     "port2",     h8_port_device,            port_r,             0x00ff)
290   AM_RANGE(0xffff52, 0xffff53) AM_DEVREAD8(     "port3",     h8_port_device,            port_r,             0xff00)
291   AM_RANGE(0xffff52, 0xffff53) AM_DEVREAD8(     "port4",     h8_port_device,            port_r,             0x00ff)
292   AM_RANGE(0xffff54, 0xffff55) AM_DEVREAD8(     "port5",     h8_port_device,            port_r,             0xff00)
293   AM_RANGE(0xffff54, 0xffff55) AM_DEVREAD8(     "port6",     h8_port_device,            port_r,             0x00ff)
294   AM_RANGE(0xffff58, 0xffff59) AM_DEVREAD8(     "porta",     h8_port_device,            port_r,             0x00ff)
295   AM_RANGE(0xffff5a, 0xffff5b) AM_DEVREAD8(     "portb",     h8_port_device,            port_r,             0xff00)
296   AM_RANGE(0xffff5a, 0xffff5b) AM_DEVREAD8(     "portc",     h8_port_device,            port_r,             0x00ff)
297   AM_RANGE(0xffff5c, 0xffff5d) AM_DEVREAD8(     "portd",     h8_port_device,            port_r,             0xff00)
298   AM_RANGE(0xffff5c, 0xffff5d) AM_DEVREAD8(     "porte",     h8_port_device,            port_r,             0x00ff)
299   AM_RANGE(0xffff5e, 0xffff5f) AM_DEVREAD8(     "portf",     h8_port_device,            port_r,             0xff00)
300   AM_RANGE(0xffff5e, 0xffff5f) AM_DEVREAD8(     "portg",     h8_port_device,            port_r,             0x00ff)
301   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("port1",     h8_port_device,            dr_r,     dr_w,     0xff00)
302   AM_RANGE(0xffff60, 0xffff61) AM_DEVREADWRITE8("port2",     h8_port_device,            dr_r,     dr_w,     0x00ff)
303   AM_RANGE(0xffff62, 0xffff63) AM_DEVREADWRITE8("port3",     h8_port_device,            dr_r,     dr_w,     0xff00)
304   AM_RANGE(0xffff64, 0xffff65) AM_DEVREADWRITE8("port5",     h8_port_device,            dr_r,     dr_w,     0xff00)
305   AM_RANGE(0xffff64, 0xffff65) AM_DEVREADWRITE8("port6",     h8_port_device,            dr_r,     dr_w,     0x00ff)
306   AM_RANGE(0xffff68, 0xffff69) AM_DEVREADWRITE8("porta",     h8_port_device,            dr_r,     dr_w,     0x00ff)
307   AM_RANGE(0xffff6a, 0xffff6b) AM_DEVREADWRITE8("portb",     h8_port_device,            dr_r,     dr_w,     0xff00)
308   AM_RANGE(0xffff6a, 0xffff6b) AM_DEVREADWRITE8("portc",     h8_port_device,            dr_r,     dr_w,     0x00ff)
309   AM_RANGE(0xffff6c, 0xffff6d) AM_DEVREADWRITE8("portd",     h8_port_device,            dr_r,     dr_w,     0xff00)
310   AM_RANGE(0xffff6c, 0xffff6d) AM_DEVREADWRITE8("porte",     h8_port_device,            dr_r,     dr_w,     0x00ff)
311   AM_RANGE(0xffff6e, 0xffff6f) AM_DEVREADWRITE8("portf",     h8_port_device,            dr_r,     dr_w,     0xff00)
312   AM_RANGE(0xffff6e, 0xffff6f) AM_DEVREADWRITE8("portg",     h8_port_device,            dr_r,     dr_w,     0x00ff)
313   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("porta",     h8_port_device,            pcr_r,    pcr_w,    0xff00)
314   AM_RANGE(0xffff70, 0xffff71) AM_DEVREADWRITE8("portb",     h8_port_device,            pcr_r,    pcr_w,    0x00ff)
315   AM_RANGE(0xffff72, 0xffff73) AM_DEVREADWRITE8("portc",     h8_port_device,            pcr_r,    pcr_w,    0xff00)
316   AM_RANGE(0xffff72, 0xffff73) AM_DEVREADWRITE8("portd",     h8_port_device,            pcr_r,    pcr_w,    0x00ff)
317   AM_RANGE(0xffff74, 0xffff75) AM_DEVREADWRITE8("porte",     h8_port_device,            pcr_r,    pcr_w,    0xff00)
318   AM_RANGE(0xffff76, 0xffff77) AM_DEVREADWRITE8("port3",     h8_port_device,            odr_r,    odr_w,    0xff00)
319   AM_RANGE(0xffff76, 0xffff77) AM_DEVREADWRITE8("porta",     h8_port_device,            odr_r,    odr_w,    0x00ff)
320   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("sci0",      h8_sci_device,             smr_r,    smr_w,    0xff00)
321   AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("sci0",      h8_sci_device,             brr_r,    brr_w,    0x00ff)
322   AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scr_r,    scr_w,    0xff00)
323   AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE8("sci0",      h8_sci_device,             tdr_r,    tdr_w,    0x00ff)
324   AM_RANGE(0xffff7c, 0xffff7d) AM_DEVREADWRITE8("sci0",      h8_sci_device,             ssr_r,    ssr_w,    0xff00)
325   AM_RANGE(0xffff7c, 0xffff7d) AM_DEVREAD8(     "sci0",      h8_sci_device,             rdr_r,              0x00ff)
326   AM_RANGE(0xffff7e, 0xffff7f) AM_DEVREADWRITE8("sci0",      h8_sci_device,             scmr_r,   scmr_w,   0xff00)
327   AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("sci1",      h8_sci_device,             smr_r,    smr_w,    0xff00)
328   AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("sci1",      h8_sci_device,             brr_r,    brr_w,    0x00ff)
329   AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scr_r,    scr_w,    0xff00)
330   AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("sci1",      h8_sci_device,             tdr_r,    tdr_w,    0x00ff)
331   AM_RANGE(0xffff84, 0xffff85) AM_DEVREADWRITE8("sci1",      h8_sci_device,             ssr_r,    ssr_w,    0xff00)
332   AM_RANGE(0xffff84, 0xffff85) AM_DEVREAD8(     "sci1",      h8_sci_device,             rdr_r,              0x00ff)
333   AM_RANGE(0xffff86, 0xffff87) AM_DEVREADWRITE8("sci1",      h8_sci_device,             scmr_r,   scmr_w,   0xff00)
334   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("sci2",      h8_sci_device,             smr_r,    smr_w,    0xff00)
335   AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("sci2",      h8_sci_device,             brr_r,    brr_w,    0x00ff)
336   AM_RANGE(0xffff8a, 0xffff8b) AM_DEVREADWRITE8("sci2",      h8_sci_device,             scr_r,    scr_w,    0xff00)
337   AM_RANGE(0xffff8a, 0xffff8b) AM_DEVREADWRITE8("sci2",      h8_sci_device,             tdr_r,    tdr_w,    0x00ff)
338   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREADWRITE8("sci2",      h8_sci_device,             ssr_r,    ssr_w,    0xff00)
339   AM_RANGE(0xffff8c, 0xffff8d) AM_DEVREAD8(     "sci2",      h8_sci_device,             rdr_r,              0x00ff)
340   AM_RANGE(0xffff8e, 0xffff8f) AM_DEVREADWRITE8("sci2",      h8_sci_device,             scmr_r,   scmr_w,   0xff00)
341   AM_RANGE(0xffff90, 0xffff97) AM_DEVREAD8(     "adc",       h8_adc_device,             addr8_r,            0xffff)
342   AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcsr_r,  adcsr_w,  0xff00)
343   AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc",       h8_adc_device,             adcr_r,   adcr_w,   0x00ff)
319344
320   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,  tstr_w,  0xff00)
321   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,  tsyr_w,  0x00ff)
345   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcr_r,    tcr_w,    0xff00)
346   AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcr_r,    tcr_w,    0x00ff)
347   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcsr_r,   tcsr_w,   0xff00)
348   AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcsr_r,   tcsr_w,   0x00ff)
349   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcor_r,   tcor_w,   0xff00)
350   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,   tcor_w,   0x00ff)
351   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,   tcnt_w,   0xff00)
352   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,   tcnt_w,   0x00ff)
353   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,     wd_w            )
354   AM_RANGE(0xffffbe, 0xffffbf) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,    rst_w           )
355   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,   tstr_w,   0xff00)
356   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,   tsyr_w,   0x00ff)
322357
323   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
324   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
325   AM_RANGE(0xffffd2, 0xffffd3) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tior_r,  tior_w,  0xffff)
326   AM_RANGE(0xffffd4, 0xffffd5) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
327   AM_RANGE(0xffffd4, 0xffffd5) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
328   AM_RANGE(0xffffd6, 0xffffd7) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
329   AM_RANGE(0xffffd8, 0xffffdf) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tgr_r,   tgr_w          )
330   AM_RANGE(0xffffe0, 0xffffe1) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
331   AM_RANGE(0xffffe0, 0xffffe1) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
332   AM_RANGE(0xffffe2, 0xffffe3) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tior_r,  tior_w,  0xff00)
333   AM_RANGE(0xffffe4, 0xffffe5) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
334   AM_RANGE(0xffffe4, 0xffffe5) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
335   AM_RANGE(0xffffe6, 0xffffe7) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
336   AM_RANGE(0xffffe8, 0xffffeb) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tgr_r,   tgr_w          )
337   AM_RANGE(0xfffff0, 0xfffff1) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
338   AM_RANGE(0xfffff0, 0xfffff1) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tmdr_r,  tmdr_w,  0x00ff)
339   AM_RANGE(0xfffff2, 0xfffff3) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tior_r,  tior_w,  0xff00)
340   AM_RANGE(0xfffff4, 0xfffff5) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tier_r,  tier_w,  0xff00)
341   AM_RANGE(0xfffff4, 0xfffff5) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tsr_r,   tsr_w,   0x00ff)
342   AM_RANGE(0xfffff6, 0xfffff7) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r,  tcnt_w         )
343   AM_RANGE(0xfffff8, 0xfffffb) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r,   tgr_w          )
358   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
359   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
360   AM_RANGE(0xffffd2, 0xffffd3) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tior_r,   tior_w,   0xffff)
361   AM_RANGE(0xffffd4, 0xffffd5) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
362   AM_RANGE(0xffffd4, 0xffffd5) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
363   AM_RANGE(0xffffd6, 0xffffd7) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
364   AM_RANGE(0xffffd8, 0xffffdf) AM_DEVREADWRITE( "timer16:0", h8_timer16_channel_device, tgr_r,    tgr_w           )
365   AM_RANGE(0xffffe0, 0xffffe1) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
366   AM_RANGE(0xffffe0, 0xffffe1) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
367   AM_RANGE(0xffffe2, 0xffffe3) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tior_r,   tior_w,   0xff00)
368   AM_RANGE(0xffffe4, 0xffffe5) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
369   AM_RANGE(0xffffe4, 0xffffe5) AM_DEVREADWRITE8("timer16:1", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
370   AM_RANGE(0xffffe6, 0xffffe7) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
371   AM_RANGE(0xffffe8, 0xffffeb) AM_DEVREADWRITE( "timer16:1", h8_timer16_channel_device, tgr_r,    tgr_w           )
372   AM_RANGE(0xfffff0, 0xfffff1) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tcr_r,    tcr_w,    0xff00)
373   AM_RANGE(0xfffff0, 0xfffff1) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tmdr_r,   tmdr_w,   0x00ff)
374   AM_RANGE(0xfffff2, 0xfffff3) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tior_r,   tior_w,   0xff00)
375   AM_RANGE(0xfffff4, 0xfffff5) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tier_r,   tier_w,   0xff00)
376   AM_RANGE(0xfffff4, 0xfffff5) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tsr_r,    tsr_w,    0x00ff)
377   AM_RANGE(0xfffff6, 0xfffff7) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r,   tcnt_w          )
378   AM_RANGE(0xfffff8, 0xfffffb) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r,    tgr_w           )
344379ADDRESS_MAP_END
345380
346381machine_config_constructor h8s2320_device::device_mconfig_additions() const
r243808r243809
425460   add_event(event_time, timer16_3->internal_update(current_time));
426461   add_event(event_time, timer16_4->internal_update(current_time));
427462   add_event(event_time, timer16_5->internal_update(current_time));
463   add_event(event_time, watchdog->internal_update(current_time));
428464
429465   recompute_bcount(event_time);
430466}
trunk/src/emu/cpu/h8/h8s2320.h
r243808r243809
5555#define __H8S2320_H__
5656
5757#include "h8s2000.h"
58#include "h8_intc.h"
5859#include "h8_adc.h"
60#include "h8_dma.h"
5961#include "h8_port.h"
60#include "h8_intc.h"
61#include "h8_sci.h"
6262#include "h8_timer8.h"
6363#include "h8_timer16.h"
64#include "h8_sci.h"
65#include "h8_watchdog.h"
6466
6567class h8s2320_device : public h8s2000_device {
6668public:
r243808r243809
7375protected:
7476   required_device<h8s_intc_device> intc;
7577   required_device<h8_adc_device> adc;
78   optional_device<h8_dma_device> dma;
79   optional_device<h8_dma_channel_device> dma0;
80   optional_device<h8_dma_channel_device> dma1;
7681   required_device<h8_port_device> port1;
7782   required_device<h8_port_device> port2;
7883   required_device<h8_port_device> port3;
r243808r243809
98103   required_device<h8_sci_device> sci0;
99104   required_device<h8_sci_device> sci1;
100105   required_device<h8_sci_device> sci2;
106   required_device<h8_watchdog_device> watchdog;
101107
102108   UINT32 ram_start;
103109   UINT8 syscr;
trunk/src/emu/cpu/h8/h8s2357.c
r243808r243809
3636   timer16_5(*this, "timer16:5"),
3737   sci0(*this, "sci0"),
3838   sci1(*this, "sci1"),
39   sci2(*this, "sci2")
39   sci2(*this, "sci2"),
40   watchdog(*this, "watchdog")
4041{
4142}
4243
r243808r243809
6869   timer16_5(*this, "timer16:5"),
6970   sci0(*this, "sci0"),
7071   sci1(*this, "sci1"),
71   sci2(*this, "sci2")
72   sci2(*this, "sci2"),
73   watchdog(*this, "watchdog")
7274{
7375   ram_start = 0xffdc00;
7476}
r243808r243809
181183   MCFG_H8_SCI_ADD("sci0", "intc", 80, 81, 82, 83)
182184   MCFG_H8_SCI_ADD("sci1", "intc", 84, 85, 86, 87)
183185   MCFG_H8_SCI_ADD("sci2", "intc", 88, 89, 90, 91)
186   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 25, h8_watchdog_device::S)
184187MACHINE_CONFIG_END
185188
186189DEVICE_ADDRESS_MAP_START(map, 16, h8s2357_device)
r243808r243809
290293   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
291294   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
292295   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
296   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
297   AM_RANGE(0xffffbe, 0xffffbf) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
293298   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,  tstr_w,  0xff00)
294299   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,  tsyr_w,  0x00ff)
295300   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
r243808r243809
397402   add_event(event_time, timer16_3->internal_update(current_time));
398403   add_event(event_time, timer16_4->internal_update(current_time));
399404   add_event(event_time, timer16_5->internal_update(current_time));
405   add_event(event_time, watchdog->internal_update(current_time));
400406
401407   recompute_bcount(event_time);
402408}
trunk/src/emu/cpu/h8/h8s2357.h
r243808r243809
5252#define __H8S2357_H__
5353
5454#include "h8s2000.h"
55#include "h8_intc.h"
5556#include "h8_adc.h"
5657#include "h8_port.h"
57#include "h8_intc.h"
58#include "h8_sci.h"
5958#include "h8_timer8.h"
6059#include "h8_timer16.h"
60#include "h8_sci.h"
61#include "h8_watchdog.h"
6162
6263class h8s2357_device : public h8s2000_device {
6364public:
r243808r243809
9596   required_device<h8_sci_device> sci0;
9697   required_device<h8_sci_device> sci1;
9798   required_device<h8_sci_device> sci2;
99   required_device<h8_watchdog_device> watchdog;
98100
99101   UINT32 ram_start;
100102   unsigned char syscr;
trunk/src/emu/cpu/h8/h8s2655.c
r243808r243809
3232   timer16_5(*this, "timer16:5"),
3333   sci0(*this, "sci0"),
3434   sci1(*this, "sci1"),
35   sci2(*this, "sci2")
35   sci2(*this, "sci2"),
36   watchdog(*this, "watchdog")
3637{
3738   has_trace = true;
3839}
r243808r243809
6566   timer16_5(*this, "timer16:5"),
6667   sci0(*this, "sci0"),
6768   sci1(*this, "sci1"),
68   sci2(*this, "sci2")
69   sci2(*this, "sci2"),
70   watchdog(*this, "watchdog")
6971
7072{
7173   has_trace = true;
r243808r243809
154156   MCFG_H8_SCI_ADD("sci0", "intc", 80, 81, 82, 83)
155157   MCFG_H8_SCI_ADD("sci1", "intc", 84, 85, 86, 87)
156158   MCFG_H8_SCI_ADD("sci2", "intc", 88, 89, 90, 91)
159   MCFG_H8_WATCHDOG_ADD("watchdog", "intc", 25, h8_watchdog_device::S)
157160MACHINE_CONFIG_END
158161
159162DEVICE_ADDRESS_MAP_START(map, 16, h8s2655_device)
r243808r243809
264267   AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcor_r,  tcor_w,  0x00ff)
265268   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0xff00)
266269   AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1",  h8_timer8_channel_device,  tcnt_r,  tcnt_w,  0x00ff)
270   AM_RANGE(0xffffbc, 0xffffbd) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        wd_r,    wd_w           )
271   AM_RANGE(0xffffbe, 0xffffbf) AM_DEVREADWRITE( "watchdog",  h8_watchdog_device,        rst_r,   rst_w          )
267272   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tstr_r,  tstr_w,  0xff00)
268273   AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16",   h8_timer16_device,         tsyr_r,  tsyr_w,  0x00ff)
269274   AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r,   tcr_w,   0xff00)
r243808r243809
404409   add_event(event_time, timer16_3->internal_update(current_time));
405410   add_event(event_time, timer16_4->internal_update(current_time));
406411   add_event(event_time, timer16_5->internal_update(current_time));
412   add_event(event_time, watchdog->internal_update(current_time));
407413
408414   recompute_bcount(event_time);
409415}
trunk/src/emu/cpu/h8/h8s2655.h
r243808r243809
4444#define __H8S2655_H__
4545
4646#include "h8s2600.h"
47#include "h8_intc.h"
4748#include "h8_adc.h"
4849#include "h8_port.h"
49#include "h8_intc.h"
5050#include "h8_timer8.h"
5151#include "h8_timer16.h"
5252#include "h8_sci.h"
53#include "h8_watchdog.h"
5354
5455class h8s2655_device : public h8s2600_device {
5556public:
r243808r243809
8788   required_device<h8_sci_device> sci0;
8889   required_device<h8_sci_device> sci1;
8990   required_device<h8_sci_device> sci2;
91   required_device<h8_watchdog_device> watchdog;
9092
9193   UINT8 syscr;
9294
trunk/src/emu/machine/tmp68301.c
r243808r243809
1818#include "machine/tmp68301.h"
1919
2020const device_type TMP68301 = &device_creator<tmp68301_device>;
21const device_type TMP68301_SERIAL = &device_creator<tmp68301_serial_device>;
22const device_type TMP68301_RS232 = &device_creator<tmp68301_rs232_device>;
2123
2224static ADDRESS_MAP_START( tmp68301_regs, AS_0, 16, tmp68301_device )
2325//  AM_RANGE(0x000,0x3ff) AM_RAM
24   AM_RANGE(0x094,0x095) AM_READWRITE(imr_r,imr_w)
25   AM_RANGE(0x098,0x099) AM_READWRITE(iisr_r,iisr_w)
26   AM_RANGE(0x094,0x095) AM_READWRITE (imr_r,   imr_w)
27   AM_RANGE(0x098,0x099) AM_READWRITE (iisr_r,  iisr_w)
2628
2729   /* Parallel Port */
28   AM_RANGE(0x100,0x101) AM_READWRITE(pdir_r,pdir_w)
29   AM_RANGE(0x10a,0x10b) AM_READWRITE(pdr_r,pdr_w)
30   AM_RANGE(0x100,0x101) AM_READWRITE (pdir_r,  pdir_w)
31   AM_RANGE(0x10a,0x10b) AM_READWRITE (pdr_r,   pdr_w)
3032
3133   /* Serial Port */
32   AM_RANGE(0x18e,0x18f) AM_READWRITE(scr_r,scr_w)
34   AM_RANGE(0x180,0x181) AM_DEVREADWRITE8("ser0", tmp68301_serial_device, smr_r,  smr_w,  0x00ff)
35   AM_RANGE(0x182,0x183) AM_DEVREADWRITE8("ser0", tmp68301_serial_device, scmr_r, scmr_w, 0x00ff)
36   AM_RANGE(0x184,0x185) AM_DEVREADWRITE8("ser0", tmp68301_serial_device, sbrr_r, sbrr_w, 0x00ff)
37   AM_RANGE(0x186,0x187) AM_DEVREADWRITE8("ser0", tmp68301_serial_device, ssr_r,  ssr_w,  0x00ff)
38   AM_RANGE(0x188,0x189) AM_DEVREADWRITE8("ser0", tmp68301_serial_device, sdr_r,  sdr_w,  0x00ff)
39
40   AM_RANGE(0x18c,0x18d) AM_READWRITE8(spr_r,   spr_w,   0x00ff)
41   AM_RANGE(0x18e,0x18f) AM_READWRITE8(scr_r,   scr_w,   0x00ff)
42
43   AM_RANGE(0x190,0x191) AM_DEVREADWRITE8("ser1", tmp68301_serial_device, smr_r,  smr_w,  0x00ff)
44   AM_RANGE(0x192,0x193) AM_DEVREADWRITE8("ser1", tmp68301_serial_device, scmr_r, scmr_w, 0x00ff)
45   AM_RANGE(0x194,0x195) AM_DEVREADWRITE8("ser1", tmp68301_serial_device, sbrr_r, sbrr_w, 0x00ff)
46   AM_RANGE(0x196,0x197) AM_DEVREADWRITE8("ser1", tmp68301_serial_device, ssr_r,  ssr_w,  0x00ff)
47   AM_RANGE(0x198,0x199) AM_DEVREADWRITE8("ser1", tmp68301_serial_device, sdr_r,  sdr_w,  0x00ff)
48
49   AM_RANGE(0x1a0,0x1a1) AM_DEVREADWRITE8("ser2", tmp68301_serial_device, smr_r,  smr_w,  0x00ff)
50   AM_RANGE(0x1a2,0x1a3) AM_DEVREADWRITE8("ser2", tmp68301_serial_device, scmr_r, scmr_w, 0x00ff)
51   AM_RANGE(0x1a4,0x1a5) AM_DEVREADWRITE8("ser2", tmp68301_serial_device, sbrr_r, sbrr_w, 0x00ff)
52   AM_RANGE(0x1a6,0x1a7) AM_DEVREADWRITE8("ser2", tmp68301_serial_device, ssr_r,  ssr_w,  0x00ff)
53   AM_RANGE(0x1a8,0x1a9) AM_DEVREADWRITE8("ser2", tmp68301_serial_device, sdr_r,  sdr_w,  0x00ff)
3354ADDRESS_MAP_END
3455
56static MACHINE_CONFIG_FRAGMENT( tmp68301 )
57   MCFG_TMP68301_RS232_ADD ("ser0")
58   MCFG_TMP68301_SERIAL_ADD("ser1")
59   MCFG_TMP68301_SERIAL_ADD("ser2")
60MACHINE_CONFIG_END
61
3562// IRQ Mask register, 0x94
3663READ16_MEMBER(tmp68301_device::imr_r)
3764{
r243808r243809
5481   COMBINE_DATA(&m_iisr);
5582}
5683
57// Serial Control Register (TODO: 8-bit wide)
58READ16_MEMBER(tmp68301_device::scr_r)
59{
60   return m_scr;
61}
62
63WRITE16_MEMBER(tmp68301_device::scr_w)
64{
65   /*
66       *--- ---- CKSE
67       --*- ---- RES
68       ---- ---* INTM
69   */
70
71   COMBINE_DATA(&m_scr);
72   m_scr &= 0xa1;
73}
74
7584/* Parallel direction: 1 = output, 0 = input */
7685READ16_MEMBER(tmp68301_device::pdir_r)
7786{
r243808r243809
99108      device_memory_interface(mconfig, *this),
100109      m_in_parallel_cb(*this),
101110      m_out_parallel_cb(*this),
111       m_ser0(*this, "ser0"),
112       m_ser1(*this, "ser1"),
113       m_ser2(*this, "ser2"),
102114      m_space_config("regs", ENDIANNESS_LITTLE, 16, 10, 0, NULL, *ADDRESS_MAP_NAME(tmp68301_regs))
103115{
104116}
105117
118void tmp68301_device::set_cpu_tag(const char *tag)
119{
120   m_cpu_tag = tag;
121}
106122
107123//-------------------------------------------------
108124//  device_start - device-specific startup
r243808r243809
116132
117133   m_in_parallel_cb.resolve_safe(0);
118134   m_out_parallel_cb.resolve_safe();
135
136   m_cpu = machine().device<m68000_device>(m_cpu_tag);
119137}
120138
121139//-------------------------------------------------
r243808r243809
130148      m_IE[i] = 0;
131149
132150   m_imr = 0x7f7; // mask all irqs
151   m_scr = 0x00;
152   m_spr = 0x00;
153
154   double prescaled_clock = double(m_cpu->unscaled_clock())/256;
155   m_ser0->set_prescaled_clock(prescaled_clock);
156   m_ser1->set_prescaled_clock(prescaled_clock);
157   m_ser2->set_prescaled_clock(prescaled_clock);   
133158}
134159
135160//-------------------------------------------------
r243808r243809
142167   return (spacenum == AS_0) ? &m_space_config : NULL;
143168}
144169
170machine_config_constructor tmp68301_device::device_mconfig_additions() const
171{
172   return MACHINE_CONFIG_NAME(tmp68301);
173}
174
145175//**************************************************************************
146176//  INLINE HELPERS
147177//**************************************************************************
r243808r243809
190220      m_irq_vector[level]  =   IVNR & 0x00e0;
191221      m_irq_vector[level]  +=  4+i;
192222
193      machine().firstcpu->set_input_line(level,HOLD_LINE);
223      m_cpu->set_input_line(level,HOLD_LINE);
194224   }
195225
196226   if (TCR & 0x0080)   // N/1
r243808r243809
233263      {
234264         int scale = (TCR & 0x3c00)>>10;         // P4..1
235265         if (scale > 8) scale = 8;
236         duration = attotime::from_hz(machine().firstcpu->unscaled_clock()) * ((1 << scale) * max);
266         duration = attotime::from_hz(m_cpu->unscaled_clock()) * ((1 << scale) * max);
237267      }
238268      break;
239269   }
r243808r243809
275305
276306         m_IE[i] = 0;     // Interrupts are edge triggerred
277307
278         machine().firstcpu->set_input_line(level,HOLD_LINE);
308         m_cpu->set_input_line(level,HOLD_LINE);
279309      }
280310   }
281311}
r243808r243809
313343void tmp68301_device::external_interrupt_0()    { m_IE[0] = 1;   update_irq_state(); }
314344void tmp68301_device::external_interrupt_1()    { m_IE[1] = 1;   update_irq_state(); }
315345void tmp68301_device::external_interrupt_2()    { m_IE[2] = 1;   update_irq_state(); }
346
347
348// Serial subsystem
349
350tmp68301_serial_device::tmp68301_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
351   device_t(mconfig, TMP68301_SERIAL, "TMP68301 Serial", tag, owner, clock, "tmp68301_serial", __FILE__),
352   tx_cb(*this)
353{
354}
355
356tmp68301_serial_device::tmp68301_serial_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
357   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
358   tx_cb(*this)
359{
360}
361
362tmp68301_rs232_device::tmp68301_rs232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
363   tmp68301_serial_device(mconfig, TMP68301_SERIAL, "TMP68301 RS232", tag, owner, clock, "tmp68301_rs232", __FILE__),
364   rts_cb(*this),
365   dtr_cb(*this)
366{
367}
368
369void tmp68301_serial_device::device_start()
370{
371   prescaled_clock = 0;
372   clock_interval = attotime::never;
373}
374
375void tmp68301_serial_device::device_reset()
376{
377   smr  = 0xc2;
378   scmr = 0x10;
379   ssr  = 0x04;
380   sbrr = 0x00;
381   clock_interval = attotime::never;
382}
383
384void tmp68301_rs232_device::device_start()
385{
386   tmp68301_serial_device::device_start();
387}
388
389void tmp68301_rs232_device::device_reset()
390{
391   tmp68301_serial_device::device_reset();
392}
393
394READ8_MEMBER(tmp68301_device::scr_r)
395{
396   return m_scr;
397}
398
399WRITE8_MEMBER(tmp68301_device::scr_w)
400{
401   logerror("%s: scr_w %02x clokc=%s reset=%s serial_int=%s (%06x)\n", tag(), data,
402          data & 0x80 ? "internal" : "external",
403          data & 0x40 ? "on" : "off",
404          data & 0x01 ? "off" : "on",
405          space.device().safe_pc());
406
407   /*
408       *--- ---- CKSE
409       --*- ---- RES
410       ---- ---* INTM
411   */
412
413   m_scr = data & 0xa1;
414   recalc_serial_clock();
415}
416
417READ8_MEMBER(tmp68301_device::spr_r)
418{
419   logerror("%s: spr_r (%06x)\n", tag(), space.device().safe_pc());
420   return m_spr;
421}
422
423WRITE8_MEMBER(tmp68301_device::spr_w)
424{
425   logerror("%s: spr_w %02x (%06x)\n", tag(), data, space.device().safe_pc());
426   m_spr = data;
427   recalc_serial_clock();
428}
429
430void tmp68301_device::recalc_serial_clock()
431{
432   double prescaled_clock = m_scr & 0x20 ? 0 : m_spr ? double(m_cpu->unscaled_clock())/m_spr : double(clock())/256;
433   m_ser0->set_prescaled_clock(prescaled_clock);
434   m_ser1->set_prescaled_clock(prescaled_clock);
435   m_ser2->set_prescaled_clock(prescaled_clock);
436}
437
438READ8_MEMBER(tmp68301_serial_device::smr_r)
439{
440   logerror("%s: smr_r (%06x)\n", tag(), space.device().safe_pc());
441   return smr;
442}
443
444WRITE8_MEMBER(tmp68301_serial_device::smr_w)
445{
446   logerror("%s: smr_w %02x rx_int=%s tx_int=%s er_int=%s mode=%d%c%c (%06x)\n",
447          tag(), data,
448          data & 0x80 ? "off" : "on",
449          data & 0x02 ? "off" : "on",
450          data & 0x40 ? "off" : "on",
451          5 + ((data >> 2) & 3),
452          data & 0x10 ? data & 0x20 ? 'o' : 'e' : 'n',
453          data & 0x01 ? '2' : '1',
454          space.device().safe_pc());
455   smr = data;
456}
457
458READ8_MEMBER(tmp68301_serial_device::scmr_r)
459{
460   logerror("%s: scmr_r (%06x)\n", tag(), space.device().safe_pc());
461   return scmr;
462}
463
464WRITE8_MEMBER(tmp68301_serial_device::scmr_w)
465{
466   logerror("%s: scmr_w %02x ers=%s break=%s rx=%s tx=%s rts=%s dtr=%s (%06x)\n", tag(), data,
467          data & 0x10 ? "reset" : "off",
468          data & 0x08 ? "on" : "off",
469          data & 0x04 ? "on" : "off",
470          data & 0x01 ? "on" : "off",
471          data & 0x20 ? "low" : "high",
472          data & 0x02 ? "low" : "high",
473          space.device().safe_pc());
474   scmr = data;
475}
476
477READ8_MEMBER(tmp68301_serial_device::sbrr_r)
478{
479   logerror("%s: sbrr_r (%06x)\n", tag(), space.device().safe_pc());
480   return sbrr;
481}
482
483WRITE8_MEMBER(tmp68301_serial_device::sbrr_w)
484{
485   logerror("%s: sbrr_w %02x (%06x)\n", tag(), data, space.device().safe_pc());
486   sbrr = data;
487   clock_update();
488}
489
490READ8_MEMBER(tmp68301_serial_device::ssr_r)
491{
492   logerror("%s: ssr_r (%06x)\n", tag(), space.device().safe_pc());
493   return ssr;
494}
495
496WRITE8_MEMBER(tmp68301_serial_device::ssr_w)
497{
498   logerror("%s: ssr_w %02x (%06x)\n", tag(), data, space.device().safe_pc());
499   ssr = data;
500}
501
502READ8_MEMBER(tmp68301_serial_device::sdr_r)
503{
504   logerror("%s: sdr_r (%06x)\n", tag(), space.device().safe_pc());
505   return 0x00;
506}
507
508WRITE8_MEMBER(tmp68301_serial_device::sdr_w)
509{
510   logerror("%s: sdr_w %02x (%06x)\n", tag(), data, space.device().safe_pc());
511}
512
513void tmp68301_serial_device::set_prescaled_clock(double clock)
514{
515   prescaled_clock = clock;
516   clock_update();
517}
518
519void tmp68301_serial_device::clock_update()
520{
521   if(!prescaled_clock || !sbrr || (sbrr & (sbrr - 1))) {
522      clock_interval = attotime::never;
523      return;
524   }
525
526   double base_rate = prescaled_clock / sbrr;
527   clock_interval = attotime::from_seconds(1/base_rate);
528   logerror("%s: Baud rate %gHz\n", tag(), base_rate/8);
529}
trunk/src/emu/machine/tmp68301.h
r243808r243809
11#ifndef TMP68301_H
22#define TMP68301_H
33
4#include "cpu/m68000/m68000.h"
5
46//**************************************************************************
57//  INTERFACE CONFIGURATION MACROS
68//**************************************************************************
79
10#define MCFG_TMP68301_ADD(_tag, _cpu) \
11   MCFG_DEVICE_ADD( _tag, TMP68301, 0 ) \
12   downcast<tmp68301_device *>(device)->set_cpu_tag(_cpu);
13
814/* TODO: serial ports, frequency & hook it up with m68k */
915#define MCFG_TMP68301_IN_PARALLEL_CB(_devcb) \
1016   devcb = &tmp68301_device::set_in_parallel_callback(*device, DEVCB_##_devcb);
r243808r243809
1218#define MCFG_TMP68301_OUT_PARALLEL_CB(_devcb) \
1319   devcb = &tmp68301_device::set_out_parallel_callback(*device, DEVCB_##_devcb);
1420
21#define MCFG_TMP68301_SERIAL_ADD( _tag ) \
22   MCFG_DEVICE_ADD( _tag, TMP68301_SERIAL, 0 )
1523
24#define MCFG_TMP68301_RS232_ADD( _tag ) \
25   MCFG_DEVICE_ADD( _tag, TMP68301_RS232, 0 )
26
27#define MCFG_TMP68301_SERIAL_TX_CALLBACK(_devcb) \
28   devcb = &tmp68301_serial_device::set_tx_cb(*device, DEVCB_##_devcb);
29
30#define MCFG_TMP68301_SERIAL_RTS_CALLBACK(_devcb) \
31   devcb = &tmp68301_rs232_device::set_rts_cb(*device, DEVCB_##_devcb);
32
33#define MCFG_TMP68301_SERIAL_DTR_CALLBACK(_devcb) \
34   devcb = &tmp68301_rs232_device::set_str_cb(*device, DEVCB_##_devcb);
35
1636//**************************************************************************
1737//  TYPE DEFINITIONS
1838//**************************************************************************
1939
40class tmp68301_serial_device : public device_t
41{
42public:
43   tmp68301_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
44   tmp68301_serial_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
2045
46   DECLARE_READ8_MEMBER(smr_r);
47   DECLARE_WRITE8_MEMBER(smr_w);
48   DECLARE_READ8_MEMBER(scmr_r);
49   DECLARE_WRITE8_MEMBER(scmr_w);
50   DECLARE_READ8_MEMBER(sbrr_r);
51   DECLARE_WRITE8_MEMBER(sbrr_w);
52   DECLARE_READ8_MEMBER(ssr_r);
53   DECLARE_WRITE8_MEMBER(ssr_w);
54   DECLARE_READ8_MEMBER(sdr_r);
55   DECLARE_WRITE8_MEMBER(sdr_w);
2156
57   DECLARE_WRITE_LINE_MEMBER(rx_w);
58
59   template<class _Object> static devcb_base &set_tx_cb(device_t &device, _Object object) { return downcast<tmp68301_serial_device &>(device).tx_cb.set_callback(object); }
60
61   void set_prescaled_clock(double clock);
62
63protected:
64   devcb_write_line tx_cb;
65   attotime clock_interval;
66   double prescaled_clock;
67
68   UINT8 smr, scmr, ssr, sbrr;
69
70   virtual void device_start();
71   virtual void device_reset();
72
73   void clock_update();
74};
75
76class tmp68301_rs232_device : public tmp68301_serial_device {
77public:
78   tmp68301_rs232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
79
80   DECLARE_WRITE_LINE_MEMBER(cts_w);
81   DECLARE_WRITE_LINE_MEMBER(dsr_w);
82
83   template<class _Object> static devcb_base &set_rts_cb(device_t &device, _Object object) { return downcast<tmp68301_rs232_device &>(device).rts_cb.set_callback(object); }
84   template<class _Object> static devcb_base &set_dtr_cb(device_t &device, _Object object) { return downcast<tmp68301_rs232_device &>(device).dtr_cb.set_callback(object); }
85
86protected:
87   devcb_write_line rts_cb, dtr_cb;
88
89   virtual void device_start();
90   virtual void device_reset();
91};
92
2293class tmp68301_device : public device_t,
2394                  public device_memory_interface
2495{
r243808r243809
29100   template<class _Object> static devcb_base &set_in_parallel_callback(device_t &device, _Object object) { return downcast<tmp68301_device &>(device).m_in_parallel_cb.set_callback(object); }
30101   template<class _Object> static devcb_base &set_out_parallel_callback(device_t &device, _Object object) { return downcast<tmp68301_device &>(device).m_out_parallel_cb.set_callback(object); }
31102
103   void set_cpu_tag(const char *tag);
104
32105   // Hardware Registers
33106   DECLARE_READ16_MEMBER( regs_r );
34107   DECLARE_WRITE16_MEMBER( regs_w );
r243808r243809
42115   DECLARE_WRITE16_MEMBER(imr_w);
43116   DECLARE_READ16_MEMBER(iisr_r);
44117   DECLARE_WRITE16_MEMBER(iisr_w);
45   DECLARE_READ16_MEMBER(scr_r);
46   DECLARE_WRITE16_MEMBER(scr_w);
47118   DECLARE_READ16_MEMBER(pdr_r);
48119   DECLARE_WRITE16_MEMBER(pdr_w);
49120   DECLARE_READ16_MEMBER(pdir_r);
50121   DECLARE_WRITE16_MEMBER(pdir_w);
51122
123   DECLARE_READ8_MEMBER(spr_r);
124   DECLARE_WRITE8_MEMBER(spr_w);
125   DECLARE_READ8_MEMBER(scr_r);
126   DECLARE_WRITE8_MEMBER(scr_w);
127
52128   IRQ_CALLBACK_MEMBER(irq_callback);
53129protected:
54130   // device-level overrides
55131   virtual void device_start();
56132   virtual void device_reset();
57133   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
134   virtual machine_config_constructor device_mconfig_additions() const;
58135
59136private:
60137   devcb_read16         m_in_parallel_cb;
61138   devcb_write16        m_out_parallel_cb;
62139
140   required_device<tmp68301_rs232_device> m_ser0;
141   required_device<tmp68301_serial_device> m_ser1;
142   required_device<tmp68301_serial_device> m_ser2;
143
144   const char *m_cpu_tag;
145   m68000_device *m_cpu;
146
63147   // internal state
64148   UINT16 m_regs[0x400];
65149
r243808r243809
74158
75159   UINT16 m_imr;
76160   UINT16 m_iisr;
77   UINT16 m_scr;
78161   UINT16 m_pdir;
79162
163   UINT8 m_scr, m_spr;
164
80165   inline UINT16 read_word(offs_t address);
81166   inline void write_word(offs_t address, UINT16 data);
82167   const address_space_config      m_space_config;
168
169   void recalc_serial_clock();
83170};
84171
85172extern const device_type TMP68301;
173extern const device_type TMP68301_SERIAL;
174extern const device_type TMP68301_RS232;
86175
87176#endif
trunk/src/mame/drivers/csplayh5.c
r243808r243809
2121      After returning a correct status code, tmp68301 sends "FSDVD04.MPG00001<CR>" to serial, probably tries
2222      to playback the file ...
2323
24serial: prescaler (spr) = a0
25        baud rate (sbrr0) = 2
26
27H8 typing:
28  - at least h8h
29  - watchdog at ffffffaa/ffffffa8 = a500 5a00  ok 3002 3044
30  - ffffffaf/ad/ac = 05 18 23                  ok 3002 3044 (refresh controller)
31  - p6ddr |= 06
32  - p6dr  |= 02
33  - p8ddr =  fe
34  - p8dr  =  ff
35  - p9ddr =  c3
36  - p9dr  =  cf
37  - paddr =  ff
38  - padr  =  1f
39  - pbddr =  3f
40  - pbdr  =  19
41  - abwcr =  06
42  - ipra  =  1f  a4/a3/a2/a1/a0
43  - iprb  =  e8  b7/b6/b5/b3
44  - ier   =  00
45  - iscr  =  10
46  - tstr  =  e0
47  - tsnc  =  e0
48  - tmdr  =  80
49  (etc)
50
51
2452***********************************************************************************************************/
2553
2654#include "emu.h"
r243808r243809
6088   DECLARE_READ16_MEMBER(test_r);
6189   DECLARE_READ8_MEMBER(csplayh5_sound_r);
6290   DECLARE_WRITE8_MEMBER(csplayh5_soundclr_w);
63
91   DECLARE_READ8_MEMBER(r40020_r);
92   DECLARE_WRITE8_MEMBER(r40020_w);
6493   DECLARE_READ8_MEMBER(soundcpu_portd_r);
6594   DECLARE_WRITE8_MEMBER(soundcpu_porta_w);
6695   DECLARE_WRITE8_MEMBER(soundcpu_dac2_w);
6796   DECLARE_WRITE8_MEMBER(soundcpu_dac1_w);
6897   DECLARE_WRITE8_MEMBER(soundcpu_porte_w);
6998
99   DECLARE_READ8_MEMBER(ext_r);
100   DECLARE_WRITE8_MEMBER(ext_w);
101
70102   DECLARE_DRIVER_INIT(mjmania);
71103   DECLARE_DRIVER_INIT(csplayh5);
72104   DECLARE_DRIVER_INIT(fuudol);
r243808r243809
84116
85117
86118
87#define USE_H8 0
88
89119// from MSX2 driver, may be not accurate for this HW
90120#define MSX2_XBORDER_PIXELS     16
91121#define MSX2_YBORDER_PIXELS     28
r243808r243809
141171   AM_RANGE(0xc00000, 0xc7ffff) AM_RAM AM_SHARE("nvram") AM_MIRROR(0x380000) // work RAM
142172ADDRESS_MAP_END
143173
144#if USE_H8
145174READ16_MEMBER(csplayh5_state::test_r)
146175{
147176   return machine().rand();
148177}
149178
179READ8_MEMBER(csplayh5_state::r40020_r)
180{
181   logerror("read %05x (%06x)\n", 0x40020+offset, int(space.device().safe_pc()));
182   if(space.device().safe_pc() == 0x7a54)
183      return 0x08;
184   if(space.device().safe_pc() == 0x7a3c)
185      return 0x01;
186   return 0x00;
187}
188
189WRITE8_MEMBER(csplayh5_state::r40020_w)
190{
191   logerror("%05x = %02x (%06x)\n", 0x40020+offset, data, int(space.device().safe_pc()));
192}
193
150194static ADDRESS_MAP_START( csplayh5_sub_map, AS_PROGRAM, 16, csplayh5_state )
151195   AM_RANGE(0x000000, 0x01ffff) AM_ROM
152196
153   AM_RANGE(0x04002a, 0x04002b) AM_READ(test_r)
154   AM_RANGE(0x040036, 0x040037) AM_READ(test_r)
197   AM_RANGE(0x020008, 0x02000f) AM_READWRITE8(ext_r, ext_w, 0xff00)
155198
199   AM_RANGE(0x040020, 0x04002f) AM_READWRITE8(r40020_r, r40020_w, 0xffff)
200
156201   AM_RANGE(0x078000, 0x07ffff) AM_RAM AM_SHARE("nvram")
157202   AM_RANGE(0x080000, 0x0fffff) AM_RAM
158203ADDRESS_MAP_END
r243808r243809
161206static ADDRESS_MAP_START( csplayh5_sub_io_map, AS_IO, 16, csplayh5_state )
162207
163208ADDRESS_MAP_END
164#endif
165209
166210
211READ8_MEMBER(csplayh5_state::ext_r)
212{
213   return 0x08;
214}
215
216WRITE8_MEMBER(csplayh5_state::ext_w)
217{
218   //   logerror("ext_w %d, %02x\n", offset, data);
219}
220
167221/*
168222sound HW is identical to Niyanpai
169223*/
r243808r243809
221275}
222276
223277
224
225
226
227
228278static ADDRESS_MAP_START( csplayh5_sound_map, AS_PROGRAM, 8, csplayh5_state )
229279   AM_RANGE(0x0000, 0x77ff) AM_ROM
230280   AM_RANGE(0x7800, 0x7fff) AM_RAM
r243808r243809
457507static MACHINE_CONFIG_START( csplayh5, csplayh5_state )
458508
459509   /* basic machine hardware */
460   MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16 */
510   MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16, gives a 6250bps serial */
461511   MCFG_CPU_PROGRAM_MAP(csplayh5_map)
462512   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
463513
464514   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", csplayh5_state, csplayh5_irq, "screen", 0, 1)
465515
466   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
516   MCFG_TMP68301_ADD("tmp68301", "maincpu")
467517
468#if USE_H8
469   MCFG_CPU_ADD("subcpu", H83002, 16000000)    /* unknown clock */
518   MCFG_CPU_ADD("subcpu", H83002, 17600000)    /* unknown clock, 17.6MHz gives a 6250bps serial too */
470519   MCFG_CPU_PROGRAM_MAP(csplayh5_sub_map)
471520   MCFG_CPU_IO_MAP(csplayh5_sub_io_map)
472#endif
473521
474522   MCFG_CPU_ADD("audiocpu", TMPZ84C011, 8000000)  /* TMPZ84C011, unknown clock */
475523   MCFG_CPU_CONFIG(daisy_chain_sound)
trunk/src/mame/drivers/niyanpai.c
r243808r243809
774774   MCFG_CPU_VBLANK_INT_DRIVER("screen", niyanpai_state,  niyanpai_interrupt)
775775   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
776776
777   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
777   MCFG_TMP68301_ADD("tmp68301", "maincpu")
778778   MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(niyanpai_state, tmp68301_parallel_port_w))
779779
780780   MCFG_CPU_ADD("audiocpu", TMPZ84C011, 8000000) /* TMPZ84C011, 8.00 MHz */
trunk/src/mame/drivers/realbrk.c
r243808r243809
758758   MCFG_CPU_VBLANK_INT_DRIVER("screen", realbrk_state,  realbrk_interrupt)
759759   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
760760
761   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
761   MCFG_TMP68301_ADD("tmp68301", "maincpu")
762762   MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(realbrk_state,realbrk_flipscreen_w))
763763
764764   /* video hardware */
trunk/src/mame/drivers/seta2.c
r243808r243809
20932093   MCFG_CPU_VBLANK_INT_DRIVER("screen", seta2_state,  seta2_interrupt)
20942094   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
20952095
2096   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
2096   MCFG_TMP68301_ADD("tmp68301", "maincpu")
20972097
20982098   // video hardware
20992099   MCFG_SCREEN_ADD("screen", RASTER)
r243808r243809
23252325   MCFG_CPU_VBLANK_INT_DRIVER("screen", seta2_state,  seta2_interrupt)
23262326   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
23272327
2328   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)  // does this have a ticket dispenser?
2328   MCFG_TMP68301_ADD("tmp68301", "maincpu")  // does this have a ticket dispenser?
23292329
23302330   // video hardware
23312331   MCFG_SCREEN_ADD("screen", RASTER)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team