• R/O
  • SSH
  • HTTPS

Commit

Tags
No 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 (suspended)


Commit MetaInfo

Revision138 (tree)
Time2016-07-18 11:19:12
Authorkmorimatsu

Log Message

Avoid reading PORTB in PS/2 keyboard mode.

Change Summary

Incremental Difference

--- mips/branches/nauplia/library.c (revision 137)
+++ mips/branches/nauplia/library.c (revision 138)
@@ -333,7 +333,7 @@
333333 while(vkey!=0);
334334 // Get string as a line
335335 lineinput(str,63);
336- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
336+ check_break();
337337 return str;
338338 }
339339
@@ -451,7 +451,7 @@
451451 dcount=drawcount;
452452 while(dcount==drawcount){
453453 asm ("wait");
454- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
454+ check_break();
455455 }
456456 }
457457 }
@@ -466,7 +466,7 @@
466466 int _call_library(int a0,int a1,int v0,enum libs a3){
467467 // usage: call_lib_code(LIB_XXXX);
468468 // Above code takes 2 words.
469- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
469+ check_break();
470470 switch(a3){
471471 case LIB_DIV0:
472472 err_div_zero();
--- mips/branches/nauplia/run.c (revision 137)
+++ mips/branches/nauplia/run.c (revision 138)
@@ -113,11 +113,17 @@
113113 wait60thsec(15);
114114
115115 // Initialize the other parameters
116+ // Random seed
116117 g_rnd_seed=0x3045;
118+ // Clear variables
117119 for(i=0;i<ALLOC_BLOCK_NUM;i++){
118120 g_var_mem[i]=0;
119121 g_var_size[i]=0;
120122 }
123+ // Clear key input buffer
124+ for(i=0;i<256;i++){
125+ ps2keystatus[i]=0;
126+ }
121127
122128 // Assign memory
123129 set_free_area((void*)(g_object+g_objpos),(void*)(&RAM[RAMSIZE]));
--- mips/branches/nauplia/compiler.h (revision 137)
+++ mips/branches/nauplia/compiler.h (revision 138)
@@ -191,3 +191,15 @@
191191 // Divide by 36 (valid for 32 bits)
192192 #define div36_32(x) div32(x,0xe38e38e4,37)
193193 #define rem36_32(x) (x-36*div36_32(x))
194+
195+// Check break key or buttons when executing BASIC code.
196+// In PS/2 mode, detect ctrl-break.
197+// In button mode, detect pushing four buttons are pushed simultaneously.
198+#define check_break() \
199+ if (g_disable_break==0) {\
200+ if (inPS2MODE()) {\
201+ if (ps2keystatus[0x03]) err_break();\
202+ } else {\
203+ if ((PORTB&0x4c80)==0) err_break();\
204+ }\
205+ }