mirror of
https://github.com/holub/mame
synced 2025-05-21 21:29:15 +03:00

Subject: [patch] More Machine->machine changes, add machine to irq callbacks Hi mamedev, Here are two more patches to eliminate Machine globals. The first patch was autogenerated by the attached fixup script. That script has been updated to catch additional cases which it previously missed (when Machine is the last parameter to a function or Machine is used in an assignment). This makes ~50 more files deprecat.h free. A sizable chunk (~20%) of the remaining uses of the Machine global in the drivers are due to irq callbacks for sound and machine updates. Typically such callbacks need to call cpunum_set_input_line, which requires a machine parameter, so if the callbacks don't pass the machine parameter, these routines have no choice but to reference the global variable. The second patch attempts to address most cases of this by adding the machine parameter to the callback interfaces. This allows us to remove #include "deprecat.h" from ~150 files, at the cost of having to fix up hundreds of callbacks. In total, these patches reduced the number of files with deprecat.h from 783 to 575. ~aa
87 lines
2.6 KiB
C
87 lines
2.6 KiB
C
/*
|
|
**
|
|
** File: ym2151.h - header file for software implementation of YM2151
|
|
** FM Operator Type-M(OPM)
|
|
**
|
|
** (c) 1997-2002 Jarek Burczynski (s0246@poczta.onet.pl, bujar@mame.net)
|
|
** Some of the optimizing ideas by Tatsuyuki Satoh
|
|
**
|
|
** Version 2.150 final beta May, 11th 2002
|
|
**
|
|
**
|
|
** I would like to thank following people for making this project possible:
|
|
**
|
|
** Beauty Planets - for making a lot of real YM2151 samples and providing
|
|
** additional informations about the chip. Also for the time spent making
|
|
** the samples and the speed of replying to my endless requests.
|
|
**
|
|
** Shigeharu Isoda - for general help, for taking time to scan his YM2151
|
|
** Japanese Manual first of all, and answering MANY of my questions.
|
|
**
|
|
** Nao - for giving me some info about YM2151 and pointing me to Shigeharu.
|
|
** Also for creating fmemu (which I still use to test the emulator).
|
|
**
|
|
** Aaron Giles and Chris Hardy - they made some samples of one of my favourite
|
|
** arcade games so I could compare it to my emulator.
|
|
**
|
|
** Bryan McPhail and Tim (powerjaw) - for making some samples.
|
|
**
|
|
** Ishmair - for the datasheet and motivation.
|
|
*/
|
|
|
|
#ifndef _H_YM2151_
|
|
#define _H_YM2151_
|
|
|
|
/* 16- and 8-bit samples (signed) are supported*/
|
|
#define SAMPLE_BITS 16
|
|
|
|
typedef stream_sample_t SAMP;
|
|
/*
|
|
#if (SAMPLE_BITS==16)
|
|
typedef INT16 SAMP;
|
|
#endif
|
|
#if (SAMPLE_BITS==8)
|
|
typedef signed char SAMP;
|
|
#endif
|
|
*/
|
|
|
|
/*
|
|
** Initialize YM2151 emulator(s).
|
|
**
|
|
** 'num' is the number of virtual YM2151's to allocate
|
|
** 'clock' is the chip clock in Hz
|
|
** 'rate' is sampling rate
|
|
*/
|
|
void *YM2151Init(int index, int clock, int rate);
|
|
|
|
/* shutdown the YM2151 emulators*/
|
|
void YM2151Shutdown(void *chip);
|
|
|
|
/* reset all chip registers for YM2151 number 'num'*/
|
|
void YM2151ResetChip(void *chip);
|
|
|
|
/*
|
|
** Generate samples for one of the YM2151's
|
|
**
|
|
** 'num' is the number of virtual YM2151
|
|
** '**buffers' is table of pointers to the buffers: left and right
|
|
** 'length' is the number of samples that should be generated
|
|
*/
|
|
void YM2151UpdateOne(void *chip, SAMP **buffers, int length);
|
|
|
|
/* write 'v' to register 'r' on YM2151 chip number 'n'*/
|
|
void YM2151WriteReg(void *chip, int r, int v);
|
|
|
|
/* read status register on YM2151 chip number 'n'*/
|
|
int YM2151ReadStatus(void *chip);
|
|
|
|
/* set interrupt handler on YM2151 chip number 'n'*/
|
|
void YM2151SetIrqHandler(void *chip, void (*handler)(running_machine *machine, int irq));
|
|
|
|
/* set port write handler on YM2151 chip number 'n'*/
|
|
void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler);
|
|
|
|
/* refresh chip when load state */
|
|
STATE_POSTLOAD( YM2151Postload );
|
|
#endif /*_H_YM2151_*/
|