Previous 15994 Revisions Next

r7039 Thursday 14th January, 2010 at 18:51:20 UTC by Wilbert Pol
[GAMECOM] Added cases for the sound registers.
[src/mess/machine]gamecom.c

src/mess/machine/gamecom.c
r7038r7039
4444   int check_value;
4545} GAMECOM_TIMER;
4646
47typedef struct
48{
49   UINT8 sgc;
50   UINT8 sg0l;
51   UINT8 sg1l;
52   UINT8 sg2l;
53   UINT16 sg0t;
54   UINT16 sg1t;
55   UINT16 sg2t;
56   UINT8 sgda;
57   UINT8 sg0w[16];
58   UINT8 sg1w[16];
59} gamecom_sound_t;
60
4761UINT8 gamecom_internal_registers[0x80];
4862static UINT8 *cartridge1 = NULL;
4963static UINT8 *cartridge2 = NULL;
r7038r7039
5266static emu_timer *gamecom_clock_timer = NULL;
5367static GAMECOM_DMA gamecom_dma;
5468static GAMECOM_TIMER gamecom_timer[2];
69static gamecom_sound_t gamecom_sound;
5570
5671//static const int gamecom_timer_limit[8] = { 2/2, 1024/2, 2048/2, 4096/2, 8192/2, 16384/2, 32768/2, 65536/2 };
5772static const int gamecom_timer_limit[8] = { 2, 1024, 2048, 4096, 8192, 16384, 32768, 65536 };
r7038r7039
6479{
6580   UINT8 val = ( ( gamecom_internal_registers[SM8521_CLKT] & 0x3F ) + 1 ) & 0x3F;
6681   gamecom_internal_registers[SM8521_CLKT] = ( gamecom_internal_registers[SM8521_CLKT] & 0xC0 ) | val;
67   cputag_set_input_line(machine, "maincpu", CK_INT, HOLD_LINE );
82   cputag_set_input_line(machine, "maincpu", CK_INT, ASSERT_LINE );
6883}
6984
7085MACHINE_RESET( gamecom )
r7038r7039
342357      }
343358      break;
344359
360   /* Sound */
361   case SM8521_SGC:
362      gamecom_sound.sgc = data;
363      break;
364   case SM8521_SG0L:
365      gamecom_sound.sg0l = data;
366      break;
367   case SM8521_SG1L:
368      gamecom_sound.sg1l = data;
369      break;
370   case SM8521_SG0TH:
371      gamecom_sound.sg0t = ( gamecom_sound.sg0t & 0xFF ) | ( data << 8 );
372      break;
373   case SM8521_SG0TL:
374      gamecom_sound.sg0t = ( gamecom_sound.sg0t & 0xFF00 ) | data;
375      break;
376   case SM8521_SG1TH:
377      gamecom_sound.sg1t = ( gamecom_sound.sg1t & 0xFF ) | ( data << 8 );
378      break;
379   case SM8521_SG1TL:
380      gamecom_sound.sg1t = ( gamecom_sound.sg1t & 0xFF00 ) | data;
381      break;
382   case SM8521_SG2L:
383      gamecom_sound.sg2l = data;
384      break;
385   case SM8521_SG2TH:
386      gamecom_sound.sg2t = ( gamecom_sound.sg2t & 0xFF ) | ( data << 8 );
387      break;
388   case SM8521_SG2TL:
389      gamecom_sound.sg2t = ( gamecom_sound.sg2t & 0xFF00 ) | data;
390      break;
391   case SM8521_SGDA:
392      gamecom_sound.sgda = data;
393      break;
394
395   case SM8521_SG0W0:
396   case SM8521_SG0W1:
397   case SM8521_SG0W2:
398   case SM8521_SG0W3:
399   case SM8521_SG0W4:
400   case SM8521_SG0W5:
401   case SM8521_SG0W6:
402   case SM8521_SG0W7:
403   case SM8521_SG0W8:
404   case SM8521_SG0W9:
405   case SM8521_SG0W10:
406   case SM8521_SG0W11:
407   case SM8521_SG0W12:
408   case SM8521_SG0W13:
409   case SM8521_SG0W14:
410   case SM8521_SG0W15:
411      gamecom_sound.sg0w[offset - SM8521_SG0W0] = data;
412      break;
413   case SM8521_SG1W0:
414   case SM8521_SG1W1:
415   case SM8521_SG1W2:
416   case SM8521_SG1W3:
417   case SM8521_SG1W4:
418   case SM8521_SG1W5:
419   case SM8521_SG1W6:
420   case SM8521_SG1W7:
421   case SM8521_SG1W8:
422   case SM8521_SG1W9:
423   case SM8521_SG1W10:
424   case SM8521_SG1W11:
425   case SM8521_SG1W12:
426   case SM8521_SG1W13:
427   case SM8521_SG1W14:
428   case SM8521_SG1W15:
429      gamecom_sound.sg1w[offset - SM8521_SG1W0] = data;
430      break;
431
345432   /* Reserved addresses */
346433   case SM8521_18: case SM8521_1B:
347434   case SM8521_29: case SM8521_2A: case SM8521_2F:
r7038r7039
569656      gamecom_dma.dest_current = gamecom_dma.dest_line;
570657   }
571658   gamecom_dma.enabled = 0;
572   cputag_set_input_line(device->machine, "maincpu", DMA_INT, HOLD_LINE );
659   cputag_set_input_line(device->machine, "maincpu", DMA_INT, ASSERT_LINE );
573660}
574661
575662void gamecom_update_timers( const device_config *device, int cycles )
r7038r7039
584671         if ( gamecom_timer[0].counter == gamecom_timer[0].check_value )
585672         {
586673            gamecom_timer[0].counter = 0;
587            cputag_set_input_line(device->machine, "maincpu", TIM0_INT, HOLD_LINE );
674            cputag_set_input_line(device->machine, "maincpu", TIM0_INT, ASSERT_LINE );
588675         }
589676      }
590677   }
r7038r7039
598685         if ( gamecom_timer[1].counter == gamecom_timer[1].check_value )
599686         {
600687            gamecom_timer[1].counter = 0;
601            cputag_set_input_line(device->machine, "maincpu", TIM1_INT, HOLD_LINE );
688            cputag_set_input_line(device->machine, "maincpu", TIM1_INT, ASSERT_LINE );
602689         }
603690      }
604691   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team