• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

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

Révision34af68baeeaaf193851454f318db9988e2f28047 (tree)
l'heure2019-03-24 10:43:49
AuteurKatsumi <kmorimatsu@sour...>
CommiterKatsumi

Message de Log

OPTION NOLINENUM in Zoea

Change Summary

Modification

--- a/mips/zoea/compiler.c
+++ b/mips/zoea/compiler.c
@@ -160,8 +160,10 @@ char* compile_line(void){
160160 printstr(resolve_label(g_line));
161161 return ERR_MULTIPLE_LABEL;
162162 }
163- check_obj_space(1);
164- g_object[g_objpos++]=0x34160000|g_line; //ori s6,zero,xxxx;
163+ if (!g_nolinenum) {
164+ check_obj_space(1);
165+ g_object[g_objpos++]=0x34160000|g_line; //ori s6,zero,xxxx;
166+ }
165167 }
166168 while(g_source[g_srcpos]!=0x0D && g_source[g_srcpos]!=0x0A){
167169 err=statement();
--- a/mips/zoea/compiler.h
+++ b/mips/zoea/compiler.h
@@ -213,6 +213,7 @@ extern int g_var_mem[ALLOC_BLOCK_NUM];
213213 extern unsigned short g_var_pointer[ALLOC_BLOCK_NUM];
214214 extern unsigned short g_var_size[ALLOC_BLOCK_NUM];
215215 extern char g_temp_area_used;
216+extern char g_nolinenum;
216217 extern int* g_heap_mem;
217218 extern int g_max_mem;
218219 extern char g_disable_break;
--- a/mips/zoea/debug.c
+++ b/mips/zoea/debug.c
@@ -228,13 +228,13 @@ static const char initext[]=
228228 "#PRINT\n";
229229
230230 static const char bastext[]=
231-"print getdir$()\n"
232-"end\n"
233-"\n"
234-"\n"
235-"\n"
231+"REM 1\n"
232+"REM 2\n"
233+"REM 3\n"
236234 "\n"
235+"CLS\n"
237236 "\n"
237+"LABEL TST:PRINT\n"
238238 "\n";
239239
240240 static const char class1text[]=
--- a/mips/zoea/file.c
+++ b/mips/zoea/file.c
@@ -122,7 +122,10 @@ int compile_and_link_file(char* buff,char* appname){
122122 printchar('\n');
123123 return -1;
124124 }
125-
125+
126+ // Option initialization(s)
127+ g_nolinenum=0;
128+
126129 // Compile the file
127130 err=compile_file();
128131 close_file();
--- a/mips/zoea/globalvars.c
+++ b/mips/zoea/globalvars.c
@@ -55,6 +55,9 @@ unsigned short g_var_size[ALLOC_BLOCK_NUM];
5555 // Flag to use temporary area when compiling
5656 char g_temp_area_used;
5757
58+// Flag to use option nolinenum
59+char g_nolinenum;
60+
5861 // Heap area
5962 int* g_heap_mem;
6063 int g_max_mem;
--- a/mips/zoea/help.txt
+++ b/mips/zoea/help.txt
@@ -105,6 +105,8 @@ LABEL xxx
105105 代入する。「LET」は省略可。
106106 MUSIC x$
107107 BGMを演奏する。詳細は、下記<MUSIC>の項を参照。
108+OPTION x[,y[,z ... ]]]
109+ 各種オプションを指定する。オプションについては、下記<オプション>の項を参照。
108110 PLAYWAVE x$[,y]
109111 音楽用のWAVEファイル(ファイル名をx$で指定)を演奏する。WAVEのフォーマットは、
110112 モノラル、ビット長は8、サンプリング周波数が15700 Hzの物を指定する。16000 Hz
@@ -619,6 +621,16 @@ SYSTEM(105)
619621 SYSTEM 200,x
620622 ディスプレイの表示を停止(xが0のとき)、もしくは開始(xが0以外の時)する。
621623
624+<オプション>
625+OPTIONステートメントを使って、コンパイル時もしくは実行時に色々なオプションを指定
626+する事が可能です。次のオプションが有ります。
627+
628+OPTION NOLINENUM
629+ コンパイル時に、行番号を指定する命令を挿入しない。このオプションにより、プロ
630+ グラムサイズを小さくして実行速度を増加する効果が見込める。ただし、エラーが発
631+ 生した場合に、どの行でのエラーかは分からなくなる。また、一時領域を使うような
632+ 場合(主に文字列操作)は、該当箇所にLABELステートメントを入れること。
633+
622634 <クラス・オブジェクト関連機能>
623635
624636 クラスとオブジェクトの利用方法について、詳しくはclass.txtを参照して下さい。
--- a/mips/zoea/reservednames.js
+++ b/mips/zoea/reservednames.js
@@ -110,6 +110,7 @@ var namearray=[
110110 'NEXT',
111111 'NEW',
112112 'NOT',
113+ 'OPTION',
113114 'PCG',
114115 'PEEK',
115116 'PEEK16',
--- a/mips/zoea/statement.c
+++ b/mips/zoea/statement.c
@@ -1550,6 +1550,24 @@ char* setdir_statement(){
15501550 return 0;
15511551 }
15521552
1553+char* option_statement(){
1554+ while(1){
1555+ next_position();
1556+ if (nextCodeIs("NOLINENUM")) {
1557+ g_nolinenum=1;
1558+ } else {
1559+ return ERR_SYNTAX;
1560+ }
1561+ next_position();
1562+ if (g_source[g_srcpos]==',') {
1563+ g_srcpos++;
1564+ } else {
1565+ break;
1566+ }
1567+ }
1568+ return 0;
1569+}
1570+
15531571 #ifdef __DEBUG
15541572 char* debug_statement(){
15551573 call_lib_code(LIB_DEBUG);
@@ -1698,6 +1716,7 @@ static const void* statement_list[]={
16981716 "CALL ",call_statement,
16991717 "STATIC ",static_statement,
17001718 "SETDIR ",setdir_statement,
1719+ "OPTION ",option_statement,
17011720 // List of additional statements follows
17021721 ADDITIONAL_STATEMENTS
17031722 };
--- a/mips/zoea/varname.c
+++ b/mips/zoea/varname.c
@@ -91,6 +91,7 @@ static const int reserved_var_names[]={
9191 0x000b4321, /*NEXT*/
9292 0x000148f8, /*NEW*/
9393 0x00014a5d, /*NOT*/
94+ 0x38a658d7, /*OPTION*/
9495 0x000152c0, /*PCG*/
9596 0x000cacec, /*PEEK*/
9697 0x3b1c6aea, /*PEEK16*/