C140: add bank types

This commit is contained in:
tildearrow 2023-10-11 02:48:39 -05:00
parent b08f1e656f
commit 8235f6ee66
10 changed files with 107 additions and 9 deletions

View file

@ -333,6 +333,11 @@ void c219_reset(struct c219_t *c219)
}
}
// TILDEARROW
void c140_bank_type(struct c140_t *c140, unsigned char type) {
c140->bank_type = type;
}
void c140_write(struct c140_t *c140, const unsigned short addr, const unsigned char data)
{
// voice register
@ -345,7 +350,16 @@ void c140_write(struct c140_t *c140, const unsigned short addr, const unsigned c
case 0x1: voice->lvol = data; break;
case 0x2: voice->freq = (voice->freq & ~0xff00) | (unsigned int)(data << 8); break;
case 0x3: voice->freq = (voice->freq & ~0x00ff) | data; break;
case 0x4: voice->bank = data; break;
case 0x4: { // TILDEARROW
if (c140->bank_type == 0) {
voice->bank = ((data&0x20)>>2)|data&7;
} else if (c140->bank_type == 1) {
voice->bank = ((data&0x30)>>1)|data&7;
} else {
voice->bank = data;
}
break;
}
case 0x5:
voice->compressed = c140_bit(data, 3);
voice->loop = c140_bit(data, 4);

View file

@ -5,7 +5,7 @@
MODIFIED Namco C140/C219 sound emulator - MODIFIED VERSION
by cam900
MODIFICATION by tildearrow - adds muting function
MODIFICATION by tildearrow - adds muting function AND VGM banking
THIS IS NOT THE ORIGINAL VERSION - you can find the original one in
commit 72d04777c013988ed8cf6da27c62a9d784a59dff
@ -78,6 +78,7 @@ struct c140_t
signed int lout, rout;
signed short mulaw[256];
signed short *sample_mem;
unsigned char bank_type;
};
struct c219_t
@ -106,6 +107,8 @@ void c140_write(struct c140_t *c140, const unsigned short addr, const unsigned c
void c219_write(struct c219_t *c219, const unsigned short addr, const unsigned char data);
void c140_bank_type(struct c140_t *c140, unsigned char type);
void c140_init(struct c140_t *c140);
void c219_init(struct c219_t *c219);