• 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évisionc43645516955eab6e38639a5e56bbdf30b942098 (tree)
l'heure2019-01-07 12:14:02
AuteurKatsumi <kmorimatsu@sour...>
CommiterKatsumi

Message de Log

PEEK16(), PEEK32()

Change Summary

Modification

--- a/mips/megalopa/debug.c
+++ b/mips/megalopa/debug.c
@@ -228,12 +228,15 @@ static const char initext[]=
228228 static const char bastext[]=
229229 "CLS\n"
230230 "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"
237240 "\n";
238241
239242
@@ -262,14 +265,9 @@ static const void* debugjumptable[]={
262265
263266 int _debug_test(int a0, int a1, int a2, int a3, int param4, int param5){
264267 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)");
273271 asm volatile("nop");
274272 asm volatile("nop");
275273 asm volatile("nop");
--- a/mips/megalopa/function.c
+++ b/mips/megalopa/function.c
@@ -98,12 +98,23 @@ char* val_function(){
9898 return 0;
9999 }
100100
101-char* peek_function(){
101+char* peek_function_sub(int bits){
102102 char* err;
103103 err=get_value();
104104 if (err) return err;
105105 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+ }
107118 return 0;
108119 }
109120
@@ -528,6 +539,18 @@ char* str_function(void){
528539
529540 // Aliases follow
530541
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+
531554 char* gcolor_function(){
532555 return graphic_statement(FUNC_GCOLOR);
533556 }
@@ -547,6 +570,8 @@ static const void* int_func_list[]={
547570 "GOSUB(",gosub_function,
548571 "STRNCMP(",strncmp_function,
549572 "PEEK(",peek_function,
573+ "PEEK16(",peek16_function,
574+ "PEEK32(",peek32_function,
550575 "LEN(",len_function,
551576 "ASC(",asc_function,
552577 "SGN(",sgn_function,