diff --git a/Makefile b/Makefile index 7a2e856..fba1954 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CC=sdcc CFLAGS=-Ilib83 -c -mz80 --std-sdcc2x --no-std-crt0 --reserve-regs-iy --opt-code-size OBJS=_crt0.rel clrscr.rel putchar.rel puts.rel exit.rel gotoxy.rel __assert_fail.rel \ - getchar.rel put_int.rel ctype.rel \ + getchar.rel put_int.rel ctype.rel memcpy.rel memset.rel memmove.rel \ main.rel .PHONY: all clean try diff --git a/lib83/memset.c b/lib83/memset.c new file mode 100644 index 0000000..133538f --- /dev/null +++ b/lib83/memset.c @@ -0,0 +1,12 @@ + +#include + +void * memset(void * buf, unsigned char ch, size_t count) { + unsigned char * ret = buf; + + while (count--) + *ret++ = ch; + + return buf; +} + diff --git a/lib83/string.h b/lib83/string.h index c14c339..0268d4c 100644 --- a/lib83/string.h +++ b/lib83/string.h @@ -5,7 +5,7 @@ #include extern void *memcpy(void *dest, const void *src, size_t n); -extern void *memset(void *s, int c, size_t n); +extern void *memset(void *s, unsigned char c, size_t n); extern void *memmove(void *dest, const void *src, size_t n); extern int memcmp(const void *s1, const void *s2, size_t n);