src/mame/drivers/hng64.c
| r15951 | r15952 | |
| 525 | 525 | |
| 526 | 526 | READ32_MEMBER(hng64_state::hng64_sysregs_r) |
| 527 | 527 | { |
| 528 | | system_time systime; |
| 528 | UINT16 rtc_addr; |
| 529 | 529 | |
| 530 | | machine().base_datetime(systime); |
| 531 | | |
| 532 | 530 | #if 0 |
| 533 | 531 | if((offset*4) != 0x1084) |
| 534 | 532 | printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(&space.device()), offset*4); |
| 535 | 533 | #endif |
| 536 | 534 | |
| 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 | |
| 537 | 545 | switch(offset*4) |
| 538 | 546 | { |
| 539 | 547 | case 0x001c: return machine().rand(); // hng64 hangs on start-up if zero. |
| r15951 | r15952 | |
| 541 | 549 | //case 0x107c: |
| 542 | 550 | case 0x1084: return 0x00000002; //MCU->MIPS latch port |
| 543 | 551 | //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; |
| 545 | 556 | 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? |
| 564 | 557 | } |
| 565 | 558 | |
| 566 | 559 | // printf("%08x\n",offset*4); |
| r15951 | r15952 | |
| 602 | 595 | |
| 603 | 596 | WRITE32_MEMBER(hng64_state::hng64_sysregs_w) |
| 604 | 597 | { |
| 605 | | |
| 606 | 598 | COMBINE_DATA (&m_sysregs[offset]); |
| 607 | 599 | |
| 600 | if(((offset >> 1) & 0xff0) == 0x420) |
| 601 | { |
| 602 | m_rtc->write(space, (offset >> 1) & 0xf,data); |
| 603 | return; |
| 604 | } |
| 605 | |
| 608 | 606 | #if 0 |
| 609 | | if(((offset*4) & 0x1200) == 0x1200) |
| 607 | if(((offset*4) & 0xff00) == 0x1100) |
| 610 | 608 | printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device())); |
| 611 | 609 | #endif |
| 612 | 610 | |
| 613 | 611 | switch(offset*4) |
| 614 | 612 | { |
| 615 | | //case 0x100c: *DOCUMENT* |
| 616 | | |
| 617 | 613 | case 0x1084: //MIPS->MCU latch port |
| 618 | 614 | m_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such? |
| 619 | 615 | //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device())); |
| 620 | 616 | 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; |
| 622 | 620 | case 0x1204: m_dma_start = m_sysregs[offset]; break; |
| 623 | 621 | case 0x1214: m_dma_dst = m_sysregs[offset]; break; |
| 624 | 622 | case 0x1224: |
| r15951 | r15952 | |
| 626 | 624 | hng64_do_dma(&space); |
| 627 | 625 | break; |
| 628 | 626 | //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())); |
| 630 | 628 | } |
| 631 | 629 | } |
| 632 | 630 | |
| r15951 | r15952 | |
| 730 | 728 | /* Roads Edge / Xtreme Rally */ |
| 731 | 729 | READ32_MEMBER(hng64_state::racing_io_r) |
| 732 | 730 | { |
| 733 | | |
| 734 | 731 | switch (offset*4) |
| 735 | 732 | { |
| 736 | 733 | case 0x000: |
| r15951 | r15952 | |
| 1368 | 1365 | AM_RANGE(0xf0000, 0xfffff) AM_RAMBANK("bank1") |
| 1369 | 1366 | ADDRESS_MAP_END |
| 1370 | 1367 | |
| 1368 | static 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 |
| 1370 | ADDRESS_MAP_END |
| 1371 | 1371 | |
| 1372 | 1372 | static INPUT_PORTS_START( hng64 ) |
| 1373 | 1373 | PORT_START("VBLANK") |
| r15951 | r15952 | |
| 1713 | 1713 | 16384 /* data cache size */ |
| 1714 | 1714 | }; |
| 1715 | 1715 | |
| 1716 | void 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? |
| 1716 | 1724 | |
| 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 | |
| 1717 | 1760 | static TIMER_DEVICE_CALLBACK( hng64_irq ) |
| 1718 | 1761 | { |
| 1719 | 1762 | hng64_state *state = timer.machine().driver_data<hng64_state>(); |
| 1720 | 1763 | int scanline = param; |
| 1721 | | int irq_fired,irq_type; |
| 1722 | 1764 | |
| 1723 | | irq_fired = irq_type = 0; |
| 1724 | | |
| 1725 | | /* there are more, the sources are unknown at the moment */ |
| 1726 | 1765 | switch(scanline) |
| 1727 | 1766 | { |
| 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? |
| 1737 | 1771 | } |
| 1738 | | |
| 1739 | | if(irq_fired) |
| 1740 | | device_set_input_line(state->m_maincpu, 0, (irq_type) ? ASSERT_LINE : CLEAR_LINE); |
| 1741 | 1772 | } |
| 1742 | 1773 | |
| 1743 | 1774 | |
| r15951 | r15952 | |
| 1791 | 1822 | state->m_mcu_en = 0; |
| 1792 | 1823 | } |
| 1793 | 1824 | |
| 1825 | |
| 1826 | static MSM6242_INTERFACE( hng64_rtc_intf ) |
| 1827 | { |
| 1828 | DEVCB_NULL |
| 1829 | }; |
| 1830 | |
| 1794 | 1831 | static MACHINE_CONFIG_START( hng64, hng64_state ) |
| 1795 | 1832 | |
| 1796 | 1833 | /* basic machine hardware */ |
| r15951 | r15952 | |
| 1801 | 1838 | |
| 1802 | 1839 | MCFG_CPU_ADD("audiocpu", V33, 8000000) // v53, 16? mhz! |
| 1803 | 1840 | MCFG_CPU_PROGRAM_MAP(hng_sound_map) |
| 1841 | MCFG_CPU_IO_MAP(hng_sound_io) |
| 1804 | 1842 | |
| 1805 | 1843 | MCFG_CPU_ADD("comm", Z80,MASTER_CLOCK/4) /* KL5C80A12CFP - binary compatible with Z80. */ |
| 1806 | 1844 | MCFG_CPU_PROGRAM_MAP(hng_comm_map) |
| 1807 | 1845 | MCFG_CPU_IO_MAP(hng_comm_io_map) |
| 1808 | 1846 | |
| 1809 | 1847 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 1848 | MCFG_MSM6242_ADD("rtc", hng64_rtc_intf) |
| 1810 | 1849 | |
| 1811 | 1850 | MCFG_GFXDECODE(hng64) |
| 1812 | 1851 | MCFG_MACHINE_START(hyperneo) |
src/emu/audit.c
| r15951 | r15952 | |
| 100 | 100 | |
| 101 | 101 | for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) |
| 102 | 102 | { |
| 103 | const char *name = ROM_GETNAME(rom); |
| 103 | 104 | 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)); |
| 105 | 106 | |
| 106 | 107 | // count the number of files with hashes |
| 107 | 108 | if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom)) |
| r15951 | r15952 | |
| 123 | 124 | if (record != NULL) |
| 124 | 125 | { |
| 125 | 126 | // 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)) |
| 127 | 128 | { |
| 128 | 129 | found++; |
| 129 | 130 | if (shared_device != NULL) |
| r15951 | r15952 | |
| 487 | 488 | // shares a media entry with the same hashes |
| 488 | 489 | //------------------------------------------------- |
| 489 | 490 | |
| 490 | | device_t *media_auditor::find_shared_device(device_t &device, const hash_collection &romhashes, UINT64 romlength) |
| 491 | device_t *media_auditor::find_shared_device(device_t &device, const char *name, const hash_collection &romhashes, UINT64 romlength) |
| 491 | 492 | { |
| 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); |
| 495 | 494 | |
| 496 | 495 | // special case for non-root devices |
| 497 | 496 | device_t *highest_device = NULL; |
| r15951 | r15952 | |
| 502 | 501 | if (ROM_GETLENGTH(rom) == romlength) |
| 503 | 502 | { |
| 504 | 503 | hash_collection hashes(ROM_GETHASHDATA(rom)); |
| 505 | | if (hashes == romhashes) |
| 504 | if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name)) |
| 506 | 505 | highest_device = &device; |
| 507 | 506 | } |
| 508 | 507 | } |
| r15951 | r15952 | |
| 518 | 517 | if (ROM_GETLENGTH(rom) == romlength) |
| 519 | 518 | { |
| 520 | 519 | hash_collection hashes(ROM_GETHASHDATA(rom)); |
| 521 | | if (hashes == romhashes) |
| 520 | if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name)) |
| 522 | 521 | highest_device = scandevice; |
| 523 | 522 | } |
| 524 | 523 | } |
src/emu/machine/msm6242.c
| r15951 | r15952 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | MSM6242 Real Time Clock |
| 3 | MSM6242 / Epson RTC 62421 / 62423 Real Time Clock |
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | 6 | - 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? |
| 9 | 10 | |
| 10 | 11 | ***************************************************************************/ |
| 11 | 12 | |
| r15951 | r15952 | |
| 250 | 251 | { |
| 251 | 252 | case MSM6242_REG_CD: |
| 252 | 253 | { |
| 254 | /* |
| 255 | x--- 30s ADJ |
| 256 | -x-- IRQ FLAG |
| 257 | --x- BUSY |
| 258 | ---x HOLD |
| 259 | */ |
| 260 | |
| 253 | 261 | m_reg[0] = data & 0x0f; |
| 254 | 262 | |
| 255 | 263 | #if 0 |
| r15951 | r15952 | |
| 269 | 277 | } |
| 270 | 278 | |
| 271 | 279 | case MSM6242_REG_CE: |
| 272 | | m_reg[1] = data & 0x0f; |
| 273 | | if((data & 3) == 0) // MASK & STD = 0 |
| 274 | 280 | { |
| 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 | */ |
| 285 | 286 | |
| 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 |
| 292 | 289 | { |
| 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])); |
| 297 | 293 | } |
| 298 | 294 | else |
| 299 | 295 | { |
| 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 ); |
| 301 | 299 | } |
| 300 | |
| 302 | 301 | return; |
| 303 | 302 | } |
| 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 | } |
| 304 | 321 | } |
| 305 | 322 | |
| 306 | 323 | logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", machine().describe_context(), offset, data); |