Whilst the previous chapter dealt with sending all 14 registers to the sound chip it sometimes is only required to send one register.
This is equivalent to the $F590 ROM routine but alot faster
The same labels are used as in the previous chapter
#DEFINE ayc_Register $FF #DEFINE ayc_Write $FD #DEFINE ayc_Inactive $DD #DEFINE via_pcr $030C #DEFINE via_porta $030F
Load the accumulator with the Register number and store in VIA Port A. In this example it is the Volume of Channel A.
LDA #08 STA via_porta
Set AY Control lines to Register Number
LDA #ayc_Register STA via_pcr
Set AY Control lines to inactive
LDA #ayc_Inactive STA via_pcr
Place the Register value into VIA Port A. In this example we'll set the volume to 15(maximum).
LDA #15 STA via_porta
Set AY Control lines to Write
LDA #ayc_Write STA via_pcr
Set AY Control lines to inactive again
LDA #ayc_Inactive STA via_pcr
And RTS
RTS