User Tools

Site Tools


Changing the global volume

In the SID there is a register which allows you to change the global volume of the output in 4 bit precision = 16 steps, ranging from $0 to $f. If you're using a defMON tune in some other program you may want to control this register, to fade music in or out.

To do this, just change the contents of men location $10b1 and make sure that the upper nibble is always zero. In essence, set $10b1 to $0x, where x is a value between $0 (silent) and $f (max volume). Looking under the hood, the code looks like this:

.sidf_mode_gvol1    = *+1
                lda #0
.sidf_mode_gvol2    = *+1
                ora #$0f ;this one can't be edited at the moment..
                sta sidbase+$18        ;$D418/54296/SID+24 Select Filter Mode and Volume

…and $10b1 happens to point to that “$0f” byte which is OR'ed together with the filter mode byte from the sidtab and then eventually stored in $d418.

Happy hacking!

docs/globalvolume.txt · Last modified: 2014/12/08 08:20 by ftc