Merged FAT16 into Dev

Hopefully with success
This commit is contained in:
2023-02-03 21:47:05 +01:00
67 changed files with 2402 additions and 288 deletions

30
source/lib/include/mem.h Normal file
View File

@ -0,0 +1,30 @@
#pragma once
// NOTE: These should not be inline
inline void* memset (void* ptr, int value, size_t num){
for( int i = 0; i < num; i++ )
{
unsigned char* data = (unsigned char*)ptr+ i;
*data = (unsigned char)value;
}
return ptr;
}
inline int memcmp( const void* ptr1, const void* ptr2, size_t num)
{
const unsigned char * cs = (const unsigned char*) ptr1;
const unsigned char * ct = (const unsigned char*) ptr2;
for (int i = 0 ; i < num ; i++, cs++, ct++ ){
if( *cs < *ct){
return -1;
} else if( *cs > *ct){
return 1;
}
}
return 0;
}

View File

@ -0,0 +1,26 @@
#include "string.h"
size_t strlen(const char* str) {
size_t len = 0;
while(str[len]){
len++;
}
return len;
}
int strncmp ( const char* str1, const char* str2, size_t num ){
for( int i = 0; i < num ; i++){
if( str1[i] < str2[i]){
return -1;
}
if( str1[i] > str2[i] ){
return 1;
}
}
return 0;
}

View File

@ -0,0 +1,4 @@
#pragma once
#include <stddef.h>
size_t strlen(const char* str);
int strncmp ( const char* str1, const char* str2, size_t num );