1
0
Fork 0

Fix some issues with commit 4282. Thanks dreamer_ and jmarsh.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4283
This commit is contained in:
Peter Veenstra 2019-11-12 12:25:43 +00:00
parent 92da7c45ef
commit a5d561a3ad

View file

@ -1086,14 +1086,14 @@ void Chip::WriteBD( Bit8u val ) {
#define REGOP( _FUNC_ ) \
index = ( ( reg >> 3) & 0x20 ) | ( reg & 0x1f ); \
if ( OpOffsetTable[ index ] ) { \
Operator* regOp = (Operator*)( ((char *)this ) + OpOffsetTable[ index ] ); \
Operator* regOp = (Operator*)( ((char *)this ) + OpOffsetTable[ index ]-1 ); \
regOp->_FUNC_( this, val ); \
}
#define REGCHAN( _FUNC_ ) \
index = ( ( reg >> 4) & 0x10 ) | ( reg & 0xf ); \
if ( ChanOffsetTable[ index ] ) { \
Channel* regChan = (Channel*)( ((char *)this ) + ChanOffsetTable[ index ] ); \
Channel* regChan = (Channel*)( ((char *)this ) + ChanOffsetTable[ index ]-1 ); \
regChan->_FUNC_( this, val ); \
}
@ -1444,7 +1444,7 @@ void InitTables( void ) {
//Add back the bits for highest ones
if ( i >= 16 )
index += 9;
ChanOffsetTable[i] = (Bit16u)(index*sizeof(DBOPL::Channel));
ChanOffsetTable[i] = 1+(Bit16u)(index*sizeof(DBOPL::Channel));
}
//Same for operators
for ( Bitu i = 0; i < 64; i++ ) {
@ -1460,11 +1460,12 @@ void InitTables( void ) {
OpOffsetTable[i] = ChanOffsetTable[chNum]+(Bit16u)(opNum*sizeof(DBOPL::Operator));
}
#if 0
DBOPL::Chip* chip = 0;
//Stupid checks if table's are correct
for ( Bitu i = 0; i < 18; i++ ) {
Bit32u find = (Bit16u)( &(chip->chan[ i ]) );
for ( Bitu c = 0; c < 32; c++ ) {
if ( ChanOffsetTable[c] == find ) {
if ( ChanOffsetTable[c] == find+1 ) {
find = 0;
break;
}
@ -1476,7 +1477,7 @@ void InitTables( void ) {
for ( Bitu i = 0; i < 36; i++ ) {
Bit32u find = (Bit16u)( &(chip->chan[ i / 2 ].op[i % 2]) );
for ( Bitu c = 0; c < 64; c++ ) {
if ( OpOffsetTable[c] == find ) {
if ( OpOffsetTable[c] == find+1 ) {
find = 0;
break;
}