Subversion Repositories svn.mios

Rev

Rev 324 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 324 Rev 878
Line 1... Line 1...
1
; $Id: main.asm 324 2008-05-03 20:25:44Z tk $
1
; $Id: main.asm 878 2010-01-02 15:40:58Z tk $
2
;
2
;
3
; A CORE->DIN/DOUT Module Interconnection Test
3
; A CORE->DIN/DOUT Module Interconnection Test
4
;
4
;
5
; ==========================================================================
5
; ==========================================================================
6
;
6
;
Line 35... Line 35...
35
#include <mios_mt_table.inc>
35
#include <mios_mt_table.inc>
36
#include <mios_enc_table.inc>
36
#include <mios_enc_table.inc>
37
37
38
;; ---[ Custom LCD driver ]---
38
;; ---[ Custom LCD driver ]---
39
#include <app_lcd.inc>
39
#include <app_lcd.inc>
-
 
40
-
 
41
;; ---[ Debug Message Module ]---
-
 
42
#include <debug_msg.inc>
-
 
43
40
44
41
;; ==========================================================================
45
;; ==========================================================================
42
;;  All MIOS hooks in one file
46
;;  All MIOS hooks in one file
43
;; ==========================================================================
47
;; ==========================================================================
44
48
Line 91... Line 95...
91
    call    MIOS_LCD_Clear
95
    call    MIOS_LCD_Clear
92
96
93
    TABLE_ADDR TEXT_WELCOME_0
97
    TABLE_ADDR TEXT_WELCOME_0
94
    call    MIOS_LCD_PrintString
98
    call    MIOS_LCD_PrintString
95
    call    MIOS_LCD_PrintString
99
    call    MIOS_LCD_PrintString
-
 
100
-
 
101
    call    DEBUG_MSG_SendHeader
-
 
102
    movlw   '\n'
-
 
103
    call    DEBUG_MSG_SendChar
-
 
104
    call    DEBUG_MSG_SendFooter
-
 
105
   
-
 
106
    call    DEBUG_MSG_SendHeader
-
 
107
    call    DEBUG_MSG_SendASMString
-
 
108
    db  "SRIO Interconnection Test\n", 0
-
 
109
    call    DEBUG_MSG_SendFooter
-
 
110
   
-
 
111
    call    DEBUG_MSG_SendHeader
-
 
112
    call    DEBUG_MSG_SendASMString
-
 
113
    db  "=========================\n", 0
-
 
114
    call    DEBUG_MSG_SendFooter
-
 
115
-
 
116
    call    DEBUG_MSG_SendHeader
-
 
117
    call    DEBUG_MSG_SendASMString
-
 
118
    db  "Please play a note on any MIDI channel.\n", 0
-
 
119
    call    DEBUG_MSG_SendFooter
96
120
97
    bsf DISPLAY_UPDATE_REQ, 0
121
    bsf DISPLAY_UPDATE_REQ, 0
98
122
99
    return
123
    return
100
124
Line 120... Line 144...
120
    movf    PRODL, W
144
    movf    PRODL, W
121
    addwf   TBLPTRL, F
145
    addwf   TBLPTRL, F
122
    movf    PRODH, W
146
    movf    PRODH, W
123
    addwfc  TBLPTRH, F
147
    addwfc  TBLPTRH, F
124
    movlw   SRIO_PIN_NAMES_LEN
148
    movlw   SRIO_PIN_NAMES_LEN
125
    goto    MIOS_LCD_PrintPreconfString
149
    call    MIOS_LCD_PrintPreconfString
-
 
150
-
 
151
-
 
152
    ;; send message to MIOS Terminal
-
 
153
    call    DEBUG_MSG_SendHeader
-
 
154
-
 
155
    movf    SRIO_PIN_NUMBER, W
-
 
156
    bz  USER_DISPLAY_Tick_DO
-
 
157
    addlw   -1
-
 
158
    bz  USER_DISPLAY_Tick_SC
-
 
159
    addlw   -1
-
 
160
    bz  USER_DISPLAY_Tick_RC
-
 
161
    rgoto   USER_DISPLAY_Tick_Fail
-
 
162
-
 
163
USER_DISPLAY_Tick_DO
-
 
164
    call    DEBUG_MSG_SendASMString
-
 
165
    db  "Pin J8:DO set to 5V, J8:SC/J9:SC and J8:RC/J9:RC set to 0V. ", 0
-
 
166
    rgoto   USER_DISPLAY_Tick_Cont
-
 
167
-
 
168
USER_DISPLAY_Tick_SC
-
 
169
    call    DEBUG_MSG_SendASMString
-
 
170
    db  "Pin J8:SC/J9:SC set to 5V, J8:DO and J8:RC/J9:RC set to 0V. ", 0
-
 
171
    rgoto   USER_DISPLAY_Tick_Cont
-
 
172
-
 
173
USER_DISPLAY_Tick_RC
-
 
174
    call    DEBUG_MSG_SendASMString
-
 
175
    db  "Pin J8:RC/J9:RC set to 5V, J8:DO and J8:SC/J9:SC set to 0V. ", 0
-
 
176
    rgoto   USER_DISPLAY_Tick_Cont
-
 
177
-
 
178
USER_DISPLAY_Tick_Fail
-
 
179
    call    DEBUG_MSG_SendASMString
-
 
180
    db  "Something unexpected happened! Please report to tk@midibox.org! ", 0
-
 
181
    ;;  rgoto   USER_DISPLAY_Tick_Cont
-
 
182
-
 
183
USER_DISPLAY_Tick_Cont
-
 
184
    BRA_IFSET MIOS_SRIO_PORT_DIN, MIOS_SRIO_PIN_DIN, ACCESS, USER_DISPLAY_Tick_DI1
-
 
185
USER_DISPLAY_Tick_DI0
-
 
186
    call    DEBUG_MSG_SendASMString
-
 
187
    db  "Pin J9:SI reads Logic-0 (ca. 0V).\n", 0
-
 
188
    goto    DEBUG_MSG_SendFooter
-
 
189
-
 
190
USER_DISPLAY_Tick_DI1  
-
 
191
    call    DEBUG_MSG_SendASMString
-
 
192
    db  "Pin J9:SI reads Logic-1 (ca. 5V).\n", 0
-
 
193
    goto    DEBUG_MSG_SendFooter
-
 
194
126
   
195
   
127
196
128
SRIO_PIN_NAMES_LEN  EQU 2
197
SRIO_PIN_NAMES_LEN  EQU 2
129
SRIO_PIN_NAMES_NUM  EQU 3
198
SRIO_PIN_NAMES_NUM  EQU 3
130
SRIO_PIN_NAMES_TABLE
199
SRIO_PIN_NAMES_TABLE
Line 143... Line 212...
143
USER_MPROC_NotifyReceivedEvent
212
USER_MPROC_NotifyReceivedEvent
144
    ;; if modulation wheel received: set new pin
213
    ;; if modulation wheel received: set new pin
145
    movf    MIOS_PARAMETER1, W
214
    movf    MIOS_PARAMETER1, W
146
    andlw   0xf0
215
    andlw   0xf0
147
    xorlw   0xb0
216
    xorlw   0xb0
148
    bnz USER_NotifyReceivedEvent_End
217
    bnz USER_NotifyReceivedEvent_ChkNote
149
    movf    MIOS_PARAMETER2, W
218
    movf    MIOS_PARAMETER2, W
150
    xorlw   0x01
219
    xorlw   0x01
151
    bnz USER_NotifyReceivedEvent_End
220
    bnz USER_NotifyReceivedEvent_ChkNote
152
221
153
    movf    MIOS_PARAMETER3, W
222
    movf    MIOS_PARAMETER3, W
154
    movwf   SRIO_PIN_NUMBER
223
    movwf   SRIO_PIN_NUMBER
155
    movlw   SRIO_PIN_NAMES_NUM
224
    movlw   SRIO_PIN_NAMES_NUM
156
    cpfslt  SRIO_PIN_NUMBER, ACCESS
225
    cpfslt  SRIO_PIN_NUMBER, ACCESS
157
    clrf SRIO_PIN_NUMBER
226
    clrf SRIO_PIN_NUMBER
158
    bsf DISPLAY_UPDATE_REQ, 0
227
    bsf DISPLAY_UPDATE_REQ, 0
159
228
160
    ;; set the pin depending on selected pin number
229
    ;; set the pin depending on selected SRIO number
161
    call    SRIO_SetPin
230
    call    SRIO_SetPin
-
 
231
    rgoto   USER_NotifyReceivedEvent_End
-
 
232
-
 
233
-
 
234
USER_NotifyReceivedEvent_ChkNote
-
 
235
    ;; alternative control via MIDI keyboard (Note On Events with velocity > 0)
-
 
236
    movf    MIOS_PARAMETER1, W
-
 
237
    andlw   0xf0
-
 
238
    xorlw   0x90
-
 
239
    bnz USER_NotifyReceivedEvent_End
-
 
240
    movf    MIOS_PARAMETER3, W
-
 
241
    bz  USER_NotifyReceivedEvent_End
-
 
242
    ;; normalize note to 0..11 range
-
 
243
    movf    MIOS_PARAMETER2, W
-
 
244
USER_NotifyReceivedEvent_NoteNor
-
 
245
    addlw   -12
-
 
246
    BRA_IFCLR WREG, 7, ACCESS, USER_NotifyReceivedEvent_NoteNor
-
 
247
    addlw   12      ; now in range 0..11
-
 
248
    movwf   SRIO_PIN_NUMBER
-
 
249
   
-
 
250
    movlw   SRIO_PIN_NAMES_NUM
-
 
251
    cpfslt  SRIO_PIN_NUMBER, ACCESS
-
 
252
    clrf SRIO_PIN_NUMBER
-
 
253
    bsf DISPLAY_UPDATE_REQ, 0
-
 
254
-
 
255
    ;; set the pin depending on selected SRIO number
-
 
256
    call    SRIO_SetPin
-
 
257
    ;;  rgoto   USER_NotifyReceivedEvent_End
-
 
258
162
USER_NotifyReceivedEvent_End
259
USER_NotifyReceivedEvent_End
163
    return
260
    return
164
261
165
262
166
;; --------------------------------------------------------------------------
263
;; --------------------------------------------------------------------------