| plan 9 kernel history: overview | file list | diff list |
1991/0629/pc/main.c (diff list | history)
| 1991/0625/sys/src/9/pc/main.c:1,15 – 1991/0629/sys/src/9/pc/main.c:1,56 (short | long | prev | next) | ||
| 1991/0625 |
| |
| 1991/0629 | #include <u.h> #define WIDTH 80 #define HEIGHT 22 #define SCREEN ((char *)0xB8000) int pos; void prchar(int x) | |
| 1991/0625 | { | |
| 1991/0629 | if(x == '\n'){ pos = pos/WIDTH; pos = (pos+1)*WIDTH; } else { SCREEN[pos++] = x; SCREEN[pos++] = 0x43; } if(pos >= WIDTH*HEIGHT) pos = 0; | |
| 1991/0625 | } | |
| 1991/0629 | void prstr(char *s) | |
| 1991/0625 | { | |
| 1991/0629 | while(*s) prchar(*s++); | |
| 1991/0625 | } | |
| 1991/0629 | void prdig(ulong x) | |
| 1991/0625 | { | |
| 1991/0629 | if(x < 0xA) prchar('0' + x); else prchar('A' + x); | |
| 1991/0625 | } | |
| 1991/0629 | void prhex(ulong x) | |
| 1991/0625 | { | |
| 1991/0629 | ulong y; if(x <= 0xF){ prdig(x); } else { y = x&0xF; prhex(x>>4); prdig(y); } | |
| 1991/0625 | } | |
| 1991/0629 | main(void) { prstr("hello world\n"); } | |