• R/O
  • HTTP
  • 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


Commit MetaInfo

Revision6f654f5fba6c2e909e79556da2fdaca15e544c81 (tree)
Time2019-04-06 12:15:38
AuthorKatsumi <kmorimatsu@sour...>
CommiterKatsumi

Log Message

Debug INKEY INTERRUPT

Change Summary

Incremental Difference

--- a/mips/zoea/compiler.h
+++ b/mips/zoea/compiler.h
@@ -490,7 +490,7 @@ char* interrupt_statement();
490490 #define INTERRUPT_TIMER 0
491491 #define INTERRUPT_DRAWCOUNT 1
492492 #define INTERRUPT_KEYS 2
493-#define INTERRUPT_KEYINPUT 3
493+#define INTERRUPT_INKEY 3
494494 #define INTERRUPT_MUSIC 4
495495 #define INTERRUPT_WAVE 5
496496
--- a/mips/zoea/help.txt
+++ b/mips/zoea/help.txt
@@ -261,7 +261,7 @@ INTERRUPT xxx,yyy[,z1[,z2 ... ]]
261261 1/60秒毎の割り込み。
262262 KEYS
263263 ボタンの押下状態が変化した時。
264- KEYINPUT
264+ INKEY
265265 キーボード押下時。
266266 MUSIC
267267 音楽再生の時、最後の音の再生時に割り込み。
--- a/mips/zoea/timer.c
+++ b/mips/zoea/timer.c
@@ -30,7 +30,7 @@ static const void* interrupt_list[]={
3030 "TIMER", (void*)INTERRUPT_TIMER,
3131 "DRAWCOUNT",(void*)INTERRUPT_DRAWCOUNT,
3232 "KEYS", (void*)INTERRUPT_KEYS,
33- "KEYINPUT", (void*)INTERRUPT_KEYINPUT,
33+ "INKEY", (void*)INTERRUPT_INKEY,
3434 "MUSIC", (void*)INTERRUPT_MUSIC,
3535 "WAVE", (void*)INTERRUPT_WAVE,
3636 ADDITIONAL_INTERRUPT_FUNCTIONS
@@ -266,14 +266,17 @@ char* interrupt_statement(){
266266 1) Call music function if needed.
267267 MUSIC interrupt is taken by music.c
268268 2) Check buttons for KEYS interrupt
269- 3) Check PS/2 for KEYINPUT interrupt
269+ 3) Check PS/2 for INKEY interrupt
270270 4) DRAWCOUNT interrupt
271271 */
272272
273+const int* keystatus=(int*)&ps2keystatus[0];
274+
273275 #pragma interrupt CS0Handler IPL3SOFT vector 1
274276 void CS0Handler(void){
275277 static int s_keys=-1;
276- static int s_vkey=0;
278+ static char s_inkey=0;
279+ int i;
277280 IFS0bits.CS0IF=0;
278281 // Call music function
279282 if (g_music_active) musicint();
@@ -286,12 +289,22 @@ void CS0Handler(void){
286289 // Raise KEYS interrupt flag
287290 raise_interrupt_flag(INTERRUPT_KEYS);
288291 }
289- s_keys!=KEYPORT&(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE);
292+ s_keys=KEYPORT&(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE);
290293 // Check PS/2 keyboard down
291- if ((vkey&0xff) && !s_vkey) {
292- // Raise KEYINPUT interrupt flag
293- raise_interrupt_flag(INTERRUPT_KEYINPUT);
294+ if (g_int_vector[INTERRUPT_INKEY]) {
295+ for(i=0;i<64;i++){
296+ if (keystatus[i]) {
297+ // Raise INKEY interrupt flag
298+ if (!s_inkey) raise_interrupt_flag(INTERRUPT_INKEY);
299+ break;
300+ }
301+ }
302+ s_inkey=(i==64) ? 0:1;
294303 }
295- s_vkey=vkey&0xff;
296304 }
297-}
\ No newline at end of file
305+}
306+/*
307+ for(i=0;i<256;i++){
308+ if (ps2keystatus[i]) return i;
309+ }
310+*/