• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

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

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

BASIC compiler/interpreter for PIC32MX/MZ-80K (suspended)


コミットメタ情報

リビジョン238 (tree)
日時2018-06-19 10:01:18
作者kmorimatsu

ログメッセージ

Move lib_system to envspecific.c

変更サマリ

差分

--- mips/branches/megalopa/envspecific.c (revision 237)
+++ mips/branches/megalopa/envspecific.c (revision 238)
@@ -6,6 +6,7 @@
66 */
77
88 #include <xc.h>
9+#include "main.h"
910 #include "compiler.h"
1011 #include "lib_video_megalopa.h"
1112 #include "ps2keyboard.h"
@@ -121,6 +122,75 @@
121122 }
122123 }
123124
125+int lib_system(int a0, int a1 ,int v0, int a3, int g_gcolor, int g_prev_x, int g_prev_y){
126+ switch((enum extra)(a3 & EXTRA_MASK)){
127+ case EXTRA_SYSTEM:
128+ // SYSTEM statement/function (see below)
129+ break;
130+ case EXTRA_OUT:
131+ case EXTRA_OUT8H:
132+ case EXTRA_OUT8L:
133+ case EXTRA_OUT16:
134+ case EXTRA_IN:
135+ case EXTRA_IN8H:
136+ case EXTRA_IN8L:
137+ case EXTRA_IN16:
138+ case EXTRA_ANALOG:
139+ case EXTRA_PWM:
140+ case EXTRA_SERIALOUT:
141+ case EXTRA_SERIALIN:
142+ case EXTRA_SPIOUT:
143+ case EXTRA_SPIIN:
144+ // TODO: Implement IO functions
145+ return v0;
146+ default:
147+ err_unknown();
148+ return v0;
149+ }
150+ switch(a0){
151+ // Version info
152+ case 0: return (int)SYSVER1;
153+ case 1: return (int)SYSVER2;
154+ case 2: return (int)BASVER;
155+ case 3: return (int)FILENAME_FLASH_ADDRESS;
156+ // Display info
157+ case 20: return twidth;
158+ case 21: return twidthy;
159+ case 22: return gwidth;
160+ case 23: return gwidthy;
161+ case 24: return cursorcolor;
162+ case 25: return g_gcolor;
163+ case 26: return ((int)(cursor-TVRAM))%twidth;
164+ case 27: return ((int)(cursor-TVRAM))/twidth;
165+ case 28: return g_prev_x;
166+ case 29: return g_prev_y;
167+ // Keyboard info
168+ case 40: return (int)inPS2MODE();
169+ case 41: return (int)vkey;
170+ case 42: return (int)lockkey;
171+ case 43: return (int)keytype;
172+ // Pointers to gloval variables
173+ case 100: return (int)&g_var_mem[0];
174+ case 101: return (int)&g_rnd_seed;
175+ case 102: return (int)&TVRAM[0];
176+ case 103: return (int)&FontData[0];
177+ case 104: return (int)g_var_mem[ALLOC_PCG_BLOCK];
178+ case 105: return (int)g_var_mem[ALLOC_GRAPHIC_BLOCK];
179+ // Change system settings
180+ case 200:
181+ // ON/OFF monitor
182+ if (v0) {
183+ start_composite();
184+ } else {
185+ stop_composite();
186+ }
187+ break;
188+ default:
189+ break;
190+ }
191+ return 0;
192+}
193+
124194 void videowidth(int width){
125195 // TODO: must do something here
126196
--- mips/branches/megalopa/envspecific.h (revision 237)
+++ mips/branches/megalopa/envspecific.h (revision 238)
@@ -12,11 +12,8 @@
1212 void usegraphic(int mode);
1313 void videowidth(int width);
1414 void set_graphmode(unsigned char m);
15+int lib_system(int a0, int a1 ,int v0, int a3, int g_gcolor, int g_prev_x, int g_prev_y);
1516
16-// Graphic resolution is frexible (see lib_system)
17-#define G_X_RES gwidth
18-#define G_Y_RES gwidthy
19-
2017 // 30 or 40 characters per line for Zoea
2118 #define printcomma() printstr(" "+rem10_32((unsigned int)(cursor-TVRAM)))
2219
@@ -32,3 +29,24 @@
3229 #define ADDITIONAL_STATEMENTS
3330 #define ADDITIONAL_INT_FUNCTIONS
3431 #define ADDITIONAL_STR_FUNCTIONS
32+
33+#define EXTRA_MASK 0x003F
34+#define EXTRA_STEP 0x0001
35+enum extra{
36+ EXTRA_SYSTEM =EXTRA_STEP*0,
37+ EXTRA_OUT =EXTRA_STEP*1,
38+ EXTRA_OUT8H =EXTRA_STEP*2,
39+ EXTRA_OUT8L =EXTRA_STEP*3,
40+ EXTRA_OUT16 =EXTRA_STEP*4,
41+ EXTRA_IN =EXTRA_STEP*5,
42+ EXTRA_IN8H =EXTRA_STEP*6,
43+ EXTRA_IN8L =EXTRA_STEP*7,
44+ EXTRA_IN16 =EXTRA_STEP*8,
45+ EXTRA_ANALOG =EXTRA_STEP*9,
46+ EXTRA_PWM =EXTRA_STEP*10,
47+ EXTRA_SERIALOUT =EXTRA_STEP*11,
48+ EXTRA_SERIALIN =EXTRA_STEP*12,
49+ EXTRA_SPIOUT =EXTRA_STEP*13,
50+ EXTRA_SPIIN =EXTRA_STEP*14,
51+ // MAX 63
52+};
--- mips/branches/megalopa/library.c (revision 237)
+++ mips/branches/megalopa/library.c (revision 238)
@@ -608,51 +608,6 @@
608608 }
609609
610610
611-int lib_system(int a0,int v0){
612- switch(a0){
613- // Version info
614- case 0: return (int)SYSVER1;
615- case 1: return (int)SYSVER2;
616- case 2: return (int)BASVER;
617- case 3: return (int)FILENAME_FLASH_ADDRESS;
618- // Display info
619- case 20: return twidth;
620- case 21: return WIDTH_Y;
621- case 22: return G_X_RES;
622- case 23: return G_Y_RES;
623- case 24: return cursorcolor;
624- case 25: return g_gcolor;
625- case 26: return ((int)(cursor-TVRAM))%twidth;
626- case 27: return ((int)(cursor-TVRAM))/twidth;
627- case 28: return g_prev_x;
628- case 29: return g_prev_y;
629- // Keyboard info
630- case 40: return (int)inPS2MODE();
631- case 41: return (int)vkey;
632- case 42: return (int)lockkey;
633- case 43: return (int)keytype;
634- // Pointers to gloval variables
635- case 100: return (int)&g_var_mem[0];
636- case 101: return (int)&g_rnd_seed;
637- case 102: return (int)&TVRAM[0];
638- case 103: return (int)&FontData[0];
639- case 104: return (int)g_var_mem[ALLOC_PCG_BLOCK];
640- case 105: return (int)g_var_mem[ALLOC_GRAPHIC_BLOCK];
641- // Change system settings
642- case 200:
643- // ON/OFF monitor
644- if (v0) {
645- start_composite();
646- } else {
647- stop_composite();
648- }
649- break;
650- default:
651- break;
652- }
653- return 0;
654-}
655-
656611 char* lib_sprintf(char* format, int data){
657612 char* str;
658613 int i;
@@ -1058,7 +1013,7 @@
10581013 case LIB_DRAWCOUNT:
10591014 return drawcount;
10601015 case LIB_SYSTEM:
1061- return lib_system(a0,v0);
1016+ return lib_system(a0, a1 ,v0, a3, g_gcolor, g_prev_x, g_prev_y);
10621017 case LIB_RESTORE:
10631018 return lib_read(0,v0);
10641019 case LIB_RESTORE2: