]>
Commit | Line | Data |
---|---|---|
9b8c947b JW |
1 | #include "console.h" |
2 | ||
3 | void memcpy(unsigned char *a2, unsigned char *a1, int bytes) | |
4 | { | |
5 | while (bytes--) | |
6 | *(a2++) = *(a1++); | |
7 | } | |
8 | ||
9 | void memmove(unsigned char *dest, unsigned char *src, int bytes) | |
10 | { | |
11 | if ((dest > src) && (dest <= (src + bytes))) | |
12 | { | |
13 | /* do it backwards! */ | |
14 | dest += bytes; | |
15 | src += bytes; | |
16 | while (bytes--) | |
17 | *(--dest) = *(--src); | |
18 | } else | |
19 | while (bytes--) | |
20 | *(dest++) = *(src++); | |
21 | } | |
22 | ||
d56898ee | 23 | int memcmp (unsigned char *a2, unsigned char *a1, int bytes) { |
24 | while (bytes--) | |
25 | { | |
26 | if (*(a2++) != *(a1++)) | |
27 | return 1; | |
28 | } | |
29 | return 0; | |
30 | } | |
31 | ||
32 | int strcmp (unsigned char *a2, unsigned char *a1) { | |
33 | while (1) { | |
34 | if (*a2 != *a1) return 1; | |
35 | if (*a2 == 0) return 0; | |
36 | a1++; | |
37 | a2++; | |
38 | } | |
39 | } | |
40 | ||
9b8c947b JW |
41 | int strlen(char *c) |
42 | { | |
43 | int l = 0; | |
44 | while (*(c++)) | |
45 | l++; | |
46 | return l; | |
47 | } | |
48 | ||
49 | void puts(char *c) | |
50 | { | |
51 | putbytes(c, strlen(c)); | |
52 | } | |
53 | ||
54 | static char hexarr[] = "0123456789ABCDEF"; | |
55 | void puthex(unsigned long l) | |
56 | { | |
57 | int i; | |
58 | for (i = 0; i < 8; i++) | |
59 | { | |
60 | putbyte(hexarr[l >> 28]); | |
61 | l <<= 4; | |
62 | } | |
63 | } |