A card solitaire game for the TI-84 Plus/83 Premium CE graphing calculators.
1#include "input.h"
2#include <keypadc.h>
3#include "state.h"
4#include "ops.h"
5
6void do_input()
7{
8 unsigned char edge_detection_data[7];
9 unsigned char *edge_detect = edge_detection_data - 1;
10 for (unsigned char i = 1; i <= 7; i++)
11 {
12 edge_detect[i] = kb_Data[i];
13 }
14
15 kb_Scan();
16
17 for (unsigned char i = 1; i <= 7; i++)
18 {
19 edge_detect[i] = kb_Data[i] & (edge_detect[i] ^ kb_Data[i]);
20 }
21
22 if (kb_Left & edge_detect[7] && cursor_stack > 0)
23 {
24 cursor_stack--;
25 }
26 if (kb_Right & edge_detect[7] && cursor_stack < TABLEAU_NUM_PILES - 1)
27 {
28 cursor_stack++;
29 }
30
31 if (kb_2nd & edge_detect[1])
32 {
33 if (can_grab()) grab();
34 else if (can_drop()) drop();
35 }
36
37 if (kb_Clear & edge_detect[6])
38 {
39 cancel();
40 }
41
42 if (kb_Del & edge_detect[1])
43 {
44 deal();
45 }
46}