historical/gems-kernel.git/source/diamondfs.h
2024-01-16 11:20:27 -06:00

31 lines
553 B
C

//create ram filesystem for while system is in use
char ramFileNames[9999999];
char ramFileContents[9999999];
int ramFileSizeInChars[99999999];
int makeFile(char name) {
int i = 0;
while (ramFileNames[i]) {
i++;
}
ramFileNames[i] = name;
ramFileContents[i] = 0;
ramFileSizeInChars[i] = 0;
return i;
}
char fileContents(char name) {
int i = 0;
while (ramFileNames[i] != name) {
i++;
}
return ramFileContents[i];
}
addToFile(char name, char data) {
int i = 0;
while (ramFileNames[i] != name) {
i++;
}
ramFileContents[i] += data;
}