You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
4.1 KiB

5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #include "main.h"
  2. int main(selector, pointer_parameter_segment, pointer_parameter_struct)
  3. int selector;
  4. void* pointer_parameter_segment;
  5. void* pointer_parameter_struct;
  6. {
  7. /* selectot should be a "selector" for which disk service*/
  8. /* one wnats to use. */
  9. /* 0 should not be used, to try to ensure that a value has been set explicitly. */
  10. Service_Action service_action;
  11. Directory_Table current_table;
  12. Parameter_Struct parameter_struct;
  13. int local_segment = 0x7e0;
  14. unsigned int heap_start = 0x2200;
  15. unsigned int heap_end = 0xffff;
  16. int stack_segment = 0x8fc0;
  17. int path_length;
  18. long index_as_long = 0;
  19. char *local_path = 0;
  20. FSCI *fsci = 0x2000;
  21. service_action = selector;
  22. switch (service_action)
  23. {
  24. case SERIVCE_LOAD_DISK:
  25. {
  26. /*
  27. What do we need to know:
  28. Index of FSCI
  29. */
  30. set_heap_settings(heap_start, heap_end);
  31. index_as_long = pointer_parameter_struct;
  32. disk_service_read_data_from_disk(index_as_long, (long) 1, fsci, local_segment);
  33. print("File System has been loaded: ");
  34. print_newline();
  35. print(fsci->filesystem_information);
  36. print("16-bit implementation ");
  37. print_newline();
  38. } break;
  39. case SERVICE_FIND_ENTRY:
  40. {
  41. String_Array *path_array;
  42. lsfs_file* find_file;
  43. int i;
  44. disk_service_read_data_from_disk(fsci->master_table_index[0], (long) DEFAULT_TABLE_SIZE, &current_table, stack_segment);
  45. /*
  46. print("Current table: ");
  47. print_newline();
  48. print_stack(current_table.entries[0].filename);
  49. print_newline();
  50. print_stack(current_table.entries[1].filename);
  51. print_newline();
  52. print_stack(current_table.entries[2].filename);
  53. print_newline();
  54. */
  55. memcpy(&parameter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
  56. path_length = strlen(parameter_struct.path, pointer_parameter_segment);
  57. local_path = malloc(256);
  58. memcpy(local_path, local_segment, parameter_struct.path, pointer_parameter_segment, path_length);
  59. local_path[path_length] = 0;
  60. print("Read file: ");
  61. print(local_path);
  62. print_newline();
  63. path_array = string_split_c(local_path, '/', 0);
  64. find_file = calloc(sizeof(lsfs_file), 1);
  65. if ( !lsfs_disk_getattr(find_file, local_path, fsci) )
  66. {
  67. print("File not found");
  68. print_newline();
  69. }
  70. else
  71. {
  72. print("File has been read");
  73. print_newline();
  74. }
  75. /*
  76. print_newline();
  77. print("Buffer_address: ");
  78. dump_ax(parameter_struct.buffer_address);
  79. print_newline();
  80. print("Buffer_segmnent: ");
  81. dump_ax(parameter_struct.buffer_segment);
  82. */
  83. lsfs_disk_read_data_from_file(find_file, parameter_struct.buffer_size, parameter_struct.buffer_address, (long) 0x0, parameter_struct.buffer_segment);
  84. } break;
  85. case SERIVCE_READ_DATA:
  86. {
  87. /*
  88. What do we need to know:
  89. path
  90. Buffer:
  91. destination_segment
  92. destination_address
  93. buffer_size
  94. offset_into_file
  95. */
  96. print("Hit READ case");
  97. } break;
  98. case SERIVCE_WRITE_DATA:
  99. {
  100. print("Hit WRITE case");
  101. } break;
  102. case SERIVCE_WRITE_FS_INFO:
  103. {
  104. /* print_newline(); */
  105. print(fsci->filesystem_information);
  106. /* print_newline(); */
  107. } break;
  108. default:
  109. {
  110. print("Default case: ");
  111. dump_ax(service_action);
  112. }
  113. }
  114. return 0;
  115. }
  116. /* void load_*/