Пример #1
0
Файл: 1.c Проект: TySag/project
static void interrupt_handler(struct trapframe *tf)
{
  extern clock_int_handler(void*);
  extern serial_int_handler(void*);
  extern keyboard_int_handler();
  int i;
  for(i=0;i<8;i++){
    if(tf->tf_cause & (1<<(CAUSEB_IP+i))){
      switch(i){
        case TIMER0_IRQ:
          clock_int_handler(NULL);
          break;
        case COM1_IRQ:
          //kprintf("COM1_IRQ!\n");
          serial_int_handler(NULL);
          break;
        case KEYBOARD_IRQ:
          //kprintf("KEYBOARD\n");
          keyboard_int_handler();
          break;
        default:
          print_trapframe(tf);
          panic("Unknown interrupt!");
      }
    }
  }

}
Пример #2
0
int game() {

	int menu = 0;

	load_cards();
	load_menu();

	if ((irq_set = keyboard_subscribe_int()) == 1) {
		vg_exit();
		return 1;
	}

	while (menu == 0) {
		if (keyboard_int_handler(irq_set) == 0) {
			if (scancode == 0x82) {
				menu = 1;
				vg_fill(0xff);
				vg_draw("/usr/src/drivers/proj/images/image_nivel3.mg", 64, 167,
						428, 36);
				vg_draw_all(&d1, 134, 180);
				vg_draw("/usr/src/drivers/proj/images/image_selected.mg",
						d1.cards[0]->height, d1.cards[0]->width, d1.posx[0],
						d1.posy[0]);
			} else {
				if (scancode == 0x83) {
					vg_exit();
					return 0;
				}
			}
		}
	}

	while (game_over == 0) {
		if (keyboard_int_handler(irq_set) == 0) {
			game_handling(&d1);
		}
	}

	if (keyboard_unsubscribe_int() != 0) {
		return 1;
	}

	sleep(5);
	vg_exit();
	return 0;
}