src/mess/drivers/dc.c
| r1714 | r1715 | |
| 13 | 13 | #include "driver.h" |
| 14 | 14 | #include "cpu/arm7/arm7core.h" |
| 15 | 15 | #include "dc.h" |
| 16 | #include "sound/aica.h" |
| 17 | #include "deprecat.h" |
| 16 | 18 | |
| 17 | | static UINT64 *dc_sound_ram; |
| 19 | #define DC_VIDEO_TYPE (3<<8) // composite |
| 18 | 20 | |
| 21 | static UINT32 *dc_sound_ram; |
| 22 | |
| 19 | 23 | UINT32 dma_offset; /* silly MAME global variable */ |
| 20 | 24 | |
| 25 | static UINT64 portA = 0x3, PDTRA, latched_PDTRA = 0, w; |
| 26 | static int state = 0; |
| 27 | |
| 28 | static READ64_HANDLER( dc_pdtra_r ) |
| 29 | { |
| 30 | w = portA; |
| 31 | if (!state) |
| 32 | { |
| 33 | if ((latched_PDTRA == 1) || (latched_PDTRA == 2)) |
| 34 | { |
| 35 | w &= ~3; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | return w; |
| 40 | } |
| 41 | |
| 42 | static WRITE64_HANDLER( dc_pdtra_w ) |
| 43 | { |
| 44 | if ((data) && (!PDTRA)) |
| 45 | { |
| 46 | latched_PDTRA = data; |
| 47 | state = 1; |
| 48 | } |
| 49 | else if ((!data) && (!PDTRA)) |
| 50 | { |
| 51 | latched_PDTRA = 0; |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | state = 0; |
| 56 | } |
| 57 | |
| 58 | COMBINE_DATA(&PDTRA); |
| 59 | } |
| 60 | |
| 61 | static READ64_HANDLER( dc_arm_r ) |
| 62 | { |
| 63 | return *((UINT64 *)dc_sound_ram+offset); |
| 64 | } |
| 65 | |
| 66 | static WRITE64_HANDLER( dc_arm_w ) |
| 67 | { |
| 68 | COMBINE_DATA((UINT64 *)dc_sound_ram + offset); |
| 69 | } |
| 70 | |
| 21 | 71 | static ADDRESS_MAP_START( dc_map, ADDRESS_SPACE_PROGRAM, 64 ) |
| 22 | 72 | AM_RANGE(0x00000000, 0x001fffff) AM_ROM // BIOS |
| 23 | 73 | AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION(REGION_CPU1, 0x200000) // flash |
| r1714 | r1715 | |
| 31 | 81 | AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( dc_modem_r, dc_modem_w ) |
| 32 | 82 | AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE( dc_aica_reg_r, dc_aica_reg_w ) |
| 33 | 83 | AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w ) |
| 34 | | AM_RANGE(0x00800000, 0x009fffff) AM_RAM AM_BASE( &dc_sound_ram ) // sound RAM |
| 84 | AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE( dc_arm_r, dc_arm_w ) |
| 35 | 85 | AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE(2) // texture memory |
| 36 | 86 | AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_SHARE(2) // mirror of texture RAM |
| 37 | 87 | AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE(1) |
| r1714 | r1715 | |
| 42 | 92 | AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_REGION(REGION_CPU1, 0) |
| 43 | 93 | ADDRESS_MAP_END |
| 44 | 94 | |
| 95 | static ADDRESS_MAP_START( dc_port, ADDRESS_SPACE_IO, 64 ) |
| 96 | AM_RANGE(0x00000000, 0x00000007) AM_READWRITE( dc_pdtra_r, dc_pdtra_w ) |
| 97 | ADDRESS_MAP_END |
| 98 | |
| 45 | 99 | static ADDRESS_MAP_START( dc_audio_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 46 | | AM_RANGE(0x00000000, 0x001fffff) AM_RAM /* shared with SH-4 */ |
| 100 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(&dc_sound_ram) /* shared with SH-4 */ |
| 101 | AM_RANGE(0x00800000, 0x00807fff) AM_READWRITE(dc_arm_aica_r, dc_arm_aica_w) |
| 47 | 102 | ADDRESS_MAP_END |
| 48 | 103 | |
| 49 | 104 | static INPUT_PORTS_START( dc ) |
| 50 | 105 | INPUT_PORTS_END |
| 51 | 106 | |
| 107 | static MACHINE_RESET( dc_console ) |
| 108 | { |
| 109 | MACHINE_RESET_CALL(dc); |
| 110 | AICA_set_ram_base(0, dc_sound_ram, 2*1024*1024); |
| 111 | } |
| 112 | |
| 113 | static void aica_irq(int irq) |
| 114 | { |
| 115 | cpunum_set_input_line(Machine, 1, ARM7_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE); |
| 116 | } |
| 117 | |
| 118 | static const struct AICAinterface aica_interface = |
| 119 | { |
| 120 | REGION_CPU1, // temporary |
| 121 | 0, |
| 122 | aica_irq |
| 123 | }; |
| 124 | |
| 52 | 125 | static MACHINE_DRIVER_START( dc ) |
| 53 | 126 | /* basic machine hardware */ |
| 54 | 127 | MDRV_CPU_ADD_TAG("main", SH4, 200000000) |
| 55 | 128 | MDRV_CPU_PROGRAM_MAP(dc_map,0) |
| 129 | MDRV_CPU_IO_MAP(dc_port,0) |
| 56 | 130 | |
| 57 | 131 | MDRV_CPU_ADD_TAG("sound", ARM7, 45000000) |
| 58 | 132 | MDRV_CPU_PROGRAM_MAP(dc_audio_map, 0) |
| 59 | 133 | |
| 60 | | MDRV_MACHINE_RESET( dc ) |
| 134 | MDRV_MACHINE_RESET( dc_console ) |
| 61 | 135 | |
| 62 | 136 | /* video hardware */ |
| 63 | 137 | MDRV_SCREEN_ADD("main", RASTER) |
| r1714 | r1715 | |
| 70 | 144 | |
| 71 | 145 | MDRV_VIDEO_START(dc) |
| 72 | 146 | MDRV_VIDEO_UPDATE(dc) |
| 147 | |
| 148 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 149 | MDRV_SOUND_ADD(AICA, 0) |
| 150 | MDRV_SOUND_CONFIG(aica_interface) |
| 151 | MDRV_SOUND_ROUTE(0, "left", 2.0) |
| 152 | MDRV_SOUND_ROUTE(0, "right", 2.0) |
| 73 | 153 | MACHINE_DRIVER_END |
| 74 | 154 | |
| 75 | 155 | ROM_START(dc) |