diff --git a/Source/SIDKick/AudioStreamSID.cpp b/Source/SIDKick/AudioStreamSID.cpp index 0de2d49..dd92918 100644 --- a/Source/SIDKick/AudioStreamSID.cpp +++ b/Source/SIDKick/AudioStreamSID.cpp @@ -86,6 +86,7 @@ uint8_t samActive = 0; #ifdef SID_DAC_MODE_SUPPORT extern uint8_t sidDACMode; int16_t sidCurDACValue = 0; +int16_t sidCurDACValueR = 0; #endif uint32_t samCurPos, samEndPos1, samStartPos2, samEndPos2; @@ -125,12 +126,15 @@ void AudioStreamSID::init() #ifdef SID_DAC_MODE_SUPPORT sidCurDACValue = 0; + sidCurDACValueR = 0; #endif sid16_1->set_chip_model( MOS6581 ); sid16_2->set_chip_model( MOS6581 ); sid16_1->reset(); sid16_2->reset(); + sid16_1->input( 0 ); + sid16_2->input( 0 ); sid16_1->set_sampling_parameters( CLOCKFREQ, SAMPLE_INTERPOLATE, AUDIO_SAMPLE_RATE_EXACT ); sid16_2->set_sampling_parameters( CLOCKFREQ, SAMPLE_INTERPOLATE, AUDIO_SAMPLE_RATE_EXACT ); @@ -261,10 +265,12 @@ void AudioStreamSID::updateConfiguration( uint8_t *cfg, uint8_t *globalCfg ) { sid_1->set_voice_mask( 0x07 ); sid_1->input( 0 ); + sid16_1->input( 0 ); } else { sid_1->set_voice_mask( 0x0f ); sid_1->input( -(1<input( -(1<set_voice_mask( 0x07 ); sid_2->input( 0 ); + sid16_2->input( 0 ); } else { sid_2->set_voice_mask( 0x0f ); sid_2->input( -(1<input( -(1<>= 8; - +skipMixer: if ( samSpeaking ) { int32_t sam = ( (int32_t)(*(int8_t*)&samvoice_raw[ samCurPos >> 1 ]) * samActive ) << 2; diff --git a/Source/SIDKick/SIDKick.ino b/Source/SIDKick/SIDKick.ino index 7b39b44..39bd077 100644 --- a/Source/SIDKick/SIDKick.ino +++ b/Source/SIDKick/SIDKick.ino @@ -67,25 +67,25 @@ const uint8_t *prgCode = NULL; #ifdef FIRMWARE_C128 #if audioDevice == 1 -static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', 0x44, 0x41, 0x43, '1', '2', '8' }; +static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', 0x44, 0x41, 0x43, '1', '2', '8', 0, 0, 0, 0 }; #else -static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', 0x4d, 0x51, 0x53, '1', '2', '8' }; +static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', 0x4d, 0x51, 0x53, '1', '2', '8', 0, 0, 0, 0 }; #endif #else #if audioDevice == 1 -static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', '/', 0x44, 0x41, 0x43, '6', '4' }; +static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', '/', 0x44, 0x41, 0x43, '6', '4', 0, 0, 0, 0 }; #else -static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', '/', 0x4d, 0x51, 0x53, '6', '4' }; +static const char VERSION_STR_Flash[20] = {0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, '0', '.', '2', '/', 0x4d, 0x51, 0x53, '6', '4', 0, 0, 0, 0 }; #endif #endif -// signature + version 0.21 +// signature + version 0.22 #define VERSION_STR_EXT_SIZE 16 static const unsigned char VERSION_STR_ext[VERSION_STR_EXT_SIZE] = { 0x53, 0x49, 0x44, 0x4b, 0x09, 0x03, 0x0b, 0x00, // signature + extension version 0 - 0, 21, // firmware version with stepping + 0, 22, // firmware version with stepping #ifdef SID_DAC_MODE_SUPPORT // support DAC modes? which? - 1, + SID_DAC_MONO8 | SID_DAC_STEREO8, #else 0, #endif @@ -140,6 +140,7 @@ uint8_t sidOnlyMode = SID_ONLY_OFF; uint8_t sidDACMode = SID_DAC_OFF; #endif + uint8_t addrLine = 0; uint32_t fmFakeOutput = 0; uint32_t fmAutoDetectStep = 0; @@ -1526,7 +1527,14 @@ FASTRUN void isrSID() #ifdef SID_DAC_MODE_SUPPORT else if ( D == 0xfc ) { - sidDACMode = 1; + sidDACMode = SID_DAC_MONO8; + stateInConfigMode = + stateInTransferMode = + stateInVisualizationMode = 0; + } + else if ( D == 0xfb ) + { + sidDACMode = SID_DAC_STEREO8; stateInConfigMode = stateInTransferMode = stateInVisualizationMode = 0; @@ -1615,7 +1623,7 @@ FASTRUN void isrSID() busValueTTL = 0xa2000; else // 8580 busValueTTL = 0x1d00; // 6581 - if ( A <= 24 ) + if ( A <= 25 ) { // pseudo stereo? if ( SID2_ADDR == (uint32_t)(1 << 31) ) @@ -1826,12 +1834,12 @@ noSID_FM_MIDI_Commands: newPotCounterX = newPotCounterY = 1; } else if ( potCycleCounter >= 256 ) { - if ( newPotCounterX && (data_9 & CORE_PIN4_BITMASK) ) + if ( newPotCounterX && ( (data_9 & CORE_PIN4_BITMASK) || potCycleCounter == 511 ) ) { outRegisters[ 25 ] = potCycleCounter - 256; newPotCounterX = 0; } - if ( newPotCounterY && (data_9 & CORE_PIN5_BITMASK) ) + if ( newPotCounterY && ( (data_9 & CORE_PIN5_BITMASK) || potCycleCounter == 511 ) ) { outRegisters[ 26 ] = potCycleCounter - 256; newPotCounterY = 0; diff --git a/Source/SIDKick/globals.h b/Source/SIDKick/globals.h index 52104ec..9bdf2bd 100644 --- a/Source/SIDKick/globals.h +++ b/Source/SIDKick/globals.h @@ -37,7 +37,7 @@ // Teensy clock speed (keep 816 unless you deactivate MIDI and LED) #define TEENSY_CLOCK 816 -#define FIRMWARE_C128 +//#define FIRMWARE_C128 // C128 does not support $D500 for SID #2 // except for the C64-mode if: @@ -50,7 +50,7 @@ //#define SUPPORT_MIDI // define if WS2818b-LED support to be included in the firmware -#define FANCY_LED +//#define FANCY_LED // define this to use the sample generation routine which adapts to the actual C64/C128 clock #define DYNAMIC_ADJUSTMENT_MIXER @@ -63,7 +63,7 @@ #define SID_DAC_OFF 0 #define SID_DAC_MONO8 1 #define SID_DAC_STEREO8 2 -#define SID_DAC_MONO16 3 -#define SID_DAC_STEREO16 4 +#define SID_DAC_MONO16 4 +#define SID_DAC_STEREO16 8 //#define DEBUG_OUTPUT