Subversion Repositories svn.mios

Rev

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

Rev 877 Rev 878
Line 1... Line 1...
1
; $Id: main.asm 877 2009-12-29 13:49:22Z tk $
1
; $Id: main.asm 878 2010-01-02 15:40:58Z tk $
2
;
2
;
3
; A CORE->MBHP_OPL3 Module Interconnection Test
3
; A CORE->MBHP_OPL3 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>
40
43
41
; define the pins to which the MBHP_OPL3 module is connected
44
; define the pins to which the MBHP_OPL3 module is connected
42
;
45
;
43
MBFM_LAT_D  EQU LATB        ; Port B
46
MBFM_LAT_D  EQU LATB        ; Port B
44
MBFM_LAT_A1 EQU LATD        ; Pin D.6
47
MBFM_LAT_A1 EQU LATD        ; Pin D.6
Line 103... Line 106...
103
    call    MIOS_LCD_Clear
106
    call    MIOS_LCD_Clear
104
107
105
    TABLE_ADDR TEXT_WELCOME_0
108
    TABLE_ADDR TEXT_WELCOME_0
106
    call    MIOS_LCD_PrintString
109
    call    MIOS_LCD_PrintString
107
    call    MIOS_LCD_PrintString
110
    call    MIOS_LCD_PrintString
-
 
111
-
 
112
    call    DEBUG_MSG_SendHeader
-
 
113
    movlw   '\n'
-
 
114
    call    DEBUG_MSG_SendChar
-
 
115
    call    DEBUG_MSG_SendFooter
-
 
116
   
-
 
117
    call    DEBUG_MSG_SendHeader
-
 
118
    call    DEBUG_MSG_SendASMString
-
 
119
    db  "MBFM Interconnection Test\n", 0
-
 
120
    call    DEBUG_MSG_SendFooter
-
 
121
   
-
 
122
    call    DEBUG_MSG_SendHeader
-
 
123
    call    DEBUG_MSG_SendASMString
-
 
124
    db  "=========================\n", 0
-
 
125
    call    DEBUG_MSG_SendFooter
-
 
126
-
 
127
    call    DEBUG_MSG_SendHeader
-
 
128
    call    DEBUG_MSG_SendASMString
-
 
129
    db  "Please play a note on any MIDI channel.\n", 0
-
 
130
    call    DEBUG_MSG_SendFooter
108
131
   
109
    bsf DISPLAY_UPDATE_REQ, 0
132
    bsf DISPLAY_UPDATE_REQ, 0
110
133
111
    return
134
    return
112
135
Line 133... Line 156...
133
    addwf   TBLPTRL, F
156
    addwf   TBLPTRL, F
134
    movf    PRODH, W
157
    movf    PRODH, W
135
    addwfc  TBLPTRH, F
158
    addwfc  TBLPTRH, F
136
    movlw   OPL3_PIN_NAMES_LEN
159
    movlw   OPL3_PIN_NAMES_LEN
137
    call    MIOS_LCD_PrintPreconfString
160
    call    MIOS_LCD_PrintPreconfString
-
 
161
-
 
162
-
 
163
    ;; send message to MIOS Terminal
-
 
164
    call    DEBUG_MSG_SendHeader
-
 
165
    call    DEBUG_MSG_SendASMString
-
 
166
    db  "Pin '", 0
-
 
167
-
 
168
    TABLE_ADDR OPL3_PIN_NAMES_TABLE
-
 
169
    movf    OPL3_PIN_NUMBER, W
-
 
170
    mullw   OPL3_PIN_NAMES_LEN
-
 
171
    movf    PRODL, W
-
 
172
    addwf   TBLPTRL, F
-
 
173
    movf    PRODH, W
-
 
174
    addwfc  TBLPTRH, F
-
 
175
-
 
176
    ;; always two chars
-
 
177
    tblrd*+
-
 
178
    movf    TABLAT, W
-
 
179
    call    DEBUG_MSG_SendChar
-
 
180
    tblrd*+
-
 
181
    movf    TABLAT, W
-
 
182
    call    DEBUG_MSG_SendChar
-
 
183
-
 
184
    call    DEBUG_MSG_SendASMString
-
 
185
    db  "' of MBHP_OPL3 module set to 5V, all other pins set to 0V", 0
-
 
186
    call    DEBUG_MSG_SendFooter
138
187
139
    ;; IMPORTANT!!!
188
    ;; IMPORTANT!!!
140
    ;; Since a LCD message could overwrite the data/address/control
189
    ;; Since a LCD message could overwrite the data/address/control
141
    ;; line value, we update the pins again
190
    ;; line value, we update the pins again
142
    goto    OPL3_SetPin
191
    goto    OPL3_SetPin
Line 202... Line 251...
202
    addlw   -12
251
    addlw   -12
203
    BRA_IFCLR WREG, 7, ACCESS, USER_NotifyReceivedEvent_NoteNor
252
    BRA_IFCLR WREG, 7, ACCESS, USER_NotifyReceivedEvent_NoteNor
204
    addlw   12      ; now in range 0..11
253
    addlw   12      ; now in range 0..11
205
    movwf   OPL3_PIN_NUMBER
254
    movwf   OPL3_PIN_NUMBER
206
   
255
   
-
 
256
    movlw   OPL3_PIN_NAMES_NUM
207
    cpfslt  OPL3_PIN_NUMBER, ACCESS
257
    cpfslt  OPL3_PIN_NUMBER, ACCESS
208
    clrf OPL3_PIN_NUMBER
258
    clrf OPL3_PIN_NUMBER
209
    bsf DISPLAY_UPDATE_REQ, 0
259
    bsf DISPLAY_UPDATE_REQ, 0
210
260
211
    ;; set the pin depending on selected OPL3 number
261
    ;; set the pin depending on selected OPL3 number