mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
timers implemented for new z80 mode
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@460 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
4b9c588826
commit
43e6eaad0b
12 changed files with 128 additions and 81 deletions
|
@ -35,8 +35,8 @@ int PsndDacLine=0;
|
|||
short *PsndOut=NULL; // PCM data buffer
|
||||
|
||||
// timers
|
||||
int timer_a_next_oflow, timer_a_step; // in z80 cycles
|
||||
//int
|
||||
int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles
|
||||
int timer_b_next_oflow, timer_b_step, timer_b_offset;
|
||||
|
||||
// sn76496
|
||||
extern int *sn76496_regs;
|
||||
|
@ -46,13 +46,15 @@ static void dac_recalculate(void)
|
|||
{
|
||||
int i, dac_cnt, pos, len, lines = Pico.m.pal ? 312 : 262, mid = Pico.m.pal ? 68 : 93;
|
||||
|
||||
if(PsndLen <= lines) {
|
||||
if (PsndLen <= lines)
|
||||
{
|
||||
// shrinking algo
|
||||
dac_cnt = -PsndLen;
|
||||
len=1; pos=0;
|
||||
dac_info[225] = 1;
|
||||
|
||||
for(i=226; i != 225; i++) {
|
||||
for(i=226; i != 225; i++)
|
||||
{
|
||||
if (i >= lines) i = 0;
|
||||
len = 0;
|
||||
if(dac_cnt < 0) {
|
||||
|
@ -63,11 +65,14 @@ static void dac_recalculate(void)
|
|||
dac_cnt -= PsndLen;
|
||||
dac_info[i] = (pos<<4)|len;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// stretching
|
||||
dac_cnt = PsndLen;
|
||||
pos=0;
|
||||
for(i = 225; i != 224; i++) {
|
||||
for(i = 225; i != 224; i++)
|
||||
{
|
||||
if (i >= lines) i = 0;
|
||||
len=0;
|
||||
while(dac_cnt >= 0) {
|
||||
|
|
|
@ -1584,8 +1584,6 @@ static int OPNWriteReg(int r, int v)
|
|||
/* YM2612 local section */
|
||||
/*******************************************************************************/
|
||||
|
||||
FM_ST *ym2612_st;
|
||||
|
||||
/* Generate samples for YM2612 */
|
||||
int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty)
|
||||
{
|
||||
|
@ -1650,9 +1648,6 @@ int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty)
|
|||
/* initialize YM2612 emulator */
|
||||
void YM2612Init_(int clock, int rate)
|
||||
{
|
||||
// notaz
|
||||
ym2612_st = &ym2612.OPN.ST;
|
||||
|
||||
memset(&ym2612, 0, sizeof(ym2612));
|
||||
init_tables();
|
||||
|
||||
|
|
|
@ -141,35 +141,16 @@ typedef struct
|
|||
} YM2612;
|
||||
#endif
|
||||
|
||||
extern FM_ST *ym2612_st;
|
||||
#ifndef EXTERNAL_YM2612
|
||||
extern YM2612 ym2612;
|
||||
#endif
|
||||
|
||||
#define YM2612Read() ym2612_st->status
|
||||
|
||||
#define YM2612PicoTick(n) \
|
||||
{ \
|
||||
/* timer A */ \
|
||||
if(ym2612_st->mode & 0x01 && (ym2612_st->TAT+=64*n) >= ym2612_st->TAC) { \
|
||||
ym2612_st->TAT -= ym2612_st->TAC; \
|
||||
if(ym2612_st->mode & 0x04) ym2612_st->status |= 1; \
|
||||
} \
|
||||
\
|
||||
/* timer B */ \
|
||||
if(ym2612_st->mode & 0x02 && (ym2612_st->TBT+=64*n) >= ym2612_st->TBC) { \
|
||||
ym2612_st->TBT -= ym2612_st->TBC; \
|
||||
if(ym2612_st->mode & 0x08) ym2612_st->status |= 2; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
void YM2612Init_(int baseclock, int rate);
|
||||
void YM2612ResetChip_(void);
|
||||
int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty);
|
||||
|
||||
int YM2612Write_(unsigned int a, unsigned int v);
|
||||
unsigned char YM2612Read_(void);
|
||||
//unsigned char YM2612Read_(void);
|
||||
|
||||
int YM2612PicoTick_(int n);
|
||||
void YM2612PicoStateLoad_(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue