• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++objective-ccocoac#誰得gamebathyscaphephplinuxqtrubycomegat翻訳windowspythontwitterbtronvb.netguitestframeworkdom計画中(planning stage)directxpreviewerpukiwikimruby

BASIC compiler/interpreter for PIC32MX/MZ-80K


コミットメタ情報

リビジョン224 (tree)
日時2018-02-05 09:51:50
作者kmorimatsu

ログメッセージ

Megalopa with stereo MUSIC enabled

変更サマリ

差分

--- mips/branches/megalopa/compiler.h (revision 223)
+++ mips/branches/megalopa/compiler.h (revision 224)
@@ -232,9 +232,9 @@
232232 void err_invalid_param(void);
233233 char* resolve_label(int s6);
234234
235-void set_sound(unsigned long* data);
236-int musicRemaining(void);
237-void set_music(char* str);
235+void set_sound(unsigned long* data, int flagsLR);
236+int musicRemaining(int flagsLR);
237+void set_music(char* str, int flagsLR);
238238 void init_music(void);
239239
240240 char* statement(void);
--- mips/branches/megalopa/music.c (revision 223)
+++ mips/branches/megalopa/music.c (revision 224)
@@ -92,8 +92,7 @@
9292 #define MFLAG_L 2
9393 #define MFLAG_R 1
9494
95-//int musicRemaining(int flagsLR){
96-int musicRemaining(){int flagsLR=3;
95+int musicRemaining(int flagsLR){
9796 int l, r;
9897 l=(g_musicendL-g_musicstartL)&31;
9998 r=(g_musicendL-g_musicstartL)&31;
@@ -436,8 +435,7 @@
436435 musicGetNum();
437436 }
438437
439-//void set_sound(unsigned long* data, int flagsLR){
440-void set_sound(unsigned long* data){int flagsLR=3;
438+void set_sound(unsigned long* data, int flagsLR){
441439 int sound;
442440 int len;
443441 int pos;
@@ -486,8 +484,7 @@
486484 IEC0bits.CS0IE=1; // Restart interrupt.
487485 }
488486
489-//void set_music(char* str, int flagsLR){
490-void set_music(char* str){int flagsLR=3;
487+void set_music(char* str, int flagsLR){
491488 char b;
492489 unsigned long tone,tonenatural;
493490 int len;
--- mips/branches/megalopa/main.c (revision 223)
+++ mips/branches/megalopa/main.c (revision 224)
@@ -217,12 +217,6 @@
217217 IPC1bits.T1IS=0;
218218 IFS0bits.T1IF=0;
219219 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; */
226220 T1CONbits.ON=1; // Start timer1
227221
228222 printstr("MachiKania BASIC System\n");
@@ -272,6 +266,8 @@
272266 while(1) asm(WAIT);
273267 }
274268
269+// Following interrupt function will be removed after modification of video library.
270+#ifndef __DEBUG
275271 #pragma interrupt timer1int IPL3SOFT vector 4
276272 void timer1int(){
277273 // Trigger software interrupt 0
@@ -278,13 +274,4 @@
278274 IFS0bits.T1IF=0;
279275 IFS0bits.CS0IF=1;
280276 }
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
277+#endif
--- mips/branches/megalopa/statement.c (revision 223)
+++ mips/branches/megalopa/statement.c (revision 224)
@@ -5,6 +5,7 @@
55 kmorimatsu@users.sourceforge.jp
66 */
77
8+#include "main.h"
89 #include "api.h"
910 #include "compiler.h"
1011
@@ -37,6 +38,25 @@
3738 if (err) return err;
3839 call_lib_code(LIB_LABEL);
3940 }
41+#ifdef MEGALOPA
42+ // 2nd param is optional
43+ if (g_source[g_srcpos]==',') {
44+ g_srcpos++;
45+ check_obj_space(2);
46+ g_object[g_objpos++]=0x27BDFFFC; // addiu sp,sp,-4
47+ g_object[g_objpos++]=0xAFA20004; // sw v0,4(sp)
48+ err=get_value();
49+ if (err) return err;
50+ check_obj_space(3);
51+ g_object[g_objpos++]=0x00402021; // addu a0,v0,zero
52+ g_object[g_objpos++]=0x8FA20004; // lw v0,4(sp)
53+ g_object[g_objpos++]=0x27BD0004; // addiu sp,sp,4
54+ } else {
55+ // Set 3 if omitted
56+ check_obj_space(1);
57+ g_object[g_objpos++]=0x24040003; // addiu a0,zero,xx
58+ }
59+#endif
4060 call_lib_code(LIB_SOUND);
4161 return 0;
4262 }
@@ -43,6 +63,26 @@
4363 char* music_statement(){
4464 char *err;
4565 err=get_string();
66+ if (err) return err;
67+#ifdef MEGALOPA
68+ // 2nd param is optional
69+ if (g_source[g_srcpos]==',') {
70+ g_srcpos++;
71+ check_obj_space(2);
72+ g_object[g_objpos++]=0x27BDFFFC; // addiu sp,sp,-4
73+ g_object[g_objpos++]=0xAFA20004; // sw v0,4(sp)
74+ err=get_value();
75+ if (err) return err;
76+ check_obj_space(3);
77+ g_object[g_objpos++]=0x00402021; // addu a0,v0,zero
78+ g_object[g_objpos++]=0x8FA20004; // lw v0,4(sp)
79+ g_object[g_objpos++]=0x27BD0004; // addiu sp,sp,4
80+ } else {
81+ // Set 3 if omitted
82+ check_obj_space(1);
83+ g_object[g_objpos++]=0x24040003; // addiu a0,zero,xx
84+ }
85+#endif
4686 call_lib_code(LIB_MUSIC);
4787 return 0;
4888 }
--- mips/branches/megalopa/function.c (revision 223)
+++ mips/branches/megalopa/function.c (revision 224)
@@ -5,10 +5,22 @@
55 kmorimatsu@users.sourceforge.jp
66 */
77
8+#include "main.h"
89 #include "compiler.h"
910 #include "api.h"
1011
1112 char* music_function(){
13+#ifdef MEGALOPA
14+ char* err;
15+ next_position();
16+ if (g_source[g_srcpos]==')') {
17+ check_obj_space(1);
18+ g_object[g_objpos++]=0x34020003; //ori v0,zero,0x03
19+ } else {
20+ err=get_value();
21+ if (err) return err;
22+ }
23+#endif
1224 call_lib_code(LIB_MUSICFUNC);
1325 return 0;
1426 }
--- mips/branches/megalopa/debug.c (revision 223)
+++ mips/branches/megalopa/debug.c (revision 224)
@@ -233,7 +233,8 @@
233233
234234 int _debug_test(int a0, int a1, int a2, int a3, int param4, int param5){
235235 // if (a0<0xa0008192) return 0xa0000000;
236- asm volatile("lw $v1,0($v1)");
236+ asm volatile("lw $v0,4($sp)");
237+ asm volatile("addu $a0,$v0,$zero");
237238 return a2+a3;
238239 }
239240
--- mips/branches/megalopa/library.c (revision 223)
+++ mips/branches/megalopa/library.c (revision 224)
@@ -1210,12 +1210,12 @@
12101210 setcursor(g_libparams[1],v0,cursorcolor);
12111211 return v0;
12121212 case LIB_SOUND:
1213- set_sound((unsigned long*)v0);
1213+ set_sound((unsigned long*)v0,a0);
12141214 return v0;
12151215 case LIB_MUSICFUNC:
1216- return musicRemaining();
1216+ return musicRemaining(a0);
12171217 case LIB_MUSIC:
1218- set_music((char*)v0);
1218+ set_music((char*)v0,a0);
12191219 return v0;
12201220 case LIB_SETDRAWCOUNT:
12211221 drawcount=(v0&0x0000FFFF);