1 #include <stddef.h> 2 #include <com32.h> 3 #include <stdio.h> 4 #include <string.h> 5 6 #include "core.h" 7 8 #include <console.h> 9 10 void myputchar(int c) 11 { 12 if (c == '\n') 13 myputchar('\r'); 14 15 writechr(c); 16 } 17 18 void myputs(const char *str) 19 { 20 while (*str) 21 myputchar(*str++); 22 } 23 24 void hello(void) 25 { 26 static char hello_str[] = "Hello, World!"; 27 28 printf("%s from (%s)\n", hello_str, __FILE__); /* testing */ 29 } 30 31 void hexdump(void *buf, int bytelen, const char *str) 32 { 33 unsigned int *p32, i; 34 35 if (str) 36 printf("Dump %s:\n", str); 37 38 p32 = (unsigned int *)buf; 39 for (i = 0; i < (bytelen / 4); i++){ 40 printf(" 0x%08x ", p32[i]); 41 } 42 printf("\n\n"); 43 } 44 45 static inline void myprint(int num) 46 { 47 uint32_t i; 48 49 for (i = 0; i < 5; i ++) 50 printf("%d", num); 51 printf("\n"); 52 } 53 54 void mp1(void) 55 { 56 myprint(1); 57 } 58 59 void mp2(void) 60 { 61 myprint(2); 62 } 63 64 void mp3(void) 65 { 66 myprint(3); 67 } 68 69 void mp4(void) 70 { 71 myprint(4); 72 } 73 74 void mp5(void) 75 { 76 myprint(5); 77 } 78 79