Compare commits

...

1 Commits

Author SHA1 Message Date
Yourtion
9096191855 添加FIFO缓冲中断信息 2014-09-17 15:17:16 +08:00
3 changed files with 12 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ void HariMain(void)
{
struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO;
char s[40], mcursor[256];
int mx, my, i;
int mx, my, i, j;
init_gdtidt();
init_pic();
@@ -29,11 +29,14 @@ void HariMain(void)
for (;;) {
io_cli();
if (keybuf.flag == 0) {
if (keybuf.next == 0) {
io_stihlt();
} else {
i = keybuf.data;
keybuf.flag = 0;
i = keybuf.data[0];
keybuf.next--;
for (j = 0; j < keybuf.next; j++) {
keybuf.data[j] = keybuf.data[j + 1];
}
io_sti();
sprintf(s, "%02X", i);
boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 16, 15, 31);

View File

@@ -75,7 +75,8 @@ void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar);
/* int.c */
struct KEYBUF {
unsigned char data, flag;
unsigned char data[32];
int next;
};
void init_pic(void);
void inthandler21(int *esp);

View File

@@ -35,9 +35,9 @@ void inthandler21(int *esp)
unsigned char data, s[4];
io_out8(PIC0_OCW2, 0x61); /* 通知PIC IRQ-01 已经受理完毕 */
data = io_in8(PORT_KEYDAT);
if (keybuf.flag == 0) {
keybuf.data = data;
keybuf.flag = 1;
if (keybuf.next < 32) {
keybuf.data[keybuf.next] = data;
keybuf.next++;
}
return;
}