• 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

Revision137 (tree)
Time2016-07-18 11:08:36
Authorkmorimatsu

Log Message

Avoid reading PORTB in PS/2 keyboard mode.

Change Summary

Incremental Difference

--- mips/branches/zoea/library.c (revision 136)
+++ mips/branches/zoea/library.c (revision 137)
@@ -376,7 +376,7 @@
376376 while(vkey!=0);
377377 // Get string as a line
378378 lineinput(str,63);
379- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
379+ check_break();
380380 return str;
381381 }
382382
@@ -494,7 +494,7 @@
494494 dcount=drawcount;
495495 while(dcount==drawcount){
496496 asm (WAIT);
497- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
497+ check_break();
498498 }
499499 }
500500 }
@@ -825,7 +825,7 @@
825825 int _call_library(int a0,int a1,int v0,enum libs a3){
826826 // usage: call_lib_code(LIB_XXXX);
827827 // Above code takes 2 words.
828- if (g_disable_break==0 && (ps2keystatus[0x03] || (PORTB&0x4c80)==0)) err_break();
828+ check_break();
829829 switch(a3){
830830 case LIB_FLOAT:
831831 return lib_float(a0,v0,(enum operator)a1); // see operator.c
--- mips/branches/zoea/compiler.h (revision 136)
+++ mips/branches/zoea/compiler.h (revision 137)
@@ -288,3 +288,15 @@
288288 // Divide by 36 (valid for 32 bits)
289289 #define div36_32(x) div32(x,0xe38e38e4,37)
290290 #define rem36_32(x) (x-36*div36_32(x))
291+
292+// Check break key or buttons when executing BASIC code.
293+// In PS/2 mode, detect ctrl-break.
294+// In button mode, detect pushing four buttons are pushed simultaneously.
295+#define check_break() \
296+ if (g_disable_break==0) {\
297+ if (inPS2MODE()) {\
298+ if (ps2keystatus[0x03]) err_break();\
299+ } else {\
300+ if ((PORTB&0x4c80)==0) err_break();\
301+ }\
302+ }
--- mips/branches/zoea/run.c (revision 136)
+++ mips/branches/zoea/run.c (revision 137)
@@ -111,11 +111,17 @@
111111 wait60thsec(15);
112112
113113 // Initialize the other parameters
114+ // Random seed
114115 g_rnd_seed=0x3045;
116+ // Clear variables
115117 for(i=0;i<ALLOC_BLOCK_NUM;i++){
116118 g_var_mem[i]=0;
117119 g_var_size[i]=0;
118120 }
121+ // Clear key input buffer
122+ for(i=0;i<256;i++){
123+ ps2keystatus[i]=0;
124+ }
119125
120126 // Assign memory
121127 set_free_area((void*)(g_object+g_objpos),(void*)(&RAM[RAMSIZE]));