• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine 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


Commit MetaInfo

Revision8dba5357eb208a26c172292efa3c80263fba97ab (tree)
Zeit2019-01-07 12:01:47
AutorKatsumi <kmorimatsu@sour...>
CommiterKatsumi

Log Message

POKE16, POKE32

Ändern Zusammenfassung

Diff

--- a/mips/megalopa/debug.c
+++ b/mips/megalopa/debug.c
@@ -227,19 +227,13 @@ static const char initext[]=
227227
228228 static const char bastext[]=
229229 "CLS\n"
230-"useclass class1\n"
231-"a=new(class1)\n"
232-"a.test=1234\n"
233-"a.test2=5678\n"
234-"print gosub(LABEL1,789)\n"
235-"print a.mtest(123,456)\n"
236-"call a.mtest(321,654)\n"
237-"print hex$(a),a.test,a.test2,a.test3\n"
238-"end \n"
239-"label LABEL1\n"
240-"print ARGS(0),ARGS(1),\n"
241-"return 100\n"
242-"\n"
230+"dim a(0)\n"
231+"poke a,0x12\n"
232+"print hex$(a(0))\n"
233+"poke16 a+2,0x1234\n"
234+"print hex$(a(0))\n"
235+"poke32 a,0x12345678\n"
236+"print hex$(a(0))\n"
243237 "\n";
244238
245239
@@ -271,6 +265,14 @@ int _debug_test(int a0, int a1, int a2, int a3, int param4, int param5){
271265 asm volatile("addiu $s5,$sp,4");
272266 asm volatile("sw $zero,4($s8)");
273267 asm volatile("lw $a0,4($s8)");
268+ asm volatile("addiu $v0,$s8,4");
269+ asm volatile("sh $v0,0($v1)");
270+ asm volatile("sw $v0,0($v1)");
271+ ((unsigned short*)a0)[0]=(unsigned short)a1;
272+ asm volatile("nop");
273+ asm volatile("nop");
274+ asm volatile("nop");
275+ asm volatile("nop");
274276 asm volatile("nop");
275277 asm volatile("nop");
276278 return a2+a3;
--- a/mips/megalopa/reservednames.js
+++ b/mips/megalopa/reservednames.js
@@ -45,6 +45,7 @@ var namearray=[
4545 'ATAN',
4646 'ATAN2',
4747 'BREAK',
48+ 'CALL',
4849 'CDATA',
4950 'CEIL',
5051 'CHR',
@@ -58,6 +59,7 @@ var namearray=[
5859 'CURSOR',
5960 'DATA',
6061 'DEC',
62+ 'DELETE',
6163 'DIM',
6264 'DO',
6365 'ELSE',
@@ -71,6 +73,7 @@ var namearray=[
7173 'FEOF',
7274 'FGET',
7375 'FGETC',
76+ 'FIELD',
7477 'FILE',
7578 'FINPUT',
7679 'FLEN',
@@ -104,15 +107,21 @@ var namearray=[
104107 'MODF',
105108 'MUSIC',
106109 'NEXT',
110+ 'NEW',
107111 'NOT',
108112 'PCG',
109113 'PEEK',
114+ 'PEEK16',
115+ 'PEEK32',
110116 'PI',
111117 'POINT',
112118 'POKE',
119+ 'POKE16',
120+ 'POKE32',
113121 'POW',
114122 'PRINT',
115123 'PSET',
124+ 'PUBLIC',
116125 'PUTBMP',
117126 'READ',
118127 'REM',
--- a/mips/megalopa/statement.c
+++ b/mips/megalopa/statement.c
@@ -237,7 +237,7 @@ char* clear_statement(){
237237 return 0;
238238 }
239239
240-char* poke_statement(){
240+char* poke_statement_sub(int bits){
241241 char* err;
242242 err=get_value();
243243 if (err) return err;
@@ -251,7 +251,18 @@ char* poke_statement(){
251251 check_obj_space(3);
252252 g_object[g_objpos++]=0x8FA30004; // lw v1,4(sp)
253253 g_object[g_objpos++]=0x27BD0004; // addiu sp,sp,4
254- g_object[g_objpos++]=0xA0620000; // sb v0,0(v1)
254+ switch(bits){
255+ case 32:
256+ g_object[g_objpos++]=0xAC620000; // sw v0,0(v1)
257+ break;
258+ case 16:
259+ g_object[g_objpos++]=0xA4620000; // sh v0,0(v1)
260+ break;
261+ case 8:
262+ default:
263+ g_object[g_objpos++]=0xA0620000; // sb v0,0(v1)
264+ break;
265+ }
255266 return 0;
256267 }
257268
@@ -1555,6 +1566,18 @@ char* useclass_statement(){
15551566
15561567 // Aliases follow
15571568
1569+char* poke_statement(){
1570+ return poke_statement_sub(8);
1571+}
1572+
1573+char* poke16_statement(){
1574+ return poke_statement_sub(16);
1575+}
1576+
1577+char* poke32_statement(){
1578+ return poke_statement_sub(32);
1579+}
1580+
15581581 char* palette_statement(){
15591582 return param4_statement(LIB_PALETTE);
15601583 }
@@ -1637,6 +1660,8 @@ static const void* statement_list[]={
16371660 "GOSUB ",gosub_statement,
16381661 "RETURN",return_statement,
16391662 "POKE ",poke_statement,
1663+ "POKE16 ",poke16_statement,
1664+ "POKE32 ",poke32_statement,
16401665 "FOR ",for_statement,
16411666 "NEXT",next_statement,
16421667 "LET ",let_statement,
--- a/mips/megalopa/varname.c
+++ b/mips/megalopa/varname.c
@@ -18,111 +18,115 @@
1818 */
1919
2020 static const int reserved_var_names[]={
21- 0x000106b8, //ABS
22- 0x0001f67c, //ACOS
23- 0x0002414c, //ARGS
24- 0x0001090c, //ASC
25- 0x0002469f, //ASIN
26- 0x00024a8f, //ATAN
27- 0x002f7c1e, //ATAN2
28- 0x0047c31c, //BREAK
21+ 0x000106b8, /*ABS*/
22+ 0x0001f67c, /*ACOS*/
23+ 0x0002414c, /*ARGS*/
24+ 0x0001090c, /*ASC*/
25+ 0x0002469f, /*ASIN*/
26+ 0x00024a8f, /*ATAN*/
27+ 0x002f7c1e, /*ATAN2*/
28+ 0x0047c31c, /*BREAK*/
2929 0x00035869, /*CALL*/
30- 0x00575afe, //CDATA
31- 0x00036c3d, //CEIL
32- 0x000111af, //CHR
33- 0x0cb1b682, //CIRCLE
34- 0x005d1ea3, //CLEAR
35- 0x00011240, //CLS
36- 0x005f66cb, //COLOR
37- 0x000112ac, //COS
38- 0x0003a041, //COSH
39- 0x00616415, //CREAD
40- 0x0de593fb, //CURSOR
41- 0x00040fbe, //DATA
30+ 0x00575afe, /*CDATA*/
31+ 0x00036c3d, /*CEIL*/
32+ 0x000111af, /*CHR*/
33+ 0x0cb1b682, /*CIRCLE*/
34+ 0x005d1ea3, /*CLEAR*/
35+ 0x00011240, /*CLS*/
36+ 0x005f66cb, /*COLOR*/
37+ 0x000112ac, /*COS*/
38+ 0x0003a041, /*COSH*/
39+ 0x00616415, /*CREAD*/
40+ 0x0de593fb, /*CURSOR*/
41+ 0x00040fbe, /*DATA*/
42+ 0x00011644, /*DEC*/
4243 0x0fe19c42, /*DELETE*/
43- 0x00011644, //DEC
44- 0x000116de, //DIM
45- 0x000100a8, //DO
46- 0x0004fd8e, //ELSE
47- 0x1434a177, //ELSEIF
48- 0x00011c99, //END
49- 0x0091c927, //ENDIF
50- 0x00053854, //EXEC
51- 0x00011e0d, //EXP
52- 0x000579c8, //FABS
53- 0x16e3d4be, //FCLOSE
54- 0x00058fcf, //FEOF
55- 0x00059895, //FGET
56- 0x00a67500, //FGETC
44+ 0x000116de, /*DIM*/
45+ 0x000100a8, /*DO*/
46+ 0x0004fd8e, /*ELSE*/
47+ 0x1434a177, /*ELSEIF*/
48+ 0x00011c99, /*END*/
49+ 0x0091c927, /*ENDIF*/
50+ 0x00053854, /*EXEC*/
51+ 0x00011e0d, /*EXP*/
52+ 0x000579c8, /*FABS*/
53+ 0x16e3d4be, /*FCLOSE*/
54+ 0x00058fcf, /*FEOF*/
55+ 0x00059895, /*FGET*/
56+ 0x00a67500, /*FGETC*/
5757 0x00a7e061, /*FIELD*/
58- 0x0005a3a2, //FILE
59- 0x177f0ca5, //FINPUT
60- 0x0005b1df, //FLEN
61- 0x00aa3445, //FLOAT
62- 0x00aa363b, //FLOOR
63- 0x0005b84d, //FMOD
64- 0x00ac5c9f, //FOPEN
65- 0x000121db, //FOR
66- 0x18352839, //FPRINT
67- 0x0005c865, //FPUT
68- 0x00ad2e40, //FPUTC
69- 0x00aefdec, //FSEEK
70- 0x00063b90, //GCLS
71- 0x1a808bcb, //GCOLOR
72- 0x00c60f03, //GOSUB
73- 0x0006796c, //GOTO
74- 0x1bcfcc39, //GPRINT
75- 0x00012a99, //HEX
76- 0x00010153, //IF
77- 0x00f8701a, //INKEY
78- 0x00f88ba5, //INPUT
79- 0x000130e9, //INT
80- 0x00092084, //KEYS
81- 0x013be43d, //LABEL
82- 0x00013ecf, //LEN
83- 0x00013ed5, //LET
84- 0x0009e96a, //LINE
85- 0x00014030, //LOG
86- 0x0145f324, //LOG10
87- 0x000a07f9, //LOOP
88- 0x000abca3, //MODF
89- 0x016418d4, //MUSIC
90- 0x000b4321, //NEXT
91- 0x000148f8, //NEW
92- 0x00014a5d, //NOT
93- 0x000152c0, //PCG
94- 0x000cacec, //PEEK
95- 0x00010252, //PI
96- 0x01ac8479, //POINT
97- 0x000ce05e, //POKE
98- 0x00015480, //POW
99- 0x01aea739, //PRINT
100- 0x000cf3d5, //PSET
58+ 0x0005a3a2, /*FILE*/
59+ 0x177f0ca5, /*FINPUT*/
60+ 0x0005b1df, /*FLEN*/
61+ 0x00aa3445, /*FLOAT*/
62+ 0x00aa363b, /*FLOOR*/
63+ 0x0005b84d, /*FMOD*/
64+ 0x00ac5c9f, /*FOPEN*/
65+ 0x000121db, /*FOR*/
66+ 0x18352839, /*FPRINT*/
67+ 0x0005c865, /*FPUT*/
68+ 0x00ad2e40, /*FPUTC*/
69+ 0x00aefdec, /*FSEEK*/
70+ 0x00063b90, /*GCLS*/
71+ 0x1a808bcb, /*GCOLOR*/
72+ 0x00c60f03, /*GOSUB*/
73+ 0x0006796c, /*GOTO*/
74+ 0x1bcfcc39, /*GPRINT*/
75+ 0x00012a99, /*HEX*/
76+ 0x00010153, /*IF*/
77+ 0x00f8701a, /*INKEY*/
78+ 0x00f88ba5, /*INPUT*/
79+ 0x000130e9, /*INT*/
80+ 0x00092084, /*KEYS*/
81+ 0x013be43d, /*LABEL*/
82+ 0x00013ecf, /*LEN*/
83+ 0x00013ed5, /*LET*/
84+ 0x0009e96a, /*LINE*/
85+ 0x00014030, /*LOG*/
86+ 0x0145f324, /*LOG10*/
87+ 0x000a07f9, /*LOOP*/
88+ 0x000abca3, /*MODF*/
89+ 0x016418d4, /*MUSIC*/
90+ 0x000b4321, /*NEXT*/
91+ 0x000148f8, /*NEW*/
92+ 0x00014a5d, /*NOT*/
93+ 0x000152c0, /*PCG*/
94+ 0x000cacec, /*PEEK*/
95+ 0x3b1c6aea, /*PEEK16*/
96+ 0x3b1c6b2e, /*PEEK32*/
97+ 0x00010252, /*PI*/
98+ 0x01ac8479, /*POINT*/
99+ 0x000ce05e, /*POKE*/
100+ 0x3c20dc0a, /*POKE16*/
101+ 0x3c20dc4e, /*POKE32*/
102+ 0x00015480, /*POW*/
103+ 0x01aea739, /*PRINT*/
104+ 0x000cf3d5, /*PSET*/
101105 0x3cb45fa4, /*PUBLIC*/
102- 0x3cc0fe21, //PUTBMP
103- 0x000e18d5, //READ
104- 0x00015d2e, //REM
105- 0x425c9703, //RETURN
106- 0x00015e69, //RND
107- 0x45c26d49, //SCROLL
108- 0x00016287, //SGN
109- 0x000162cf, //SIN
110- 0x000ee52d, //SINH
111- 0x01f9a429, //SOUND
112- 0x000f0e49, //SQRT
113- 0x47f711de, //SYSTEM
114- 0x000166bf, //TAN
115- 0x000f72ed, //TANH
116- 0x02182fee, //TVRAM
117- 0x022c2a2d, //UNTIL
118- 0x4e8887d0, //USEPCG
119- 0x4e88a5f3, //USEVAR
120- 0x000170dd, //VAL
121- 0x000170e3, //VAR
122- 0x00119505, //WAIT
123- 0x0011a9e9, //WEND
124- 0x025aef62, //WHILE
125- 0x025b8d75, //WIDTH
106+ 0x3cc0fe21, /*PUTBMP*/
107+ 0x000e18d5, /*READ*/
108+ 0x00015d2e, /*REM*/
109+ 0x425c9703, /*RETURN*/
110+ 0x00015e69, /*RND*/
111+ 0x45c26d49, /*SCROLL*/
112+ 0x00016287, /*SGN*/
113+ 0x000162cf, /*SIN*/
114+ 0x000ee52d, /*SINH*/
115+ 0x01f9a429, /*SOUND*/
116+ 0x000f0e49, /*SQRT*/
117+ 0x47f711de, /*SYSTEM*/
118+ 0x000166bf, /*TAN*/
119+ 0x000f72ed, /*TANH*/
120+ 0x02182fee, /*TVRAM*/
121+ 0x022c2a2d, /*UNTIL*/
122+ 0x4e8887d0, /*USEPCG*/
123+ 0x4e88a5f3, /*USEVAR*/
124+ 0x000170dd, /*VAL*/
125+ 0x000170e3, /*VAR*/
126+ 0x00119505, /*WAIT*/
127+ 0x0011a9e9, /*WEND*/
128+ 0x025aef62, /*WHILE*/
129+ 0x025b8d75, /*WIDTH*/
126130 // Additional names follow
127131 ADDITIONAL_RESERVED_VAR_NAMES
128132 };