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->SID Module Interconnection Test
3
; A CORE->SID 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
;;  Include the SID SR Code
46
;;  Include the SID SR Code
43
;; ==========================================================================
47
;; ==========================================================================
44
#include "sid_sr.inc"
48
#include "sid_sr.inc"
Line 98... Line 102...
98
    call    MIOS_LCD_Clear
102
    call    MIOS_LCD_Clear
99
103
100
    TABLE_ADDR TEXT_WELCOME_0
104
    TABLE_ADDR TEXT_WELCOME_0
101
    call    MIOS_LCD_PrintString
105
    call    MIOS_LCD_PrintString
102
    call    MIOS_LCD_PrintString
106
    call    MIOS_LCD_PrintString
-
 
107
-
 
108
    call    DEBUG_MSG_SendHeader
-
 
109
    movlw   '\n'
-
 
110
    call    DEBUG_MSG_SendChar
-
 
111
    call    DEBUG_MSG_SendFooter
-
 
112
   
-
 
113
    call    DEBUG_MSG_SendHeader
-
 
114
    call    DEBUG_MSG_SendASMString
-
 
115
    db  "MBSID Interconnection Test\n", 0
-
 
116
    call    DEBUG_MSG_SendFooter
-
 
117
   
-
 
118
    call    DEBUG_MSG_SendHeader
-
 
119
    call    DEBUG_MSG_SendASMString
-
 
120
    db  "==========================\n", 0
-
 
121
    call    DEBUG_MSG_SendFooter
-
 
122
-
 
123
    call    DEBUG_MSG_SendHeader
-
 
124
    call    DEBUG_MSG_SendASMString
-
 
125
    db  "Please play a note on any MIDI channel.\n", 0
-
 
126
    call    DEBUG_MSG_SendFooter
103
127
104
    bsf DISPLAY_UPDATE_REQ, 0
128
    bsf DISPLAY_UPDATE_REQ, 0
105
129
106
    return
130
    return
107
131
Line 127... Line 151...
127
    movf    PRODL, W
151
    movf    PRODL, W
128
    addwf   TBLPTRL, F
152
    addwf   TBLPTRL, F
129
    movf    PRODH, W
153
    movf    PRODH, W
130
    addwfc  TBLPTRH, F
154
    addwfc  TBLPTRH, F
131
    movlw   SID_PIN_NAMES_LEN
155
    movlw   SID_PIN_NAMES_LEN
132
    goto    MIOS_LCD_PrintPreconfString
156
    call    MIOS_LCD_PrintPreconfString
-
 
157
-
 
158
   
-
 
159
    ;; send message to MIOS Terminal
-
 
160
    call    DEBUG_MSG_SendHeader
-
 
161
-
 
162
    ;; special message for CS# pin (since it's inverted)
-
 
163
    movf    SID_PIN_NUMBER, W
-
 
164
    xorlw   14
-
 
165
    bnz USER_DISPLAY_Tick_Normal
-
 
166
USER_DISPLAY_Tick_CS
-
 
167
    call    DEBUG_MSG_SendASMString
-
 
168
    db  "Pin 'CS#' of SID chip set to 5V, remaining digital pins set to 0V as well.", 0
-
 
169
    call    DEBUG_MSG_SendFooter
-
 
170
    return
-
 
171
-
 
172
-
 
173
USER_DISPLAY_Tick_Normal
-
 
174
    call    DEBUG_MSG_SendASMString
-
 
175
    db  "Pin '", 0
-
 
176
-
 
177
    TABLE_ADDR SID_PIN_NAMES_TABLE
-
 
178
    movf    SID_PIN_NUMBER, W
-
 
179
    mullw   SID_PIN_NAMES_LEN
-
 
180
    movf    PRODL, W
-
 
181
    addwf   TBLPTRL, F
-
 
182
    movf    PRODH, W
-
 
183
    addwfc  TBLPTRH, F
-
 
184
-
 
185
    ;; always four chars
-
 
186
    tblrd*+
-
 
187
    movf    TABLAT, W
-
 
188
    call    DEBUG_MSG_SendChar
-
 
189
    tblrd*+
-
 
190
    movf    TABLAT, W
-
 
191
    call    DEBUG_MSG_SendChar
-
 
192
    tblrd*+
-
 
193
    movf    TABLAT, W
-
 
194
    call    DEBUG_MSG_SendChar
-
 
195
    tblrd*+
-
 
196
    movf    TABLAT, W
-
 
197
    call    DEBUG_MSG_SendChar
-
 
198
-
 
199
    call    DEBUG_MSG_SendASMString
-
 
200
    db  "' of SID chip set to 5V, remaining digital pins set to 0V (exception: CS# set to 5V)", 0
-
 
201
    call    DEBUG_MSG_SendFooter
-
 
202
-
 
203
    return
133
   
204
   
134
205
135
SID_PIN_NAMES_LEN   EQU 4
206
SID_PIN_NAMES_LEN   EQU 4
136
SID_PIN_NAMES_NUM   EQU 15
207
SID_PIN_NAMES_NUM   EQU 15
137
SID_PIN_NAMES_TABLE
208
SID_PIN_NAMES_TABLE
Line 162... Line 233...
162
USER_MPROC_NotifyReceivedEvent
233
USER_MPROC_NotifyReceivedEvent
163
    ;; if modulation wheel received: set new pin
234
    ;; if modulation wheel received: set new pin
164
    movf    MIOS_PARAMETER1, W
235
    movf    MIOS_PARAMETER1, W
165
    andlw   0xf0
236
    andlw   0xf0
166
    xorlw   0xb0
237
    xorlw   0xb0
167
    bnz USER_NotifyReceivedEvent_End
238
    bnz USER_NotifyReceivedEvent_ChkNote
168
    movf    MIOS_PARAMETER2, W
239
    movf    MIOS_PARAMETER2, W
169
    xorlw   0x01
240
    xorlw   0x01
170
    bnz USER_NotifyReceivedEvent_End
241
    bnz USER_NotifyReceivedEvent_ChkNote
171
242
172
    movf    MIOS_PARAMETER3, W
243
    movf    MIOS_PARAMETER3, W
173
    movwf   SID_PIN_NUMBER
244
    movwf   SID_PIN_NUMBER
174
    movlw   SID_PIN_NAMES_NUM
245
    movlw   SID_PIN_NAMES_NUM
175
    cpfslt  SID_PIN_NUMBER, ACCESS
246
    cpfslt  SID_PIN_NUMBER, ACCESS
176
    clrf SID_PIN_NUMBER
247
    clrf SID_PIN_NUMBER
177
    bsf DISPLAY_UPDATE_REQ, 0
248
    bsf DISPLAY_UPDATE_REQ, 0
178
249
179
    ;; set the pin depending on selected SID number
250
    ;; set the pin depending on selected SID number
180
    call    SID_SetPin
251
    call    SID_SetPin
-
 
252
    rgoto   USER_NotifyReceivedEvent_End
-
 
253
-
 
254
-
 
255
USER_NotifyReceivedEvent_ChkNote
-
 
256
    ;; alternative control via MIDI keyboard (Note On Events with velocity > 0)
-
 
257
    movf    MIOS_PARAMETER1, W
-
 
258
    andlw   0xf0
-
 
259
    xorlw   0x90
-
 
260
    bnz USER_NotifyReceivedEvent_End
-
 
261
    movf    MIOS_PARAMETER3, W
-
 
262
    bz  USER_NotifyReceivedEvent_End
-
 
263
    ;; normalize note to 0..23 range
-
 
264
    movf    MIOS_PARAMETER2, W
-
 
265
USER_NotifyReceivedEvent_NoteNor
-
 
266
    addlw   -24
-
 
267
    BRA_IFCLR WREG, 7, ACCESS, USER_NotifyReceivedEvent_NoteNor
-
 
268
    addlw   24      ; now in range 0..23
-
 
269
    movwf   SID_PIN_NUMBER
-
 
270
   
-
 
271
    movlw   SID_PIN_NAMES_NUM
-
 
272
    cpfslt  SID_PIN_NUMBER, ACCESS
-
 
273
    clrf SID_PIN_NUMBER
-
 
274
    bsf DISPLAY_UPDATE_REQ, 0
-
 
275
-
 
276
    ;; set the pin depending on selected SID number
-
 
277
    call    SID_SetPin
-
 
278
    ;;  rgoto   USER_NotifyReceivedEvent_End
-
 
279
181
USER_NotifyReceivedEvent_End
280
USER_NotifyReceivedEvent_End
182
    return
281
    return
183
282
184
283
185
;; --------------------------------------------------------------------------
284
;; --------------------------------------------------------------------------