This shows you the differences between two versions of the page.
adding_buttons_for_bankstick_switching [2008/03/23 21:56] |
adding_buttons_for_bankstick_switching [2008/03/23 21:56] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to add bankstick UP/DOWN buttons to mbSID v2 ====== | ||
+ | This is another draft. Actually it's just the source code that you'll need to add :D Make sure you've read the other tutorials that cover all the stuff needed to understand this one. This is not really a great way of achieving what we want, but it's good enough for now... | ||
+ | |||
+ | * In app_defines.h you'll need to find some space (1 byte) for a variable we'll name "BANK_STICK_NO". This variable will hold the selected bankstick. | ||
+ | |||
+ | * In cs_menu_buttons.inc: | ||
+ | <code> | ||
+ | CS_MENU_BUTTON_BankUp | ||
+ | ;; do nothing if button has been depressed | ||
+ | btfsc MIOS_PARAMETER2, 0 | ||
+ | return | ||
+ | incf BANK_STICK_NO, W ; increment bank, load result into w | ||
+ | goto CS_MENU_BUTTON_AssignBank | ||
+ | |||
+ | CS_MENU_BUTTON_BankDown | ||
+ | ;; do nothing if button has been depressed | ||
+ | btfsc MIOS_PARAMETER2, 0 | ||
+ | return | ||
+ | decf BANK_STICK_NO, W ; decrement bank, load result into w | ||
+ | ;; goto CS_MENU_BUTTON_AssignBank | ||
+ | |||
+ | CS_MENU_BUTTON_AssignBank | ||
+ | andlw 0x07 ; this keeps result from getting bigger than 7 | ||
+ | movwf BANK_STICK_NO | ||
+ | movwf CS_MENU_SID_M_BANK | ||
+ | movff CS_MENU_SID_M_BANK, SID_BANK | ||
+ | ;; mask out 'sent' flag | ||
+ | bcf SID_PATCH, 7 | ||
+ | call CS_MENU_EXEC_GoToMain | ||
+ | return | ||
+ | </code> |