• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

BASIC compiler/interpreter for PIC32MX/MZ-80K


Commit MetaInfo

修訂d352944f78a1c7f6b782ee5215aa68b4654c6dd2 (tree)
時間2019-04-15 05:10:19
作者Katsumi <kmorimatsu@sour...>
CommiterKatsumi

Log Message

Debug: INIT method in classes.

Change Summary

差異

--- a/mips/megalopa/compiler.h
+++ b/mips/megalopa/compiler.h
@@ -446,7 +446,7 @@ char* interrupt_statement();
446446 /* Macros */
447447
448448 // Lables as 31 bit integer
449-#define LABEL_INIT 0x0007df55
449+#define LABEL_INIT 0x0008727b
450450
451451 // Skip blanc(s) in source code
452452 #define next_position() while(g_source[g_srcpos]==' ') {g_srcpos++;}
--- a/mips/protozoa/compiler.h
+++ b/mips/protozoa/compiler.h
@@ -280,6 +280,7 @@ char* fput_statement();
280280 char* fputc_statement();
281281 char* fremove_statement();
282282 char* label_statement();
283+char* exec_statement();
283284
284285 char* function(void);
285286 char* str_function(void);
@@ -375,6 +376,8 @@ void stop_timer();
375376 char* usetimer_statement();
376377 char* timer_statement();
377378 char* timer_function();
379+char* coretimer_statement();
380+char* coretimer_function();
378381 char* interrupt_statement();
379382
380383 /* Error messages */
@@ -443,7 +446,7 @@ char* interrupt_statement();
443446 /* Macros */
444447
445448 // Lables as 31 bit integer
446-#define LABEL_INIT 0x0007df55
449+#define LABEL_INIT 0x0008727b
447450
448451 // Skip blanc(s) in source code
449452 #define next_position() while(g_source[g_srcpos]==' ') {g_srcpos++;}
@@ -493,6 +496,7 @@ char* interrupt_statement();
493496 #define INTERRUPT_INKEY 3
494497 #define INTERRUPT_MUSIC 4
495498 #define INTERRUPT_WAVE 5
499+#define INTERRUPT_CORETIMER 6
496500
497501 extern int g_interrupt_flags;
498502 extern int g_int_vector[];
--- a/mips/protozoa/function.c
+++ b/mips/protozoa/function.c
@@ -391,6 +391,10 @@ char* getdir_function(){
391391 return 0;
392392 }
393393
394+char* exec_function(){
395+ return exec_statement();
396+}
397+
394398 char* float_constant(float val){
395399 volatile int i;
396400 ((float*)(&i))[0]=val;
@@ -597,6 +601,8 @@ static const void* int_func_list[]={
597601 "NEW(",new_function,
598602 "SETDIR(",setdir_function,
599603 "TIMER(",timer_function,
604+ "EXEC(",exec_function,
605+ "CORETIMER(",coretimer_function,
600606 // Additional functions follow
601607 ADDITIONAL_INT_FUNCTIONS
602608 };
--- a/mips/protozoa/statement.c
+++ b/mips/protozoa/statement.c
@@ -1741,6 +1741,7 @@ static const void* statement_list[]={
17411741 "TIMER ",timer_statement,
17421742 "INTERRUPT ",interrupt_statement,
17431743 "IDLE",idle_statement,
1744+ "CORETIMER",coretimer_statement,
17441745 // List of additional statements follows
17451746 ADDITIONAL_STATEMENTS
17461747 };
--- a/mips/protozoa/timer.c
+++ b/mips/protozoa/timer.c
@@ -33,6 +33,7 @@ static const void* interrupt_list[]={
3333 "INKEY", (void*)INTERRUPT_INKEY,
3434 "MUSIC", (void*)INTERRUPT_MUSIC,
3535 "WAVE", (void*)INTERRUPT_WAVE,
36+ "CORETIMER",(void*)INTERRUPT_CORETIMER,
3637 ADDITIONAL_INTERRUPT_FUNCTIONS
3738 };
3839 #define NUM_INTERRUPT_TYPES ((sizeof(interrupt_list)/sizeof(interrupt_list[0]))/2)
@@ -69,6 +70,7 @@ void stop_timer(){
6970 IEC0bits.T1IE=0;
7071 // Disable interrupt
7172 IEC0bits.CS1IE=0;
73+ IEC0bits.CTIE=0;
7274 }
7375
7476 /*
@@ -157,6 +159,40 @@ char* timer_function(){
157159 }
158160
159161 /*
162+ Coretimer implementaion
163+*/
164+
165+#pragma interrupt CTHandler IPL2SOFT vector 0
166+void CTHandler(void){
167+ // Clear CT interrupt flag
168+ IFS0bits.CTIF=0;
169+ // Raise TIMER interrupt flag
170+ raise_interrupt_flag(INTERRUPT_CORETIMER);
171+}
172+
173+char* coretimer_function(){
174+ check_obj_space(1);
175+ g_object[g_objpos++]=0x40024800; // mfc0 v0,Count
176+ return 0;
177+}
178+
179+void lib_coretimer(){
180+ // CT interrupt: priority 2
181+ IPC0bits.CTIP=2;
182+ IPC0bits.CTIS=0;
183+ IEC0bits.CTIE=1;
184+}
185+
186+char* coretimer_statement(){
187+ char* err;
188+ err=get_value();
189+ if (err) return err;
190+ // 0x40825800: mtc0 v0,Compare
191+ call_quicklib_code(lib_coretimer,0x40825800);
192+ return 0;
193+}
194+
195+/*
160196 Interrupt interprtation
161197 To cause interruption, use raise_interrupt_flag() macro
162198 For example,
--- a/mips/zoea/compiler.h
+++ b/mips/zoea/compiler.h
@@ -446,7 +446,7 @@ char* interrupt_statement();
446446 /* Macros */
447447
448448 // Lables as 31 bit integer
449-#define LABEL_INIT 0x0007df55
449+#define LABEL_INIT 0x0008727b
450450
451451 // Skip blanc(s) in source code
452452 #define next_position() while(g_source[g_srcpos]==' ') {g_srcpos++;}