Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

129 righe
2.8 KiB

  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. typedef struct Directory_Table Directory_Table;
  19. typedef struct struct_table_entry struct_table_entry;
  20. typedef struct struct_partition_control partition_control;
  21. typedef struct File_System_Control_Information FSCI;
  22. typedef struct meta_information_format mif;
  23. typedef struct tag_record tag_record;
  24. typedef struct lsfs_file lsfs_file;
  25. typedef enum Table_Entry_Kind
  26. {
  27. // These are specific values since, is has to corrospond to the implementation in assembly
  28. ENTRY_EMPTY = 0,
  29. ENTRY_FILE = 1,
  30. ENTRY_DIRECTORY = 2,
  31. } Table_Entry_Kind;
  32. int number_low;
  33. int selector;
  34. struct File_System_Control_Information
  35. {
  36. char filesystem_information[256];
  37. long master_table_index[2];
  38. long this_partition_offset_on_disk[2];
  39. long next_free_sector[2];
  40. long next_uniqe_id[2]; // both files and directories gets this.
  41. long next_sector_reuse_pointer[2];
  42. long last_sector_index_on_partition[2];
  43. long maximum_sectors_on_disk[2];
  44. long sector_size_on_disk[2];
  45. long not_used[48];
  46. };
  47. struct test
  48. {
  49. char* first;
  50. char* second;
  51. };
  52. int argument;
  53. void print(argument);
  54. int main(selector, path, path_segment)
  55. int path_segment;
  56. char path[256];
  57. {
  58. // selectot should be a "selector" for which disk service
  59. // one wnats to use.
  60. // 0 should not be used, to try to ensure that a value has been set explicitly.
  61. int local_segment = 0x7e0;
  62. 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";
  63. struct test my_struct;
  64. char *hello = "LessSimpleFileSystem";
  65. char *yes = "Read file: ";
  66. my_struct.first = hello;
  67. my_struct.second = yes;
  68. if (selector == 1)
  69. {
  70. // SERVICE: READ FILE
  71. FSCI fsci;
  72. print(my_struct.first);
  73. print(my_struct.second);
  74. strcpy(local_path, local_segment, path, path_segment);
  75. print(local_path);
  76. fsci.master_table_index[0] = 32;
  77. dump_ax(fsci.master_table_index[0]);
  78. }
  79. else
  80. {
  81. print(my_struct.first);
  82. return 0;
  83. }
  84. return 0;
  85. }
  86. void print(argument)
  87. {
  88. #asm
  89. push bp
  90. mov bp,sp
  91. mov si,4[bp]
  92. call 0x0000:0x7C47
  93. pop bp
  94. #endasm
  95. }
  96. dump_ax_return(input)
  97. void* input;
  98. {
  99. return input;
  100. }
  101. void dump_ax(input)
  102. void* input;
  103. {
  104. // Force the variable in ax
  105. dump_ax_return(input)
  106. #asm
  107. call 0x000:0x7C2A
  108. #endasm
  109. }