#include "input.h" #include #include "state.h" #include "ops.h" void do_input() { unsigned char edge_detection_data[7]; unsigned char *edge_detect = edge_detection_data - 1; for (unsigned char i = 1; i <= 7; i++) { edge_detect[i] = kb_Data[i]; } kb_Scan(); for (unsigned char i = 1; i <= 7; i++) { edge_detect[i] = kb_Data[i] & (edge_detect[i] ^ kb_Data[i]); } if (kb_Left & edge_detect[7] && cursor_stack > 0) { cursor_stack--; } if (kb_Right & edge_detect[7] && cursor_stack < TABLEAU_NUM_PILES - 1) { cursor_stack++; } if (kb_2nd & edge_detect[1]) { if (can_grab()) grab(); else if (can_drop()) drop(); } if (kb_Clear & edge_detect[6]) { cancel(); } if (kb_Del & edge_detect[1]) { deal(); } }