BASIC compiler/interpreter for PIC32MX/MZ-80K
修訂 | c43645516955eab6e38639a5e56bbdf30b942098 (tree) |
---|---|
時間 | 2019-01-07 12:14:02 |
作者 | Katsumi <kmorimatsu@sour...> |
Commiter | Katsumi |
PEEK16(), PEEK32()
@@ -228,12 +228,15 @@ static const char initext[]= | ||
228 | 228 | static const char bastext[]= |
229 | 229 | "CLS\n" |
230 | 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" | |
231 | +"a(0)=0x89ABCDEF\n" | |
232 | +"print hex$(peek(a)),\n" | |
233 | +"print hex$(peek16(a)),\n" | |
234 | +"print hex$(peek32(a)),\n" | |
235 | +"\n" | |
236 | +"\n" | |
237 | +"\n" | |
238 | +"\n" | |
239 | +"\n" | |
237 | 240 | "\n"; |
238 | 241 | |
239 | 242 |
@@ -262,14 +265,9 @@ static const void* debugjumptable[]={ | ||
262 | 265 | |
263 | 266 | int _debug_test(int a0, int a1, int a2, int a3, int param4, int param5){ |
264 | 267 | asm volatile(".set noreorder"); |
265 | - asm volatile("addiu $s5,$sp,4"); | |
266 | - asm volatile("sw $zero,4($s8)"); | |
267 | - 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"); | |
268 | + asm volatile("lbu $v0,0($v0)"); | |
269 | + asm volatile("lhu $v0,0($v0)"); | |
270 | + asm volatile("lw $v0,0($v0)"); | |
273 | 271 | asm volatile("nop"); |
274 | 272 | asm volatile("nop"); |
275 | 273 | asm volatile("nop"); |
@@ -98,12 +98,23 @@ char* val_function(){ | ||
98 | 98 | return 0; |
99 | 99 | } |
100 | 100 | |
101 | -char* peek_function(){ | |
101 | +char* peek_function_sub(int bits){ | |
102 | 102 | char* err; |
103 | 103 | err=get_value(); |
104 | 104 | if (err) return err; |
105 | 105 | check_obj_space(1); |
106 | - g_object[g_objpos++]=0x90420000; // lbu v0,0(v0) | |
106 | + switch(bits){ | |
107 | + case 32: | |
108 | + g_object[g_objpos++]=0x8C420000; // lw v0,0(v0) | |
109 | + break; | |
110 | + case 16: | |
111 | + g_object[g_objpos++]=0x94420000; // lhu v0,0(v0) | |
112 | + break; | |
113 | + case 8: | |
114 | + default: | |
115 | + g_object[g_objpos++]=0x90420000; // lbu v0,0(v0) | |
116 | + break; | |
117 | + } | |
107 | 118 | return 0; |
108 | 119 | } |
109 | 120 |
@@ -528,6 +539,18 @@ char* str_function(void){ | ||
528 | 539 | |
529 | 540 | // Aliases follow |
530 | 541 | |
542 | +char* peek_function(){ | |
543 | + return peek_function_sub(8); | |
544 | +} | |
545 | + | |
546 | +char* peek16_function(){ | |
547 | + return peek_function_sub(16); | |
548 | +} | |
549 | + | |
550 | +char* peek32_function(){ | |
551 | + return peek_function_sub(32); | |
552 | +} | |
553 | + | |
531 | 554 | char* gcolor_function(){ |
532 | 555 | return graphic_statement(FUNC_GCOLOR); |
533 | 556 | } |
@@ -547,6 +570,8 @@ static const void* int_func_list[]={ | ||
547 | 570 | "GOSUB(",gosub_function, |
548 | 571 | "STRNCMP(",strncmp_function, |
549 | 572 | "PEEK(",peek_function, |
573 | + "PEEK16(",peek16_function, | |
574 | + "PEEK32(",peek32_function, | |
550 | 575 | "LEN(",len_function, |
551 | 576 | "ASC(",asc_function, |
552 | 577 | "SGN(",sgn_function, |