Previous 15994 Revisions Next

r6864 Saturday 2nd January, 2010 at 11:06:16 UTC by Harmony
[ACAN] Hooked up basic DMA support, and added temporary handlers for the potentially graphics-related areas the DMAs target. [Harmony]
[src/mess/drivers]supracan.c

src/mess/drivers/supracan.c
r6863r6864
1212
1313f00000 - bit 15 is probably vblank bit.
1414
15Known unemulated graphical effects:
16- The green blob of the A'Can logo should slide out from beneath the word
17  "A'Can"
18- The A'Can logo should have a scrolling ROZ layer beneath it
19- Sprites
20
1521***************************************************************************/
1622
1723#include "driver.h"
r6863r6864
1925#include "cpu/m6502/m6502.h"
2026#include "devices/cartslot.h"
2127
22
2328static UINT16 supracan_m6502_reset;
2429static UINT8 *supracan_soundram;
2530static UINT16 *supracan_soundram_16;
2631static UINT16 supracan_video_regs[256];
2732static emu_timer *supracan_video_timer;
28static UINT16 *supracan_charram, *supracan_vram;
33static UINT16 *supracan_unk1_dma_ram;
34static UINT16 *supracan_unk2_dma_ram;
35static UINT16 *supracan_unk3_dma_ram;
36static UINT16 *supracan_unk4_dma_ram;
37static UINT16 *supracan_unk5_dma_ram;
38static UINT16 *supracan_charram;
39static UINT16 *supracan_vram;
40static UINT16 *supracan_rram;
41static UINT16 *supracan_rozpal;
2942
3043static READ16_HANDLER( supracan_unk1_r );
3144static WRITE16_HANDLER( supracan_soundram_w );
r6863r6864
3447static WRITE16_HANDLER( supracan_video_w );
3548static WRITE16_HANDLER( supracan_char_w );
3649
50#define VERBOSE_LEVEL   (99)
51
52#define ENABLE_VERBOSE_LOG (1)
53
54#if ENABLE_VERBOSE_LOG
55INLINE void verboselog(running_machine *machine, int n_level, const char *s_fmt, ...)
56{
57   if( VERBOSE_LEVEL >= n_level )
58   {
59      va_list v;
60      char buf[ 32768 ];
61      va_start( v, s_fmt );
62      vsprintf( buf, s_fmt, v );
63      va_end( v );
64      logerror( "%06x: %s", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), buf );
65   }
66}
67#else
68#define verboselog(x,y,z,...)
69#endif
70
3771static VIDEO_START( supracan )
3872{
3973
r6863r6864
4680
4781   count = 0;
4882
83   for (y=0;y<32;y++)
84   {
85      for (x=0;x<32;x += 4)
86      {
87         *BITMAP_ADDR16(bitmap, y, 128+x+0) = (supracan_rram[count] >> 12) & 0x000f;
88         *BITMAP_ADDR16(bitmap, y, 128+x+1) = (supracan_rram[count] >>  8) & 0x000f;
89         *BITMAP_ADDR16(bitmap, y, 128+x+2) = (supracan_rram[count] >>  4) & 0x000f;
90         *BITMAP_ADDR16(bitmap, y, 128+x+3) = (supracan_rram[count] >>  0) & 0x000f;
91         count++;
92      }
93   }
94
95   count = 0;
96
4997   for (y=0;y<16;y++)
5098   {
5199      for (x=0;x<16;x++)
r6863r6864
61109   return 0;
62110}
63111
112typedef struct
113{
114   UINT32 source;
115   UINT32 dest;
116   UINT16 count;
117   UINT16 control;
118} _acan_dma_regs_t;
119
120static _acan_dma_regs_t acan_dma_regs;
121
122static WRITE16_HANDLER( supracan_dma_w )
123{
124   int i;
125   switch(offset)
126   {
127      case 0x00/2: // Source address MSW
128         acan_dma_regs.source &= 0x0000ffff;
129         acan_dma_regs.source |= data << 16;
130         break;
131      case 0x02/2: // Source address LSW
132         acan_dma_regs.source &= 0xffff0000;
133         acan_dma_regs.source |= data;
134         break;
135      case 0x04/2: // Destination address MSW
136         acan_dma_regs.dest &= 0x0000ffff;
137         acan_dma_regs.dest |= data << 16;
138         break;
139      case 0x06/2: // Destination address LSW
140         acan_dma_regs.dest &= 0xffff0000;
141         acan_dma_regs.dest |= data;
142         break;
143      case 0x08/2: // Byte count
144         acan_dma_regs.count = data;
145         break;
146      case 0x0a/2: // Control
147         if(data & 0x8800)
148         {
149            verboselog(space->machine, 0, "supracan_dma_w: Kicking off a DMA from %08x to %08x, %d bytes\n", acan_dma_regs.source, acan_dma_regs.dest, acan_dma_regs.count + 1);
150            for(i = 0; i <= acan_dma_regs.count; i++)
151            {
152               memory_write_byte(space, acan_dma_regs.dest++, memory_read_byte(space, acan_dma_regs.source++));
153            }
154         }
155         else
156         {
157            verboselog(space->machine, 0, "supracan_dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n", data, acan_dma_regs.source, acan_dma_regs.dest, acan_dma_regs.count + 1);
158         }
159         break;
160   }
161}
162
163static WRITE16_HANDLER( supracan_unk1_dma_w )
164{
165   COMBINE_DATA(&supracan_unk1_dma_ram[offset]);
166}
167
168static WRITE16_HANDLER( supracan_unk2_dma_w )
169{
170   COMBINE_DATA(&supracan_unk2_dma_ram[offset]);
171}
172
173static WRITE16_HANDLER( supracan_unk3_dma_w )
174{
175   COMBINE_DATA(&supracan_unk3_dma_ram[offset]);
176}
177
178static WRITE16_HANDLER( supracan_unk4_dma_w )
179{
180   COMBINE_DATA(&supracan_unk4_dma_ram[offset]);
181}
182
183static WRITE16_HANDLER( supracan_unk5_dma_w )
184{
185   COMBINE_DATA(&supracan_unk5_dma_ram[offset]);
186}
187
64188static ADDRESS_MAP_START( supracan_mem, ADDRESS_SPACE_PROGRAM, 16 )
65189   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM AM_REGION( "cart", 0 )
66190   AM_RANGE( 0xe80204, 0xe80205 ) AM_READ( supracan_unk1_r )
67191   AM_RANGE( 0xe80300, 0xe80301 ) AM_READ( supracan_unk1_r )
68   AM_RANGE( 0xe88400, 0xe88c87 ) AM_RAM   /* Unknown, some data gets copied here during boot */
192   AM_RANGE( 0xe88400, 0xe88bff ) AM_RAM   /* Unknown, some data gets copied here during boot */
193   AM_RANGE( 0xe88c00, 0xe88dff ) AM_RAM_WRITE(supracan_unk1_dma_w) AM_BASE(&supracan_unk1_dma_ram) /* Unknown DMA target, likely gfx-related */
194   AM_RANGE( 0xe89000, 0xe897ff ) AM_RAM_WRITE(supracan_unk2_dma_w) AM_BASE(&supracan_unk2_dma_ram) /* Unknown DMA target, likely gfx-related */
195   AM_RANGE( 0xe8a000, 0xe8afff ) AM_RAM_WRITE(supracan_unk3_dma_w) AM_BASE(&supracan_unk3_dma_ram) /* Unknown DMA target, likely gfx-related */
196   AM_RANGE( 0xe8c000, 0xe8c7ff ) AM_RAM_WRITE(supracan_unk4_dma_w) AM_BASE(&supracan_unk4_dma_ram) /* Unknown DMA target, likely gfx-related */
197   AM_RANGE( 0xe8d000, 0xe8d3ff ) AM_RAM_WRITE(supracan_unk5_dma_w) AM_BASE(&supracan_unk5_dma_ram) /* Unknown DMA target, likely gfx-related */
69198   AM_RANGE( 0xe8f000, 0xe8ffff ) AM_RAM_WRITE( supracan_soundram_w ) AM_BASE( &supracan_soundram_16 )
70199   AM_RANGE( 0xe90000, 0xe9001f ) AM_WRITE( supracan_sound_w )
200   AM_RANGE( 0xe90020, 0xe9002b ) AM_WRITE( supracan_dma_w )
71201   AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE( supracan_video_r, supracan_video_w )
72202   AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
73203   AM_RANGE( 0xf40000, 0xf43fff ) AM_RAM_WRITE(supracan_char_w) AM_BASE(&supracan_charram)   /* Unknown, some data gets copied here during boot */
74   AM_RANGE( 0xf44000, 0xf441ff ) AM_RAM   /* Unknown */
75   AM_RANGE( 0xf44200, 0xf443ff ) AM_RAM AM_BASE(&supracan_vram)   /* Unknown, some data gets copied here during boot. Possibly a tilemap?? */
76   AM_RANGE( 0xf44400, 0xf445ff ) AM_RAM   /* Unknown, some data gets copied here during boot. Looks like the Functech logo is here */
204   AM_RANGE( 0xf44000, 0xf441ff ) AM_RAM AM_BASE(&supracan_rozpal) /* Unknown */
205   AM_RANGE( 0xf44200, 0xf443ff ) AM_RAM AM_BASE(&supracan_vram)   /* Foreground tilemap layer */
206   AM_RANGE( 0xf44400, 0xf445ff ) AM_RAM AM_BASE(&supracan_rram)   /* ROZ layer tiles */
77207   AM_RANGE( 0xf44600, 0xf44fff ) AM_RAM   /* Unknown, stuff gets written here. Zoom table?? */
78208   AM_RANGE( 0xfc0000, 0xfcffff ) AM_RAM   /* System work ram */
79209   AM_RANGE( 0xff8000, 0xffffff ) AM_RAM   /* System work ram */
r6863r6864
105235
106236static PALETTE_INIT( supracan )
107237{
108   #if 0
238   // Used for debugging purposes for now
239   //#if 0
109240   int i, r, g, b;
110241
111242   for( i = 0; i < 32768; i++ )
112243   {
113      /* TODO: Verfiy that we are taking the proper bits for r, g, and b. */
114244      r = (i & 0x1f) << 3;
115245      g = ((i >> 5) & 0x1f) << 3;
116246      b = ((i >> 10) & 0x1f) << 3;
117247      palette_set_color_rgb( machine, i, r, g, b );
118248   }
119   #endif
249   //#endif
120250}
121251
122252
r6863r6864
168298{
169299   UINT16 data = supracan_video_regs[offset];
170300
301   switch(offset)
302   {
303      case 0: // VBlank flag
304         break;
305      default:
306         verboselog(space->machine, 0, "supracan_video_r: Unknown register: %08x (%04x & %04x)\n", 0xf0000 + (offset << 1), data, mem_mask);
307         break;
308   }
309
171310   return data;
172311}
173312
r6863r6864
192331
193332static WRITE16_HANDLER( supracan_video_w )
194333{
334   switch(offset)
335   {
336      default:
337         verboselog(space->machine, 0, "supracan_video_w: Unknown register: %08x = %04x & %04x\n", 0xf0000 + (offset << 1), data, mem_mask);
338         break;
339   }
195340   supracan_video_regs[offset] = data;
196341}
197342
r6863r6864
242387
243388
244389static GFXDECODE_START( supracan )
245   GFXDECODE_ENTRY( "ram_gfx", 0, supracan_gfxlayout,   0, 1 )
390   GFXDECODE_ENTRY( "ram_gfx", 0, supracan_gfxlayout,   0, 1 )
246391GFXDECODE_END
247392
248
249393static MACHINE_DRIVER_START( supracan )
250394   MDRV_CPU_ADD( "maincpu", M68000, XTAL_10_738635MHz )      /* Correct frequency unknown */
251395   MDRV_CPU_PROGRAM_MAP( supracan_mem )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team