Index: kernel/arch/ppc32/src/drivers/cuda.c
===================================================================
--- kernel/arch/ppc32/src/drivers/cuda.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ kernel/arch/ppc32/src/drivers/cuda.c	(revision 4527fb5b9cd99ab3d0607e26e017b7ea0f92d227)
@@ -42,154 +42,111 @@
 #include <stdarg.h>
 #include <ddi/device.h>
+#include <string.h>
 
 #define CUDA_IRQ 10
-#define SPECIAL		'?'
-
-#define PACKET_ADB  0x00
-#define PACKET_CUDA 0x01
-
-#define CUDA_POWERDOWN	0x0a
-#define CUDA_RESET		0x11
-
-#define RS 0x200
-#define B (0 * RS)
-#define A (1 * RS)
-#define SR (10 * RS)
-#define ACR (11 * RS)
-
-#define SR_OUT 0x10
-#define TACK 0x10
-#define TIP 0x20
-
+
+#define PACKET_ADB   0x00
+#define PACKET_CUDA  0x01
+
+#define CUDA_POWERDOWN  0x0a
+#define CUDA_RESET      0x11
+
+#define RS   0x200
+#define B    (0 * RS)
+#define A    (1 * RS)
+#define SR   (10 * RS)
+#define ACR  (11 * RS)
+
+#define SR_OUT  0x10
+#define TACK    0x10
+#define TIP     0x20
+
+#define SCANCODES  128
 
 static volatile uint8_t *cuda = NULL;
-static irq_t cuda_irq;		/**< Cuda's IRQ. */
-
-static char lchars[0x80] = {
-	'a',
-	's',
-	'd',
-	'f',
-	'h',
-	'g',
-	'z',
-	'x',
-	'c',
-	'v', 
-	SPECIAL,
-	'b',
-	'q',
-	'w',
-	'e',
-	'r',
-	'y',
-	't',
-	'1',
-	'2',
-	'3',
-	'4',
-	'6',
-	'5',
-	'=',
-	'9',
-	'7',
-	'-',
-	'8',
-	'0',
-	']',
-	'o',
-	'u',
-	'[',
-	'i', 
-	'p',
-	'\n',    /* Enter */
-	'l',
-	'j',
-	'\'',
-	'k',
-	';',
-	'\\',
-	',',
-	'/',
-	'n',
-	'm',
-	'.',
-	'\t',    /* Tab */
-	' ',
-	'`',
-	'\b',    /* Backspace */
-	SPECIAL,
-	SPECIAL, /* Escape */
-	SPECIAL, /* Ctrl */
-	SPECIAL, /* Alt */
-	SPECIAL, /* Shift */
-	SPECIAL, /* Caps-Lock */
-	SPECIAL, /* RAlt */
-	SPECIAL, /* Left */
-	SPECIAL, /* Right */
-	SPECIAL, /* Down */
-	SPECIAL, /* Up */
-	SPECIAL, 
-	SPECIAL,
-	'.',     /* Keypad . */
-	SPECIAL, 
-	'*',     /* Keypad * */
-	SPECIAL,
-	'+',     /* Keypad + */
-	SPECIAL,
-	SPECIAL, /* NumLock */
-	SPECIAL,
-	SPECIAL,
-	SPECIAL,
-	'/',     /* Keypad / */
-	'\n',    /* Keypad Enter */
-	SPECIAL,
-	'-',     /* Keypad - */
-	SPECIAL,
-	SPECIAL,
-	SPECIAL,
-	'0',     /* Keypad 0 */
-	'1',     /* Keypad 1 */
-	'2',     /* Keypad 2 */
-	'3',     /* Keypad 3 */
-	'4',     /* Keypad 4 */
-	'5',     /* Keypad 5 */
-	'6',     /* Keypad 6 */
-	'7',     /* Keypad 7 */
-	SPECIAL,
-	'8',     /* Keypad 8 */
-	'9',     /* Keypad 9 */
-	SPECIAL,
-	SPECIAL,
-	SPECIAL,
-	SPECIAL, /* F5 */
-	SPECIAL, /* F6 */
-	SPECIAL, /* F7 */
-	SPECIAL, /* F3 */
-	SPECIAL, /* F8 */
-	SPECIAL, /* F9 */
-	SPECIAL,
-	SPECIAL, /* F11 */
-	SPECIAL,
-	SPECIAL, /* F13 */
-	SPECIAL,
-	SPECIAL, /* ScrollLock */
-	SPECIAL,
-	SPECIAL, /* F10 */
-	SPECIAL,
-	SPECIAL, /* F12 */
-	SPECIAL,
-	SPECIAL, /* Pause */
-	SPECIAL, /* Insert */
-	SPECIAL, /* Home */
-	SPECIAL, /* PageUp */
-	SPECIAL, /* Delete */
-	SPECIAL, /* F4 */
-	SPECIAL, /* End */
-	SPECIAL, /* F2 */
-	SPECIAL, /* PageDown */
-	SPECIAL  /* F1 */
+static irq_t cuda_irq;                 /**< Cuda's IRQ. */
+
+static wchar_t lchars[SCANCODES] = {
+	'a', 's', 'd', 'f', 'h', 'g', 'z', 'x', 'c', 'v',
+	U_SPECIAL,
+	'b', 'q', 'w', 'e', 'r', 'y', 't', '1', '2', '3', '4', '6', '5',
+	'=', '9', '7', '-', '8', '0', ']', 'o', 'u', '[', 'i', 'p',
+	'\n',           /* Enter */
+	'l', 'j', '\'', 'k', ';', '\\', ',', '/', 'n', 'm', '.',
+	'\t',           /* Tab */
+	' ', '`',
+	'\b',           /* Backspace */
+	U_SPECIAL,
+	U_ESCAPE,       /* Escape */
+	U_SPECIAL,      /* Ctrl */
+	U_SPECIAL,      /* Alt */
+	U_SPECIAL,      /* Shift */
+	U_SPECIAL,      /* CapsLock */
+	U_SPECIAL,      /* Right Alt */
+	U_LEFT_ARROW,   /* Left */
+	U_RIGHT_ARROW,  /* Right */
+	U_DOWN_ARROW,   /* Down */
+	U_UP_ARROW,     /* Up */
+	U_SPECIAL,
+	U_SPECIAL,
+	'.',            /* Keypad . */
+	U_SPECIAL,
+	'*',            /* Keypad * */
+	U_SPECIAL,
+	'+',            /* Keypad + */
+	U_SPECIAL,
+	U_SPECIAL,      /* NumLock */
+	U_SPECIAL,
+	U_SPECIAL,
+	U_SPECIAL,
+	'/',            /* Keypad / */
+	'\n',           /* Keypad Enter */
+	U_SPECIAL,
+	'-',            /* Keypad - */
+	U_SPECIAL,
+	U_SPECIAL,
+	U_SPECIAL,
+	'0',            /* Keypad 0 */
+	'1',            /* Keypad 1 */
+	'2',            /* Keypad 2 */
+	'3',            /* Keypad 3 */
+	'4',            /* Keypad 4 */
+	'5',            /* Keypad 5 */
+	'6',            /* Keypad 6 */
+	'7',            /* Keypad 7 */
+	U_SPECIAL,
+	'8',            /* Keypad 8 */
+	'9',            /* Keypad 9 */
+	U_SPECIAL,
+	U_SPECIAL,
+	U_SPECIAL,
+	U_SPECIAL,      /* F5 */
+	U_SPECIAL,      /* F6 */
+	U_SPECIAL,      /* F7 */
+	U_SPECIAL,      /* F3 */
+	U_SPECIAL,      /* F8 */
+	U_SPECIAL,      /* F9 */
+	U_SPECIAL,
+	U_SPECIAL,      /* F11 */
+	U_SPECIAL,
+	U_SPECIAL,      /* F13 */
+	U_SPECIAL,
+	U_SPECIAL,      /* ScrollLock */
+	U_SPECIAL,
+	U_SPECIAL,      /* F10 */
+	U_SPECIAL,
+	U_SPECIAL,      /* F12 */
+	U_SPECIAL,
+	U_SPECIAL,      /* Pause */
+	U_SPECIAL,      /* Insert */
+	U_HOME_ARROW,   /* Home */
+	U_PAGE_UP,      /* Page Up */
+	U_DELETE,       /* Delete */
+	U_SPECIAL,      /* F4 */
+	U_END_ARROW,    /* End */
+	U_SPECIAL,      /* F2 */
+	U_PAGE_DOWN,    /* Page Down */
+	U_SPECIAL       /* F1 */
 };
-
 
 static void receive_packet(uint8_t *kind, index_t count, uint8_t data[])
@@ -204,5 +161,4 @@
 	cuda[B] = cuda[B] | TIP;
 }
-
 
 static indev_t kbrd;
@@ -210,5 +166,4 @@
 	.poll = NULL
 };
-
 
 int cuda_get_scancode(void)
@@ -264,5 +219,4 @@
 }
 
-
 static void send_packet(const uint8_t kind, count_t count, ...)
 {
@@ -288,5 +242,4 @@
 }
 
-
 void cpu_halt(void) {
 	asm volatile (
