14 /* the user has started to type in his/her UID. grab the last key and continue
15 * reading. Returns true if a UID was entered successfully.
16 * The UID will be entered as 5 digits. (shorter uids should be pre-padded
19 uid = last_key%10; /* 10 => 0, it was _not_ reset (hopefuly :) */
20 set_msg("UID? ", WRAP_NONE);
21 set_char((last_key%10)+'0', 5);
23 for (uidpos = 2; uidpos <= 5; uidpos++) {
25 if (last_key == KEY_RESET) {
29 uid = (uid*10) + (last_key%10);
30 set_char((last_key%10)+'0', 4+uidpos);
38 /* We ask for a pin, display a PIN: prompt. PINs must be a 4 digit number.
39 * Strictly, they must be 16-bit, but it's easier to use the guarantee that
40 * 4-digits numbers are < 65536
42 * Also display X's on screen as the pin is entered.
44 set_msg("PIN? ", WRAP_NONE);
45 for (pinpos = 1; pinpos <= 5; pinpos++) {
47 if (last_key == KEY_RESET) {
51 pin = (pin*10) + (last_key%10);
52 set_char('X', 4+pinpos);
57 void selection_menu() {
58 set_msg("ENTER SELECTION OR INSERT COINS", WRAP_SCROLL);
61 void load_default_msg() {
62 /* FIXME: want this message to be changeable from the server */
63 set_msg("UNIVERSITY COMPUTER CLUB *** INSERT COINS OR USER-ID *** ",
68 while (door_open()) { /* don't quit until door is closed */
75 set_msg("UNIVERSITY", WRAP_NONE);
77 set_msg(" COMPUTER ", WRAP_NONE);
79 set_msg(" CLUB ", WRAP_NONE);
84 /* this needs to be a relatively tight loop to make sure we catch
85 * keypresses at the main menu
88 if (keypad_pressed()) {
89 if (last_key != KEY_RESET) {
90 if (uid_enter() && pin_enter()) {
91 /* authenticate them */
92 switch (server_authenticate(uid, pin)) {
97 set_msg(" BAD USER ", WRAP_NONE);
101 set_msg(" NO MONEY ", WRAP_NONE);
105 set_msg("YOUR ACCOUNT IS LOCKED", WRAP_SCROLL);
117 /* test door switch */
123 /* check on coin mech */
128 /* Initialize Stuff. Particularly some memory locations that can only be
129 * written in the first 64 clock cycles upon reset.
133 /* enable RTI & set rate */
139 chime(); /* turn chime on or of as need be */
141 /* scroll the display if need be too */
142 if (scroll_timer == 0) {
144 scroll_timer = SCROLL_TIME;