Starting to create the structre of implementation
This commit is contained in:
1 parent
36679a8376
commit
f113cf57c9
5 files changed
+152
-107
No files matched your search
@@ -1,14 +1,12 @@
|
||||
bcc -S main.c
|
||||
echo -e "push bp
|
||||
mov bp,sp
|
||||
push 12[bp]
|
||||
push 10[bp]
|
||||
push 8[bp]
|
||||
push 6[bp]
|
||||
call _main
|
||||
add sp, 0x4
|
||||
pop bp
|
||||
retf $(cat main.s)" > main.s
|
||||
mov bp,sp
|
||||
push 8[bp]
|
||||
push 6[bp]
|
||||
call _main
|
||||
add sp, #0x4
|
||||
pop bp
|
||||
retf\n $(cat main.s)" > main.s
|
||||
sed -i '/.globl ___mkargv/d' ./main.s
|
||||
sed -i '/.globl _environ/d' ./main.s
|
||||
sed -i '/^.data$/d' ./main.s
|
||||
|
||||
+7
-19
@@ -1,8 +1,7 @@
|
||||
int data_from_disk(index, number_sectors, data_buffer, data_buffer_segment);
|
||||
int sec_stub();
|
||||
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);
|
||||
|
||||
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 number_sectors;
|
||||
void* data_buffer;
|
||||
@@ -10,20 +9,14 @@ int data_buffer_segment;
|
||||
{
|
||||
|
||||
#asm
|
||||
#define index 4[bp];
|
||||
#define number_sectors 6[bp];
|
||||
#define data_buffer 8[bp];
|
||||
#define data_buffer_segment 10[bp];
|
||||
#define index 4[bp]; // Note that this is a 32-bit argument.
|
||||
#define number_sectors 8[bp];
|
||||
#define data_buffer 10[bp];
|
||||
#define data_buffer_segment 12[bp];
|
||||
|
||||
push bp
|
||||
mov bp,sp
|
||||
pusha
|
||||
//mov ax, ds
|
||||
//call 0x0000:0x7C2A
|
||||
//mov ax, DAPACK
|
||||
//call 0x0000:0x7C2A
|
||||
mov ax, #DAPACK
|
||||
call 0x0000:0x7C2A
|
||||
|
||||
lsfs_load_data:
|
||||
mov ax, index
|
||||
@@ -38,7 +31,7 @@ int data_buffer_segment;
|
||||
mov ah, #0x42 ; READ
|
||||
mov dl, [global_disk_identifier]
|
||||
int #0x13
|
||||
call 0x0000:0x7C2A
|
||||
;call 0x0000:0x7C2A
|
||||
popa
|
||||
pop bp
|
||||
ret
|
||||
@@ -57,8 +50,3 @@ int data_buffer_segment;
|
||||
|
||||
#endasm
|
||||
}
|
||||
|
||||
int sec_stub()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
void dump_ax(input);
|
||||
void print_stack(argument);
|
||||
void print_newline();
|
||||
|
||||
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 File_System_Control_Information FSCI;
|
||||
typedef struct meta_information_format mif;
|
||||
@@ -36,9 +37,34 @@ typedef enum Table_Entry_Kind
|
||||
ENTRY_DIRECTORY = 2,
|
||||
} 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 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
|
||||
{
|
||||
char filesystem_information[256];
|
||||
@@ -54,113 +80,146 @@ struct File_System_Control_Information
|
||||
|
||||
};
|
||||
|
||||
struct test
|
||||
typedef struct Directory_Table
|
||||
{
|
||||
char* first;
|
||||
char* second;
|
||||
};
|
||||
Table_Entry entries[DEFAULT_TABLE_SIZE];
|
||||
|
||||
int argument;
|
||||
void print(argument);
|
||||
};
|
||||
|
||||
int main(selector, path, path_segment, fsci_lba_index)
|
||||
int path_segment;
|
||||
int fsci_lba_index;
|
||||
char path[256];
|
||||
|
||||
void print(string);
|
||||
|
||||
int main(selector, parameter_struct)
|
||||
int selector;
|
||||
void* parameter_struct;
|
||||
{
|
||||
// selectot should be a "selector" for which disk service
|
||||
// one wnats to use.
|
||||
// 0 should not be used, to try to ensure that a value has been set explicitly.
|
||||
// selectot should be a "selector" for which disk service
|
||||
// one wnats to use.
|
||||
// 0 should not be used, to try to ensure that a value has been set explicitly.
|
||||
FSCI fsci;
|
||||
Service_Action service_action;
|
||||
Directory_Table current_table;
|
||||
int local_segment = 0x7e0;
|
||||
int stack_segment = 0x8fc0;
|
||||
long index_as_long;
|
||||
|
||||
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;
|
||||
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";
|
||||
service_action = selector;
|
||||
|
||||
|
||||
my_struct.first = hello;
|
||||
my_struct.second = yes;
|
||||
|
||||
if (selector == 1)
|
||||
{
|
||||
// SERVICE: READ FILE
|
||||
FSCI fsci;
|
||||
print(my_struct.first);
|
||||
print(my_struct.second);
|
||||
//strcpy(local_path, local_segment, path, path_segment);
|
||||
print(local_path);
|
||||
fsci.master_table_index[0] = 42;
|
||||
nubmer = 0x55;
|
||||
//dump_ax(fsci.master_table_index[0]);
|
||||
//dump_ax(nubmer);
|
||||
//fsci_lba_index = 0x1000;
|
||||
fsci.filesystem_information[0] = 'i';
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
switch (service_action)
|
||||
{
|
||||
case SERIVCE_LOAD_DISK:
|
||||
{
|
||||
/*
|
||||
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, ¤t_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;
|
||||
|
||||
}
|
||||
|
||||
void print(argument)
|
||||
//void load_
|
||||
|
||||
|
||||
void print(string)
|
||||
char* string;
|
||||
{
|
||||
#asm
|
||||
push bp
|
||||
mov bp,sp
|
||||
mov si,4[bp]
|
||||
call 0x0000:0x7C47
|
||||
pop bp
|
||||
push bp
|
||||
mov bp,sp
|
||||
mov si,4[bp]
|
||||
call 0x0000:0x7C47
|
||||
pop bp
|
||||
#endasm
|
||||
}
|
||||
|
||||
void print_stack(argument)
|
||||
{
|
||||
#asm
|
||||
push bp
|
||||
mov bp,sp
|
||||
push ds
|
||||
push ax
|
||||
push bp
|
||||
mov bp,sp
|
||||
push ds
|
||||
push ax
|
||||
|
||||
mov ax, ss
|
||||
mov ds, ax
|
||||
mov si,4[bp]
|
||||
call 0x0000:0x7C47
|
||||
|
||||
pop ax
|
||||
pop ds
|
||||
pop bp
|
||||
mov ax, ss
|
||||
mov ds, ax
|
||||
mov si,4[bp]
|
||||
call 0x0000:0x7C47
|
||||
|
||||
pop ax
|
||||
pop ds
|
||||
pop bp
|
||||
#endasm
|
||||
}
|
||||
|
||||
dump_ax_return(input)
|
||||
void* input;
|
||||
{
|
||||
return input;
|
||||
return input;
|
||||
}
|
||||
|
||||
void dump_ax(input)
|
||||
void* input;
|
||||
{
|
||||
// Force the variable in ax
|
||||
dump_ax_return(input)
|
||||
// Force the variable in ax
|
||||
dump_ax_return(input)
|
||||
#asm
|
||||
push bp
|
||||
mov bp,sp
|
||||
call 0x000:0x7C2A
|
||||
pop bp
|
||||
push bp
|
||||
mov bp,sp
|
||||
call 0x000:0x7C2A
|
||||
pop bp
|
||||
#endasm
|
||||
}
|
||||
|
||||
void print_newline()
|
||||
{
|
||||
#asm
|
||||
printCRLF:
|
||||
mov ah, #0xE
|
||||
mov al, #13
|
||||
int #0x10
|
||||
mov al, #10
|
||||
int #0x10
|
||||
ret
|
||||
#endasm
|
||||
}
|
||||
Reference in new issue
Block a user