Previous 15994 Revisions Next

r8933 Sunday 29th August, 2010 at 05:09:01 UTC by Robbbert
[GAMECOM] Removed something accidently left in from last time. Tidied dma code.
[src/mess/machine]gamecom.c

src/mess/machine/gamecom.c
r8932r8933
6868
6969static const int gamecom_timer_limit[8] = { 2, 1024, 2048, 4096, 8192, 16384, 32768, 65536 };
7070
71static void gamecom_dma_init(running_machine *machine);
72
7371static TIMER_CALLBACK(gamecom_clock_timer_callback)
7472{
7573   UINT8 * RAM = memory_region(machine, "maincpu");
r8932r8933
8785   memory_set_bankptr( machine, "bank4", rom );
8886
8987   cartridge = NULL;
90   /* disable DMA and timer */
91   gamecom_dma.enabled = 0;
9288}
9389
9490static void gamecom_set_mmu( running_machine *machine, int mmu, UINT8 data )
r8932r8933
136132   }
137133   else
138134   {
139      RAM[SM8521_P0] = 0xfe | (RAM[SM8521_CLKT]&1);
135      RAM[SM8521_P0] = 0xFF;
140136      RAM[SM8521_P1] = ( RAM[SM8521_P1] & 0xFC ) | 3;
141137   }
142138}
r8932r8933
277273      break;
278274
279275   /* Video hardware and DMA */
280   case SM8521_LCDC:
281//      logerror( "%X: Setting LCDC to %X\n", activecpu_get_pc(), data );
282      break;
283   case SM8521_LCH:
284      break;
285   case SM8521_LCV:
286      break;
287   case SM8521_DMC:
288      gamecom_dma.overwrite_mode = data & 0x01;
289      gamecom_dma.transfer_mode = data & 0x06;
290      gamecom_dma.decrement_x = data & 0x08;
291      gamecom_dma.decrement_y = data & 0x10;
292      gamecom_dma.enabled = data & 0x80;
293      if ( gamecom_dma.enabled )
294      {
295         gamecom_dma_init(space->machine);
296      }
297      break;
298   case SM8521_DMX1:
299      break;
300   case SM8521_DMY1:
301      break;
302   case SM8521_DMDX:
303      break;
304   case SM8521_DMDY:
305      break;
306   case SM8521_DMX2:
307      break;
308   case SM8521_DMY2:
309      break;
310   case SM8521_DMPL:
311      break;
312276   case SM8521_DMBR:
313277      data &= 0x7f;
314278      break;
315   case SM8521_DMVP:
316      break;
317279   case SM8521_TM0D:
318280      gamecom_timer[0].check_value = data;
319281      return;
r8932r8933
445407
446408/* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines
447409   which page for source or destination is used */
448static void gamecom_dma_init(running_machine *machine)
410/* For now the increment/decrement-x and increment/decrement-y parts are NOT supported.
411   Their usage is also not explained properly in the manuals. Guess we'll have to wait
412   for them to show up in some rom images...
413 */
414void gamecom_handle_dma( running_device *device, int cycles )
449415{
450   UINT8 * RAM = memory_region(machine, "maincpu");
416   UINT8 * RAM = memory_region(device->machine, "maincpu");
417   UINT8 data = RAM[SM8521_DMC];
418   gamecom_dma.overwrite_mode = data & 0x01;
419   gamecom_dma.transfer_mode = data & 0x06;
420   gamecom_dma.decrement_x = data & 0x08;
421   gamecom_dma.decrement_y = data & 0x10;
422   gamecom_dma.enabled = data & 0x80;
423   if ( !gamecom_dma.enabled ) return;
424
425
451426   if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y )
452427   {
453428      logerror( "TODO: Decrement-x and decrement-y are not supported yet\n" );
r8932r8933
486461      gamecom_dma.source_mask = 0x3FFF;
487462      if ( RAM[SM8521_DMBR] < 16 )
488463      {
489         gamecom_dma.source_bank = memory_region(machine, "kernel") + (RAM[SM8521_DMBR] << 14);
464         gamecom_dma.source_bank = memory_region(device->machine, "kernel") + (RAM[SM8521_DMBR] << 14);
490465      }
491466      else
492467      {
r8932r8933
515490   gamecom_dma.source_line = gamecom_dma.source_current;
516491   gamecom_dma.dest_line = gamecom_dma.dest_current;
517492   gamecom_dma.state_count = 0;
518}
519493
520/* For now the increment/decrement-x and increment/decrement-y parts are NOT supported.
521   Their usage is also not explained properly in the manuals. Guess we'll have to wait
522   for them to show up in some rom images...
523 */
524void gamecom_handle_dma( running_device *device, int cycles )
525{
526494   unsigned y_count, x_count;
527   /* If not enabled, ignore */
528   if ( ! gamecom_dma.enabled )
529   {
530      return;
531   }
495
532496   for( y_count = 0; y_count <= gamecom_dma.width_y; y_count++ )
533497   {
534498      for( x_count = 0; x_count <= gamecom_dma.width_x; x_count++ )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team