Hey... Here is my sid_ain.inc: ;
; Enhanced AIN Driver for MIDIbox SID
; which allows you to change Control Surface Parameters via Pots
; Layers are not supported here, instead every menu parameter can be assigned
; to a single pot.
;
; Up to 64 entries can be added to SID_AIN_POT_ASSIGN_TABLE (see below)
;
; 19 entries are predefined here
;
; Open sid_init.inc and configure the AIN driver in the following way:
;
; ;; initialize the AIN driver
; movlw 19 ; use 19 pots
; call MIOS_AIN_NumberSet
; call MIOS_AIN_Muxed ; service the multiplexer interface
; movlw 0x07
; movwf MIOS_AIN_DeadbandSet ; configure deadband for 7-bit values
;
; ==========================================================================
;
; Copyright (C) 1998-2003 Thorsten Klose (Thorsten.Klose@gmx.de)
; http://www.uCApps.de
;
; ==========================================================================
;
; This file is part of MIDIbox SID
;
; MIDIbox SID is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; MIDIbox SID is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with MIDIbox SID; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;
; ==========================================================================
;; --------------------------------------------------------------------------
;; This function is called by MIOS when a pot has been moved
;; Input:
;; o Pot number in WREG and MIOS_PARAMETER1
;; o LSB value in MIOS_PARAMETER2
;; o MSB value in MIOS_PARAMETER3
;; --------------------------------------------------------------------------
USER_AIN_NotifyChange
SID_AIN_NotifyChange
;; store pot number in TMP1
movwf TMP1
;; get 7-bit value of pot (number already in WREG)
call MIOS_AIN_Pin7bitGet
;; store it in MIOS_PARAMETER3
movwf MIOS_PARAMETER3
;; get offset to SID data base
call CS_MENU_MS_GetSIDNumber
call CS_MENU_MS_GetSIDBase
;; prepare CS parameters depending on pot number
;; read it from table for an easy customization
TABLE_ADDR SID_AIN_POT_ASSIGN_TABLE
;; select entry (pot number * 4)
movf TMP1, W ; pot number stored in TMP1
mullw 4
movf PRODL, W
addwf TBLPTRL, F
movf PRODH, W
addwfc TBLPTRH, F
;; get function and store it in TMP1
tblrd*+
movff TABLAT, TMP1
;; get parameter value and add it to FSR0L
tblrd*+
movf TABLAT, W
addwf FSR0L, F
;; get menu number and store it in TMP2
tblrd*+
movff TABLAT, TMP2
;; get menu offset and pos
tblrd*+
;; store cursor position in MIOS_PARAMETER1
movf TABLAT, W
andlw 0x0f
movwf MIOS_PARAMETER1
;; store page offset in MIOS_PARAMETER2
swapf TABLAT, W
andlw 0x0f
movwf MIOS_PARAMETER2
;; absolute value already in MIOS_PARAMETER3
;; now branch depending on function
swapf TMP1, W
andlw 0x0f
JUMPTABLE_2BYTES 4 ; entries
rgoto SID_AIN_Modify_Sys
rgoto SID_AIN_Modify_Osc
rgoto SID_AIN_Modify_LFO
rgoto SID_AIN_Modify_Env
;; ---
SID_AIN_Modify_Sys
;; just modify current parameter
movf TMP2, W ; load menu number
rgoto SID_AIN_ModifyValue
SID_AIN_Modify_Osc
;; add voice offset
call CS_MENU_Hlp_AddVoiceOffset
;; and change parameter
rgoto SID_AIN_Modify_Sys
SID_AIN_Modify_LFO
;; add LFO offset
call CS_MENU_Hlp_AddLFOOffset
;; and change parameter
rgoto SID_AIN_Modify_Sys
SID_AIN_Modify_Env
;; add ENV offset
call CS_MENU_Hlp_AddENVOffset
;; and change parameter
rgoto SID_AIN_Modify_Sys
;; the pot assign table
;; similar to the table which can be found in cs_menu_enc_table.inc
;; (read the comments there)
;; NOTE: this version can only be used for changing control surface
;; parameter. It doesn't allow you to send CC values or whatever.
;; feel free to enhance the code like in cs_menu_enc.inc if you
;; want to control also other parameters
CSAIN_ENTRY MACRO function, parameter, menu, page_offset, cursor_pos
db function, parameter, menu, ((page_offset&0x0f)<<4) | (cursor_pos&0x0f)
ENDM
;; available functions:
;; CSENC_ENTRY parameters:
;; - the ID itself
;; - the variable offset (see app_defines.inc, variables begin with CS_SID_*)
;; - the menu in which the variable is located (see cs_menu_tables.inc)
;; - the page offset (which menu item should be at the left border)
;; - the cursor position of the menu item
#define CS_MENU_AIN_CHANGE_SYS 0x00 ; to change any internal parameter directly
#define CS_MENU_AIN_CHANGE_OSC 0x10 ; to change parameter of currently selected OSC
#define CS_MENU_AIN_CHANGE_LFO 0x20 ; to change parameter of currently selected LFO
#define CS_MENU_AIN_CHANGE_ENV 0x30 ; to change parameter of currently selected ENV
SID_AIN_POT_ASSIGN_TABLE
;; every pot has it's own entry
;; no layer handling supported here!
;; up to 64 entries are allowed for various parameter values
;; Function name parameter menu offset cursor pos
CSAIN_ENTRY CS_MENU_AIN_CHANGE_SYS, CS_SID_FILTER_CUTOFF, CS_MENU_FIL, 0x00, 0x01
CSAIN_ENTRY CS_MENU_AIN_CHANGE_SYS, CS_SID_FILTER_RESONANCE, CS_MENU_FIL, 0x00, 0x02
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_DECAY, CS_MENU_OSC, 0x03, 0x05
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_SUSTAIN, CS_MENU_OSC, 0x03, 0x06
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_RELEASE, CS_MENU_OSC, 0x03, 0x07
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_TRANSPOSE, CS_MENU_OSC, 0x09, 0x09
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_FINETUNE, CS_MENU_OSC, 0x09, 0x0a
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_PORTAMENTO, CS_MENU_OSC, 0x09, 0x0b
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_ARPEGGIATOR,CS_MENU_OSC, 0x09, 0x0c
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_PULSEWIDTH, CS_MENU_OSC, 0x09, 0x0d
CSAIN_ENTRY CS_MENU_AIN_CHANGE_LFO, CS_SID_LFOx_RATE, CS_MENU_LFO, 0x00, 0x02
CSAIN_ENTRY CS_MENU_AIN_CHANGE_LFO, CS_SID_LFOx_DEPTH, CS_MENU_LFO, 0x00, 0x03
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_DELAY, CS_MENU_OSC, 0x03, 0x03
CSAIN_ENTRY CS_MENU_AIN_CHANGE_OSC, CS_SID_VOICEx_ATTACK, CS_MENU_OSC, 0x03, 0x04
CSAIN_ENTRY CS_MENU_AIN_CHANGE_ENV, CS_SID_ENVx_DEPTH, CS_MENU_ENV, 0x01, 0x01
CSAIN_ENTRY CS_MENU_AIN_CHANGE_ENV, CS_SID_ENVx_ATTACK, CS_MENU_ENV, 0x01, 0x02
CSAIN_ENTRY CS_MENU_AIN_CHANGE_ENV, CS_SID_ENVx_DECAY, CS_MENU_ENV, 0x01, 0x03
CSAIN_ENTRY CS_MENU_AIN_CHANGE_ENV, CS_SID_ENVx_SUSTAIN, CS_MENU_ENV, 0x01, 0x04
CSAIN_ENTRY CS_MENU_AIN_CHANGE_ENV, CS_SID_ENVx_RELEASE, CS_MENU_ENV, 0x01, 0x05
;; --------------------------------------------------------------------------
;; This function modifies a given parameter which is indexed like shown
;; here:
;; ID of CS_MENU in WREG (example: CS_MENU_OSC)
;; table (cursor) position in MIOS_PARAMETER1 (example: 0x01 for waveform)
;; page offset in MIOS_PARAMETER2 (example: 0x00 begins at first line)
;; 7-bit value in MIOS_PARAMETER3
;; --------------------------------------------------------------------------
SID_AIN_ModifyValue
;; save WREG
movwf TMP5
;; change to menu
movwf CS_MENU
call CS_MENU_Page_Init
;; set new page offset and cursor pos
movff MIOS_PARAMETER1, CS_MENU_CURSOR_POS
movff MIOS_PARAMETER2, CS_MENU_PAGE_OFFSET
;; select parameter
call CS_MENU_EXEC_SelPar
;; copy value into the appr. CS register
;; here we could scale the value over the whole pot range,
;; but to keep it simple we just limit it to the max value
movf MIOS_PARAMETER3, W
cpfsgt CS_MENU_PARAMETER_MAX_L, ACCESS ; (IFLEQ)
movf CS_MENU_PARAMETER_MAX_L, W
movwf CS_MENU_PARAMETER_L
call CS_MENU_ParameterUpdate ; update parameter
call CS_MENU_EXEC_Hlp_ChangeMenu ; deselect parameter
;; force a display update and exit
bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ
return
in sid_init.inc:
;; initialize the AIN driver
movlw 2 ; use 2 pots
call MIOS_AIN_NumberSet
call MIOS_AIN_UnMuxed ; don't service multiplexer interface
movlw 7
call MIOS_AIN_DeadbandSet After u made those changes - u build a new .hex file then convert that to .syx - this proceedure has been covered many times and is also on the main ucapps.de site :)