From d19a7c6a6989f19c4f82212a9a7b654bdf289739 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 2 Jun 2009 19:56:27 -0700 Subject: [PATCH] core/hello.c: better demo on how to do putchar() Better illustrate how putchar() should be implemented... Signed-off-by: H. Peter Anvin --- core/hello.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/hello.c b/core/hello.c index eb0069f..a4fff7a 100644 --- a/core/hello.c +++ b/core/hello.c @@ -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); } -- 2.7.4