• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

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 (suspended)


Commit MetaInfo

Revision140 (tree)
Time2016-07-24 12:28:39
Authorkmorimatsu

Log Message

Reset data/read when executing BASIC code.

Change Summary

Incremental Difference

--- mips/branches/zoea/debug.c (revision 139)
+++ mips/branches/zoea/debug.c (revision 140)
@@ -139,13 +139,7 @@
139139
140140 static const char bastext[]=
141141 "CLS\n"
142-"PRINT \"\\x21\",\n"
143-"PRINT \"\\x2A\",\n"
144-"PRINT \"\\xA2\",\n"
145-"PRINT \"\\x2a\",\n"
146-"PRINT \"\\xa2\",\n"
147-"PRINT \"\\\"\",\n"
148-"PRINT \"\\\\\",\n"
142+"for i=1 to 9:print rnd(),:next\n"
149143 "\n";
150144
151145 /*
--- mips/branches/zoea/library.c (revision 139)
+++ mips/branches/zoea/library.c (revision 140)
@@ -38,10 +38,16 @@
3838 }
3939 break;
4040 case 1:
41- default:
4241 // label is pointer
4342 i=label;
4443 break;
44+ case 2:
45+ default:
46+ // Reset data/read
47+ pos=0;
48+ in_data=0;
49+ skip=0;
50+ return 0;
4551 }
4652 i-=(int)(&g_object[0]);
4753 pos=i/4;
@@ -97,6 +103,10 @@
97103 }
98104 }
99105
106+void reset_dataread(){
107+ lib_read(2,1);
108+}
109+
100110 char* lib_midstr(int var_num, int pos, int len){
101111 int i;
102112 char* str;
--- mips/branches/zoea/compiler.h (revision 139)
+++ mips/branches/zoea/compiler.h (revision 140)
@@ -208,6 +208,7 @@
208208 char* float_function(void);
209209
210210 void call_library(void);
211+void reset_dataread();
211212
212213 void free_temp_str(char* str);
213214 void* alloc_memory(int size, int var_num);
--- mips/branches/zoea/help.txt (revision 139)
+++ mips/branches/zoea/help.txt (revision 140)
@@ -241,7 +241,7 @@
241241 ACOS#(x#)
242242 x# の逆余弦を実数値で返す。
243243 ARGS#(x)
244- サブルーチン中で、GOSUBに渡されたx番目の引数を整数値として取り出す。
244+ サブルーチン中で、GOSUBに渡されたx番目の引数を実数値として取り出す。
245245 ASIN#(x#)
246246 x# の逆正弦を実数値で返す。
247247 ATAN#(x#)
@@ -271,7 +271,7 @@
271271 LOG10#(x#)
272272 x# の常用対数を実数値で返す。
273273 MODF#(x#)
274- x# の整数部を実数値で返す。
274+ x# の小数部を実数値で返す。
275275 PI#
276276 3.141593を返す。
277277 POW#(x#,y#)
@@ -333,9 +333,9 @@
333333 x % y
334334 整数剰余
335335 x >> y
336+ xの値をyビット右シフト
337+x << y
336338 xの値をyビット左シフト
337-x << y
338- xの値をyビット右シフト
339339 x = y
340340 2つの整数値が等しい場合に1、そうでないときに0
341341 x != y
--- mips/branches/zoea/run.c (revision 139)
+++ mips/branches/zoea/run.c (revision 140)
@@ -122,6 +122,8 @@
122122 for(i=0;i<256;i++){
123123 ps2keystatus[i]=0;
124124 }
125+ // Reset data/read.
126+ reset_dataread();
125127
126128 // Assign memory
127129 set_free_area((void*)(g_object+g_objpos),(void*)(&RAM[RAMSIZE]));
--- mips/branches/nauplia/library.c (revision 139)
+++ mips/branches/nauplia/library.c (revision 140)
@@ -10,10 +10,16 @@
1010 #include "api.h"
1111 #include "keyinput.h"
1212
13-int lib_read(unsigned int label){
13+int lib_read(int mode,unsigned int label){
1414 unsigned int i,code;
1515 static unsigned int pos=0;
1616 static unsigned int in_data=0;
17+ if (mode==2) {
18+ // Reset data/read
19+ pos=0;
20+ in_data=0;
21+ return 0;
22+ }
1723 if (label) {
1824 // RESTORE function
1925 i=(int)search_label(label);
@@ -54,6 +60,10 @@
5460 }
5561 }
5662
63+void reset_dataread(){
64+ lib_read(2,1);
65+}
66+
5767 char* lib_midstr(int var_num, int pos, int len){
5868 int i;
5969 char* str;
@@ -520,10 +530,10 @@
520530 case LIB_DRAWCOUNT:
521531 return drawcount;
522532 case LIB_RESTORE:
523- lib_read(v0);
533+ lib_read(0,v0);
524534 return;
525535 case LIB_READ:
526- return lib_read(0);
536+ return lib_read(0,0);
527537 case LIB_LABEL:
528538 return (int)lib_label(v0);
529539 case LIB_INPUT:
--- mips/branches/nauplia/run.c (revision 139)
+++ mips/branches/nauplia/run.c (revision 140)
@@ -124,6 +124,8 @@
124124 for(i=0;i<256;i++){
125125 ps2keystatus[i]=0;
126126 }
127+ // Reset data/read.
128+ reset_dataread();
127129
128130 // Assign memory
129131 set_free_area((void*)(g_object+g_objpos),(void*)(&RAM[RAMSIZE]));
--- mips/branches/nauplia/compiler.h (revision 139)
+++ mips/branches/nauplia/compiler.h (revision 140)
@@ -128,6 +128,7 @@
128128 char* str_function(void);
129129
130130 void call_library(void);
131+void reset_dataread();
131132
132133 void free_temp_str(char* str);
133134 void* alloc_memory(int size, int var_num);