No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

164 líneas
3.3 KiB

hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
hace 5 años
  1. // Adress to dump ax, 7C2A
  2. // Address to print 7C47
  3. //
  4. //
  5. #include "std_singos/string.h"
  6. #include "driver/disk.h"
  7. #define SPACE_MBR_RECORD 2048 // Sectors
  8. #define SPACE_VBR_RECORD 2048 // Sectors
  9. #define SIZE_FSCI_RECORD 1 // Sectors
  10. #define DEFAULT_ENTRY_SIZE 1 // Sectors
  11. #define SECTOR_SIZE 512 // BYTES
  12. #define NUMBER_OF_MBR_PARTITIONS 4
  13. #define DEFAULT_FILE_SIZE 4 // This is in sectors
  14. #define DEFAULT_DATA_POINTER_SIZE 4 // This is in sectors
  15. #define DEFAULT_TABLE_SIZE 16
  16. #define NUM_DATA_POINTERS 27
  17. void dump_ax(input);
  18. void print_stack(argument);
  19. typedef struct Directory_Table Directory_Table;
  20. typedef struct struct_table_entry struct_table_entry;
  21. typedef struct struct_partition_control partition_control;
  22. typedef struct File_System_Control_Information FSCI;
  23. typedef struct meta_information_format mif;
  24. typedef struct tag_record tag_record;
  25. typedef struct lsfs_file lsfs_file;
  26. typedef enum Table_Entry_Kind
  27. {
  28. // These are specific values since, is has to corrospond to the implementation in assembly
  29. ENTRY_EMPTY = 0,
  30. ENTRY_FILE = 1,
  31. ENTRY_DIRECTORY = 2,
  32. } Table_Entry_Kind;
  33. int number_low;
  34. int selector;
  35. struct File_System_Control_Information
  36. {
  37. char filesystem_information[256];
  38. long master_table_index[2];
  39. long this_partition_offset_on_disk[2];
  40. long next_free_sector[2];
  41. long next_uniqe_id[2]; // both files and directories gets this.
  42. long next_sector_reuse_pointer[2];
  43. long last_sector_index_on_partition[2];
  44. long maximum_sectors_on_disk[2];
  45. long sector_size_on_disk[2];
  46. long not_used[48];
  47. };
  48. struct test
  49. {
  50. char* first;
  51. char* second;
  52. };
  53. int argument;
  54. void print(argument);
  55. int main(selector, path, path_segment, fsci_lba_index)
  56. int path_segment;
  57. int fsci_lba_index;
  58. char path[256];
  59. {
  60. // selectot should be a "selector" for which disk service
  61. // one wnats to use.
  62. // 0 should not be used, to try to ensure that a value has been set explicitly.
  63. int local_segment = 0x7e0;
  64. char* local_path = "Hello world\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
  65. struct test my_struct;
  66. char *fs_info;
  67. char *hello = "LessSimpleFileSystem_Hello";
  68. char *yes = "Read file: ";
  69. int nubmer;
  70. my_struct.first = hello;
  71. my_struct.second = yes;
  72. if (selector == 1)
  73. {
  74. // SERVICE: READ FILE
  75. FSCI fsci;
  76. print(my_struct.first);
  77. print(my_struct.second);
  78. //strcpy(local_path, local_segment, path, path_segment);
  79. print(local_path);
  80. fsci.master_table_index[0] = 42;
  81. nubmer = 0x55;
  82. //dump_ax(fsci.master_table_index[0]);
  83. dump_ax(nubmer);
  84. fsci.filesystem_information[0] = 'i';
  85. fsci.filesystem_information[1] = '\0';
  86. stub(fsci_lba_index, 1, &fsci, 0x8fc0);
  87. fs_info = fsci.filesystem_information;
  88. //dump_ax(&fsci);
  89. print_stack( fs_info );
  90. //dump_ax(fsci.master_table_index[0]);
  91. }
  92. else
  93. {
  94. print(my_struct.first);
  95. return 0;
  96. }
  97. return 0;
  98. }
  99. void print(argument)
  100. {
  101. #asm
  102. push bp
  103. mov bp,sp
  104. mov si,4[bp]
  105. call 0x0000:0x7C47
  106. pop bp
  107. #endasm
  108. }
  109. void print_stack(argument)
  110. {
  111. #asm
  112. push bp
  113. mov bp,sp
  114. push ds
  115. push ax
  116. mov ax, ss
  117. mov ds, ax
  118. mov si,4[bp]
  119. call 0x0000:0x7C47
  120. pop ax
  121. pop ds
  122. pop bp
  123. #endasm
  124. }
  125. dump_ax_return(input)
  126. void* input;
  127. {
  128. return input;
  129. }
  130. void dump_ax(input)
  131. void* input;
  132. {
  133. // Force the variable in ax
  134. dump_ax_return(input)
  135. #asm
  136. push bp
  137. mov bp,sp
  138. call 0x000:0x7C2A
  139. pop bp
  140. #endasm
  141. }