Previous 15994 Revisions Next

r4900 Monday 1st June, 2009 at 03:39:55 UTC by R. Belmont
[DC] Sync memory map with Naomi in MAME, fix PDTRA readback so all BIOSes show a title screen.
[src/mess/drivers]dc.c

src/mess/drivers/dc.c
r4899r4900
1616
1717    PCLKs = 26917135 (NTSC 480 @ 59.94), 26944080 (VGA 480 @ 60.0), 13458568 (NTSC 240 @ 59.94),
1818            25925600 (PAL 480 @ 50.00), 13462800 (PAL 240 @ 50.00)
19
1920*/
2021
2122#include "driver.h"
r4899r4900
2728
2829#define CPU_CLOCK (200000000)
2930
30#define DC_VIDEO_TYPE   (3<<8)      // composite
31
3231static UINT32 *dc_sound_ram;
3332
34//UINT32 dma_offset;
3533int jvsboard_type;
3634
37static UINT64 portA = 0x3, PDTRA, latched_PDTRA = 0, w;
38static int state = 0;
39
35static UINT64 PDTRA, PCTRA;
4036static READ64_HANDLER( dc_pdtra_r )
4137{
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))
4444   {
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)
4652      {
47         w &= ~3;
53         out |= 3;
4854      }
4955   }
5056
51   return w;
57   return out;
5258}
5359
5460static WRITE64_HANDLER( dc_pdtra_w )
5561{
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);
7164}
7265
7366static READ64_HANDLER( dc_arm_r )
r4899r4900
8073   COMBINE_DATA((UINT64 *)dc_sound_ram + offset);
8174}
8275
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
83106static ADDRESS_MAP_START( dc_map, ADDRESS_SPACE_PROGRAM, 64 )
84107   AM_RANGE(0x00000000, 0x001fffff) AM_ROM   AM_WRITENOP            // BIOS
85108   AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("maincpu", 0x200000)   // flash
r4899r4900
94117   AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE("aica", dc_aica_reg_r, dc_aica_reg_w )
95118   AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w )
96119   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 */
101132   AM_RANGE(0x10000000, 0x107fffff) AM_WRITE( ta_fifo_poly_w )
102133   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
104140   AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_REGION("maincpu", 0)
105141ADDRESS_MAP_END
106142
r4899r4900
153189   MDRV_MACHINE_RESET( dc_console )
154190
155191   /* 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)
159192   MDRV_SCREEN_ADD("screen", RASTER)
160193   MDRV_SCREEN_REFRESH_RATE(60)
161194   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team