To get the three voices of the SID I had to mute the sample playback by patching the SID file, because JSIDPlay does not offer muting of the sample playback. This one was bit of a dog because the SID file contains at least three players, one for the intro, one for main, and one for the rest, which where relocated at run time. The intro and main tunes has low-pass and band-pass filter enabled. Resonance is at minimum on the intro and about 20% on the main tune. These settings and the cut-off frequency never change, and makes little to no difference to the sound compared to filters off. Since one sample is 4-bit, two samples is stored in one byte. The sample playing code plays the high nibble first, then the low one. Self modifying and duplicate code blocks is used to speed things up. Sample playing code for the intro tune: This can play samples at two volumes, full and half. Half volume throws away one bit, making it a 3bit playback instead of 4. 2133 85 E3 STA $E3 // Store accumulator, other registers is not used * Alternate between code path for high or low nibble 2135 A5 E4 LDA $E4 2137 D0 27 BNE $2160 * Code path for high nibble 2139 AD xl xh LDA $xhxl // Read a new sample byte from RAM at address $xhxl. This address is modified by line 216F and 2174 213c C9 1F CMP #$1F // Compare with end-of-sample marker $1F 213e D0 0C BNE $214C // = Branch if Not Equal 2140 A9 00 LDA #$00 // Equal, turn of sample playback 2142 8D 0E DD STA $DD0E 2145 A9 38 LDA #$38 // and set volume to base line (half of full) 2147 8D 18 D4 STA $D418 214a D0 2B BNE $2177 // Relative jump to common code path 214c 8D 61 21 STA $2161 // Store sample byte for later use by the low nibble code path 214f 4A LSR A // shift high nibble to low nibble 2150 4A LSR A 2151 4A LSR A 2152 4A LSR A 2153 EA / 4A NOP / LSR A // This is NOP for full volume or LSR A (shift right, divide by 2) for half volume. This is modified by the music player. 2154 18 CLC 2155 69 3v ADC #$3v // Add filter enable bits and volume offset v (0 for full volume or 4 for half volume. This is modified by the music player. 2157 8D 18 D4 STA $D418 // PLay sample! 215a A9 01 LDA #$01 // Set nibble selector to low nibble 215c 85 E4 STA $E4 215e D0 17 BNE $2177 // Relative jump to common code path * Code path for low nibble 2160 A9 sw LDA #$sw // Get sample byte saved by the high nibble code path 2162 29 0F AND #$0F // Strip off the high nibble 2164 EA / 4A NOP / LSR A // This is NOP for full volume or LSR A (shift right, divide by 2) for half volume. This is modified by the music player. 2165 18 CLC 2166 69 3v ADC #$3v // Add filter enable bits and volume offset v (0 for full volume or 4 for half volume. This is modified by the music player. 2168 8D 18 D4 STA $D418 // Play sample! 216b A9 00 LDA #$00 // Set nibble selector to high nibble 216d 85 E4 STA $E4 216f EE 3A 21 INC $213A // Modify data field of instruction at $2139: Increase 16bit address by one. 2172 D0 03 BNE $2177 2174 EE 3B 21 INC $213B * Common code path 2177 AD 0D DD LDA $DD0D // Clear interrupt flag 217a A5 E3 LDA $E3 // Restore accumulator 217c 40 RTI // Exit NMI interrupt service Sample playback code for the main tune: This one is similar to the intro one, but can play samples with three different volumes, full, 1/2, and 1/4. Full volume is never used, thus wasting 1 or 2 bits of the 4-bit samples. This one also resides in page zero, a 256 byte RAM area normally used for storing data for faster access. This speeds it up a bit. It contains one completely unnecessary instruction! Can you find it? :) 00a0 D8 CLD 00a1 85 0B STA $0B 00a3 AD xl xh LDA $xhxl 00a6 C9 1F CMP #$1F 00a8 D0 0C BNE $00B6 00aa A9 00 LDA #$00 00ac 8D 0E DD STA $DD0E 00af A9 38 LDA #$38 00b1 8D 18 D4 STA $D418 00b4 D0 2A BNE $00E0 00b6 24 0A BIT $0A 00b8 30 12 BMI $00CC 00ba 4A LSR A 00bb 4A LSR A 00bc 4A LSR A 00bd 4A LSR A 00be EA / 4A NOP / LSR A 00bf EA / 4A NOP / LSR A 00c0 18 CLC 00c1 69 3v ADC #$3v 00c3 8D 18 27 STA $D418 00c6 A9 80 LDA #$80 00c8 85 0A STA $0A 00ca D0 14 BNE $00E0 00cc 29 0F AND #$0F 00ce EA / 4A NOP / LSR A 00cf EA / 4A NOP / LSR A 00d0 18 CLC 00d1 69 3v ADC #$3v 00d3 8D 18 27 STA $D418 00d6 A9 00 LDA #$00 00d8 85 0A STA $0A 00da E6 A4 INC $A4 00dc D0 02 BNE $00E0 00de E6 A5 INC $A5 00e0 AD 0D DD LDA $DD0D 00e3 A5 0B LDA $0B 00e5 40 RTI