Skip to content

Commit

Permalink
fixed #6 + removed debug print
Browse files Browse the repository at this point in the history
  • Loading branch information
NullExceptionTSB committed Jan 6, 2023
1 parent 3b707c7 commit 02a6c02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/fat/fat12.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ int fat12_allocclusters(image* img, bpb16* bpb, int cluster_count) {
if (!cluster) {
if (prev_al_clus) {
if (prev_al_clus % 2) {
fat_start[prev_al_clus/2].odd_clust1 = (char)(i&0xF);
fat_start[prev_al_clus/2].odd_clust2 = (char)(i>>8);
fat_start[prev_al_clus/2].odd_clust1 = (char)(i&0x00F);
fat_start[prev_al_clus/2].odd_clust2 = (char)(i>>4);
}
else {
fat_start[prev_al_clus/2].even_clust1 = (char)i;
fat_start[prev_al_clus/2].even_clust2 = (char)((i>>8)&0xF);
fat_start[prev_al_clus/2].even_clust2 = (char)((i>>8)&0x0F);
}
}
prev_al_clus = i;
Expand Down Expand Up @@ -184,7 +184,7 @@ void fat12_write_file_via_cluster_chain(char* data, size_t data_size,
int nclus = 0;
if (clustern%2) {
nclus |= (fat[clustern/2].odd_clust1 & 0xF);
nclus |= fat[clustern/2].odd_clust2 << 8;
nclus |= fat[clustern/2].odd_clust2 << 4;
} else {
nclus |= fat[clustern/2].even_clust1;
nclus |= fat[clustern/2].even_clust2 << 8 ;
Expand Down
1 change: 0 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ void mode_add(mkimg_args* args) {
}

int main(int argc, char* argv[]) {
printf("%u\n",sizeof(bpb16));
mkimg_args* args = arg_parse(argc, argv);
switch (args->mode) {
case create:
Expand Down

0 comments on commit 02a6c02

Please sign in to comment.