Using two buttons to select the L/R SID is pretty easy, just follow the step-by-step procedure described below.
Difficulty level:
Required actions:
Affected files [2]:
src/cs_menu_buttons.inc
setup_*.inc
setup_*.asm
.CS_MENU_DIN_TABLE
DIN_ENTRY CS_MENU_BUTTON_SID_R, 4, 2 ; direct access to L/R toggling DIN_ENTRY CS_MENU_BUTTON_SID_L, 4, 3 ; direct access to L/R toggling
4,2
and 4,3
)
DIN_ENTRY_EOT MACRO dw 0x0000, 0x0000 ENDM CS_MENU_DIN_TABLE ;; Function name SR# Pin# DIN_ENTRY CS_MENU_BUTTON_Dec, 1, 0 ; only valid if rotary encoder not assigned to these pins DIN_ENTRY CS_MENU_BUTTON_Inc, 1, 1 ; (see mios_tables.inc) and CS_MENU_USE_INCDEC_BUTTONS == 1
DIN_ENTRY_EOT MACRO dw 0x0000, 0x0000 ENDM CS_MENU_DIN_TABLE ;; Function name SR# Pin# DIN_ENTRY CS_MENU_BUTTON_SID_R, 4, 2 ; direct access to L/R toggling DIN_ENTRY CS_MENU_BUTTON_SID_L, 4, 3 ; direct access to L/R toggling DIN_ENTRY CS_MENU_BUTTON_Dec, 1, 0 ; only valid if rotary encoder not assigned to these pins DIN_ENTRY CS_MENU_BUTTON_Inc, 1, 1 ; (see mios_tables.inc) and CS_MENU_USE_INCDEC_BUTTONS == 1
CS_MENU_DOUT_TABLE
DOUT_ENTRY TMP4, 6, 1, 6 ; LEFT Sid LED DOUT_ENTRY TMP4, 7, 1, 7 ; RIGHT Sid LED
1,6
and 1,7
) according to where you wired your two status LEDs
DOUT_ENTRY_EOT MACRO dw 0x0000, 0x0000 ENDM CS_MENU_DOUT_TABLE ;; Register and bit SR# Pin# Description DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 0, 1, 0 ; SID1 LED (Note: Pin #0 is the D7 output of first SR) DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 1, 1, 1 ; SID2 LED DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 2, 1, 2 ; SID3 LED DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 3, 1, 3 ; SID4 LED
DOUT_ENTRY_EOT MACRO dw 0x0000, 0x0000 ENDM CS_MENU_DOUT_TABLE ;; Register and bit SR# Pin# Description DOUT_ENTRY TMP4, 6, 1, 6 ; LEFT Sid LED DOUT_ENTRY TMP4, 7, 1, 7 ; RIGHT Sid LED DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 0, 1, 0 ; SID1 LED (Note: Pin #0 is the D7 output of first SR) DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 1, 1, 1 ; SID2 LED DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 2, 1, 2 ; SID3 LED DOUT_ENTRY CS_MENU_SELECTED_SID_FLAGS, 3, 1, 3 ; SID4 LED
src/cs_menu_buttons.inc
CS_MENU_BUTTON_SID_LR
;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_L movlw 0x01 goto CS_MENU_BUTTON_SID_TOGGLE ;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_R movlw 0x02 ;; goto CS_MENU_BUTTON_SID_TOGGLE CS_MENU_BUTTON_SID_TOGGLE ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0 return ;; exit with message if SID player mode enabled and SID1 selected BRA_IFSET SID_STAT, SID_STAT_SIDPLAYER_CS_DISABLE, ACCESS, CS_MENU_BUTTON_SP_IgnoreMsg ;; toggle L/R xorwf CS_MENU_SELECTED_SID_LR, 1 bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return
bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return ;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_LR ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0 return ;; exit with message if SID player mode enabled and SID1 selected BRA_IFSET SID_STAT, SID_STAT_SIDPLAYER_CS_DISABLE, ACCESS, CS_MENU_BUTTON_SP_IgnoreMsg ;; toggle L/R incf CS_MENU_SELECTED_SID_LR, W andlw 0x03 skpnz addlw 1 movwf CS_MENU_SELECTED_SID_LR bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return ;; ------------------------------------------------------------------ CS_MENU_BUTTON_Sync ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0
bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return ;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_L movlw 0x01 goto CS_MENU_BUTTON_SID_TOGGLE ;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_R movlw 0x02 ;; goto CS_MENU_BUTTON_SID_TOGGLE CS_MENU_BUTTON_SID_TOGGLE ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0 return ;; exit with message if SID player mode enabled and SID1 selected BRA_IFSET SID_STAT, SID_STAT_SIDPLAYER_CS_DISABLE, ACCESS, CS_MENU_BUTTON_SP_IgnoreMsg ;; toggle L/R xorwf CS_MENU_SELECTED_SID_LR, 1 bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return ;; ------------------------------------------------------------------ CS_MENU_BUTTON_SID_LR ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0 return ;; exit with message if SID player mode enabled and SID1 selected BRA_IFSET SID_STAT, SID_STAT_SIDPLAYER_CS_DISABLE, ACCESS, CS_MENU_BUTTON_SP_IgnoreMsg ;; toggle L/R incf CS_MENU_SELECTED_SID_LR, W andlw 0x03 skpnz addlw 1 movwf CS_MENU_SELECTED_SID_LR bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ return ;; ------------------------------------------------------------------ CS_MENU_BUTTON_Sync ;; do nothing if button has been depressed btfsc MIOS_PARAMETER2, 0