Previous 15994 Revisions Next

r2513 Thursday 1st May, 2008 at 17:28:17 UTC by Dirk Best
Converted the MSM6242 RTC into a proper device
[src/emu/machine]msm6242.c msm6242.h
[src/mame/drivers]ddenlovr.c dynax.c royalmah.c seta.c
[src/mess/devices]coco_fdc.c
[src/mess/drivers]amiga.c coco.c coupe.c
[src/mess/machine]coupe.c

src/mame/drivers/dynax.c
r2512r2513
345345         break;
346346
347347      case 0x1c:   // RTC
348         msm6242_w(machine,offset,data);
349         return;
348      {
349         const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "rtc");
350         msm6242_w(rtc, offset, data);
351      }
352      return;
350353
351354      default:
352355         popmessage("palette_w with bank = %02x",hnoridur_bank);
r2512r2513
11211124   AM_RANGE( 0x44, 0x44 ) AM_WRITE   ( AY8910_write_port_0_w      )   //
11221125   AM_RANGE( 0x46, 0x46 ) AM_WRITE   ( YM2413_register_port_0_w   )   // YM2413
11231126   AM_RANGE( 0x47, 0x47 ) AM_WRITE   ( YM2413_data_port_0_w      )   //
1124   AM_RANGE( 0x80, 0x8f ) AM_READWRITE( msm6242_r, msm6242_w   )   // 6242RTC
1127   AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)   // 6242RTC
11251128   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE ( ddenlovr_palette_base_w      )   // ddenlovr mixer chip
11261129   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE ( ddenlovr_palette_mask_w      )
11271130   AM_RANGE( 0xa8, 0xab ) AM_WRITE ( ddenlovr_transparency_pen_w   )
r2512r2513
13271330   }
13281331   else if ( (rombank == 0x10) && (offset < 0x10) )
13291332   {
1330      return msm6242_r(machine,offset);
1333      const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "rtc");
1334      return msm6242_r(rtc, offset);
13311335   }
13321336   else if (rombank == 0x12)
13331337   {
r2512r2513
13421346{
13431347   if ( (rombank == 0x10) && (offset < 0x10) )
13441348   {
1345      msm6242_w(machine,offset,data);
1349      const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "rtc");
1350      msm6242_w(rtc, offset, data);
13461351      return;
13471352   }
13481353   else if (rombank == 0x12)
r2512r2513
40944099
40954100   MDRV_SOUND_ADD(YM2413, 3579545)
40964101   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
4102
4103   /* devices */
4104   MDRV_DEVICE_ADD("rtc", MSM6242)
40974105MACHINE_DRIVER_END
40984106
40994107
src/mame/drivers/ddenlovr.c
r2512r2513
15771577   AM_RANGE(0x300270, 0x300271) AM_READ(unk16_r               )   // ? must be 78 on startup (not necessary in ddlover)
15781578   AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r         )   // Video Chip
15791579   AM_RANGE(0x3002c0, 0x3002c1) AM_READ(OKIM6295_status_0_lsb_r   )   // Sound
1580   AM_RANGE(0x300340, 0x30035f) AM_READ(msm6242_lsb_r            )   // 6242RTC
1580   AM_RANGE(0x300340, 0x30035f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff)   // 6242RTC
15811581   AM_RANGE(0x300384, 0x300385) AM_READ(AY8910_read_port_0_lsb_r   )
15821582   AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM               )   // RAM
15831583ADDRESS_MAP_END
r2512r2513
15991599   AM_RANGE(0x300280, 0x300283) AM_WRITE(ddenlovr_blitter_w         )
16001600   AM_RANGE(0x300300, 0x300301) AM_WRITE(YM2413_register_port_0_lsb_w   )
16011601   AM_RANGE(0x300302, 0x300303) AM_WRITE(YM2413_data_port_0_lsb_w      )
1602   AM_RANGE(0x300340, 0x30035f) AM_WRITE(msm6242_lsb_w               )   // 6242RTC
1602   AM_RANGE(0x300340, 0x30035f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff)   // 6242RTC
16031603   AM_RANGE(0x3003ca, 0x3003cb) AM_WRITE(ddenlovr_blitter_irq_ack_w   )   // Blitter irq acknowledge
16041604   AM_RANGE(0x300380, 0x300381) AM_WRITE(AY8910_control_port_0_lsb_w   )
16051605   AM_RANGE(0x300382, 0x300383) AM_WRITE(AY8910_write_port_0_lsb_w      )
r2512r2513
16401640   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM               )   // ROM
16411641   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r               )   // ? must be 78 on startup (not necessary in ddlover)
16421642   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r         )   // Video Chip
1643   AM_RANGE(0x300100, 0x30011f) AM_READ(msm6242_lsb_r            )   // 6242RTC
1643   AM_RANGE(0x300100, 0x30011f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r,   0x00ff)   // 6242RTC
16441644   AM_RANGE(0x300180, 0x300181) AM_READ(input_port_0_word_r      )   // P1
16451645   AM_RANGE(0x300182, 0x300183) AM_READ(input_port_1_word_r      )   // P2
16461646   AM_RANGE(0x300184, 0x300185) AM_READ(ddenlvrj_blitter_r         )   // Coins + ?
r2512r2513
16631663   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w         )
16641664   AM_RANGE(0x3000c0, 0x3000c1) AM_WRITE(YM2413_register_port_0_lsb_w   )
16651665   AM_RANGE(0x3000c2, 0x3000c3) AM_WRITE(YM2413_data_port_0_lsb_w      )
1666   AM_RANGE(0x300100, 0x30011f) AM_WRITE(msm6242_lsb_w               )   // 6242RTC
1666   AM_RANGE(0x300100, 0x30011f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff)   // 6242RTC
16671667   AM_RANGE(0x300140, 0x300141) AM_WRITE(AY8910_control_port_0_lsb_w   )
16681668   AM_RANGE(0x300142, 0x300143) AM_WRITE(AY8910_write_port_0_lsb_w      )
16691669   AM_RANGE(0x300188, 0x300189) AM_WRITE(ddenlvrj_coincounter_w      )   // Coin Counters
r2512r2513
16831683   AM_RANGE(0xe00102, 0xe00103) AM_READ(input_port_1_word_r      )   // P2?
16841684   AM_RANGE(0xe00104, 0xe00105) AM_READ(ddenlovr_special_r         )   // Coins + ?
16851685   AM_RANGE(0xe00200, 0xe00201) AM_READ(input_port_3_word_r      )   // DSW
1686   AM_RANGE(0xe00500, 0xe0051f) AM_READ(msm6242_lsb_r            )   // 6242RTC
1686   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r,   0x00ff)   // 6242RTC
16871687   AM_RANGE(0xe00604, 0xe00605) AM_READ(AY8910_read_port_0_lsb_r   )
16881688   AM_RANGE(0xe00700, 0xe00701) AM_READ(OKIM6295_status_0_lsb_r   )   // Sound
16891689   AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM               )   // RAM
r2512r2513
17071707   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w      )   //
17081708   AM_RANGE(0xe00400, 0xe00401) AM_WRITE(YM2413_register_port_0_lsb_w   )
17091709   AM_RANGE(0xe00402, 0xe00403) AM_WRITE(YM2413_data_port_0_lsb_w      )
1710   AM_RANGE(0xe00500, 0xe0051f) AM_WRITE(msm6242_lsb_w               )   // 6242RTC
1710   AM_RANGE(0xe00500, 0xe0051f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff)   // 6242RTC
17111711//  AM_RANGE(0xe00302, 0xe00303) AM_WRITE(SMH_NOP                     )   // ?
17121712   AM_RANGE(0xe00600, 0xe00601) AM_WRITE(AY8910_control_port_0_lsb_w   )
17131713   AM_RANGE(0xe00602, 0xe00603) AM_WRITE(AY8910_write_port_0_lsb_w      )
r2512r2513
17681768   AM_RANGE(0x200c02, 0x200c03) AM_READ(nettoqc_protection_r      )   //
17691769   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r               )   // ? must be 78 on startup (not necessary in ddlover)
17701770   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r         )   // Video Chip
1771   AM_RANGE(0x300100, 0x30011f) AM_READ(msm6242_lsb_r            )   // 6242RTC
1771   AM_RANGE(0x300100, 0x30011f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r,   0x00ff)   // 6242RTC
17721772   AM_RANGE(0x300180, 0x300181) AM_READ(input_port_0_word_r      )   //
17731773   AM_RANGE(0x300182, 0x300183) AM_READ(input_port_1_word_r      )   //
17741774   AM_RANGE(0x300184, 0x300185) AM_READ(nettoqc_special_r         )   // Coins + ?
r2512r2513
17921792   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w         )
17931793   AM_RANGE(0x3000c0, 0x3000c1) AM_WRITE(YM2413_register_port_0_lsb_w   )
17941794   AM_RANGE(0x3000c2, 0x3000c3) AM_WRITE(YM2413_data_port_0_lsb_w      )
1795   AM_RANGE(0x300100, 0x30011f) AM_WRITE(msm6242_lsb_w               )   // 6242RTC
1795   AM_RANGE(0x300100, 0x30011f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff)   // 6242RTC
17961796   AM_RANGE(0x300140, 0x300141) AM_WRITE(AY8910_control_port_0_lsb_w   )
17971797   AM_RANGE(0x300142, 0x300143) AM_WRITE(AY8910_write_port_0_lsb_w      )
17981798   AM_RANGE(0x300188, 0x300189) AM_WRITE(nettoqc_coincounter_w         )   // Coin Counters
r2512r2513
18531853   AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r         )
18541854   AM_RANGE(0x40, 0x40) AM_READ(OKIM6295_status_0_r      )
18551855   AM_RANGE(0x98, 0x98) AM_READ(unk_r                  )   // ? must be 78 on startup
1856   AM_RANGE(0xa0, 0xaf) AM_READ(msm6242_r               )   // 6242RTC
1856   AM_RANGE(0xa0, 0xaf) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
18571857ADDRESS_MAP_END
18581858
18591859static ADDRESS_MAP_START( quizchq_writeport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
r2512r2513
18711871   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w         )
18721872   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w         )
18731873   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w      )
1874   AM_RANGE(0xa0, 0xaf) AM_WRITE(msm6242_w               )   // 6242RTC
1874   AM_RANGE(0xa0, 0xaf) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
18751875   AM_RANGE(0xc0, 0xc0) AM_WRITE(quizchq_oki_bank_w      )
18761876   AM_RANGE(0xc2, 0xc2) AM_WRITE(SMH_NOP               )   // enables palette RAM at 8000
18771877ADDRESS_MAP_END
r2512r2513
18951895   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r         )
18961896   AM_RANGE(0x1b, 0x1b) AM_READ(rongrong_blitter_busy_r   )
18971897   AM_RANGE(0x1c, 0x1c) AM_READ(rongrong_input_r         )
1898   AM_RANGE(0x20, 0x2f) AM_READ(msm6242_r               )   // 6242RTC
1898   AM_RANGE(0x20, 0x2f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
18991899   AM_RANGE(0x40, 0x40) AM_READ(OKIM6295_status_0_r      )
19001900   AM_RANGE(0x98, 0x98) AM_READ(unk_r                  )   // ? must be 78 on startup
19011901   AM_RANGE(0xa2, 0xa3) AM_READ(rongrong_input2_r         )
r2512r2513
19051905   AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w      )
19061906   AM_RANGE(0x1b, 0x1b) AM_WRITE(rongrong_blitter_busy_w   )
19071907   AM_RANGE(0x1e, 0x1e) AM_WRITE(rongrong_select_w         )
1908   AM_RANGE(0x20, 0x2f) AM_WRITE(msm6242_w               )   // 6242RTC
1908   AM_RANGE(0x20, 0x2f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
19091909   AM_RANGE(0x40, 0x40) AM_WRITE(OKIM6295_data_0_w         )
19101910   AM_RANGE(0x60, 0x60) AM_WRITE(YM2413_register_port_0_w   )
19111911   AM_RANGE(0x61, 0x61) AM_WRITE(YM2413_data_port_0_w      )
r2512r2513
20092009   AM_RANGE(0x8000, 0x81ff) AM_WRITE(rongrong_palette_w      )
20102010ADDRESS_MAP_END
20112011
2012static ADDRESS_MAP_START( mmpanic_readport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
2013   AM_RANGE(0x00, 0x0f) AM_READ(msm6242_r            )   // 6242RTC
2012static ADDRESS_MAP_START( mmpanic_readport, ADDRESS_SPACE_IO, 8 )
2013   ADDRESS_MAP_GLOBAL_MASK(0xff)
2014   AM_RANGE(0x00, 0x0f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
20142015   AM_RANGE(0x38, 0x38) AM_READ(unk_r               )   // ? must be 78 on startup
20152016   AM_RANGE(0x58, 0x58) AM_READ(unk_r               )   // ? must be 78 on startup
20162017   AM_RANGE(0x63, 0x63) AM_READ(rongrong_gfxrom_r      )   // Video Chip
r2512r2513
20232024   AM_RANGE(0x9c, 0x9c) AM_READ(input_port_4_r         )   // DSW 1&2 high bits
20242025ADDRESS_MAP_END
20252026
2026static ADDRESS_MAP_START( mmpanic_writeport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
2027   AM_RANGE(0x00, 0x0f) AM_WRITE(msm6242_w               )   // 6242RTC
2027static ADDRESS_MAP_START( mmpanic_writeport, ADDRESS_SPACE_IO, 8 )
2028   ADDRESS_MAP_GLOBAL_MASK(0xff)
2029   AM_RANGE(0x00, 0x0f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
20282030   // Layers 0-3:
20292031   AM_RANGE(0x20, 0x23) AM_WRITE(ddenlovr_palette_base_w      )
20302032   AM_RANGE(0x24, 0x27) AM_WRITE(ddenlovr_palette_mask_w      )
r2512r2513
21862188   AM_RANGE(0x04, 0x04) AM_READ( funkyfig_busy_r      )
21872189   AM_RANGE(0x1c, 0x1c) AM_READ( funkyfig_dsw_r      )
21882190   AM_RANGE(0x23, 0x23) AM_READ( rongrong_gfxrom_r      )   // Video Chip
2189   AM_RANGE(0x40, 0x4f) AM_READ( msm6242_r            )   // 6242RTC
2191   AM_RANGE(0x40, 0x4f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
21902192   AM_RANGE(0x78, 0x78) AM_READ( unk_r               )   // ? must be 78 on startup
21912193   AM_RANGE(0x82, 0x82) AM_READ( funkyfig_coin_r      )
21922194   AM_RANGE(0x83, 0x83) AM_READ( funkyfig_key_r      )
r2512r2513
21992201   AM_RANGE(0x02, 0x02) AM_WRITE( mmpanic_soundlatch_w      )   //
22002202   AM_RANGE(0x1e, 0x1e) AM_WRITE( funkyfig_rombank_w      )
22012203   AM_RANGE(0x20, 0x21) AM_WRITE( funkyfig_blitter_w      )
2202   AM_RANGE(0x40, 0x4f) AM_WRITE( msm6242_w            )   // 6242RTC
2204   AM_RANGE(0x40, 0x4f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
22032205
22042206   // Layers 0-3:
22052207   AM_RANGE(0x60, 0x63) AM_WRITE( ddenlovr_palette_base_w      )
r2512r2513
23762378   AM_RANGE(0x91, 0x92) AM_READ( hanakanz_keyb_r         )
23772379   AM_RANGE(0x96, 0x96) AM_READ( hanakanz_rand_r         )
23782380   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
2379   AM_RANGE(0xe0, 0xef) AM_READ( msm6242_r               )   // 6242RTC
2381   AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
23802382ADDRESS_MAP_END
23812383
23822384static ADDRESS_MAP_START( hanakanz_writeport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
r2512r2513
23912393   AM_RANGE(0xa0, 0xa0) AM_WRITE( YM2413_register_port_0_w   )
23922394   AM_RANGE(0xa1, 0xa1) AM_WRITE( YM2413_data_port_0_w      )
23932395   AM_RANGE(0xc0, 0xc0) AM_WRITE( OKIM6295_data_0_w      )
2394   AM_RANGE(0xe0, 0xef) AM_WRITE( msm6242_w            )   // 6242RTC
2396   AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
23952397ADDRESS_MAP_END
23962398
23972399
r2512r2513
24032405   AM_RANGE(0xb1, 0xb2) AM_READ( hanakanz_keyb_r         )
24042406   AM_RANGE(0xb6, 0xb6) AM_READ( hanakanz_rand_r         )
24052407   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
2406   AM_RANGE(0xe0, 0xef) AM_READ( msm6242_r               )   // 6242RTC
2408   AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
24072409ADDRESS_MAP_END
24082410
24092411static ADDRESS_MAP_START( hkagerou_writeport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
r2512r2513
24182420   AM_RANGE(0xb3, 0xb3) AM_WRITE( hanakanz_coincounter_w   )
24192421   AM_RANGE(0xb4, 0xb4) AM_WRITE( hanakanz_keyb_w         )
24202422   AM_RANGE(0xc0, 0xc0) AM_WRITE( OKIM6295_data_0_w      )
2421   AM_RANGE(0xe0, 0xef) AM_WRITE( msm6242_w            )   // 6242RTC
2423   AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
24222424ADDRESS_MAP_END
24232425
24242426
r2512r2513
24432445   AM_RANGE(0x94, 0x94) AM_READ( input_port_0_r         )
24442446   AM_RANGE(0x95, 0x96) AM_READ( hanakanz_keyb_r         )
24452447   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
2446   AM_RANGE(0xe0, 0xef) AM_READ( msm6242_r               )   // 6242RTC
2448   AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
24472449ADDRESS_MAP_END
24482450
24492451static ADDRESS_MAP_START( mjreach1_writeport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
r2512r2513
24592461   AM_RANGE(0xa0, 0xa0) AM_WRITE( YM2413_register_port_0_w   )
24602462   AM_RANGE(0xa1, 0xa1) AM_WRITE( YM2413_data_port_0_w      )
24612463   AM_RANGE(0xc0, 0xc0) AM_WRITE( OKIM6295_data_0_w      )
2462   AM_RANGE(0xe0, 0xef) AM_WRITE( msm6242_w            )   // 6242RTC
2464   AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
24632465ADDRESS_MAP_END
24642466
24652467
r2512r2513
25782580   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ( input_port_14_r         )   // DSW 4
25792581   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ( input_port_15_r         )   // DSW 1-4 high bits
25802582   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_READ( OKIM6295_status_0_r      )
2581   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_READ( msm6242_r            )   // 6242RTC
2583   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
25822584ADDRESS_MAP_END
25832585
25842586static ADDRESS_MAP_START( mjchuuka_writeport, ADDRESS_SPACE_IO, 8 )   // 16 bit I/O
r2512r2513
25882590   AM_RANGE(0x40, 0x40) AM_MIRROR(0xff00) AM_WRITE( mjchuuka_coincounter_w      )
25892591   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff00) AM_WRITE( hanakanz_keyb_w         )
25902592   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITE( OKIM6295_data_0_w         )
2591   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_WRITE( msm6242_w               )   // 6242RTC
2593   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
25922594   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0xff00) AM_WRITE( YM2413_register_port_0_w   )
25932595   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0xff00) AM_WRITE( YM2413_data_port_0_w      )
25942596   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0xff00) AM_WRITE( AY8910_control_port_0_w   )
r2512r2513
27002702   AM_RANGE(0x23, 0x23) AM_READ( mjmyster_keyb_r         )
27012703   AM_RANGE(0x40, 0x40) AM_READ( OKIM6295_status_0_r      )
27022704   AM_RANGE(0x44, 0x44) AM_READ( AY8910_read_port_0_r      )
2703   AM_RANGE(0x60, 0x6f) AM_READ( msm6242_r               )   // 6242RTC
2705   AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
27042706   AM_RANGE(0x98, 0x98) AM_READ( unk_r                  )   // ? must be 78 on startup
27052707   AM_RANGE(0xc2, 0xc2) AM_READ( hanakanz_rand_r         )
27062708   AM_RANGE(0xc3, 0xc3) AM_READ( mjmyster_dsw_r         )
r2512r2513
27172719   AM_RANGE(0x43, 0x43) AM_WRITE( YM2413_data_port_0_w      )
27182720   AM_RANGE(0x46, 0x46) AM_WRITE( AY8910_write_port_0_w   )
27192721   AM_RANGE(0x48, 0x48) AM_WRITE( AY8910_control_port_0_w   )
2720   AM_RANGE(0x60, 0x6f) AM_WRITE( msm6242_w            )   // 6242RTC
2722   AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
27212723   AM_RANGE(0x80, 0x83) AM_WRITE( ddenlovr_palette_base_w      )
27222724   AM_RANGE(0x84, 0x87) AM_WRITE( ddenlovr_palette_mask_w      )
27232725   AM_RANGE(0x88, 0x8b) AM_WRITE( ddenlovr_transparency_pen_w   )
r2512r2513
28762878   AM_RANGE(0x03, 0x03) AM_READ( rongrong_gfxrom_r         )
28772879   AM_RANGE(0x1c, 0x1c) AM_READ( SMH_NOP               )
28782880   AM_RANGE(0x24, 0x24) AM_READ( AY8910_read_port_0_r      )
2879   AM_RANGE(0x60, 0x6f) AM_READ( msm6242_r               )   // 6242RTC
2881   AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
28802882   AM_RANGE(0x42, 0x42) AM_READ( hginga_coins_r         )
28812883   AM_RANGE(0x43, 0x43) AM_READ( hginga_input_r         )
28822884   AM_RANGE(0xb8, 0xb8) AM_READ( unk_r                  )   // ? must be 78 on startup
r2512r2513
28922894   AM_RANGE(0x28, 0x28) AM_WRITE( AY8910_control_port_0_w   )
28932895   AM_RANGE(0x40, 0x40) AM_WRITE( hginga_input_w         )
28942896   AM_RANGE(0x41, 0x41) AM_WRITE( hginga_coins_w         )
2895   AM_RANGE(0x60, 0x6f) AM_WRITE( msm6242_w            )   // 6242RTC
2897   AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
28962898   AM_RANGE(0x80, 0x80) AM_WRITE( hginga_80_w            )
28972899   AM_RANGE(0xa0, 0xa3) AM_WRITE( ddenlovr_palette_base_w      )
28982900   AM_RANGE(0xa4, 0xa7) AM_WRITE( ddenlovr_palette_mask_w      )
r2512r2513
29882990static ADDRESS_MAP_START( hgokou_readport, ADDRESS_SPACE_IO, 8 )   ADDRESS_MAP_GLOBAL_MASK(0xff)
29892991   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r         )
29902992   AM_RANGE(0x1c, 0x1c) AM_READ(SMH_NOP               )   // ? ack on RTC int
2991   AM_RANGE(0x20, 0x2f) AM_READ(msm6242_r               )   // 6242RTC
2993   AM_RANGE(0x20, 0x2f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
29922994   AM_RANGE(0x58, 0x58) AM_READ(unk_r                  )   // ? must be 78 on startup
29932995   AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r            )
29942996   AM_RANGE(0x80, 0x80) AM_READ(OKIM6295_status_0_r      )
r2512r2513
29993001   AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w         )
30003002   AM_RANGE(0x1c, 0x1c) AM_WRITE(mjmyster_rambank_w      )
30013003   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w         )
3002   AM_RANGE(0x20, 0x2f) AM_WRITE(msm6242_w               )   // 6242RTC
3004   AM_RANGE(0x20, 0x2f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
30033005   AM_RANGE(0x40, 0x43) AM_WRITE(ddenlovr_palette_base_w      )
30043006   AM_RANGE(0x44, 0x47) AM_WRITE(ddenlovr_palette_mask_w      )
30053007   AM_RANGE(0x48, 0x4b) AM_WRITE(ddenlovr_transparency_pen_w   )
r2512r2513
31353137   AM_RANGE(0x23, 0x23) AM_READ( mjmyster_keyb_r         )
31363138   AM_RANGE(0x40, 0x40) AM_READ( OKIM6295_status_0_r      )
31373139   AM_RANGE(0x44, 0x44) AM_READ( AY8910_read_port_0_r      )
3138   AM_RANGE(0x60, 0x6f) AM_READ( msm6242_r               )   // 6242RTC
3140   AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
31393141   AM_RANGE(0x98, 0x98) AM_READ( unk_r                  )   // ? must be 78 on startup
31403142   AM_RANGE(0xc0, 0xc0) AM_READ( hanakanz_rand_r         )
31413143   AM_RANGE(0xe0, 0xe0) AM_READ( mjmyster_dsw_r         )
r2512r2513
31523154   AM_RANGE(0x43, 0x43) AM_WRITE( YM2413_data_port_0_w      )
31533155   AM_RANGE(0x46, 0x46) AM_WRITE( AY8910_write_port_0_w   )
31543156   AM_RANGE(0x48, 0x48) AM_WRITE( AY8910_control_port_0_w   )
3155   AM_RANGE(0x60, 0x6f) AM_WRITE( msm6242_w            )   // 6242RTC
3157   AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
31563158   AM_RANGE(0x80, 0x83) AM_WRITE( ddenlovr_palette_base_w      )
31573159   AM_RANGE(0x84, 0x87) AM_WRITE( ddenlovr_palette_mask_w      )
31583160   AM_RANGE(0x88, 0x8b) AM_WRITE( ddenlovr_transparency_pen_w   )
r2512r2513
32213223   AM_RANGE(0xe0010c, 0xe0010d) AM_READ(akamaru_e0010d_r         )
32223224   AM_RANGE(0xe00200, 0xe00201) AM_READ(akamaru_dsw_r            )   // DSW
32233225   AM_RANGE(0xe00204, 0xe00205) AM_READ(akamaru_blitter_r         )   // Blitter Busy & IRQ
3224   AM_RANGE(0xe00500, 0xe0051f) AM_READ(msm6242_lsb_r            )   // 6242RTC
3226   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff)   // 6242RTC
32253227   AM_RANGE(0xe00604, 0xe00605) AM_READ(AY8910_read_port_0_lsb_r   )
32263228   AM_RANGE(0xe00700, 0xe00701) AM_READ(OKIM6295_status_0_lsb_r   )   // Sound
32273229   AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM               )   // RAM
r2512r2513
32473249   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w      )   //
32483250   AM_RANGE(0xe00400, 0xe00401) AM_WRITE(YM2413_register_port_0_lsb_w   )
32493251   AM_RANGE(0xe00402, 0xe00403) AM_WRITE(YM2413_data_port_0_lsb_w      )
3250   AM_RANGE(0xe00500, 0xe0051f) AM_WRITE(msm6242_lsb_w               )   // 6242RTC
3252   AM_RANGE(0xe00500, 0xe0051f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff)   // 6242RTC
32513253   AM_RANGE(0xe00600, 0xe00601) AM_WRITE(AY8910_control_port_0_lsb_w   )
32523254   AM_RANGE(0xe00602, 0xe00603) AM_WRITE(AY8910_write_port_0_lsb_w      )
32533255   AM_RANGE(0xe00700, 0xe00701) AM_WRITE(OKIM6295_data_0_lsb_w       )
r2512r2513
33253327   AM_RANGE(0x0082, 0x0082) AM_READ( mjflove_blitter_r         )
33263328   AM_RANGE(0x00da, 0x00da) AM_READ( mjflove_protection_r      )   AM_MIRROR(0xff00)
33273329   AM_RANGE(0x0100, 0x0100) AM_READ( input_port_11_r         )
3328   AM_RANGE(0x0280, 0x028f) AM_READ( msm6242_r               )   // 6242RTC
3330   AM_RANGE(0x0280, 0x028f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
33293331   AM_RANGE(0x0380, 0x0380) AM_READ( OKIM6295_status_0_r      )
33303332ADDRESS_MAP_END
33313333
r2512r2513
33463348   AM_RANGE(0x0184, 0x0184) AM_WRITE( mjflove_coincounter_w   )
33473349   AM_RANGE(0x0200, 0x0200) AM_WRITE( YM2413_register_port_0_w   )
33483350   AM_RANGE(0x0201, 0x0201) AM_WRITE( YM2413_data_port_0_w      )
3349   AM_RANGE(0x0280, 0x028f) AM_WRITE( msm6242_w            )   // 6242RTC
3351   AM_RANGE(0x0280, 0x028f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w)   // 6242RTC
33503352   AM_RANGE(0x0300, 0x0300) AM_WRITE( AY8910_control_port_0_w   )
33513353   AM_RANGE(0x0301, 0x0301) AM_WRITE( AY8910_write_port_0_w   )
33523354   AM_RANGE(0x0380, 0x0380) AM_WRITE( OKIM6295_data_0_w      )
r2512r2513
65346536   MDRV_SOUND_ADD(OKIM6295, 1022720)
65356537   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
65366538   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
6539
6540   /* devices */
6541   MDRV_DEVICE_ADD("rtc", MSM6242)
65376542MACHINE_DRIVER_END
65386543
65396544static MACHINE_DRIVER_START( ddenlvrj )
r2512r2513
66486653   MDRV_SOUND_ADD(OKIM6295, 1022720)
66496654   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
66506655   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
6656
6657   /* devices */
6658   MDRV_DEVICE_ADD("rtc", MSM6242)
66516659MACHINE_DRIVER_END
66526660
66536661static MACHINE_DRIVER_START( rongrong )
r2512r2513
67266734   MDRV_SOUND_ADD(OKIM6295, 1022720)
67276735   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
67286736   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
6737
6738   /* devices */
6739   MDRV_DEVICE_ADD("rtc", MSM6242)
67296740MACHINE_DRIVER_END
67306741
67316742
r2512r2513
67876798   MDRV_SOUND_ADD(OKIM6295, 1022720)
67886799   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
67896800   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
6801
6802   /* devices */
6803   MDRV_DEVICE_ADD("rtc", MSM6242)
67906804MACHINE_DRIVER_END
67916805
67926806static MACHINE_DRIVER_START( hkagerou )
src/mame/drivers/seta.c
r2512r2513
31463146
31473147   AM_RANGE(0x700000, 0x700101) AM_READWRITE(inttoote_700000_r,SMH_RAM) AM_BASE(&inttoote_700000)
31483148
3149   AM_RANGE(0x800000, 0x80001f) AM_READWRITE(msm6242_lsb_r,msm6242_lsb_w)   // 6242RTC
3149   AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8(MSM6242, "rtc", msm6242_r, msm6242_w, 0x00ff)   // 6242RTC
31503150
31513151   AM_RANGE(0x900000, 0x903fff) AM_READWRITE( seta_sound_word_r, seta_sound_word_w      )   // Sound
31523152
r2512r2513
81568156   MDRV_SOUND_CONFIG(seta_sound_intf)
81578157   MDRV_SOUND_ROUTE(0, "left", 1.0)
81588158   MDRV_SOUND_ROUTE(1, "right", 1.0)
8159
8160   /* devices */
8161   MDRV_DEVICE_ADD("rtc", MSM6242)
81598162MACHINE_DRIVER_END
81608163
81618164
src/mame/drivers/royalmah.c
r2512r2513
541541   AM_RANGE( 0x1c, 0x1c ) AM_READ( janptr96_dsw_r )
542542   AM_RANGE( 0x20, 0x20 ) AM_READWRITE( janptr96_unknown_r, janptr96_rambank_w )
543543   AM_RANGE( 0x50, 0x50 ) AM_WRITE( mjderngr_palbank_w )
544   AM_RANGE( 0x60, 0x6f ) AM_READWRITE( msm6242_r, msm6242_w )
544   AM_RANGE( 0x60, 0x6f ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)
545545   AM_RANGE( 0x81, 0x81 ) AM_READ( AY8910_read_port_0_r )
546546   AM_RANGE( 0x82, 0x82 ) AM_WRITE( AY8910_write_port_0_w )
547547   AM_RANGE( 0x83, 0x83 ) AM_WRITE( AY8910_control_port_0_w )
r2512r2513
753753   AM_RANGE( 0x6fc3, 0x6fc3 ) AM_WRITE( AY8910_control_port_0_w )
754754   AM_RANGE( 0x6fd0, 0x6fd0 ) AM_WRITE( janptr96_coin_counter_w )
755755   AM_RANGE( 0x6fd1, 0x6fd1 ) AM_READWRITE( input_port_10_r, input_port_select_w )
756   AM_RANGE( 0x6fe0, 0x6fef ) AM_READWRITE( msm6242_r, msm6242_w )
756   AM_RANGE( 0x6fe0, 0x6fef ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)
757757   AM_RANGE( 0x6ff0, 0x6ff0 ) AM_READWRITE( janptr96_dsw_r, janptr96_dswsel_w )
758758   AM_RANGE( 0x6ff1, 0x6ff1 ) AM_WRITE( mjderngr_palbank_w )
759759   AM_RANGE( 0x6ff3, 0x6ff3 ) AM_WRITE( mjtensin_6ff3_w )
r2512r2513
828828   AM_RANGE( 0x7fe2, 0x7fe2 ) AM_WRITE( mjderngr_palbank_w )
829829   AM_RANGE( 0x7fe3, 0x7fe3 ) AM_WRITE( cafetime_7fe3_w )
830830   AM_RANGE( 0x7fe4, 0x7fe4 ) AM_READ( cafetime_7fe4_r )
831   AM_RANGE( 0x7ff0, 0x7fff ) AM_READWRITE( msm6242_r, msm6242_w )
831   AM_RANGE( 0x7ff0, 0x7fff ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)
832832   AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 )
833833   AM_RANGE( 0x8000, 0xffff ) AM_WRITE( SMH_RAM ) AM_BASE(&videoram)
834834ADDRESS_MAP_END
r2512r2513
34213421
34223422   MDRV_SCREEN_MODIFY("main")
34233423   MDRV_SCREEN_VISIBLE_AREA(0, 255, 9, 255-8)
3424
3425   /* devices */
3426   MDRV_DEVICE_ADD("rtc", MSM6242)
34243427MACHINE_DRIVER_END
34253428
34263429
r2512r2513
34663469
34673470   MDRV_SCREEN_MODIFY("main")
34683471   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
3472
3473   /* devices */
3474   MDRV_DEVICE_ADD("rtc", MSM6242)
34693475MACHINE_DRIVER_END
34703476
34713477static MACHINE_DRIVER_START( cafetime )
r2512r2513
34773483
34783484   MDRV_SCREEN_MODIFY("main")
34793485   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
3486
3487   /* devices */
3488   MDRV_DEVICE_ADD("rtc", MSM6242)
34803489MACHINE_DRIVER_END
34813490
34823491/***************************************************************************
src/emu/machine/msm6242.c
r2512r2513
77#include "driver.h"
88#include "machine/msm6242.h"
99
10static UINT8 msm6264_reg[3] = { 0, 0, 0 };
11static mame_system_time msm6264_hold_time = { 0 };
1210
1311enum
1412{
15   MSM6264_REG_S1      = 0,
16   MSM6264_REG_S10,
17   MSM6264_REG_MI1,
18   MSM6264_REG_MI10,
19   MSM6264_REG_H1,
20   MSM6264_REG_H10,
21   MSM6264_REG_D1,
22   MSM6264_REG_D10,
23   MSM6264_REG_MO1,
24   MSM6264_REG_MO10,
25   MSM6264_REG_Y1,
26   MSM6264_REG_Y10,
27   MSM6264_REG_W,
28   MSM6264_REG_CD,
29   MSM6264_REG_CE,
30   MSM6264_REG_CF
13   MSM6242_REG_S1      = 0,
14   MSM6242_REG_S10,
15   MSM6242_REG_MI1,
16   MSM6242_REG_MI10,
17   MSM6242_REG_H1,
18   MSM6242_REG_H10,
19   MSM6242_REG_D1,
20   MSM6242_REG_D10,
21   MSM6242_REG_MO1,
22   MSM6242_REG_MO10,
23   MSM6242_REG_Y1,
24   MSM6242_REG_Y10,
25   MSM6242_REG_W,
26   MSM6242_REG_CD,
27   MSM6242_REG_CE,
28   MSM6242_REG_CF
3129};
3230
33READ8_HANDLER( msm6242_r )
31
32typedef struct _msm6242_t msm6242_t;
33struct _msm6242_t
3434{
35   UINT8 reg[3];
36   mame_system_time hold_time;
37};
38
39
40/* makes sure that the passed in device is the right type */
41INLINE msm6242_t *get_safe_token(const device_config *device)
42{
43   assert(device != NULL);
44   assert(device->token != NULL);
45   assert(device->type == DEVICE_GET_INFO_NAME(msm6242));
46
47   return (msm6242_t *)device->token;
48}
49
50
51READ8_DEVICE_HANDLER( msm6242_r )
52{
3553   mame_system_time curtime, *systime = &curtime;
54   msm6242_t *msm6242 = get_safe_token(device);
3655
37   if ( msm6264_reg[0] & 1 ) /* if HOLD is set, use the hold time */
56   if (msm6242->reg[0] & 1) /* if HOLD is set, use the hold time */
3857   {
39      systime = &msm6264_hold_time;
58      systime = &msm6242->hold_time;
4059   }
4160   else /* otherwise, use the current time */
4261   {
43      mame_get_current_datetime(machine, &curtime);
62      mame_get_current_datetime(device->machine, &curtime);
4463   }
4564
4665   switch(offset)
4766   {
48      case MSM6264_REG_S1: return systime->local_time.second % 10;
49      case MSM6264_REG_S10: return systime->local_time.second / 10;
50      case MSM6264_REG_MI1: return systime->local_time.minute % 10;
51      case MSM6264_REG_MI10: return systime->local_time.minute / 10;
52      case MSM6264_REG_H1:
53      case MSM6264_REG_H10:
67      case MSM6242_REG_S1: return systime->local_time.second % 10;
68      case MSM6242_REG_S10: return systime->local_time.second / 10;
69      case MSM6242_REG_MI1: return systime->local_time.minute % 10;
70      case MSM6242_REG_MI10: return systime->local_time.minute / 10;
71      case MSM6242_REG_H1:
72      case MSM6242_REG_H10:
5473      {
5574         int   hour = systime->local_time.hour;
5675
5776         /* check for 12/24 hour mode */
58         if ( (msm6264_reg[2] & 0x04) == 0 ) /* 12 hour mode? */
77         if ((msm6242->reg[2] & 0x04) == 0) /* 12 hour mode? */
5978         {
6079            hour %= 12;
6180
r2512r2513
6382            hour = 12;
6483         }
6584
66         if ( offset == MSM6264_REG_H1 )
85         if ( offset == MSM6242_REG_H1 )
6786            return hour % 10;
6887
6988         return hour / 10;
7089      }
7190
72      case MSM6264_REG_D1: return systime->local_time.mday % 10;
73      case MSM6264_REG_D10: return systime->local_time.mday / 10;
74      case MSM6264_REG_MO1: return (systime->local_time.month+1) % 10;
75      case MSM6264_REG_MO10: return (systime->local_time.month+1) / 10;
76      case MSM6264_REG_Y1: return systime->local_time.year % 10;
77      case MSM6264_REG_Y10: return (systime->local_time.year % 100) / 10;
78      case MSM6264_REG_W: return systime->local_time.weekday;
79      case MSM6264_REG_CD: return msm6264_reg[0];
80      case MSM6264_REG_CE: return msm6264_reg[1];
81      case MSM6264_REG_CF: return msm6264_reg[2];
91      case MSM6242_REG_D1: return systime->local_time.mday % 10;
92      case MSM6242_REG_D10: return systime->local_time.mday / 10;
93      case MSM6242_REG_MO1: return (systime->local_time.month+1) % 10;
94      case MSM6242_REG_MO10: return (systime->local_time.month+1) / 10;
95      case MSM6242_REG_Y1: return systime->local_time.year % 10;
96      case MSM6242_REG_Y10: return (systime->local_time.year % 100) / 10;
97      case MSM6242_REG_W: return systime->local_time.weekday;
98      case MSM6242_REG_CD: return msm6242->reg[0];
99      case MSM6242_REG_CE: return msm6242->reg[1];
100      case MSM6242_REG_CF: return msm6242->reg[2];
82101   }
83102
84   logerror("%04x: MSM6242 unmapped offset %02X read\n",activecpu_get_pc(),offset);
103   logerror("%04x: MSM6242 unmapped offset %02x read\n", activecpu_get_pc(), offset);
85104   return 0;
86105}
87106
88WRITE8_HANDLER( msm6242_w )
107
108WRITE8_DEVICE_HANDLER( msm6242_w )
89109{
110   msm6242_t *msm6242 = get_safe_token(device);
111
90112   switch(offset)
91113   {
92      case MSM6264_REG_CD:
114      case MSM6242_REG_CD:
93115      {
94          msm6264_reg[0] = data;
116         msm6242->reg[0] = data;
95117
96          if ( data & 1 )   /* was Hold set? */
97          {
98             mame_get_current_datetime(machine, &msm6264_hold_time);
99          }
118         if (data & 1)   /* was Hold set? */
119         {
120            mame_get_current_datetime(device->machine, &msm6242->hold_time);
121         }
100122
101          return;
123         return;
102124      }
103125
104      case MSM6264_REG_CE: msm6264_reg[1] = data; return;
126      case MSM6242_REG_CE: msm6242->reg[1] = data; return;
105127
106      case MSM6264_REG_CF:
128      case MSM6242_REG_CF:
107129      {
108130         /* the 12/24 mode bit can only be changed while REST is 1 */
109         if ( (data ^ msm6264_reg[2]) & 0x04 )
131         if ((data ^ msm6242->reg[2]) & 0x04)
110132         {
111            if ( msm6264_reg[2] & 1 )
112               msm6264_reg[2] = data;
133            if (msm6242->reg[2] & 1)
134               msm6242->reg[2] = data;
113135         }
114136         else
115137         {
116            msm6264_reg[2] = data;
138            msm6242->reg[2] = data;
117139         }
118140         return;
119141      }
120142   }
121143
122   logerror("%04x: MSM6242 unmapped offset %02X written with %02X\n",activecpu_get_pc(),offset,data);
144   logerror("%04x: MSM6242 unmapped offset %02x written with %02x\n", activecpu_get_pc(), offset, data);
123145}
124146
125147
148static DEVICE_START( msm6242 )
149{
150   msm6242_t *msm6242 = get_safe_token(device);
151
152   msm6242->reg[0] = 0;
153   msm6242->reg[1] = 0;
154   msm6242->reg[2] = 0;
155   memset(&msm6242->hold_time, 0, sizeof(mame_system_time));
156}
157
158
159static DEVICE_SET_INFO( msm6242 )
160{
161   switch (state)
162   {
163      /* no parameters to set */
164   }
165}
166
167
168DEVICE_GET_INFO( msm6242 )
169{
170   switch (state)
171   {
172      /* --- the following bits of info are returned as 64-bit signed integers --- */
173      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(msm6242_t);            break;
174      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
175      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_TIMER;            break;
176
177      /* --- the following bits of info are returned as pointers to data or functions --- */
178      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(msm6242); break;
179      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(msm6242);   break;
180      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
181      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
182
183      /* --- the following bits of info are returned as NULL-terminated strings --- */
184      case DEVINFO_STR_NAME:                     info->s = "OKI MSM6242";               break;
185      case DEVINFO_STR_FAMILY:                  info->s = "MSM6242 RTC";               break;
186      case DEVINFO_STR_VERSION:                  info->s = "1.00";                     break;
187      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
188      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
189   }
190}
191
192
193
194
195
196#if 0
126197READ16_HANDLER( msm6242_lsb_r )
127198{
128199   return msm6242_r(machine, offset);
r2512r2513
133204   if (ACCESSING_BITS_0_7)
134205      msm6242_w(machine, offset, data);
135206}
207#endif
src/emu/machine/msm6242.h
r2512r2513
1#ifndef MSM6242_INCLUDE
2#define MSM6242_INCLUDE
1/***************************************************************************
32
4READ8_HANDLER( msm6242_r );
5WRITE8_HANDLER( msm6242_w );
3    MSM6242 Real Time Clock
64
7READ16_HANDLER( msm6242_lsb_r );
8WRITE16_HANDLER( msm6242_lsb_w );
5    Copyright Nicola Salmoria and the MAME Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
97
10#endif
8***************************************************************************/
9
10#pragma once
11
12#ifndef __MSM6242_H__
13#define __MSM6242_H__
14
15
16#define MSM6242      DEVICE_GET_INFO_NAME(msm6242)
17
18
19/* device interface */
20DEVICE_GET_INFO( msm6242 );
21
22READ8_DEVICE_HANDLER( msm6242_r );
23WRITE8_DEVICE_HANDLER( msm6242_w );
24
25
26#endif /* __MSM6242_H__ */
src/mess/devices/coco_fdc.c
r2512r2513
398398   {
399399      case 0x10:   /* FF50 */
400400         if (real_time_clock() == RTC_DISTO)
401            result = msm6242_r(machine, msm6242_rtc_address);
401         {
402            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
403            result = msm6242_r(dev, msm6242_rtc_address);
404         }
402405         break;
403406
404407      case 0x38:   /* FF78 */
r2512r2513
447450   {
448451      case 0x10:   /* FF50 */
449452         if (real_time_clock() == RTC_DISTO)
450            msm6242_w(machine, msm6242_rtc_address, data);
453         {
454            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
455            msm6242_w(dev, msm6242_rtc_address, data);
456         }
451457         break;
452458
453459      case 0x11:   /* FF51 */
src/mess/machine/coupe.c
r2512r2513
150150
151151static READ8_HANDLER( coupe_rtc_r )
152152{
153   return msm6242_r(machine, offset >> 12);
153   const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "sambus_clock");
154   return msm6242_r(rtc, offset >> 12);
154155}
155156
156157
157158static WRITE8_HANDLER( coupe_rtc_w )
158159{
159   msm6242_w(machine, offset >> 12, data);
160   const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "sambus_clock");
161   msm6242_w(rtc, offset >> 12, data);
160162}
161163
162164
src/mess/drivers/coco.c
r2512r2513
1313#include "driver.h"
1414#include "machine/6821pia.h"
1515#include "video/m6847.h"
16#include "machine/msm6242.h"
1617#include "machine/6883sam.h"
1718#include "includes/coco.h"
1819#include "devices/basicdsk.h"
r2512r2513
793794   /* snapshot/quickload */
794795   MDRV_SNAPSHOT_ADD(coco_pak, "pak", 0)
795796   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
797
798   /* devices */
799   MDRV_DEVICE_ADD("disto", MSM6242)
796800MACHINE_DRIVER_END
797801
798802static MACHINE_DRIVER_START( coco2 )
r2512r2513
820824   /* snapshot/quickload */
821825   MDRV_SNAPSHOT_ADD(coco_pak, "pak", 0)
822826   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
827
828   /* devices */
829   MDRV_DEVICE_ADD("disto", MSM6242)
823830MACHINE_DRIVER_END
824831
825832static MACHINE_DRIVER_START( coco2b )
r2512r2513
847854   /* snapshot/quickload */
848855   MDRV_SNAPSHOT_ADD(coco_pak, "pak", 0)
849856   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
857
858   /* devices */
859   MDRV_DEVICE_ADD("disto", MSM6242)
850860MACHINE_DRIVER_END
851861
852862static MACHINE_DRIVER_START( coco3 )
r2512r2513
886896
887897   /* devices */
888898   MDRV_DEVICE_ADD("vhd", COCO_VHD)
899   MDRV_DEVICE_ADD("disto", MSM6242)
889900MACHINE_DRIVER_END
890901
891902static MACHINE_DRIVER_START( coco3p )
src/mess/drivers/amiga.c
r2512r2513
3535
3636
3737/***************************************************************************
38  Battery Backed-Up Clock (MSM6264)
39***************************************************************************/
40static READ16_HANDLER( amiga_clock_r ) { return msm6242_r( machine, offset / 2 ); }
41static WRITE16_HANDLER( amiga_clock_w ) { msm6242_w( machine, offset / 2, data ); }
42
43/***************************************************************************
4438  Address maps
4539***************************************************************************/
4640
r2512r2513
211205   MDRV_VIDEO_START(amiga)
212206   MDRV_VIDEO_UPDATE(amiga)
213207
208   /* devices */
209   MDRV_DEVICE_ADD("rtc", MSM6242)
210
214211   /* sound hardware */
215212   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
216213
r2512r2513
264261
265262***************************************************************************/
266263
264
267265static UINT8 amiga_cia_0_portA_r( void )
268266{
269267   UINT8 ret = input_port_read(Machine, "CIA0PORTA") & 0xc0;   /* Gameport 1 and 0 buttons */
r2512r2513
338336   }
339337}
340338
339
340/***************************************************************************
341  Battery Backed-Up Clock (MSM6264)
342***************************************************************************/
343
344static READ16_HANDLER( amiga_clock_r )
345{
346   const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "rtc");
347   return msm6242_r(rtc, offset / 2);
348}
349
350
351static WRITE16_HANDLER( amiga_clock_w )
352{
353   const device_config *rtc = device_list_find_by_tag(machine->config->devicelist, MSM6242, "rtc");
354   msm6242_w(rtc, offset / 2, data);
355}
356
357
341358static void amiga_reset(void)
342359{
343360   if (input_port_read(Machine, "hardware") & 0x08)
src/mess/drivers/coupe.c
r2512r2513
6060#include "machine/wd17xx.h"
6161#include "sound/saa1099.h"
6262#include "sound/speaker.h"
63#include "machine/msm6242.h"
6364
6465/* devices */
6566#include "devices/mflopimg.h"
r2512r2513
515516   MDRV_VIDEO_UPDATE(coupe)
516517   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
517518
519   /* devices */
520   MDRV_DEVICE_ADD("sambus_clock", MSM6242)
521
518522   /* sound hardware */
519523   MDRV_SPEAKER_STANDARD_MONO("mono")
520524   MDRV_SOUND_ADD(SPEAKER, 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team