BASIC compiler/interpreter for PIC32MX/MZ-80K
修订版 | 6f654f5fba6c2e909e79556da2fdaca15e544c81 (tree) |
---|---|
时间 | 2019-04-06 12:15:38 |
作者 | Katsumi <kmorimatsu@sour...> |
Commiter | Katsumi |
Debug INKEY INTERRUPT
@@ -490,7 +490,7 @@ char* interrupt_statement(); | ||
490 | 490 | #define INTERRUPT_TIMER 0 |
491 | 491 | #define INTERRUPT_DRAWCOUNT 1 |
492 | 492 | #define INTERRUPT_KEYS 2 |
493 | -#define INTERRUPT_KEYINPUT 3 | |
493 | +#define INTERRUPT_INKEY 3 | |
494 | 494 | #define INTERRUPT_MUSIC 4 |
495 | 495 | #define INTERRUPT_WAVE 5 |
496 | 496 |
@@ -261,7 +261,7 @@ INTERRUPT xxx,yyy[,z1[,z2 ... ]] | ||
261 | 261 | 1/60秒毎の割り込み。 |
262 | 262 | KEYS |
263 | 263 | ボタンの押下状態が変化した時。 |
264 | - KEYINPUT | |
264 | + INKEY | |
265 | 265 | キーボード押下時。 |
266 | 266 | MUSIC |
267 | 267 | 音楽再生の時、最後の音の再生時に割り込み。 |
@@ -30,7 +30,7 @@ static const void* interrupt_list[]={ | ||
30 | 30 | "TIMER", (void*)INTERRUPT_TIMER, |
31 | 31 | "DRAWCOUNT",(void*)INTERRUPT_DRAWCOUNT, |
32 | 32 | "KEYS", (void*)INTERRUPT_KEYS, |
33 | - "KEYINPUT", (void*)INTERRUPT_KEYINPUT, | |
33 | + "INKEY", (void*)INTERRUPT_INKEY, | |
34 | 34 | "MUSIC", (void*)INTERRUPT_MUSIC, |
35 | 35 | "WAVE", (void*)INTERRUPT_WAVE, |
36 | 36 | ADDITIONAL_INTERRUPT_FUNCTIONS |
@@ -266,14 +266,17 @@ char* interrupt_statement(){ | ||
266 | 266 | 1) Call music function if needed. |
267 | 267 | MUSIC interrupt is taken by music.c |
268 | 268 | 2) Check buttons for KEYS interrupt |
269 | - 3) Check PS/2 for KEYINPUT interrupt | |
269 | + 3) Check PS/2 for INKEY interrupt | |
270 | 270 | 4) DRAWCOUNT interrupt |
271 | 271 | */ |
272 | 272 | |
273 | +const int* keystatus=(int*)&ps2keystatus[0]; | |
274 | + | |
273 | 275 | #pragma interrupt CS0Handler IPL3SOFT vector 1 |
274 | 276 | void CS0Handler(void){ |
275 | 277 | static int s_keys=-1; |
276 | - static int s_vkey=0; | |
278 | + static char s_inkey=0; | |
279 | + int i; | |
277 | 280 | IFS0bits.CS0IF=0; |
278 | 281 | // Call music function |
279 | 282 | if (g_music_active) musicint(); |
@@ -286,12 +289,22 @@ void CS0Handler(void){ | ||
286 | 289 | // Raise KEYS interrupt flag |
287 | 290 | raise_interrupt_flag(INTERRUPT_KEYS); |
288 | 291 | } |
289 | - s_keys!=KEYPORT&(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE); | |
292 | + s_keys=KEYPORT&(KEYUP|KEYDOWN|KEYLEFT|KEYRIGHT|KEYSTART|KEYFIRE); | |
290 | 293 | // 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; | |
294 | 303 | } |
295 | - s_vkey=vkey&0xff; | |
296 | 304 | } |
297 | -} | |
\ No newline at end of file | ||
305 | +} | |
306 | +/* | |
307 | + for(i=0;i<256;i++){ | |
308 | + if (ps2keystatus[i]) return i; | |
309 | + } | |
310 | +*/ |