| 1 |
#ifndef __YMDELTAT_H__ |
| 2 |
#define __YMDELTAT_H__ |
| 3 |
|
| 4 |
#include "mamedefs.h" |
| 5 |
|
| 6 |
#define YM_DELTAT_SHIFT (16) |
| 7 |
|
| 8 |
#define YM_DELTAT_EMULATION_MODE_NORMAL 0 |
| 9 |
#define YM_DELTAT_EMULATION_MODE_YM2610 1 |
| 10 |
|
| 11 |
|
| 12 |
typedef void (*STATUS_CHANGE_HANDLER)(void *chip, UINT8 status_bits); |
| 13 |
|
| 14 |
|
| 15 |
/* DELTA-T (adpcm type B) struct */ |
| 16 |
typedef struct deltat_adpcm_state { /* AT: rearranged and tightened structure */ |
| 17 |
UINT8 *memory; |
| 18 |
INT32 *output_pointer;/* pointer of output pointers */ |
| 19 |
INT32 *pan; /* pan : &output_pointer[pan] */ |
| 20 |
double freqbase; |
| 21 |
#if 0 |
| 22 |
double write_time; /* Y8950: 10 cycles of main clock; YM2608: 20 cycles of main clock */ |
| 23 |
double read_time; /* Y8950: 8 cycles of main clock; YM2608: 18 cycles of main clock */ |
| 24 |
#endif |
| 25 |
UINT32 memory_size; |
| 26 |
UINT32 memory_mask; |
| 27 |
int output_range; |
| 28 |
UINT32 address_mask; |
| 29 |
UINT32 now_addr; /* current address */ |
| 30 |
UINT32 now_step; /* current step */ |
| 31 |
UINT32 step; /* step */ |
| 32 |
UINT32 start; /* start address */ |
| 33 |
UINT32 limit; /* limit address */ |
| 34 |
UINT32 end; /* end address */ |
| 35 |
UINT32 delta; /* delta scale */ |
| 36 |
INT32 volume; /* current volume */ |
| 37 |
INT32 acc; /* shift Measurement value*/ |
| 38 |
INT32 adpcmd; /* next Forecast */ |
| 39 |
INT32 adpcml; /* current value */ |
| 40 |
INT32 prev_acc; /* leveling value */ |
| 41 |
UINT8 now_data; /* current rom data */ |
| 42 |
UINT8 CPU_data; /* current data from reg 08 */ |
| 43 |
UINT8 portstate; /* port status */ |
| 44 |
UINT8 control2; /* control reg: SAMPLE, DA/AD, RAM TYPE (x8bit / x1bit), ROM/RAM */ |
| 45 |
UINT8 portshift_base; /* address bits shift-left: |
| 46 |
** 8 for YM2610, |
| 47 |
** 5 for Y8950 and YM2608 */ |
| 48 |
UINT8 now_portshift; /* current address bits shift-left */ |
| 49 |
|
| 50 |
UINT8 memread; /* needed for reading/writing external memory */ |
| 51 |
|
| 52 |
/* handlers and parameters for the status flags support */ |
| 53 |
STATUS_CHANGE_HANDLER status_set_handler; |
| 54 |
STATUS_CHANGE_HANDLER status_reset_handler; |
| 55 |
|
| 56 |
/* note that different chips have these flags on different |
| 57 |
** bits of the status register |
| 58 |
*/ |
| 59 |
void * status_change_which_chip; /* this chip id */ |
| 60 |
UINT8 status_change_EOS_bit; /* 1 on End Of Sample (record/playback/cycle time of AD/DA converting has passed)*/ |
| 61 |
UINT8 status_change_BRDY_bit; /* 1 after recording 2 datas (2x4bits) or after reading/writing 1 data */ |
| 62 |
UINT8 status_change_ZERO_bit; /* 1 if silence lasts for more than 290 miliseconds on ADPCM recording */ |
| 63 |
|
| 64 |
/* neither Y8950 nor YM2608 can generate IRQ when PCMBSY bit changes, so instead of above, |
| 65 |
** the statusflag gets ORed with PCM_BSY (below) (on each read of statusflag of Y8950 and YM2608) |
| 66 |
*/ |
| 67 |
UINT8 PCM_BSY; /* 1 when ADPCM is playing; Y8950/YM2608 only */ |
| 68 |
|
| 69 |
UINT8 reg[16]; /* adpcm registers */ |
| 70 |
UINT8 emulation_mode; /* which chip we're emulating */ |
| 71 |
}YM_DELTAT; |
| 72 |
|
| 73 |
//void YM_DELTAT_BRDY_callback(YM_DELTAT *DELTAT); |
| 74 |
|
| 75 |
UINT8 YM_DELTAT_ADPCM_Read(YM_DELTAT *DELTAT); |
| 76 |
void YM_DELTAT_ADPCM_Write(YM_DELTAT *DELTAT,int r,int v); |
| 77 |
void YM_DELTAT_ADPCM_Init(YM_DELTAT *DELTAT,int emulation_mode,int portshift,INT32* output_ptr,int output_range); |
| 78 |
void YM_DELTAT_ADPCM_Reset(YM_DELTAT *DELTAT,int pan); |
| 79 |
void YM_DELTAT_ADPCM_CALC(YM_DELTAT *DELTAT); |
| 80 |
|
| 81 |
void YM_DELTAT_calc_mem_mask(YM_DELTAT* DELTAT); |
| 82 |
|
| 83 |
#endif // __YMDELTAT_H__ |