Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdint.h>
- extern void serial_outs();
- extern void write_serial();
- extern void terminal_putchar();
- static inline uint8_t inb(uint16_t port)
- {
- uint8_t ret;
- asm volatile ( "inb %1, %0"
- : "=a"(ret)
- : "Nd"(port) );
- return ret;
- }
- int kbufn = 0;
- char kbuff[100];
- char key;
- unsigned char kbdus[128] =
- {
- 0,0,'1','2','3','4','5','6','7','8','9','0','-','=','\b','\t','q','w','e','r','t','y','u','i','o','p','[',']','\n',0,'a','s','d','f','g','h','j','k','l',';','\'','`',0,'\\','z','x','c','v','b','n','m',',','.','/',0,'*',
- };
- void keyboard_handler(struct regs *r)
- {
- unsigned char scancode;
- scancode = inb(0x60);
- key = kbdus[scancode];
- if (scancode & 0x80)
- {
- }
- else
- {
- kbuff[kbufn] = key;
- }
- terminal_putchar(key);
- write_serial(key);
- write_serial(kbuff[kbufn]);
- kbufn++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement