core/hello.c: better demo on how to do putchar()
authorH. Peter Anvin <hpa@zytor.com>
Wed, 3 Jun 2009 02:56:27 +0000 (19:56 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 3 Jun 2009 02:56:27 +0000 (19:56 -0700)
Better illustrate how putchar() should be implemented...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/hello.c

index eb0069f..a4fff7a 100644 (file)
@@ -4,13 +4,13 @@
 void myputchar(int c)
 {
     static com32sys_t ireg;
-    static uint16_t *vram = 0xb8000;
+
+    if (c == '\n')
+       myputchar('\r');
 
     ireg.eax.b[1] = 0x02;
     ireg.edx.b[0] = c;
     __intcall(0x21, &ireg, NULL);
-
-    *vram++ = c + 0x1f00;
 }
 
 void myputs(const char *str)
@@ -21,7 +21,7 @@ void myputs(const char *str)
 
 void hello(void)
 {
-    static char hello_str[] = "Hello, World!  (hello.c)\r\n";
+    static char hello_str[] = "Hello, World!  (hello.c)\n";
 
     myputs(hello_str);
 }