Previous 15994 Revisions Next

r15952 Saturday 18th August, 2012 at 08:05:54 UTC by Miodrag Milanović
Sync with MAME r17325 (nw)
[src/emu]audit.c audit.h
[src/emu/debug]debugcon.c
[src/emu/machine]msm6242.c
[src/mame/drivers]gyruss.c hng64.c
[src/mame/includes]hng64.h

src/mame/includes/hng64.h
r15951r15952
1#include "machine/msm6242.h"
2
13#define FIGHT_MCU  1
24#define SHOOT_MCU  2
35#define RACING_MCU 3
r15951r15952
911   hng64_state(const machine_config &mconfig, device_type type, const char *tag)
1012      : driver_device(mconfig, type, tag),
1113      m_maincpu(*this, "maincpu"),
14      m_rtc(*this, "rtc"),
1215      m_mainram(*this, "mainram"),
1316      m_cart(*this, "cart"),
1417      m_sysregs(*this, "sysregs"),
r15951r15952
2730      m_com_mmu_mem(*this, "com_mmu_mem"){ }
2831
2932   required_device<cpu_device> m_maincpu;
33   required_device<msm6242_device> m_rtc;
3034   required_shared_ptr<UINT32> m_mainram;
3135   required_shared_ptr<UINT32> m_cart;
3236   required_shared_ptr<UINT32> m_sysregs;
r15951r15952
6771
6872   UINT32 m_activeBuffer;
6973   UINT32 m_no_machine_error_code;
70   int m_interrupt_level_request;
7174
7275   UINT32 m_unk_vreg_toggle;
7376   UINT32 m_p1_trig;
r15951r15952
168171   DECLARE_DRIVER_INIT(ss64);
169172   DECLARE_DRIVER_INIT(hng64_fght);
170173   DECLARE_DRIVER_INIT(hng64_reorder_gfx);
174
175   void m_set_irq(UINT32 irq_vector);
176   UINT32 m_irq_pending;
177   int m_irq_level;
171178};
172179
173180
src/mame/drivers/hng64.c
r15951r15952
525525
526526READ32_MEMBER(hng64_state::hng64_sysregs_r)
527527{
528   system_time systime;
528   UINT16 rtc_addr;
529529
530   machine().base_datetime(systime);
531
532530#if 0
533531   if((offset*4) != 0x1084)
534532      printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(&space.device()), offset*4);
535533#endif
536534
535   rtc_addr = offset >> 1;
536
537   if((rtc_addr & 0xff0) == 0x420)
538   {
539      if((rtc_addr & 0xf) == 0xd)
540         return m_rtc->read(space, (rtc_addr) & 0xf) | 0x10; // bit 4 disables "system log reader"
541
542      return m_rtc->read(space, (rtc_addr) & 0xf);
543   }
544
537545   switch(offset*4)
538546   {
539547      case 0x001c: return machine().rand(); // hng64 hangs on start-up if zero.
r15951r15952
541549      //case 0x107c:
542550      case 0x1084: return 0x00000002; //MCU->MIPS latch port
543551      //case 0x108c:
544      case 0x1104: return m_interrupt_level_request;
552      case 0x1104: return m_irq_level;
553      case 0x111c:
554         printf("Read to IRQ ACK?\n");
555         break;
545556      case 0x1254: return 0x00000000; //dma status, 0x800
546      /* 4-bit RTC */
547      case 0x2104: return (systime.local_time.second % 10);
548      case 0x210c: return (systime.local_time.second / 10);
549      case 0x2114: return (systime.local_time.minute % 10);
550      case 0x211c: return (systime.local_time.minute / 10);
551      case 0x2124: return (systime.local_time.hour % 10);
552      case 0x212c: return (systime.local_time.hour / 10);
553      case 0x2134: return (systime.local_time.mday % 10);
554      case 0x213c: return (systime.local_time.mday / 10);
555      case 0x2144: return ((systime.local_time.month+1) % 10);
556      case 0x214c: return ((systime.local_time.month+1) / 10);
557      case 0x2154: return (systime.local_time.year%10);
558      case 0x215c: return ((systime.local_time.year%100)/10);
559      case 0x2164: return (systime.local_time.weekday);
560
561      case 0x216c: return 0x00000010; //disables "system log reader"
562
563      case 0x217c: return 0; //RTC status?
564557   }
565558
566559//  printf("%08x\n",offset*4);
r15951r15952
602595
603596WRITE32_MEMBER(hng64_state::hng64_sysregs_w)
604597{
605
606598   COMBINE_DATA (&m_sysregs[offset]);
607599
600   if(((offset >> 1) & 0xff0) == 0x420)
601   {
602      m_rtc->write(space, (offset >> 1) & 0xf,data);
603      return;
604   }
605
608606#if 0
609   if(((offset*4) & 0x1200) == 0x1200)
607   if(((offset*4) & 0xff00) == 0x1100)
610608      printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
611609#endif
612610
613611   switch(offset*4)
614612   {
615      //case 0x100c: *DOCUMENT*
616
617613      case 0x1084: //MIPS->MCU latch port
618614         m_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such?
619615         //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
620616         break;
621      case 0x111c: /*irq ack */ break;
617      //0x110c global irq mask?
618      /* irq ack */
619      case 0x111c: m_irq_pending &= ~m_sysregs[offset]; m_set_irq(0x0000); break;
622620      case 0x1204: m_dma_start = m_sysregs[offset]; break;
623621      case 0x1214: m_dma_dst = m_sysregs[offset]; break;
624622      case 0x1224:
r15951r15952
626624         hng64_do_dma(&space);
627625         break;
628626      //default:
629         //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
627      //   printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
630628   }
631629}
632630
r15951r15952
730728/* Roads Edge / Xtreme Rally */
731729READ32_MEMBER(hng64_state::racing_io_r)
732730{
733
734731   switch (offset*4)
735732   {
736733        case 0x000:
r15951r15952
13681365   AM_RANGE(0xf0000, 0xfffff) AM_RAMBANK("bank1")
13691366ADDRESS_MAP_END
13701367
1368static ADDRESS_MAP_START( hng_sound_io, AS_IO, 16, hng64_state )
1369   AM_RANGE(0xc002, 0xc003) AM_NOP // buriki one fills the log, wants 0xffff
1370ADDRESS_MAP_END
13711371
13721372static INPUT_PORTS_START( hng64 )
13731373   PORT_START("VBLANK")
r15951r15952
17131713   16384            /* data cache size */
17141714};
17151715
1716void hng64_state::m_set_irq(UINT32 irq_vector)
1717{
1718   /*
1719      TODO:
1720      - irq sources;
1721      - irq priority;
1722      - is there an irq mask mechanism?
1723      - is irq level cleared too when the irq acks?
17161724
1725      This is written with irqs DISABLED
1726      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000001. (PC=80009b54) 0 vblank irq
1727      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000002. (PC=80009b5c) 1
1728      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000004. (PC=80009b64) 2
1729      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000008. (PC=80009b6c) 3 (actually this is cleared even if it isn't fired?)
1730      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000200. (PC=80009b70) 9
1731      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000400. (PC=80009b78) 10
1732      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00020000. (PC=80009b80) 17
1733      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000800. (PC=80009b88) 11 network irq? needed by xrally and roadedge
1734
1735      samsho64 / samsho64_2 does this during running:
1736      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000000. (PC=800008fc) just checking?
1737      HNG64 writing to SYSTEM Registers 0x0000111c == 0x00000040. (PC=800008fc) <- most notably causes TLBL error in fatfurwa
1738   */
1739
1740   m_irq_pending |= irq_vector;
1741
1742   if(m_irq_pending)
1743   {
1744      int i;
1745      for(i=0;i<31;i++)
1746      {
1747         if(m_irq_pending & 1 << i)
1748         {
1749            m_irq_level = i;
1750            break;
1751         }
1752      }
1753
1754      device_set_input_line(m_maincpu, 0, ASSERT_LINE);
1755   }
1756   else
1757      device_set_input_line(m_maincpu, 0, CLEAR_LINE);
1758}
1759
17171760static TIMER_DEVICE_CALLBACK( hng64_irq )
17181761{
17191762   hng64_state *state = timer.machine().driver_data<hng64_state>();
17201763   int scanline = param;
1721   int irq_fired,irq_type;
17221764
1723   irq_fired = irq_type = 0;
1724
1725   /* there are more, the sources are unknown at the moment */
17261765   switch(scanline)
17271766   {
1728      case 224*2:   state->m_interrupt_level_request = 0; irq_fired = 1; irq_type = 1; break;
1729      case 0*2: state->m_interrupt_level_request = 1; irq_fired = 1; irq_type = 1; break;
1730      case 64*2: state->m_interrupt_level_request = 2; irq_fired = 1; irq_type = 1; break;
1731      case 128*2:  state->m_interrupt_level_request = 11; irq_fired = 1; irq_type = 1; break;
1732      case (0+1)*2:
1733      case (224+1)*2:
1734      case (64+1)*2:
1735      case (128+1)*2:
1736         irq_fired = 1; irq_type = 0; break;
1767      case 224*2:   state->m_set_irq(0x0001);  break; // lv 0 vblank irq
1768      //case 0*2:   state->m_set_irq(0x0002);  break; // lv 1
1769      //case 64*2:  state->m_set_irq(0x0004);  break; // lv 2
1770      case 128*2: state->m_set_irq(0x0800);  break; // lv 11 network irq?
17371771   }
1738
1739   if(irq_fired)
1740      device_set_input_line(state->m_maincpu, 0, (irq_type) ? ASSERT_LINE : CLEAR_LINE);
17411772}
17421773
17431774
r15951r15952
17911822   state->m_mcu_en = 0;
17921823}
17931824
1825
1826static MSM6242_INTERFACE( hng64_rtc_intf )
1827{
1828   DEVCB_NULL
1829};
1830
17941831static MACHINE_CONFIG_START( hng64, hng64_state )
17951832
17961833   /* basic machine hardware */
r15951r15952
18011838
18021839   MCFG_CPU_ADD("audiocpu", V33, 8000000)            // v53, 16? mhz!
18031840   MCFG_CPU_PROGRAM_MAP(hng_sound_map)
1841   MCFG_CPU_IO_MAP(hng_sound_io)
18041842
18051843   MCFG_CPU_ADD("comm", Z80,MASTER_CLOCK/4)      /* KL5C80A12CFP - binary compatible with Z80. */
18061844   MCFG_CPU_PROGRAM_MAP(hng_comm_map)
18071845   MCFG_CPU_IO_MAP(hng_comm_io_map)
18081846
18091847   MCFG_NVRAM_ADD_0FILL("nvram")
1848   MCFG_MSM6242_ADD("rtc", hng64_rtc_intf)
18101849
18111850   MCFG_GFXDECODE(hng64)
18121851   MCFG_MACHINE_START(hyperneo)
src/mame/drivers/gyruss.c
r15951r15952
185185
186186static ADDRESS_MAP_START( main_cpu2_map, AS_PROGRAM, 8, gyruss_state )
187187   AM_RANGE(0x0000, 0x0000) AM_READ(gyruss_scanline_r)
188   AM_RANGE(0x2000, 0x2000) AM_WRITE(slave_irq_mask_w)
188   AM_RANGE(0x2000, 0x2000) AM_WRITE(slave_irq_mask_w) AM_READNOP
189189   AM_RANGE(0x4000, 0x403f) AM_RAM
190190   AM_RANGE(0x4040, 0x40ff) AM_RAM_WRITE(gyruss_spriteram_w) AM_SHARE("spriteram")
191191   AM_RANGE(0x4100, 0x47ff) AM_RAM
src/emu/debug/debugcon.c
r15951r15952
9595      return;
9696
9797   /* print the opening lines */
98   debug_console_printf(machine, "MAME new debugger version %s\n", build_version);
98   debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), build_version);
9999   debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description);
100100
101101   /* request callback upon exiting */
src/emu/audit.c
r15951r15952
100100
101101         for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
102102         {
103            const char *name = ROM_GETNAME(rom);
103104            hash_collection hashes(ROM_GETHASHDATA(rom));
104            device_t *shared_device = find_shared_device(*device, hashes, ROM_GETLENGTH(rom));
105            device_t *shared_device = find_shared_device(*device, name, hashes, ROM_GETLENGTH(rom));
105106
106107            // count the number of files with hashes
107108            if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom))
r15951r15952
123124            if (record != NULL)
124125            {
125126               // count the number of files that are found.
126               if (record->status() == audit_record::STATUS_GOOD || (record->status() == audit_record::STATUS_FOUND_INVALID && find_shared_device(*device, record->actual_hashes(), record->actual_length()) == NULL))
127               if (record->status() == audit_record::STATUS_GOOD || (record->status() == audit_record::STATUS_FOUND_INVALID && find_shared_device(*device, name, record->actual_hashes(), record->actual_length()) == NULL))
127128               {
128129                  found++;
129130                  if (shared_device != NULL)
r15951r15952
487488//  shares a media entry with the same hashes
488489//-------------------------------------------------
489490
490device_t *media_auditor::find_shared_device(device_t &device, const hash_collection &romhashes, UINT64 romlength)
491device_t *media_auditor::find_shared_device(device_t &device, const char *name, const hash_collection &romhashes, UINT64 romlength)
491492{
492   // doesn't apply to NO_DUMP items
493   if (romhashes.flag(hash_collection::FLAG_NO_DUMP))
494      return NULL;
493   bool dumped = !romhashes.flag(hash_collection::FLAG_NO_DUMP);
495494
496495   // special case for non-root devices
497496   device_t *highest_device = NULL;
r15951r15952
502501            if (ROM_GETLENGTH(rom) == romlength)
503502            {
504503               hash_collection hashes(ROM_GETHASHDATA(rom));
505               if (hashes == romhashes)
504               if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
506505                  highest_device = &device;
507506            }
508507   }
r15951r15952
518517                  if (ROM_GETLENGTH(rom) == romlength)
519518                  {
520519                     hash_collection hashes(ROM_GETHASHDATA(rom));
521                     if (hashes == romhashes)
520                     if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
522521                        highest_device = scandevice;
523522                  }
524523      }
src/emu/audit.h
r15951r15952
184184   audit_record *audit_one_rom(const rom_entry *rom);
185185   audit_record *audit_one_disk(const rom_entry *rom);
186186   void compute_status(audit_record &record, const rom_entry *rom, bool found);
187   device_t *find_shared_device(device_t &device, const hash_collection &romhashes, UINT64 romlength);
187   device_t *find_shared_device(device_t &device, const char *name, const hash_collection &romhashes, UINT64 romlength);
188188
189189   // internal state
190190   simple_list<audit_record>   m_record_list;
src/emu/machine/msm6242.c
r15951r15952
11/***************************************************************************
22
3    MSM6242 Real Time Clock
3    MSM6242 / Epson RTC 62421 / 62423 Real Time Clock
44
55    TODO:
66    - HOLD mechanism
7    - IRQ ACK
8    - why skns tries to read uninitialized registers?
7    - IRQs are grossly mapped
8    - STOP / RESET mechanism
9    - why skns.c games try to read uninitialized registers?
910
1011***************************************************************************/
1112
r15951r15952
250251   {
251252      case MSM6242_REG_CD:
252253      {
254         /*
255         x--- 30s ADJ
256         -x-- IRQ FLAG
257         --x- BUSY
258         ---x HOLD
259         */
260
253261         m_reg[0] = data & 0x0f;
254262
255263         #if 0
r15951r15952
269277      }
270278
271279      case MSM6242_REG_CE:
272      m_reg[1] = data & 0x0f;
273      if((data & 3) == 0) // MASK & STD = 0
274280      {
275         m_irq_flag = 1;
276         m_irq_type = (data & 0xc) >> 2;
277         //m_std_timer->adjust(attotime::from_msec(timer_param[(data & 0xc) >> 2]), 0, attotime::from_msec(timer_param[(data & 0xc) >> 2]));
278      }
279      else
280      {
281         m_irq_flag = 0;
282         if ( !m_out_int_func.isnull() )
283            m_out_int_func( CLEAR_LINE );
284      }
281         /*
282         xx-- t0,t1 (timing irq)
283         --x- STD
284         ---x MASK
285         */
285286
286      return;
287
288      case MSM6242_REG_CF:
289      {
290         /* the 12/24 mode bit can only be changed while REST is 1 */
291         if ((data ^ m_reg[2]) & 0x04)
287         m_reg[1] = data & 0x0f;
288         if((data & 3) == 0) // MASK & STD = 0
292289         {
293            m_reg[2] = (m_reg[2] & 0x04) | (data & ~0x04);
294
295            if (m_reg[2] & 1)
296               m_reg[2] = (m_reg[2] & ~0x04) | (data & 0x04);
290            m_irq_flag = 1;
291            m_irq_type = (data & 0xc) >> 2;
292            //m_std_timer->adjust(attotime::from_msec(timer_param[(data & 0xc) >> 2]), 0, attotime::from_msec(timer_param[(data & 0xc) >> 2]));
297293         }
298294         else
299295         {
300            m_reg[2] = data & 0x0f;
296            m_irq_flag = 0;
297            if ( !m_out_int_func.isnull() )
298               m_out_int_func( CLEAR_LINE );
301299         }
300
302301         return;
303302      }
303
304      case MSM6242_REG_CF:
305      {
306         /*
307         x--- TEST
308         -x-- 24/12
309         --x- STOP
310         ---x RESET
311         */
312
313         /* the 12/24 mode bit can only be changed when RESET does a 1 -> 0 transition */
314         if (((data & 0x01) == 0x00) && (m_reg[2] & 0x01))
315            m_reg[2] = (m_reg[2] & ~0x04) | (data & 0x04);
316         else
317            m_reg[2] = (data & 0x0b) | (m_reg[2] & 4);
318
319         return;
320      }
304321   }
305322
306323   logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", machine().describe_context(), offset, data);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team