ansicon, vesacon: beep on ^G
authorH. Peter Anvin <hpa@zytor.com>
Wed, 10 Sep 2008 00:08:14 +0000 (17:08 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 10 Sep 2008 00:08:14 +0000 (17:08 -0700)
If we get a ^G, issue a beep.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/lib/sys/ansi.c
com32/lib/sys/ansi.h
com32/lib/sys/ansicon_write.c
com32/lib/sys/vesacon_write.c

index 29a069f..590b1b4 100644 (file)
@@ -83,6 +83,9 @@ void __ansi_putchar(const struct term_info *ti, uint8_t ch)
       st->state = st_tbl;
       st->parms[0] = ch;
       break;
+    case '\a':
+      op->beep();
+      break;
     case '\b':
       if ( xy.x > 0 ) xy.x--;
       break;
index 5ac008e..da06903 100644 (file)
@@ -47,6 +47,7 @@ struct ansi_ops {
   void (*showcursor)(const struct term_state *st);
   void (*scroll_up)(const struct term_state *st);
   void (*set_cursor)(int x, int y, int visible);
+  void (*beep)(void);
 };
 
 struct term_info {
@@ -58,5 +59,6 @@ struct term_info {
 
 void __ansi_init(const struct term_info *ti);
 void __ansi_putchar(const struct term_info *ti, uint8_t ch);
+void __ansicon_beep(void);
 
 #endif /* COM32_LIB_SYS_ANSI_H */
index e436966..711f8b5 100644 (file)
@@ -54,6 +54,7 @@ struct ansi_ops __ansicon_ops = {
   .showcursor   = ansicon_showcursor,
   .set_cursor   = ansicon_set_cursor,
   .scroll_up    = ansicon_scroll_up,
+  .beep         = __ansicon_beep,
 };
 
 static struct term_info ti =
@@ -237,6 +238,15 @@ ssize_t __ansicon_write(struct file_info *fp, const void *buf, size_t count)
   return n;
 }
 
+void __ansicon_beep(void)
+{
+  static com32sys_t ireg;
+  
+  ireg.eax.w[0] = 0x0e07;
+  ireg.ebx.b[1] = BIOS_PAGE;
+  __intcall(0x10, &ireg, NULL);
+}
+
 const struct output_dev dev_ansicon_w = {
   .dev_magic  = __DEV_MAGIC,
   .flags      = __DEV_TTY | __DEV_OUTPUT,
index bae5265..fda967c 100644 (file)
@@ -55,6 +55,7 @@ static struct ansi_ops op = {
   .showcursor   = vesacon_showcursor,
   .set_cursor   = __vesacon_set_cursor,        /* in drawtxt.c */
   .scroll_up    = vesacon_scroll_up,
+  .beep                = __ansicon_beep,
 };
 
 static struct term_info ti =