void keyboard_irq() { uint16_t key = 0x0000; uint8_t sc = inb(0x60); if (sc == 0xe0) { key = 0xe000; while (sc == 0xe0) sc = inb(0x60); } key += sc; switch (key) { case KEY_LEFT: keystate |= 0x01; break; case KEY_LEFT+RELEASE: keystate &= 0xfe; break; case KEY_RIGHT: keystate |= 0x02; break; case KEY_RIGHT+RELEASE: keystate &= 0xfd; break; case KEY_UP: keystate |= 0x04; break; case KEY_UP+RELEASE: keystate &= 0xfb; break; case KEY_DOWN: keystate |= 0x08; break; case KEY_DOWN+RELEASE: keystate &= 0xf7; break; } keyboard_callback(key); }
int ns_keyboard_callback(int ch) { switch (ch) { case 'a': aflag = !aflag; gotsig_alarm = 1; break; case 'n': nflag = !nflag; gotsig_alarm = 1; break; case 'r': aflag = 0; nflag = 1; protos = TCP|UDP; gotsig_alarm = 1; break; case 't': protos ^= TCP; gotsig_alarm = 1; break; case 'u': protos ^= UDP; gotsig_alarm = 1; break; default: return keyboard_callback(ch); }; return 1; }
void figure_t_t::keyboard(unsigned char key, int x, int y) { switch(key) { case 'q': glutDestroyWindow(window_number); break; case 'p': print(); break; } if(keyboard_callback) keyboard_callback(key, x, y); }
/* Menu callback */ GLvoid selectMenuOption(GLint idCommand) { if ( (GLUT_KEY_UP+128==idCommand) || (GLUT_KEY_LEFT+128==idCommand) || (GLUT_KEY_DOWN+128==idCommand) || (GLUT_KEY_RIGHT+128==idCommand) || (GLUT_KEY_PAGE_DOWN+128==idCommand) || (GLUT_KEY_PAGE_UP+128==idCommand)) { special_keyboard(idCommand-128, 0, 0); } else { keyboard_callback(idCommand, 0, 0); } }
void poly88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_USART: poly88_usart_timer_callback(ptr, param); break; case TIMER_KEYBOARD: keyboard_callback(ptr, param); break; case TIMER_CASSETTE: poly88_cassette_timer_callback(ptr, param); break; default: assert_always(FALSE, "Unknown id in poly88_state::device_timer"); } }
void read_keypresses_from_standard_input_callback() { while (true) { // skip whitespace (except actual spaces, they are legal input) while (isspace(cin.peek()) && cin.peek() != ' ') cin.ignore(); char keypress; cin.get(keypress); // if there was a problem (such as reaching EOF) stop if (!cin.good()) break; switch(keypress) { case 6: // ^F event_manager->execute_handlers(Window::F1); break; case 1: // ^A event_manager->execute_handlers(Window::UPARROW); break; case 2: // ^B event_manager->execute_handlers(Window::DOWNARROW); break; case 4: // ^D event_manager->execute_handlers(Window::LEFTARROW); break; case 3: // ^C event_manager->execute_handlers(Window::RIGHTARROW); break; default: keyboard_callback(keypress, 0, 0); } draw_callback(); } // only call this function the first time we are idle // it is assumed that all the commands will have been read by now glutIdleFunc(0); }
int if_keyboard_callback(int ch) { struct ifstat *ifs; switch (ch) { case 'r': for (ifs = ifstats; ifs < ifstats + nifs; ifs++) ifs->ifs_old = ifs->ifs_now; state = RUN; gotsig_alarm = 1; break; case 'b': state = BOOT; for (ifs = ifstats; ifs < ifstats + nifs; ifs++) bzero(&ifs->ifs_old, sizeof(ifs->ifs_old)); gotsig_alarm = 1; break; case 'B': show_bits = !show_bits; if (show_bits) { FLD_IF_IBYTES->title = "IBITS"; FLD_IF_OBYTES->title = "OBITS"; } else { FLD_IF_IBYTES->title = "IBYTES"; FLD_IF_OBYTES->title = "OBYTES"; } gotsig_alarm = 1; break; case 't': state = TIME; gotsig_alarm = 1; break; default: return keyboard_callback(ch); }; return 1; }
int vm_keyboard_callback(int ch) { switch(ch) { case 'r': copyinfo(&s2, &s1); state = RUN; break; case 'b': state = BOOT; copyinfo(&z, &s1); break; case 't': state = TIME; break; case 'z': if (state == RUN) getinfo(&s1); break; } return (keyboard_callback(ch)); }