mirror of
https://github.com/BoredDevNL/BoredOS.git
synced 2026-05-15 10:48:38 +00:00
Updated word of god
This commit is contained in:
parent
cb2af7f06b
commit
d2e7808cfa
11 changed files with 103 additions and 30 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
brewos.iso
BIN
brewos.iso
Binary file not shown.
BIN
build/brewos.elf
BIN
build/brewos.elf
Binary file not shown.
Binary file not shown.
BIN
build/cmd.o
BIN
build/cmd.o
Binary file not shown.
BIN
build/fat32.o
BIN
build/fat32.o
Binary file not shown.
Binary file not shown.
|
|
@ -6,11 +6,11 @@
|
|||
#include "../cmd.h"
|
||||
|
||||
// --- Compiler Limits ---
|
||||
#define MAX_SOURCE 8192
|
||||
#define MAX_TOKENS 2048
|
||||
#define MAX_VARS 64
|
||||
#define CODE_SIZE 4096
|
||||
#define STR_POOL_SIZE 2048
|
||||
#define MAX_SOURCE 65536
|
||||
#define MAX_TOKENS 16384
|
||||
#define MAX_VARS 512
|
||||
#define CODE_SIZE 32768
|
||||
#define STR_POOL_SIZE 16384
|
||||
|
||||
static int compile_error = 0;
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ typedef struct {
|
|||
static Symbol symbols[MAX_VARS];
|
||||
static int symbol_count = 0;
|
||||
|
||||
static int next_var_addr = 4096;
|
||||
static int next_var_addr = 32768;
|
||||
|
||||
static int find_symbol(const char *name) {
|
||||
for (int i = 0; i < symbol_count; i++) {
|
||||
|
|
@ -629,19 +629,27 @@ void cli_cmd_cc(char *args) {
|
|||
return;
|
||||
}
|
||||
|
||||
char source[MAX_SOURCE];
|
||||
char *source = (char*)kmalloc(MAX_SOURCE);
|
||||
if (!source) {
|
||||
cmd_write("Error: Out of memory for source buffer.\n");
|
||||
fat32_close(fh);
|
||||
return;
|
||||
}
|
||||
|
||||
int len = fat32_read(fh, source, MAX_SOURCE - 1);
|
||||
source[len] = 0;
|
||||
fat32_close(fh);
|
||||
|
||||
lexer(source);
|
||||
kfree(source);
|
||||
|
||||
if (compile_error) return;
|
||||
|
||||
code_pos = 0;
|
||||
symbol_count = 0;
|
||||
cur_token = 0;
|
||||
str_pool_pos = 0;
|
||||
next_var_addr = 4096;
|
||||
next_var_addr = 32768;
|
||||
|
||||
const char* magic = VM_MAGIC;
|
||||
for(int i=0; i<7; i++) emit(magic[i]);
|
||||
|
|
|
|||
|
|
@ -431,9 +431,7 @@ static const CommandEntry commands[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
// --- Dispatcher ---
|
||||
|
||||
// Find pipe operator in command string (||)
|
||||
static const char* find_pipe(const char* cmd) {
|
||||
while (*cmd) {
|
||||
if (*cmd == '|' && *(cmd + 1) == '|') {
|
||||
|
|
@ -444,20 +442,23 @@ static const char* find_pipe(const char* cmd) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Execute a single command
|
||||
static void cmd_exec_single(char *cmd) {
|
||||
while (*cmd == ' ') cmd++;
|
||||
if (!*cmd) return;
|
||||
|
||||
// Check for file execution ./filename
|
||||
if (cmd[0] == '.' && cmd[1] == '/') {
|
||||
char *filename = cmd + 2;
|
||||
FAT32_FileHandle *fh = fat32_open(filename, "r");
|
||||
if (fh) {
|
||||
// It's a file, try to execute it
|
||||
// Limit executable size to 4KB for now
|
||||
uint8_t buffer[4096];
|
||||
int size = fat32_read(fh, buffer, 4096);
|
||||
|
||||
uint8_t *buffer = (uint8_t*)kmalloc(VM_MEMORY_SIZE);
|
||||
if (!buffer) {
|
||||
cmd_write("Error: Out of memory.\n");
|
||||
fat32_close(fh);
|
||||
return;
|
||||
}
|
||||
|
||||
int size = fat32_read(fh, buffer, VM_MEMORY_SIZE);
|
||||
fat32_close(fh);
|
||||
|
||||
if (size > 0) {
|
||||
|
|
@ -468,6 +469,7 @@ static void cmd_exec_single(char *cmd) {
|
|||
} else {
|
||||
cmd_write("Error: Empty file.\n");
|
||||
}
|
||||
kfree(buffer);
|
||||
} else {
|
||||
cmd_write("Error: Command not found or file does not exist.\n");
|
||||
}
|
||||
|
|
@ -1022,29 +1024,69 @@ static void create_test_files(void) {
|
|||
|
||||
fh = fat32_open("Apps/wordofgod.c", "w");
|
||||
if (fh) {
|
||||
char *h = "int main(){int l;l=malloc(400);";
|
||||
char *h = "int main(){int l;l=malloc(1200);";
|
||||
fat32_write(fh, h, cmd_strlen(h));
|
||||
char *w1 = "poke(l+0,\"In\");poke(l+4,\"the\");poke(l+8,\"beginning\");poke(l+12,\"God\");poke(l+16,\"created\");poke(l+20,\"heaven\");poke(l+24,\"and\");poke(l+28,\"earth\");poke(l+32,\"light\");poke(l+36,\"darkness\");";
|
||||
char *w1 = "poke(l+0,\"In \");poke(l+4,\"the \");poke(l+8,\"beginning \");poke(l+12,\"God \");poke(l+16,\"created \");poke(l+20,\"heaven \");poke(l+24,\"and \");poke(l+28,\"earth \");poke(l+32,\"light \");poke(l+36,\"darkness \");";
|
||||
fat32_write(fh, w1, cmd_strlen(w1));
|
||||
char *w2 = "poke(l+40,\"day\");poke(l+44,\"night\");poke(l+48,\"waters\");poke(l+52,\"firmament\");poke(l+56,\"evening\");poke(l+60,\"morning\");poke(l+64,\"land\");poke(l+68,\"seas\");poke(l+72,\"grass\");poke(l+76,\"herb\");";
|
||||
char *w2 = "poke(l+40,\"day \");poke(l+44,\"night \");poke(l+48,\"waters \");poke(l+52,\"firmament \");poke(l+56,\"evening \");poke(l+60,\"morning \");poke(l+64,\"land \");poke(l+68,\"seas \");poke(l+72,\"grass \");poke(l+76,\"herb \");";
|
||||
fat32_write(fh, w2, cmd_strlen(w2));
|
||||
char *w3 = "poke(l+80,\"seed\");poke(l+84,\"fruit\");poke(l+88,\"tree\");poke(l+92,\"sun\");poke(l+96,\"moon\");poke(l+100,\"stars\");poke(l+104,\"signs\");poke(l+108,\"seasons\");poke(l+112,\"days\");poke(l+116,\"years\");";
|
||||
char *w3 = "poke(l+80,\"seed \");poke(l+84,\"fruit \");poke(l+88,\"tree \");poke(l+92,\"sun \");poke(l+96,\"moon \");poke(l+100,\"stars \");poke(l+104,\"signs \");poke(l+108,\"seasons \");poke(l+112,\"days \");poke(l+116,\"years \");";
|
||||
fat32_write(fh, w3, cmd_strlen(w3));
|
||||
char *w4 = "poke(l+120,\"creature\");poke(l+124,\"life\");poke(l+128,\"fowl\");poke(l+132,\"whales\");poke(l+136,\"cattle\");poke(l+140,\"creeping\");poke(l+144,\"beast\");poke(l+148,\"man\");poke(l+152,\"image\");poke(l+156,\"likeness\");";
|
||||
char *w4 = "poke(l+120,\"creature \");poke(l+124,\"life \");poke(l+128,\"fowl \");poke(l+132,\"whales \");poke(l+136,\"cattle \");poke(l+140,\"creeping \");poke(l+144,\"beast \");poke(l+148,\"man \");poke(l+152,\"image \");poke(l+156,\"likeness \");";
|
||||
fat32_write(fh, w4, cmd_strlen(w4));
|
||||
char *w5 = "poke(l+160,\"dominion\");poke(l+164,\"fish\");poke(l+168,\"air\");poke(l+172,\"every\");poke(l+176,\"green\");poke(l+180,\"meat\");poke(l+184,\"holy\");poke(l+188,\"rest\");poke(l+192,\"dust\");poke(l+196,\"breath\");";
|
||||
char *w5 = "poke(l+160,\"dominion \");poke(l+164,\"fish \");poke(l+168,\"air \");poke(l+172,\"every \");poke(l+176,\"CIA \");poke(l+180,\"meat \");poke(l+184,\"holy \");poke(l+188,\"rest \");poke(l+192,\"dust \");poke(l+196,\"breath \");";
|
||||
fat32_write(fh, w5, cmd_strlen(w5));
|
||||
char *w6 = "poke(l+200,\"soul\");poke(l+204,\"garden\");poke(l+208,\"east\");poke(l+212,\"Eden\");poke(l+216,\"ground\");poke(l+220,\"sight\");poke(l+224,\"good\");poke(l+228,\"evil\");poke(l+232,\"river\");poke(l+236,\"gold\");";
|
||||
char *w6 = "poke(l+200,\"soul \");poke(l+204,\"garden \");poke(l+208,\"east \");poke(l+212,\"Eden \");poke(l+216,\"ground \");poke(l+220,\"sight \");poke(l+224,\"good \");poke(l+228,\"evil \");poke(l+232,\"river \");poke(l+236,\"gold \");";
|
||||
fat32_write(fh, w6, cmd_strlen(w6));
|
||||
char *w7 = "poke(l+240,\"stone\");poke(l+244,\"woman\");poke(l+248,\"wife\");poke(l+252,\"flesh\");poke(l+256,\"bone\");poke(l+260,\"naked\");poke(l+264,\"serpent\");poke(l+268,\"subtle\");poke(l+272,\"eat\");poke(l+276,\"eyes\");";
|
||||
char *w7 = "poke(l+240,\"stone \");poke(l+244,\"woman \");poke(l+248,\"wife \");poke(l+252,\"flesh \");poke(l+256,\"bone \");poke(l+260,\"naked \");poke(l+264,\"serpent \");poke(l+268,\"subtle \");poke(l+272,\"eat \");poke(l+276,\"eyes \");";
|
||||
fat32_write(fh, w7, cmd_strlen(w7));
|
||||
char *w8 = "poke(l+280,\"wise\");poke(l+284,\"cool\");poke(l+288,\"voice\");poke(l+292,\"fear\");poke(l+296,\"hid\");poke(l+300,\"cursed\");poke(l+304,\"belly\");poke(l+308,\"enmity\");poke(l+312,\"sorrow\");poke(l+316,\"conception\");";
|
||||
char *w8 = "poke(l+280,\"wise \");poke(l+284,\"cool \");poke(l+288,\"voice \");poke(l+292,\"fear \");poke(l+296,\"hid \");poke(l+300,\"cursed \");poke(l+304,\"belly \");poke(l+308,\"enmity \");poke(l+312,\"sorrow \");poke(l+316,\"conception \");";
|
||||
fat32_write(fh, w8, cmd_strlen(w8));
|
||||
char *w9 = "poke(l+320,\"children\");poke(l+324,\"desire\");poke(l+328,\"husband\");poke(l+332,\"thorns\");poke(l+336,\"thistles\");poke(l+340,\"sweat\");poke(l+344,\"bread\");poke(l+348,\"mother\");poke(l+352,\"skin\");poke(l+356,\"coats\");";
|
||||
char *w9 = "poke(l+320,\"children \");poke(l+324,\"desire \");poke(l+328,\"husband \");poke(l+332,\"thorns \");poke(l+336,\"thistles \");poke(l+340,\"sweat \");poke(l+344,\"bread \");poke(l+348,\"mother \");poke(l+352,\"skin \");poke(l+356,\"coats \");";
|
||||
fat32_write(fh, w9, cmd_strlen(w9));
|
||||
char *w10 = "poke(l+360,\"cherubims\");poke(l+364,\"sword\");poke(l+368,\"gate\");poke(l+372,\"offering\");poke(l+376,\"respect\");poke(l+380,\"sin\");poke(l+384,\"door\");poke(l+388,\"blood\");poke(l+392,\"brother\");poke(l+396,\"keeper\");";
|
||||
char *w10 = "poke(l+360,\"cherubims \");poke(l+364,\"sword \");poke(l+368,\"gate \");poke(l+372,\"offering \");poke(l+376,\"respect \");poke(l+380,\"sin \");poke(l+384,\"door \");poke(l+388,\"blood \");poke(l+392,\"brother \");poke(l+396,\"keeper \");";
|
||||
fat32_write(fh, w10, cmd_strlen(w10));
|
||||
char *e = "int c;int r;r=rand();r=r-(r/3)*3;c=5+r;int i;i=0;while(i<c){int x;x=rand();x=x-(x/100)*100;int w;w=peek(l+x*4);print_str(w);print_str(\" \");i=i+1;}print_str(\"\\n\");}";
|
||||
char *w11 = "poke(l+400,\"voice \");poke(l+404,\"heard \");poke(l+408,\"walking \");poke(l+412,\"cool \");poke(l+416,\"day \");poke(l+420,\"where \");poke(l+424,\"art \");poke(l+428,\"thou \");poke(l+432,\"told \");poke(l+436,\"thee \");";
|
||||
fat32_write(fh, w11, cmd_strlen(w11));
|
||||
char *w12 = "poke(l+440,\"hast \");poke(l+444,\"eaten \");poke(l+448,\"tree \");poke(l+452,\"whereof \");poke(l+456,\"commanded \");poke(l+460,\"shouldest \");poke(l+464,\"not \");poke(l+468,\"eat \");poke(l+472,\"gave \");poke(l+476,\"me \");";
|
||||
fat32_write(fh, w12, cmd_strlen(w12));
|
||||
char *w13 = "poke(l+480,\"beguiled \");poke(l+484,\"belly \");poke(l+488,\"go \");poke(l+492,\"dust \");poke(l+496,\"shalt \");poke(l+500,\"eat \");poke(l+504,\"days \");poke(l+508,\"life \");poke(l+512,\"put \");poke(l+516,\"enmity \");";
|
||||
fat32_write(fh, w13, cmd_strlen(w13));
|
||||
char *w14 = "poke(l+520,\"between \");poke(l+524,\"seed \");poke(l+528,\"bruise \");poke(l+532,\"head \");poke(l+536,\"heel \");poke(l+540,\"multiply \");poke(l+544,\"sorrow \");poke(l+548,\"conception \");poke(l+552,\"forth \");poke(l+556,\"children \");";
|
||||
fat32_write(fh, w14, cmd_strlen(w14));
|
||||
char *w15 = "poke(l+560,\"desire \");poke(l+564,\"rule \");poke(l+568,\"over \");poke(l+572,\"sake \");poke(l+576,\"sweat \");poke(l+580,\"face \");poke(l+584,\"till \");poke(l+588,\"return \");poke(l+592,\"ground \");poke(l+596,\"taken \");";
|
||||
fat32_write(fh, w15, cmd_strlen(w15));
|
||||
char *w16 = "poke(l+600,\"mother \");poke(l+604,\"living \");poke(l+608,\"coats \");poke(l+612,\"skins \");poke(l+616,\"clothed \");poke(l+620,\"become \");poke(l+624,\"one \");poke(l+628,\"us \");poke(l+632,\"know \");poke(l+636,\"good \");";
|
||||
fat32_write(fh, w16, cmd_strlen(w16));
|
||||
char *w17 = "poke(l+640,\"evil \");poke(l+644,\"lest \");poke(l+648,\"put \");poke(l+652,\"hand \");poke(l+656,\"take \");poke(l+660,\"live \");poke(l+664,\"ever \");poke(l+668,\"sent \");poke(l+672,\"garden \");poke(l+676,\"eden \");";
|
||||
fat32_write(fh, w17, cmd_strlen(w17));
|
||||
char *w18 = "poke(l+680,\"flaming \");poke(l+684,\"sword \");poke(l+688,\"turned \");poke(l+692,\"way \");poke(l+696,\"knew \");poke(l+700,\"conceived \");poke(l+704,\"bare \");poke(l+708,\"cain \");poke(l+712,\"said \");poke(l+716,\"gotten \");";
|
||||
fat32_write(fh, w18, cmd_strlen(w18));
|
||||
char *w19 = "poke(l+720,\"lord \");poke(l+724,\"again \");poke(l+728,\"abel \");poke(l+732,\"sheep \");poke(l+736,\"tiller \");poke(l+740,\"process \");poke(l+744,\"time \");poke(l+748,\"pass \");poke(l+752,\"brought \");poke(l+756,\"fruit \");";
|
||||
fat32_write(fh, w19, cmd_strlen(w19));
|
||||
char *w20 = "poke(l+760,\"offering \");poke(l+764,\"firstlings \");poke(l+768,\"flock \");poke(l+772,\"fat \");poke(l+776,\"thereof \");poke(l+780,\"respect \");poke(l+784,\"wroth \");poke(l+788,\"countenance \");poke(l+792,\"fallen \");poke(l+796,\"well \");";
|
||||
fat32_write(fh, w20, cmd_strlen(w20));
|
||||
char *w21 = "poke(l+800,\"accepted \");poke(l+804,\"not \");poke(l+808,\"sin \");poke(l+812,\"lieth \");poke(l+816,\"door \");poke(l+820,\"unto \");poke(l+824,\"rule \");poke(l+828,\"talked \");poke(l+832,\"field \");poke(l+836,\"rose \");";
|
||||
fat32_write(fh, w21, cmd_strlen(w21));
|
||||
char *w22 = "poke(l+840,\"slew \");poke(l+844,\"done \");poke(l+848,\"crieth \");poke(l+852,\"mouth \");poke(l+856,\"receive \");poke(l+860,\"strength \");poke(l+864,\"fugitive \");poke(l+868,\"vagabond \");poke(l+872,\"punishment \");poke(l+876,\"greater \");";
|
||||
fat32_write(fh, w22, cmd_strlen(w22));
|
||||
char *w23 = "poke(l+880,\"bear \");poke(l+884,\"driven \");poke(l+888,\"hid \");poke(l+892,\"findeth \");poke(l+896,\"slay \");poke(l+900,\"vengeance \");poke(l+904,\"sevenfold \");poke(l+908,\"mark \");poke(l+912,\"finding \");poke(l+916,\"kill \");";
|
||||
fat32_write(fh, w23, cmd_strlen(w23));
|
||||
char *w24 = "poke(l+920,\"presence \");poke(l+924,\"dwelt \");poke(l+928,\"nod \");poke(l+932,\"enoch \");poke(l+936,\"city \");poke(l+940,\"irad \");poke(l+944,\"mehujael \");poke(l+948,\"methusael \");poke(l+952,\"lamech \");poke(l+956,\"adah \");";
|
||||
fat32_write(fh, w24, cmd_strlen(w24));
|
||||
char *w25 = "poke(l+960,\"zillah \");poke(l+964,\"jabal \");poke(l+968,\"tent \");poke(l+972,\"cattle \");poke(l+976,\"jubal \");poke(l+980,\"harp \");poke(l+984,\"organ \");poke(l+988,\"tubalcain \");poke(l+992,\"brass \");poke(l+996,\"iron \");";
|
||||
fat32_write(fh, w25, cmd_strlen(w25));
|
||||
char *w26 = "poke(l+1000,\"naamah \");poke(l+1004,\"wives \");poke(l+1008,\"hear \");poke(l+1012,\"speech \");poke(l+1016,\"hearken \");poke(l+1020,\"young \");poke(l+1024,\"hurt \");poke(l+1028,\"wounding \");poke(l+1032,\"avenged \");poke(l+1036,\"seventy \");";
|
||||
fat32_write(fh, w26, cmd_strlen(w26));
|
||||
char *w27 = "poke(l+1040,\"seth \");poke(l+1044,\"appointed \");poke(l+1048,\"enos \");poke(l+1052,\"began \");poke(l+1056,\"call \");poke(l+1060,\"name \");poke(l+1064,\"generations \");poke(l+1068,\"adam \");poke(l+1072,\"likeness \");poke(l+1076,\"blessed \");";
|
||||
fat32_write(fh, w27, cmd_strlen(w27));
|
||||
char *w28 = "poke(l+1080,\"begat \");poke(l+1084,\"sons \");poke(l+1088,\"daughters \");poke(l+1092,\"lived \");poke(l+1096,\"died \");poke(l+1100,\"cainan \");poke(l+1104,\"mahalaleel \");poke(l+1108,\"jared \");poke(l+1112,\"walked \");poke(l+1116,\"three \");";
|
||||
fat32_write(fh, w28, cmd_strlen(w28));
|
||||
char *w29 = "poke(l+1120,\"hundred \");poke(l+1124,\"sixty \");poke(l+1128,\"five \");poke(l+1132,\"methuselah \");poke(l+1136,\"lamech \");poke(l+1140,\"noah \");poke(l+1144,\"comfort \");poke(l+1148,\"work \");poke(l+1152,\"toil \");poke(l+1156,\"hands \");";
|
||||
fat32_write(fh, w29, cmd_strlen(w29));
|
||||
char *w30 = "poke(l+1160,\"shem \");poke(l+1164,\"ham \");poke(l+1168,\"japheth \");poke(l+1172,\"men \");poke(l+1176,\"daughters \");poke(l+1180,\"born \");poke(l+1184,\"fair \");poke(l+1188,\"chose \");poke(l+1192,\"spirit \");poke(l+1196,\"strive \");";
|
||||
fat32_write(fh, w30, cmd_strlen(w30));
|
||||
char *e = "int c;int r;r=abs(rand());r=r-(r/5)*5;c=14+r;int i;i=0;while(i<c){int x;x=abs(rand());x=x-(x/300)*300;int w;w=peek(l+x*4);print_str(w);i=i+1;}nl();}";
|
||||
fat32_write(fh, e, cmd_strlen(e));
|
||||
fat32_close(fh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ FAT32_FileHandle* fat32_open(const char *path, const char *mode) {
|
|||
|
||||
handle->valid = true;
|
||||
handle->cluster = entry->start_cluster;
|
||||
handle->start_cluster = entry->start_cluster;
|
||||
handle->position = 0;
|
||||
handle->size = entry->size;
|
||||
|
||||
|
|
@ -283,6 +284,17 @@ FAT32_FileHandle* fat32_open(const char *path, const char *mode) {
|
|||
} else {
|
||||
handle->mode = 2; // append
|
||||
handle->position = entry->size;
|
||||
|
||||
// Walk to the correct cluster for the current position
|
||||
uint32_t current_cluster = handle->start_cluster;
|
||||
uint32_t pos = 0;
|
||||
while (pos + FAT32_CLUSTER_SIZE <= handle->position) {
|
||||
uint32_t next = fat_table[current_cluster];
|
||||
if (next >= 0xFFFFFFF8) break;
|
||||
current_cluster = next;
|
||||
pos += FAT32_CLUSTER_SIZE;
|
||||
}
|
||||
handle->cluster = current_cluster;
|
||||
}
|
||||
|
||||
return handle;
|
||||
|
|
@ -342,8 +354,18 @@ int fat32_write(FAT32_FileHandle *handle, const void *buffer, int size) {
|
|||
|
||||
int bytes_written = 0;
|
||||
const uint8_t *buf = (const uint8_t *)buffer;
|
||||
uint32_t initial_cluster = handle->cluster;
|
||||
|
||||
// Check if we are at a cluster boundary from a previous write
|
||||
if (handle->position > 0 && (handle->position % FAT32_CLUSTER_SIZE) == 0) {
|
||||
uint32_t next = fat_table[handle->cluster];
|
||||
if (next >= 0xFFFFFFF8) {
|
||||
next = allocate_cluster();
|
||||
if (!next) return 0;
|
||||
fat_table[handle->cluster] = next;
|
||||
}
|
||||
handle->cluster = next;
|
||||
}
|
||||
|
||||
while (bytes_written < size) {
|
||||
uint32_t offset_in_cluster = handle->position % FAT32_CLUSTER_SIZE;
|
||||
int to_write = size - bytes_written;
|
||||
|
|
@ -379,7 +401,7 @@ int fat32_write(FAT32_FileHandle *handle, const void *buffer, int size) {
|
|||
|
||||
// Update file entry
|
||||
for (int i = 0; i < MAX_FILES; i++) {
|
||||
if (files[i].used && files[i].start_cluster == initial_cluster) {
|
||||
if (files[i].used && files[i].start_cluster == handle->start_cluster) {
|
||||
files[i].size = handle->size;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ typedef struct {
|
|||
// File Handle
|
||||
typedef struct {
|
||||
uint32_t cluster; // Current cluster
|
||||
uint32_t start_cluster; // Start cluster (for file entry lookup)
|
||||
uint32_t position; // Current position in file
|
||||
uint32_t size; // File size
|
||||
uint32_t mode; // 0=read, 1=write, 2=append
|
||||
|
|
|
|||
Loading…
Reference in a new issue