Previous 15994 Revisions Next

r2198 Tuesday 1st April, 2008 at 16:27:45 UTC by Dirk Best
[COUPE] Added support for the SAMBUS real time clock (patch for MAME changes submitted to MAMEDev)
[src/emu/machine]msm6242.c
[src/mess/drivers]coupe.c
[src/mess/includes]coupe.h
[src/mess/machine]coupe.c

src/emu/machine/msm6242.c
r2197r2198
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "machine/msm6242.h"
109
10
1111static UINT8 msm6264_reg[3] = { 0, 0, 0 };
1212static mame_system_time msm6264_hold_time = { 0 };
1313
14/* temporary buffer to hold values written to the device */
15static UINT8 time_buffer[13];
16
17/* TRUE if the time was just written */
18static int time_just_written = FALSE;
19
20
1421enum
1522{
1623   MSM6264_REG_S1      = 0,
r2197r2198
3138   MSM6264_REG_CF
3239};
3340
41
42static TIMER_CALLBACK( reset_time )
43{
44   time_just_written = FALSE;
45}
46
47
3448READ8_HANDLER( msm6242_r )
3549{
3650   mame_system_time curtime, *systime = &curtime;
3751
52   /* return the buffered time if it has recently been written */
53   if (time_just_written && offset < MSM6264_REG_CD)
54   {
55      return time_buffer[offset];
56   }
57
3858   if ( msm6264_reg[0] & 1 ) /* if HOLD is set, use the hold time */
3959   {
4060      systime = &msm6264_hold_time;
4161   }
4262   else /* otherwise, use the current time */
4363   {
44      mame_get_current_datetime(Machine, &curtime);
64      mame_get_current_datetime(machine, &curtime);
4565   }
4666
4767   switch(offset)
r2197r2198
90110   return 0;
91111}
92112
113
93114WRITE8_HANDLER( msm6242_w )
94115{
116   /* mark as just written and start a timer to reset it again */
117   if (offset < MSM6264_REG_CD)
118   {
119      time_buffer[offset] = data;
120      time_just_written = TRUE;
121      timer_set(ATTOTIME_IN_MSEC(500), NULL, 0, reset_time);
122      return;
123   }
124
95125   switch(offset)
96126   {
97127      case MSM6264_REG_CD:
r2197r2198
100130
101131          if ( data & 1 )   /* was Hold set? */
102132          {
103             mame_get_current_datetime(Machine, &msm6264_hold_time);
133             mame_get_current_datetime(machine, &msm6264_hold_time);
104134          }
105135
106136          return;
r2197r2198
133163   return msm6242_r(machine, offset);
134164}
135165
166
136167WRITE16_HANDLER( msm6242_lsb_w )
137168{
138169   if (ACCESSING_LSB)
src/mess/includes/coupe.h
r2197r2198
3434void coupe_update_memory(void);
3535
3636DEVICE_IMAGE_LOAD( coupe_floppy );
37MACHINE_START( coupe );
37DRIVER_INIT( coupe );
3838MACHINE_RESET( coupe );
3939
4040
src/mess/machine/coupe.c
r2197r2198
1111#include "includes/coupe.h"
1212#include "devices/basicdsk.h"
1313#include "machine/wd17xx.h"
14#include "machine/msm6242.h"
1415
1516
1617#define LMPR_RAM0   0x20   /* If bit set ram is paged into bank 0, else its rom0 */
r2197r2198
113114}
114115
115116
117static READ8_HANDLER( coupe_rtc_r )
118{
119   return msm6242_r(machine, offset >> 12);
120}
121
122
123static WRITE8_HANDLER( coupe_rtc_w )
124{
125   msm6242_w(machine, offset >> 12, data);
126}
127
128
116129MACHINE_RESET( coupe )
117130{
118131   memset(&coupe_regs, 0, sizeof(coupe_regs));
r2197r2198
123136    coupe_regs.line_int = 0xff;  /* line interrupts disabled */
124137    coupe_regs.status = 0x1f;    /* no interrupts active */
125138
139   if (readinputportbytag("config") & 0x01)
140   {
141      /* install RTC */
142      memory_install_readwrite8_handler(0, ADDRESS_SPACE_IO, 0xef, 0xef, 0xffff, 0xff00, coupe_rtc_r, coupe_rtc_w);
143   }
144   else
145   {
146      /* no RTC support */
147      memory_install_readwrite8_handler(0, ADDRESS_SPACE_IO, 0xef, 0xef, 0xffff, 0xff00, SMH_UNMAP, SMH_UNMAP);
148   }
149
126150    coupe_update_memory();
127151}
128152
129153
130MACHINE_START( coupe )
154DRIVER_INIT( coupe )
131155{
132156    wd17xx_init(machine, WD_TYPE_1772, NULL, NULL);
133157}
src/mess/drivers/coupe.c
r2197r2198
430430   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN)
431431   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT)
432432   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
433
434   PORT_START_TAG("config")
435   PORT_CONFNAME(0x01, 0x00, "Real Time Clock")
436   PORT_CONFSETTING(   0x00, DEF_STR(None))
437   PORT_CONFSETTING(   0x01, "SAMBUS")
433438INPUT_PORTS_END
434439
435440
r2197r2198
495500   MDRV_CPU_IO_MAP(coupe_io, 0)
496501   MDRV_CPU_VBLANK_INT("main", coupe_frame_interrupt)
497502
498   MDRV_MACHINE_START(coupe)
499503   MDRV_MACHINE_RESET(coupe)
500504
501505    /* video hardware */
r2197r2198
603607 *
604608 *************************************/
605609
606/*    YEAR  NAME   PARENT  COMPAT  MACHINE  INPUT  INIT  CONFIG  COMPANY                        FULLNAME     FLAGS */
607COMP( 1989, coupe, 0,      0,      coupe,   coupe, 0,    coupe,  "Miles Gordon Technology plc", "Sam Coupe", 0 )
610/*    YEAR  NAME   PARENT  COMPAT  MACHINE  INPUT  INIT   CONFIG  COMPANY                        FULLNAME     FLAGS */
611COMP( 1989, coupe, 0,      0,      coupe,   coupe, coupe, coupe,  "Miles Gordon Technology plc", "Sam Coupe", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team