summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'console.c')
-rw-r--r--console.c71
1 files changed, 42 insertions, 29 deletions
diff --git a/console.c b/console.c
index 44ce875..8deca87 100644
--- a/console.c
+++ b/console.c
@@ -10,11 +10,9 @@ struct spinlock console_lock;
int panicked = 0;
int use_console_lock = 0;
-/*
- * copy console output to parallel port, which you can tell
- * .bochsrc to copy to the stdout:
- * parport1: enabled=1, file="/dev/stdout"
- */
+// Copy console output to parallel port, which you can tell
+// .bochsrc to copy to the stdout:
+// parport1: enabled=1, file="/dev/stdout"
static void
lpt_putc(int c)
{
@@ -97,9 +95,7 @@ printint(int xx, int base, int sgn)
cons_putc(buf[i]);
}
-/*
- * print to the console. only understands %d, %x, %p, %s.
- */
+// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
@@ -182,10 +178,10 @@ console_write(int minor, char *buf, int n)
}
-/* This is i8042reg.h + kbdreg.h from NetBSD. */
-#define KBSTATP 0x64 /* kbd controller status port(I) */
-#define KBS_DIB 0x01 /* kbd data in buffer */
-#define KBDATAP 0x60 /* kbd data port(I) */
+// This is i8042reg.h + kbdreg.h from NetBSD.
+#define KBSTATP 0x64 // kbd controller status port(I)
+#define KBS_DIB 0x01 // kbd data in buffer
+#define KBDATAP 0x60 // kbd data port(I)
#define NO 0
@@ -241,12 +237,18 @@ static uchar normalmap[256] =
NO, NO, NO, NO, NO, NO, NO, '7', // 0x40
'8', '9', '-', '4', '5', '6', '+', '1',
'2', '3', '0', '.', NO, NO, NO, NO, // 0x50
- [0x97] KEY_HOME, [0x9C] '\n' /*KP_Enter*/,
- [0xB5] '/' /*KP_Div*/, [0xC8] KEY_UP,
- [0xC9] KEY_PGUP, [0xCB] KEY_LF,
- [0xCD] KEY_RT, [0xCF] KEY_END,
- [0xD0] KEY_DN, [0xD1] KEY_PGDN,
- [0xD2] KEY_INS, [0xD3] KEY_DEL
+ [0x97] KEY_HOME,
+ [0x9C] '\n', // KP_Enter
+ [0xB5] '/', // KP_Div
+ [0xC8] KEY_UP,
+ [0xC9] KEY_PGUP,
+ [0xCB] KEY_LF,
+ [0xCD] KEY_RT,
+ [0xCF] KEY_END,
+ [0xD0] KEY_DN,
+ [0xD1] KEY_PGDN,
+ [0xD2] KEY_INS,
+ [0xD3] KEY_DEL
};
static uchar shiftmap[256] =
@@ -262,12 +264,18 @@ static uchar shiftmap[256] =
NO, NO, NO, NO, NO, NO, NO, '7', // 0x40
'8', '9', '-', '4', '5', '6', '+', '1',
'2', '3', '0', '.', NO, NO, NO, NO, // 0x50
- [0x97] KEY_HOME, [0x9C] '\n' /*KP_Enter*/,
- [0xB5] '/' /*KP_Div*/, [0xC8] KEY_UP,
- [0xC9] KEY_PGUP, [0xCB] KEY_LF,
- [0xCD] KEY_RT, [0xCF] KEY_END,
- [0xD0] KEY_DN, [0xD1] KEY_PGDN,
- [0xD2] KEY_INS, [0xD3] KEY_DEL
+ [0x97] KEY_HOME,
+ [0x9C] '\n', // KP_Enter
+ [0xB5] '/', // KP_Div
+ [0xC8] KEY_UP,
+ [0xC9] KEY_PGUP,
+ [0xCB] KEY_LF,
+ [0xCD] KEY_RT,
+ [0xCF] KEY_END,
+ [0xD0] KEY_DN,
+ [0xD1] KEY_PGDN,
+ [0xD2] KEY_INS,
+ [0xD3] KEY_DEL
};
#define C(x) (x - '@')
@@ -282,11 +290,16 @@ static uchar ctlmap[256] =
NO, NO, NO, C('\\'), C('Z'), C('X'), C('C'), C('V'),
C('B'), C('N'), C('M'), NO, NO, C('/'), NO, NO,
[0x97] KEY_HOME,
- [0xB5] C('/'), [0xC8] KEY_UP,
- [0xC9] KEY_PGUP, [0xCB] KEY_LF,
- [0xCD] KEY_RT, [0xCF] KEY_END,
- [0xD0] KEY_DN, [0xD1] KEY_PGDN,
- [0xD2] KEY_INS, [0xD3] KEY_DEL
+ [0xB5] C('/'), // KP_Div
+ [0xC8] KEY_UP,
+ [0xC9] KEY_PGUP,
+ [0xCB] KEY_LF,
+ [0xCD] KEY_RT,
+ [0xCF] KEY_END,
+ [0xD0] KEY_DN,
+ [0xD1] KEY_PGDN,
+ [0xD2] KEY_INS,
+ [0xD3] KEY_DEL
};
static uchar *charcode[4] = {