BASIC compiler/interpreter for PIC32MX/MZ-80K (suspended)
Revision | 223 (tree) |
---|---|
Time | 2018-02-05 08:47:33 |
Author | kmorimatsu |
Megalopa with MUSIC (monaural) enabled
@@ -71,7 +71,7 @@ | ||
71 | 71 | #ifdef __DEBUG |
72 | 72 | asm volatile("j 0xBFC00000"); |
73 | 73 | #else |
74 | -// buttonmode(); | |
74 | + buttonmode(); | |
75 | 75 | for(i=0;i<100000;i++){ |
76 | 76 | if((KEYPORT&(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE)) |
77 | 77 | !=(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE)) i=0; |
@@ -625,28 +625,28 @@ | ||
625 | 625 | g_prev_y=y1; |
626 | 626 | break; |
627 | 627 | case FUNC_PSET:// X1,Y1[,C] |
628 | - g_pset(x1,y1,v0&0xFF); | |
628 | + g_pset(x1,y1,v0); | |
629 | 629 | g_prev_x=x1; |
630 | 630 | g_prev_y=y1; |
631 | 631 | break; |
632 | 632 | case FUNC_LINE:// X1,Y1,X2,Y2[,C] |
633 | - if (y1==y2) g_hline(x1,x2,y1,v0&0xFF); | |
634 | - else g_gline(x1,y1,x2,y2,v0&0xFF); | |
633 | + if (y1==y2) g_hline(x1,x2,y1,v0); | |
634 | + else g_gline(x1,y1,x2,y2,v0); | |
635 | 635 | g_prev_x=x2; |
636 | 636 | g_prev_y=y2; |
637 | 637 | break; |
638 | 638 | case FUNC_BOXFILL:// X1,Y1,X2,Y2[,C] |
639 | - g_boxfill(x1,y1,x2,y2,v0&0xFF); | |
639 | + g_boxfill(x1,y1,x2,y2,v0); | |
640 | 640 | g_prev_x=x2; |
641 | 641 | g_prev_y=y2; |
642 | 642 | break; |
643 | 643 | case FUNC_CIRCLE:// X1,Y1,R[,C] |
644 | - g_circle(x1,y1,x2,v0&0xFF); | |
644 | + g_circle(x1,y1,x2,v0); | |
645 | 645 | g_prev_x=x1; |
646 | 646 | g_prev_y=y1; |
647 | 647 | break; |
648 | 648 | case FUNC_CIRCLEFILL:// X1,Y1,R[,C] |
649 | - g_circlefill(x1,y1,x2,v0&0xFF); | |
649 | + g_circlefill(x1,y1,x2,v0); | |
650 | 650 | g_prev_x=x1; |
651 | 651 | g_prev_y=y1; |
652 | 652 | break; |
@@ -206,6 +206,25 @@ | ||
206 | 206 | // Show blue screen if exception before soft reset. |
207 | 207 | blue_screen(); |
208 | 208 | |
209 | + // Prepare Timer1 for 60 Hz interrupt | |
210 | + // This will be replaced by video-library-triggered interruption | |
211 | + // TCKPS=0b10 for 1/64 prescaller | |
212 | + // | |
213 | + PR1=262*6080/64-1; // = 24889 | |
214 | + TMR1=0; | |
215 | + T1CON=0x0020; | |
216 | + IPC1bits.T1IP=3; | |
217 | + IPC1bits.T1IS=0; | |
218 | + IFS0bits.T1IF=0; | |
219 | + IEC0bits.T1IE=1; | |
220 | +/* // Software interrupt every 1/60 sec (triggered by Timer1) | |
221 | + // This is a test routine. | |
222 | + IPC0bits.CS0IP=3; | |
223 | + IPC0bits.CS0IS=0; | |
224 | + IFS0bits.CS0IF=0; | |
225 | + IEC0bits.CS0IE=1; */ | |
226 | + T1CONbits.ON=1; // Start timer1 | |
227 | + | |
209 | 228 | printstr("MachiKania BASIC System\n"); |
210 | 229 | printstr(" Ver "SYSVER1" "SYSVER2" by KENKEN\n"); |
211 | 230 | printstr("BASIC Compiler "BASVER"\n"); |
@@ -252,3 +271,20 @@ | ||
252 | 271 | runbasic(tempfile,0); |
253 | 272 | while(1) asm(WAIT); |
254 | 273 | } |
274 | + | |
275 | +#pragma interrupt timer1int IPL3SOFT vector 4 | |
276 | +void timer1int(){ | |
277 | + // Trigger software interrupt 0 | |
278 | + IFS0bits.T1IF=0; | |
279 | + IFS0bits.CS0IF=1; | |
280 | +} | |
281 | + | |
282 | +/* | |
283 | +unsigned char test_c; | |
284 | +#pragma interrupt musicint IPL3SOFT vector 1 | |
285 | +void musicint(){ | |
286 | + IFS0bits.CS0IF=0; | |
287 | + test_c++; | |
288 | + TVRAM[20]=0x40+(test_c/16); | |
289 | +} | |
290 | +*/ | |
\ No newline at end of file |
@@ -66,30 +66,51 @@ | ||
66 | 66 | static int g_mpoint; |
67 | 67 | static char* g_mstr; |
68 | 68 | static int g_mspos; |
69 | -static unsigned short g_music[32]; | |
70 | -static unsigned short g_sound[32]; | |
71 | -static unsigned short g_musiclen[32]; | |
72 | -static unsigned char g_soundlen[32]; | |
73 | -static int g_musicstart; | |
74 | -static int g_musicend; | |
75 | -static int g_musicwait; | |
76 | -static int g_soundstart; | |
77 | -static int g_soundend; | |
78 | -static int g_soundwait; | |
79 | -static int g_soundrepeat; | |
69 | +static unsigned short g_musicL[32]; | |
70 | +static unsigned short g_soundL[32]; | |
71 | +static unsigned short g_musiclenL[32]; | |
72 | +static unsigned char g_soundlenL[32]; | |
73 | +static int g_musicstartL; | |
74 | +static int g_musicendL; | |
75 | +static int g_musicwaitL; | |
76 | +static int g_soundstartL; | |
77 | +static int g_soundendL; | |
78 | +static int g_soundwaitL; | |
79 | +static int g_soundrepeatL; | |
80 | +static unsigned short g_musicR[32]; | |
81 | +static unsigned short g_soundR[32]; | |
82 | +static unsigned short g_musiclenR[32]; | |
83 | +static unsigned char g_soundlenR[32]; | |
84 | +static int g_musicstartR; | |
85 | +static int g_musicendR; | |
86 | +static int g_musicwaitR; | |
87 | +static int g_soundstartR; | |
88 | +static int g_soundendR; | |
89 | +static int g_soundwaitR; | |
90 | +static int g_soundrepeatR; | |
80 | 91 | |
81 | -int musicRemaining(){ | |
82 | - return (g_musicend-g_musicstart)&31; | |
92 | +#define MFLAG_L 2 | |
93 | +#define MFLAG_R 1 | |
94 | + | |
95 | +//int musicRemaining(int flagsLR){ | |
96 | +int musicRemaining(){int flagsLR=3; | |
97 | + int l, r; | |
98 | + l=(g_musicendL-g_musicstartL)&31; | |
99 | + r=(g_musicendL-g_musicstartL)&31; | |
100 | + if (flagsLR & MFLAG_L) return l; | |
101 | + if (flagsLR & MFLAG_R) return r; | |
102 | + return (l>r) ? l:r; | |
83 | 103 | } |
84 | 104 | |
85 | -#pragma interrupt timer4int IPL3SOFT vector 16 | |
86 | -void timer4int(){ | |
105 | +#pragma interrupt musicint IPL3SOFT vector 1 | |
106 | +void musicint(){ | |
87 | 107 | unsigned int i; |
88 | 108 | // This function is called every 1/60 sec. |
89 | - IFS0CLR=_IFS0_T4IF_MASK; //IFS0bits.T4IF=0; | |
90 | - if (g_soundstart!=g_soundend){ | |
91 | - // Start timer & OC4 | |
92 | - i=g_sound[g_soundstart]; | |
109 | + IFS0bits.CS0IF=0; | |
110 | + // Left sound/music uses Timer3 | |
111 | + if (g_soundstartL!=g_soundendL){ | |
112 | + // Start timer | |
113 | + i=g_soundL[g_soundstartL]; | |
93 | 114 | if (i<0xffff) { |
94 | 115 | T3CONSET=0x8000; |
95 | 116 | PR3=i; |
@@ -97,31 +118,31 @@ | ||
97 | 118 | } else { |
98 | 119 | T3CONCLR=0x8000; |
99 | 120 | } |
100 | - if ((--g_soundwait)<=0) { | |
101 | - g_soundstart++; | |
102 | - if (g_soundstart==g_soundend || 31<g_soundstart) { | |
103 | - g_soundstart=0; | |
104 | - g_soundrepeat--; | |
105 | - if (0<g_soundrepeat) { | |
106 | - g_soundwait=g_soundlen[g_soundstart]; | |
121 | + if ((--g_soundwaitL)<=0) { | |
122 | + g_soundstartL++; | |
123 | + if (g_soundstartL==g_soundendL || 31<g_soundstartL) { | |
124 | + g_soundstartL=0; | |
125 | + g_soundrepeatL--; | |
126 | + if (0<g_soundrepeatL) { | |
127 | + g_soundwaitL=g_soundlenL[g_soundstartL]; | |
107 | 128 | } else { |
108 | - g_soundend=g_soundrepeat=g_soundwait=0; | |
129 | + g_soundendL=g_soundrepeatL=g_soundwaitL=0; | |
109 | 130 | } |
110 | 131 | } else { |
111 | - g_soundwait=g_soundlen[g_soundstart]; | |
132 | + g_soundwaitL=g_soundlenL[g_soundstartL]; | |
112 | 133 | } |
113 | 134 | } |
114 | 135 | // Shift music data even though without output. |
115 | - if (g_musicstart!=g_musicend) { | |
116 | - if ((--g_musicwait)<=0) { | |
117 | - g_musicstart++; | |
118 | - g_musicstart&=31; | |
119 | - g_musicwait=g_musiclen[g_musicstart]; | |
136 | + if (g_musicstartL!=g_musicendL) { | |
137 | + if ((--g_musicwaitL)<=0) { | |
138 | + g_musicstartL++; | |
139 | + g_musicstartL&=31; | |
140 | + g_musicwaitL=g_musiclenL[g_musicstartL]; | |
120 | 141 | } |
121 | 142 | } |
122 | - } else if (g_musicstart!=g_musicend) { | |
123 | - // Start timer & OC4 | |
124 | - i=g_music[g_musicstart]; | |
143 | + } else if (g_musicstartL!=g_musicendL) { | |
144 | + // Start timer | |
145 | + i=g_musicL[g_musicstartL]; | |
125 | 146 | if (i<0xffff) { |
126 | 147 | T3CONSET=0x8000; |
127 | 148 | PR3=i; |
@@ -129,15 +150,67 @@ | ||
129 | 150 | } else { |
130 | 151 | T3CONCLR=0x8000; |
131 | 152 | } |
132 | - if ((--g_musicwait)<=0) { | |
133 | - g_musicstart++; | |
134 | - g_musicstart&=31; | |
135 | - g_musicwait=g_musiclen[g_musicstart]; | |
153 | + if ((--g_musicwaitL)<=0) { | |
154 | + g_musicstartL++; | |
155 | + g_musicstartL&=31; | |
156 | + g_musicwaitL=g_musiclenL[g_musicstartL]; | |
136 | 157 | } |
137 | 158 | } else { |
138 | 159 | // Stop timer |
139 | 160 | T3CONCLR=0x8000; |
140 | 161 | } |
162 | + // Right sound/music uses Timer4 | |
163 | + if (g_soundstartR!=g_soundendR){ | |
164 | + // Start timer | |
165 | + i=g_soundR[g_soundstartR]; | |
166 | + if (i<0xffff) { | |
167 | + T4CONSET=0x8000; | |
168 | + PR4=i; | |
169 | + if (i<TMR4) TMR4=0; | |
170 | + } else { | |
171 | + T4CONCLR=0x8000; | |
172 | + } | |
173 | + if ((--g_soundwaitR)<=0) { | |
174 | + g_soundstartR++; | |
175 | + if (g_soundstartR==g_soundendR || 31<g_soundstartR) { | |
176 | + g_soundstartR=0; | |
177 | + g_soundrepeatR--; | |
178 | + if (0<g_soundrepeatR) { | |
179 | + g_soundwaitR=g_soundlenR[g_soundstartR]; | |
180 | + } else { | |
181 | + g_soundendR=g_soundrepeatR=g_soundwaitR=0; | |
182 | + } | |
183 | + } else { | |
184 | + g_soundwaitR=g_soundlenR[g_soundstartR]; | |
185 | + } | |
186 | + } | |
187 | + // Shift music data even though without output. | |
188 | + if (g_musicstartR!=g_musicendR) { | |
189 | + if ((--g_musicwaitR)<=0) { | |
190 | + g_musicstartR++; | |
191 | + g_musicstartR&=31; | |
192 | + g_musicwaitR=g_musiclenR[g_musicstartR]; | |
193 | + } | |
194 | + } | |
195 | + } else if (g_musicstartR!=g_musicendR) { | |
196 | + // Start timer | |
197 | + i=g_musicR[g_musicstartR]; | |
198 | + if (i<0xffff) { | |
199 | + T4CONSET=0x8000; | |
200 | + PR4=i; | |
201 | + if (i<TMR4) TMR4=0; | |
202 | + } else { | |
203 | + T4CONCLR=0x8000; | |
204 | + } | |
205 | + if ((--g_musicwaitR)<=0) { | |
206 | + g_musicstartR++; | |
207 | + g_musicstartR&=31; | |
208 | + g_musicwaitR=g_musiclenR[g_musicstartR]; | |
209 | + } | |
210 | + } else { | |
211 | + // Stop timer | |
212 | + T4CONCLR=0x8000; | |
213 | + } | |
141 | 214 | } |
142 | 215 | |
143 | 216 | int musicGetNum(){ |
@@ -157,36 +230,57 @@ | ||
157 | 230 | return ret; |
158 | 231 | } |
159 | 232 | |
233 | +static const unsigned int inv_rf4[1]={0x00000010}; | |
234 | +static const unsigned int inv_rf5[1]={0x00000020}; | |
235 | + | |
160 | 236 | void init_music(){ |
161 | - // Use Timer3, OC3, and OC4 for sound. | |
162 | - RPF4R = 0x0b; //Use RPF4 for OC3 | |
163 | - OC3R=0; | |
164 | - OC3CON=0x000b; // Timer3, toggle mode | |
165 | - OC3CONSET=0x8000;// Start OC4 | |
166 | - RPF5R = 0x0b; //Use RPF5 for OC4 | |
167 | - OC4R=0; | |
168 | - OC4CON=0x000b; // Timer3, toggle mode | |
169 | - OC4CONSET=0x8000;// Start OC4 | |
237 | + // Use Timer3 and DMA2 for left (RF5) | |
238 | + // Use Timer4 and DMA1 for right (RF4) | |
239 | + | |
240 | + // Timer3/Timer4 initialization | |
241 | + TMR3=0; | |
170 | 242 | T3CON=0x0050; // Prescaller: 1:32 (1.8 MHz), not yet started |
243 | + TMR4=0; | |
244 | + T4CON=0x0050; // Prescaller: 1:32 (1.8 MHz), not yet started | |
171 | 245 | |
172 | - // Timer4 is used to intterupt every 1/60 sec, just after NTSC view. | |
173 | - T4CON=0x0050; // Prescaller: 1:32 | |
174 | - PR4=49779; // 6080*262/32-1 | |
175 | - // Timer 4 interruption, IPL3 | |
176 | - IPC4bits.T4IP=3; | |
177 | - IPC4bits.T4IS=0; | |
178 | - IFS0bits.T4IF=0; | |
179 | - IEC0bits.T4IE=1; | |
180 | - // Wait until end of NTSC view. | |
181 | - while(!drawing); | |
182 | - while(drawing); | |
183 | - T4CONSET=0x8000; // Start timer 4. | |
246 | + //DMA2 settings; used for toggling RF5 | |
247 | + DMACONSET=0x8000; | |
248 | + DCH2CON=0x00000012; // CHBUSY=0, CHCHNS=0, CHEN=0, CHAED=0, CHCHN=0, CHAEN=1, CHEDET=0, CHPRI=b10 | |
249 | + DCH2ECON=0x0e10; // CHAIRQ=0, CHSIRQ=19, CFORCE=0, CABRT=0, PATEN=0, SIRQEN=1, AIRQEN=0 | |
250 | + // CHSIRQ=14: Timer3 interrupt | |
251 | + DCH2SSA=((unsigned int)&(inv_rf4[0]))&0x1fffffff; | |
252 | + DCH2DSA=0x1F88653C; // LATFINV | |
253 | + DCH2SSIZ=1; | |
254 | + DCH2DSIZ=1; | |
255 | + DCH2CSIZ=1; | |
256 | + DCH2INTCLR=0x00FF00FF; | |
257 | + DCH2CONSET=0x00000080; | |
258 | + | |
259 | + //DMA1 settings; used for toggling RF4 | |
260 | + DMACONSET=0x8000; | |
261 | + DCH1CON=0x00000012; // CHBUSY=0, CHCHNS=0, CHEN=0, CHAED=0, CHCHN=0, CHAEN=1, CHEDET=0, CHPRI=b10 | |
262 | + DCH1ECON=0x1310; // CHAIRQ=0, CHSIRQ=19, CFORCE=0, CABRT=0, PATEN=0, SIRQEN=1, AIRQEN=0 | |
263 | + // CHSIRQ=19: Timer4 interrupt | |
264 | + DCH1SSA=((unsigned int)&(inv_rf5[0]))&0x1fffffff; | |
265 | + DCH1DSA=0x1F88653C; // LATFINV | |
266 | + DCH1SSIZ=1; | |
267 | + DCH1DSIZ=1; | |
268 | + DCH1CSIZ=1; | |
269 | + DCH1INTCLR=0x00FF00FF; | |
270 | + DCH1CONSET=0x00000080; | |
271 | + | |
272 | + // Software interrupt every 1/60 sec (triggered by Timer5) | |
273 | + IPC0bits.CS0IP=3; | |
274 | + IPC0bits.CS0IS=0; | |
275 | + IFS0bits.CS0IF=0; | |
276 | + IEC0bits.CS0IE=1; | |
184 | 277 | |
185 | 278 | // Initializations for music/sound. |
186 | 279 | g_qvalue=160; // Q: 1/4=90 |
187 | 280 | g_lvalue=20; // L: 1/8 |
188 | 281 | g_tones=(int*)&(g_keys[49]); // C major |
189 | - g_musicstart=g_musicend=g_musicwait=g_soundstart=g_soundend=g_soundwait=g_soundrepeat=0; | |
282 | + g_musicstartL=g_musicendL=g_musicwaitL=g_soundstartL=g_soundendL=g_soundwaitL=g_soundrepeatL=0; | |
283 | + g_musicstartR=g_musicendR=g_musicwaitR=g_soundstartR=g_soundendR=g_soundwaitR=g_soundrepeatR=0; | |
190 | 284 | } |
191 | 285 | |
192 | 286 | void musicSetL(){ |
@@ -332,7 +426,7 @@ | ||
332 | 426 | g_tones=(int*)&(g_keys[56]); |
333 | 427 | return; |
334 | 428 | default: |
335 | - err_music(g_mstr); | |
429 | +// err_music(g_mstr); | |
336 | 430 | break; |
337 | 431 | } |
338 | 432 | } |
@@ -342,14 +436,16 @@ | ||
342 | 436 | musicGetNum(); |
343 | 437 | } |
344 | 438 | |
345 | -void set_sound(unsigned long* data){ | |
439 | +//void set_sound(unsigned long* data, int flagsLR){ | |
440 | +void set_sound(unsigned long* data){int flagsLR=3; | |
346 | 441 | int sound; |
347 | 442 | int len; |
348 | 443 | int pos; |
349 | 444 | int datalen; |
350 | - IEC0bits.T4IE=0; // Stop interruption, first. | |
445 | + IEC0bits.CS0IE=0; // Stop interruption, first. | |
351 | 446 | // Initialize |
352 | - g_soundrepeat=g_soundstart=g_soundend=0; | |
447 | + if (flagsLR & MFLAG_L) g_soundrepeatL=g_soundstartL=g_soundendL=0; | |
448 | + if (flagsLR & MFLAG_R) g_soundrepeatR=g_soundstartR=g_soundendR=0; | |
353 | 449 | pos=0; |
354 | 450 | do { |
355 | 451 | while(data[1]!=0x00000020) data++; // Seek DATA statement |
@@ -362,30 +458,36 @@ | ||
362 | 458 | data++; |
363 | 459 | if (len) { |
364 | 460 | // Shift tone if graphic is used |
365 | - if (g_use_graphic) { | |
461 | + if (/*g_use_graphic*/ 0) { | |
366 | 462 | // MUL_15 instead of MUL_16 for CPU clock. |
367 | 463 | // sound=sound*15/16 |
368 | 464 | sound-=(sound+7)>>4; |
369 | 465 | } |
370 | - g_sound[pos]=sound-1; | |
371 | - g_soundlen[pos]=len; | |
466 | + if (flagsLR & MFLAG_L) g_soundL[pos]=sound-1; | |
467 | + if (flagsLR & MFLAG_R) g_soundR[pos]=sound-1; | |
468 | + if (flagsLR & MFLAG_L) g_soundlenL[pos]=len; | |
469 | + if (flagsLR & MFLAG_R) g_soundlenR[pos]=len; | |
372 | 470 | pos++; |
373 | 471 | if (32<pos) { |
374 | - err_music("Sound data too long."); | |
472 | +// err_music("Sound data too long."); | |
375 | 473 | return; |
376 | 474 | } |
377 | 475 | } else { |
378 | - g_soundrepeat=sound; | |
476 | + if (flagsLR & MFLAG_L) g_soundrepeatL=sound; | |
477 | + if (flagsLR & MFLAG_R) g_soundrepeatR=sound; | |
379 | 478 | break; |
380 | 479 | } |
381 | 480 | } |
382 | 481 | } while(len); |
383 | - g_soundend=pos; | |
384 | - g_soundwait=g_soundlen[0]; | |
385 | - IEC0bits.T4IE=1; // Restart interrupt. | |
482 | + if (flagsLR & MFLAG_L) g_soundendL=pos; | |
483 | + if (flagsLR & MFLAG_R) g_soundendR=pos; | |
484 | + if (flagsLR & MFLAG_L) g_soundwaitL=g_soundlenL[0]; | |
485 | + if (flagsLR & MFLAG_R) g_soundwaitR=g_soundlenR[0]; | |
486 | + IEC0bits.CS0IE=1; // Restart interrupt. | |
386 | 487 | } |
387 | 488 | |
388 | -void set_music(char* str){ | |
489 | +//void set_music(char* str, int flagsLR){ | |
490 | +void set_music(char* str){int flagsLR=3; | |
389 | 491 | char b; |
390 | 492 | unsigned long tone,tonenatural; |
391 | 493 | int len; |
@@ -409,7 +511,7 @@ | ||
409 | 511 | musicSetM(); |
410 | 512 | break; |
411 | 513 | default: |
412 | - err_music(str); | |
514 | +// err_music(str); | |
413 | 515 | break; |
414 | 516 | } |
415 | 517 | } else if ('A'<=b && b<='G' || 'a'<=b && b<='g' || b=='z') { |
@@ -463,23 +565,36 @@ | ||
463 | 565 | len=len/musicGetNum(); |
464 | 566 | } |
465 | 567 | // Shift tone if graphic is used |
466 | - if (g_use_graphic) { | |
568 | + if (/*g_use_graphic*/ 0) { | |
467 | 569 | // MUL_15 instead of MUL_16 for CPU clock. |
468 | 570 | // tone=tone*15/16 |
469 | 571 | tone-=(tone+7)>>4; |
470 | 572 | } |
471 | 573 | // Update music value array |
472 | - IEC0bits.T4IE=0; // Stop interruption, first. | |
473 | - if (g_musicstart==g_musicend) { | |
474 | - g_musicwait=len; | |
574 | + IEC0bits.CS0IE=0; // Stop interruption, first. | |
575 | + // Update left music | |
576 | + if (flagsLR & MFLAG_L) { | |
577 | + if (g_musicstartL==g_musicendL) { | |
578 | + g_musicwaitL=len; | |
579 | + } | |
580 | + g_musicL[g_musicendL]=(tone-1)&0x0000FFFF; | |
581 | + g_musiclenL[g_musicendL]=len; | |
582 | + g_musicendL++; | |
583 | + g_musicendL&=31; | |
475 | 584 | } |
476 | - g_music[g_musicend]=(tone-1)&0x0000FFFF; | |
477 | - g_musiclen[g_musicend]=len; | |
478 | - g_musicend++; | |
479 | - g_musicend&=31; | |
480 | - IEC0bits.T4IE=1; // Restart interruption. | |
585 | + // Update right music | |
586 | + if (flagsLR & MFLAG_R) { | |
587 | + if (g_musicstartR==g_musicendR) { | |
588 | + g_musicwaitR=len; | |
589 | + } | |
590 | + g_musicR[g_musicendR]=(tone-1)&0x0000FFFF; | |
591 | + g_musiclenR[g_musicendR]=len; | |
592 | + g_musicendR++; | |
593 | + g_musicendR&=31; | |
594 | + } | |
595 | + IEC0bits.CS0IE=1; // Restart interruption. | |
481 | 596 | } else { |
482 | - err_music(str); | |
597 | +// err_music(str); | |
483 | 598 | } |
484 | 599 | // Go to next character |
485 | 600 | while(0<g_mstr[g_mspos] && g_mstr[g_mspos]<=0x20 || g_mstr[g_mspos]=='|') g_mspos++; |
@@ -168,16 +168,7 @@ | ||
168 | 168 | // 上位8ビット:シフト状態(押下:1)、上位から<0><CAPSLK><NUMLK><SCRLK><Win><ALT><CTRL><SHIFT> |
169 | 169 | // 英数・記号文字の場合、戻り値としてASCIIコード(それ以外は0を返す) |
170 | 170 | |
171 | -#ifdef ZOEA | |
172 | -// PIC32MX1xx/2xx版のキーボードとボタンの排他利用システムで使用する関数、マクロ | |
173 | -void ps2mode(); // PS/2を有効にする | |
174 | -void buttonmode(); // ボタンを有効にする | |
175 | -#define inPS2MODE() ((LATA&2)>>1) // モード確認用マクロ。PS/2モードの場合1、ボタンモードの場合0を返す | |
176 | -#endif | |
177 | - | |
178 | -#ifdef MEGALOPA | |
179 | 171 | // Macros for dummy functions |
180 | 172 | #define ps2mode() (0) |
181 | 173 | #define buttonmode() (0) |
182 | 174 | #define inPS2MODE() (1) |
183 | -#endif | |
\ No newline at end of file |