Skip to content

Commit f7cce9c

Browse files
add comments to bins
1 parent fbce737 commit f7cce9c

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

filesystem/src/bootscreen/bootscreen.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,28 @@ void main(void) {
66
char * file_buff = malloc(0x2000);
77
char * path = malloc(sizeof(char)*50);
88
char itoar_buff[3];
9+
// Prepare the path
910
memcpy(path, "/boot/frames/frame", 19);
1011
path[19] = '\0';
1112
unsigned int i, j, k;
13+
// Do 1 to 9
1214
for(i = 1; i < 10; i++) {
1315
screen_clear();
1416
itoa(i, &itoar_buff, 10);
1517
path[18] = itoar_buff[0];
1618
load_file(path_to_inode(path), 0, 0, file_buff);
17-
file_buff[1575] = '\0';
19+
file_buff[1575] = '\0'; // Make sure there is a null terminaltor
1820
k=0;
1921
while(file_buff[k]){
20-
if(k==6) set_screen_bgfg(0x1E);
22+
if(k==6) set_screen_bgfg(0x1E); // Highlight `DuckOS`
2123
if(k==0) set_screen_bgfg(0xE1);
2224
putc(file_buff[k]);
2325
k++;
2426
}
2527
j = 0;
2628
while(j++<25000000);
2729
}
30+
// Do 10 to 19
2831
for(; i < 20; i++) {
2932
screen_clear();
3033
itoa(i, &itoar_buff, 10);
@@ -42,6 +45,5 @@ void main(void) {
4245
while(j++<25000000);
4346
}
4447
getc();
45-
set_screen_bgfg(0x07);
46-
// screen_clear();
48+
set_screen_bgfg(0x07); // Retorun to normal colors
4749
}

filesystem/src/cat/program.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ void main(int argc, char ** argv) {
1414
file_buff = (char *)malloc((inode->sector_usage+1)*512);
1515
load_file(inode_num, 0, 0, file_buff);
1616
for(int i = 0; i < inode->size_low; i++) {
17+
// If it's a printable character, print it
1718
if(file_buff[i] > 0x1F || file_buff[i] == 0x0A){
1819
putc(file_buff[i]);
1920
}
20-
else{
21+
else{ // If not, print a dot
2122
putc('.');
2223
}
2324
}

filesystem/src/dmatest/program.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ void main(int argc, char ** argv);
1111
void disp_heap();
1212

1313
void main(int argc, char ** argv) {
14+
// Sanity check - allocate an int and assign it a recognizable value
1415
unsigned int * ptr = malloc(sizeof(int));
1516
*ptr = 0xDDCCBBAA;
1617
puts("Heap:\n");
1718
getc();
18-
disp_heap();
19+
disp_heap(); // And display the heap
20+
// Allocate 0x1500, which is greater than the initial heap size
1921
ptr = malloc(0x1500);
22+
// assign it a recognizable value somewhere neer the end
2023
*(unsigned int *)((unsigned int)ptr + 0x1450) = 0xDDCCBBAA;
2124
puts("\nHeap:\n");
2225
getc();

filesystem/src/pipetest/program.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
void main(int argc, char ** argv);
33

44
void main(int argc, char ** argv) {
5+
// Prints everything in argv which demonstrates the pipe functionallity
56
puts("My argv:\n");
67
for (int i = 0; i < argc; i ++){
78
puts(argv[i]);

0 commit comments

Comments
 (0)