wip stuff
This commit is contained in:
parent
82f80e711e
commit
c5c7eeae1e
|
@ -3,7 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void __assert_fail(const char *__assertion, const char *__file, unsigned int __line, const char *__function) {
|
||||
void __assert_fail(const char * __assertion, const char * __file, unsigned int __line, const char * __function) {
|
||||
clrscr();
|
||||
gotoxy(0, 0);
|
||||
puts("Assertion failed");
|
||||
|
@ -22,4 +22,3 @@ void __assert_fail(const char *__assertion, const char *__file, unsigned int __l
|
|||
getchar();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
__at (0x844B) unsigned char curRow;
|
||||
__at (0x844C) unsigned char curCol;
|
||||
__at(0x844B) unsigned char curRow;
|
||||
__at(0x844C) unsigned char curCol;
|
||||
|
||||
void gotoxy(int x, int y) {
|
||||
curRow = y;
|
||||
curCol = x;
|
||||
}
|
||||
|
||||
|
|
9
lib83/memcpy.c
Normal file
9
lib83/memcpy.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
void * memcpy(void * dest, const void * src, size_t n) {
|
||||
char * d = dest;
|
||||
const char * s = src;
|
||||
while (n--) *d++ = *s++;
|
||||
return dest;
|
||||
}
|
24
lib83/memmove.c
Normal file
24
lib83/memmove.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
void * memmove(void * dst, void * src, size_t acount) {
|
||||
void * ret = dst;
|
||||
char * d;
|
||||
char * s;
|
||||
|
||||
if (((int)src < (int)dst) && ((((int)src) + acount) > (int)dst)) {
|
||||
d = ((char *)dst) + acount - 1;
|
||||
s = ((char *)src) + acount - 1;
|
||||
while (acount--) {
|
||||
*d-- = *s--;
|
||||
}
|
||||
} else {
|
||||
d = dst;
|
||||
s = src;
|
||||
while (acount--) {
|
||||
*d++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
|
@ -12,7 +12,5 @@ void put_int(int i) {
|
|||
buf[j++] = i % 10 + '0';
|
||||
i /= 10;
|
||||
} while (i > 0);
|
||||
while (j > 0)
|
||||
putchar(buf[--j]);
|
||||
while (j > 0) putchar(buf[--j]);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void puts(const char * s) {
|
||||
while(*s) {
|
||||
while (*s) {
|
||||
putchar(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,18 @@
|
|||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||
extern void *memset(void *s, int 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);
|
||||
|
||||
extern char *strcpy(char *dest, const char *src);
|
||||
extern char *strncpy(char *dest, const char *src, size_t n);
|
||||
extern size_t strlen(const char *s);
|
||||
extern int strcmp(const char *s1, const char *s2);
|
||||
extern int strncmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user