src/mess/drivers/dc.c
| r4899 | r4900 | |
| 16 | 16 | |
| 17 | 17 | PCLKs = 26917135 (NTSC 480 @ 59.94), 26944080 (VGA 480 @ 60.0), 13458568 (NTSC 240 @ 59.94), |
| 18 | 18 | 25925600 (PAL 480 @ 50.00), 13462800 (PAL 240 @ 50.00) |
| 19 | |
| 19 | 20 | */ |
| 20 | 21 | |
| 21 | 22 | #include "driver.h" |
| r4899 | r4900 | |
| 27 | 28 | |
| 28 | 29 | #define CPU_CLOCK (200000000) |
| 29 | 30 | |
| 30 | | #define DC_VIDEO_TYPE (3<<8) // composite |
| 31 | | |
| 32 | 31 | static UINT32 *dc_sound_ram; |
| 33 | 32 | |
| 34 | | //UINT32 dma_offset; |
| 35 | 33 | int jvsboard_type; |
| 36 | 34 | |
| 37 | | static UINT64 portA = 0x3, PDTRA, latched_PDTRA = 0, w; |
| 38 | | static int state = 0; |
| 39 | | |
| 35 | static UINT64 PDTRA, PCTRA; |
| 40 | 36 | static READ64_HANDLER( dc_pdtra_r ) |
| 41 | 37 | { |
| 42 | | w = portA; |
| 43 | | if (!state) |
| 38 | UINT64 out = PCTRA<<32; |
| 39 | |
| 40 | out |= PDTRA & ~3; |
| 41 | |
| 42 | // if both bits are inputs |
| 43 | if (!(PCTRA & 0x5)) |
| 44 | 44 | { |
| 45 | | if ((latched_PDTRA == 1) || (latched_PDTRA == 2)) |
| 45 | out |= 3; |
| 46 | } |
| 47 | |
| 48 | // one's input one's output, always pull up both bits |
| 49 | if (((PCTRA & 5) == 1) || ((PCTRA & 5) == 4)) |
| 50 | { |
| 51 | if (PDTRA & 3) |
| 46 | 52 | { |
| 47 | | w &= ~3; |
| 53 | out |= 3; |
| 48 | 54 | } |
| 49 | 55 | } |
| 50 | 56 | |
| 51 | | return w; |
| 57 | return out; |
| 52 | 58 | } |
| 53 | 59 | |
| 54 | 60 | static WRITE64_HANDLER( dc_pdtra_w ) |
| 55 | 61 | { |
| 56 | | if ((data) && (!PDTRA)) |
| 57 | | { |
| 58 | | latched_PDTRA = data; |
| 59 | | state = 1; |
| 60 | | } |
| 61 | | else if ((!data) && (!PDTRA)) |
| 62 | | { |
| 63 | | latched_PDTRA = 0; |
| 64 | | } |
| 65 | | else |
| 66 | | { |
| 67 | | state = 0; |
| 68 | | } |
| 69 | | |
| 70 | | COMBINE_DATA(&PDTRA); |
| 62 | PCTRA = (data>>16) & 0xffff; |
| 63 | PDTRA = (data & 0xffff); |
| 71 | 64 | } |
| 72 | 65 | |
| 73 | 66 | static READ64_HANDLER( dc_arm_r ) |
| r4899 | r4900 | |
| 80 | 73 | COMBINE_DATA((UINT64 *)dc_sound_ram + offset); |
| 81 | 74 | } |
| 82 | 75 | |
| 76 | // SB_LMMODE0 |
| 77 | static WRITE64_HANDLER( ta_texture_directpath0_w ) |
| 78 | { |
| 79 | int mode = pvrctrl_regs[SB_LMMODE0]&1; |
| 80 | if (mode&1) |
| 81 | { |
| 82 | printf("ta_texture_directpath0_w 32-bit access!\n"); |
| 83 | COMBINE_DATA(&dc_framebuffer_ram[offset]); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | COMBINE_DATA(&dc_texture_ram[offset]); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // SB_LMMODE1 |
| 92 | static WRITE64_HANDLER( ta_texture_directpath1_w ) |
| 93 | { |
| 94 | int mode = pvrctrl_regs[SB_LMMODE1]&1; |
| 95 | if (mode&1) |
| 96 | { |
| 97 | printf("ta_texture_directpath0_w 32-bit access!\n"); |
| 98 | COMBINE_DATA(&dc_framebuffer_ram[offset]); |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | COMBINE_DATA(&dc_texture_ram[offset]); |
| 103 | } |
| 104 | } |
| 105 | |
| 83 | 106 | static ADDRESS_MAP_START( dc_map, ADDRESS_SPACE_PROGRAM, 64 ) |
| 84 | 107 | AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_WRITENOP // BIOS |
| 85 | 108 | AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("maincpu", 0x200000) // flash |
| r4899 | r4900 | |
| 94 | 117 | AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE("aica", dc_aica_reg_r, dc_aica_reg_w ) |
| 95 | 118 | AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w ) |
| 96 | 119 | AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE( dc_arm_r, dc_arm_w ) |
| 97 | | AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE(2) // texture memory |
| 98 | | AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_SHARE(2) // mirror of texture RAM |
| 99 | | AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE(1) |
| 100 | | AM_RANGE(0x0d000000, 0x0dffffff) AM_RAM AM_SHARE(1) // mirror of main RAM |
| 120 | |
| 121 | /* Area 1 */ |
| 122 | AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_BASE( &dc_texture_ram ) // texture memory 64 bit access |
| 123 | AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_BASE( &dc_framebuffer_ram ) // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now |
| 124 | |
| 125 | /* Area 3 */ |
| 126 | AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE(4) |
| 127 | AM_RANGE(0x0d000000, 0x0dffffff) AM_RAM AM_SHARE(4)// extra ram on Naomi (mirror on DC) |
| 128 | AM_RANGE(0x0e000000, 0x0effffff) AM_RAM AM_SHARE(4)// mirror |
| 129 | AM_RANGE(0x0f000000, 0x0fffffff) AM_RAM AM_SHARE(4)// mirror |
| 130 | |
| 131 | /* Area 4 */ |
| 101 | 132 | AM_RANGE(0x10000000, 0x107fffff) AM_WRITE( ta_fifo_poly_w ) |
| 102 | 133 | AM_RANGE(0x10800000, 0x10ffffff) AM_WRITE( ta_fifo_yuv_w ) |
| 103 | | AM_RANGE(0x11000000, 0x11ffffff) AM_RAM AM_SHARE(2) // another mirror of texture memory |
| 134 | AM_RANGE(0x11000000, 0x117fffff) AM_WRITE( ta_texture_directpath0_w ) AM_MIRROR(0x00800000) // access to texture / fraembfufer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue |
| 135 | |
| 136 | AM_RANGE(0x12000000, 0x127fffff) AM_WRITE( ta_fifo_poly_w ) |
| 137 | AM_RANGE(0x12800000, 0x12ffffff) AM_WRITE( ta_fifo_yuv_w ) |
| 138 | AM_RANGE(0x13000000, 0x137fffff) AM_WRITE( ta_texture_directpath1_w ) AM_MIRROR(0x00800000) // access to texture / fraembfufer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue |
| 139 | |
| 104 | 140 | AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_REGION("maincpu", 0) |
| 105 | 141 | ADDRESS_MAP_END |
| 106 | 142 | |
| r4899 | r4900 | |
| 153 | 189 | MDRV_MACHINE_RESET( dc_console ) |
| 154 | 190 | |
| 155 | 191 | /* video hardware */ |
| 156 | | // MDRV_SCREEN_ADD("screen", RASTER) |
| 157 | | // MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 158 | | // MDRV_SCREEN_RAW_PARAMS((524*857*59.94), 857, 0xa4, 640+0xa4, 524, 0x12, 480+0x12) |
| 159 | 192 | MDRV_SCREEN_ADD("screen", RASTER) |
| 160 | 193 | MDRV_SCREEN_REFRESH_RATE(60) |
| 161 | 194 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |