From a5d561a3adb94354c26debd6ab564f3713125b24 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 12 Nov 2019 12:25:43 +0000 Subject: [PATCH 1/2] Fix some issues with commit 4282. Thanks dreamer_ and jmarsh. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4283 --- src/hardware/dbopl.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hardware/dbopl.cpp b/src/hardware/dbopl.cpp index 0a616c40..26f4f234 100644 --- a/src/hardware/dbopl.cpp +++ b/src/hardware/dbopl.cpp @@ -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; } From fab69cb4c7b14db5a72f7d52d7e6e762d47f3b80 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 12 Nov 2019 13:31:23 +0000 Subject: [PATCH 2/2] Stuff written to the console needs a cariage return since 4114. Thanks for spotting this dreamer_. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4284 --- src/dos/cdrom_image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dos/cdrom_image.cpp b/src/dos/cdrom_image.cpp index 68d1806d..d669462a 100644 --- a/src/dos/cdrom_image.cpp +++ b/src/dos/cdrom_image.cpp @@ -170,7 +170,7 @@ bool CDROM_Interface_Image::SetDevice(char* path, int forceCD) // print error message on dosbox console char buf[MAX_LINE_LENGTH]; - snprintf(buf, MAX_LINE_LENGTH, "Could not load image file: %s\n", path); + snprintf(buf, MAX_LINE_LENGTH, "Could not load image file: %s\r\n", path); Bit16u size = (Bit16u)strlen(buf); DOS_WriteFile(STDOUT, (Bit8u*)buf, &size); return false;