Starting to create the structre of implementation

This commit is contained in:
Jørn Guldberg committed 2019-06-27 20:55:46 +00:00
1 parent 36679a8376
commit f113cf57c9
5 files changed
+121 -76

No files matched your search

+7 -9
View File
@@ -1,14 +1,12 @@
bcc -S main.c bcc -S main.c
echo -e "push bp echo -e "push bp
mov bp,sp mov bp,sp
push 12[bp] push 8[bp]
push 10[bp] push 6[bp]
push 8[bp] call _main
push 6[bp] add sp, #0x4
call _main pop bp
add sp, 0x4 retf\n $(cat main.s)" > main.s
pop bp
retf $(cat main.s)" > main.s
sed -i '/.globl ___mkargv/d' ./main.s sed -i '/.globl ___mkargv/d' ./main.s
sed -i '/.globl _environ/d' ./main.s sed -i '/.globl _environ/d' ./main.s
sed -i '/^.data$/d' ./main.s sed -i '/^.data$/d' ./main.s
BIN
View File
Binary file not shown.
+7 -19
View File
@@ -1,8 +1,7 @@
int data_from_disk(index, number_sectors, data_buffer, data_buffer_segment); int data_from_disk(index, number_sectors, data_buffer, data_buffer_segment);
int sec_stub(); int disk_service_read_data_from_disk(index, number_sectors, data_buffer, data_buffer_segment);
int stub(index, number_sectors, data_buffer, data_buffer_segment);
int stub(index, number_sectors, data_buffer, data_buffer_segment) int disk_service_read_data_from_disk(index, number_sectors, data_buffer, data_buffer_segment)
long* index; long* index;
long number_sectors; long number_sectors;
void* data_buffer; void* data_buffer;
@@ -10,20 +9,14 @@ int data_buffer_segment;
{ {
#asm #asm
#define index 4[bp]; #define index 4[bp]; // Note that this is a 32-bit argument.
#define number_sectors 6[bp]; #define number_sectors 8[bp];
#define data_buffer 8[bp]; #define data_buffer 10[bp];
#define data_buffer_segment 10[bp]; #define data_buffer_segment 12[bp];
push bp push bp
mov bp,sp mov bp,sp
pusha pusha
//mov ax, ds
//call 0x0000:0x7C2A
//mov ax, DAPACK
//call 0x0000:0x7C2A
mov ax, #DAPACK
call 0x0000:0x7C2A
lsfs_load_data: lsfs_load_data:
mov ax, index mov ax, index
@@ -38,7 +31,7 @@ int data_buffer_segment;
mov ah, #0x42 ; READ mov ah, #0x42 ; READ
mov dl, [global_disk_identifier] mov dl, [global_disk_identifier]
int #0x13 int #0x13
call 0x0000:0x7C2A ;call 0x0000:0x7C2A
popa popa
pop bp pop bp
ret ret
@@ -57,8 +50,3 @@ int data_buffer_segment;
#endasm #endasm
} }
int sec_stub()
{
return 42;
}
+107 -48
View File
@@ -19,9 +19,10 @@
void dump_ax(input); void dump_ax(input);
void print_stack(argument); void print_stack(argument);
void print_newline();
typedef struct Directory_Table Directory_Table; typedef struct Directory_Table Directory_Table;
typedef struct struct_table_entry struct_table_entry; typedef struct Struct_Table_Entry Table_Entry;
typedef struct struct_partition_control partition_control; typedef struct struct_partition_control partition_control;
typedef struct File_System_Control_Information FSCI; typedef struct File_System_Control_Information FSCI;
typedef struct meta_information_format mif; typedef struct meta_information_format mif;
@@ -36,9 +37,34 @@ typedef enum Table_Entry_Kind
ENTRY_DIRECTORY = 2, ENTRY_DIRECTORY = 2,
} Table_Entry_Kind; } Table_Entry_Kind;
typedef enum Service_Action
{
SERIVCE_LOAD_DISK = 1,
SERVICE_FIND_ENTRY = 2,
SERIVCE_READ_DATA = 3,
SERIVCE_WRITE_DATA = 4,
} Service_Action;
int number_low; int number_low;
int selector; int selector;
struct Struct_Table_Entry
{
char filename[256];
long file_id[2];
long file_size[2];
void* ext_file_data_low;
void* ext_file_data_high;
long number_sector_s; // <- Just try to remove the last undercore and compile .
short entry_kind;
short extra_control_bits1;
short extra_control_bits2;
short extra_control_bits3;
long table_entry_sector_index[2];
long data_pointer[NUM_DATA_POINTERS * 2]; // if it is a directory, the first pointer will be to the next table.
};
struct File_System_Control_Information struct File_System_Control_Information
{ {
char filesystem_information[256]; char filesystem_information[256];
@@ -54,69 +80,89 @@ struct File_System_Control_Information
}; };
struct test typedef struct Directory_Table
{ {
char* first; Table_Entry entries[DEFAULT_TABLE_SIZE];
char* second;
}; };
int argument;
void print(argument);
int main(selector, path, path_segment, fsci_lba_index) void print(string);
int path_segment;
int fsci_lba_index; int main(selector, parameter_struct)
char path[256]; int selector;
void* parameter_struct;
{ {
// selectot should be a "selector" for which disk service // selectot should be a "selector" for which disk service
// one wnats to use. // one wnats to use.
// 0 should not be used, to try to ensure that a value has been set explicitly. // 0 should not be used, to try to ensure that a value has been set explicitly.
int local_segment = 0x7e0;
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";
struct test my_struct;
char *fs_info;
char *hello = "LessSimpleFileSystem_Hello";
char *yes = "Read file: ";
int nubmer;
my_struct.first = hello;
my_struct.second = yes;
if (selector == 1)
{
// SERVICE: READ FILE
FSCI fsci; FSCI fsci;
print(my_struct.first); Service_Action service_action;
print(my_struct.second); Directory_Table current_table;
//strcpy(local_path, local_segment, path, path_segment); int local_segment = 0x7e0;
print(local_path); int stack_segment = 0x8fc0;
fsci.master_table_index[0] = 42; long index_as_long;
nubmer = 0x55;
//dump_ax(fsci.master_table_index[0]); char local_path[256]; //= "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";
//dump_ax(nubmer); service_action = selector;
//fsci_lba_index = 0x1000;
fsci.filesystem_information[0] = 'i'; switch (service_action)
fsci.filesystem_information[1] = '\0';
dump_ax(fsci_lba_index);
stub(fsci_lba_index, 1, &fsci, 0x8fc0);
//fs_info = fsci.filesystem_information;
//dump_ax(&fsci);
print_stack(fsci.filesystem_information);
dump_ax(fsci.master_table_index[0]);
}
else
{ {
print(my_struct.first); case SERIVCE_LOAD_DISK:
return 0; {
/*
What do we need to know:
Index of FSCI
*/
index_as_long = parameter_struct;
disk_service_read_data_from_disk(index_as_long, 1, &fsci, stack_segment);
print("File System has been loaded: ");
print_newline();
print_stack(fsci.filesystem_information);
print_newline();
} break;
case SERVICE_FIND_ENTRY:
{
disk_service_read_data_from_disk(fsci.master_table_index[0], DEFAULT_TABLE_SIZE, &current_table, stack_segment);
print("Current table: ");
print_newline();
print_stack(current_table.entries[0].filename);
print_newline();
print_stack(current_table.entries[1].filename);
print_newline();
print_stack(current_table.entries[2].filename);
print_newline();
} break;
case SERIVCE_READ_DATA:
{
/*
What do we need to know:
path
// Buffer:
destination_segment
destination_address
*/
print("Hit READ case");
} break;
case SERIVCE_WRITE_DATA:
{
print("Hit WRITE case");
} break;
default:
{
print("Default case");
}
} }
return 0; return 0;
} }
void print(argument) //void load_
void print(string)
char* string;
{ {
#asm #asm
push bp push bp
@@ -164,3 +210,16 @@ void* input;
pop bp pop bp
#endasm #endasm
} }
void print_newline()
{
#asm
printCRLF:
mov ah, #0xE
mov al, #13
int #0x10
mov al, #10
int #0x10
ret
#endasm
}
BIN
View File
Binary file not shown.