Previous 15994 Revisions Next

r9286 Thursday 30th September, 2010 at 03:34:55 UTC by Angelo Salese
[32x]: testing DAC sound ...
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9285r9286
6767
6868#include "emu.h"
6969#include "cpu/z80/z80.h"
70#include "deprecat.h"
70//#include "deprecat.h"
7171#include "sound/sn76496.h"
7272#include "sound/2612intf.h"
7373#include "sound/upd7759.h"
7474#include "sound/fm.h"
75#include "sound/dac.h"
7576#include "cpu/m68000/m68000.h"
7677#include "includes/megadriv.h"
7778#include "cpu/sh2/sh2.h"
r9285r9286
27912792{
27922793   switch(offset)
27932794   {
2794      case 0/2: return pwm_ctrl; //control register
2795      case 2/2: return pwm_cycle_reg; // cycle register
2796      case 4/2: return mame_rand(space->machine) & 0xc000; // l ch TODO
2797      case 6/2: return mame_rand(space->machine) & 0xc000; // r ch TODO
2798      case 8/2: return mame_rand(space->machine) & 0xc000; // mono ch TODO
2795      case 0x00/2: return pwm_ctrl; //control register
2796      case 0x02/2: return pwm_cycle_reg; // cycle register
2797      case 0x04/2: return mame_rand(space->machine) & 0xc000; // l ch TODO
2798      case 0x06/2: return mame_rand(space->machine) & 0xc000; // r ch TODO
2799      case 0x08/2: return mame_rand(space->machine) & 0xc000; // mono ch TODO
27992800   }
28002801
28012802   printf("Read at undefined PWM register %02x\n",offset);
r9285r9286
28062807{
28072808   switch(offset)
28082809   {
2809      case 0/2:
2810      case 0x00/2:
28102811         pwm_ctrl = data & 0xffff;
28112812         pwm_tm_reg = (pwm_ctrl & 0xf00) >> 8;
28122813         calculate_pwm_timer();
28132814         break;
2814      case 2/2:
2815      case 0x02/2:
28152816         pwm_cycle = pwm_cycle_reg = data & 0xfff;
28162817         calculate_pwm_timer();
28172818         break;
2818      case 4/2:
2819         // l ch TODO
2819      case 0x04/2:
2820         dac_data_16_w(space->machine->device("lch_pwm"), ((data & 0xfff) << 4));
28202821         break;
2821      case 6/2:
2822         // r ch TODO
2822      case 0x06/2:
2823         dac_data_16_w(space->machine->device("rch_pwm"), ((data & 0xfff) << 4));
28232824         break;
2824      case 8/2:
2825         // mono TODO
2825      case 0x08/2:
2826         dac_data_16_w(space->machine->device("lch_pwm"), ((data & 0xfff) << 4));
2827         dac_data_16_w(space->machine->device("rch_pwm"), ((data & 0xfff) << 4));
28262828         break;
28272829      default:
28282830         printf("Write at undefined PWM register %02x %04x\n",offset,data);
r9285r9286
33003302
33013303
33023304/* the 32x treats everything as 16-bit registers, so we remap the 32-bit read & writes
3303   to 2x 16-bit handlers here */
3305   to 2x 16-bit handlers here (TODO: nuke this shit) */
33043306
33053307#define _32X_MAP_READHANDLERS(NAMEA,NAMEB)                                          \
33063308static READ32_HANDLER( _32x_sh2_##NAMEA##_##NAMEB##_r )                             \
r9285r9286
62966298   // boosting the interleave here actually makes Kolibri run incorrectly however, that
62976299   // one works best just boosting the interleave on communications?!
62986300   MDRV_QUANTUM_TIME(HZ(1800000))
6301
6302   MDRV_SOUND_ADD("lch_pwm", DAC, 0)
6303   MDRV_SOUND_ROUTE(0, "lspeaker", 0.75)
6304
6305   MDRV_SOUND_ADD("rch_pwm", DAC, 0)
6306   MDRV_SOUND_ROUTE(0, "rspeaker", 0.75)
62996307MACHINE_CONFIG_END
63006308
63016309
r9285r9286
63096317   MDRV_CPU_PROGRAM_MAP(sh2_slave_map)
63106318   MDRV_CPU_CONFIG(sh2_conf_slave)
63116319
6320   // brutal needs at least 30000 or the backgrounds don't animate properly / lock up, and the game
6321   // freezes.  Some stage seem to need as high as 80000 ?   this *KILLS* performance
6322   //
6323   // boosting the interleave here actually makes Kolibri run incorrectly however, that
6324   // one works best just boosting the interleave on communications?!
6325   MDRV_QUANTUM_TIME(HZ(1800000))
63126326MACHINE_CONFIG_END
63136327
63146328MACHINE_CONFIG_DERIVED( genesis_scd, megadriv )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team