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
|
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
|
||||||
|
|||||||
+7
-19
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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,113 +80,146 @@ 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)
|
|
||||||
int path_segment;
|
void print(string);
|
||||||
int fsci_lba_index;
|
|
||||||
char path[256];
|
int main(selector, parameter_struct)
|
||||||
|
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.
|
||||||
|
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[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";
|
||||||
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";
|
service_action = selector;
|
||||||
struct test my_struct;
|
|
||||||
char *fs_info;
|
|
||||||
char *hello = "LessSimpleFileSystem_Hello";
|
|
||||||
char *yes = "Read file: ";
|
|
||||||
int nubmer;
|
|
||||||
|
|
||||||
|
switch (service_action)
|
||||||
my_struct.first = hello;
|
{
|
||||||
my_struct.second = yes;
|
case SERIVCE_LOAD_DISK:
|
||||||
|
{
|
||||||
if (selector == 1)
|
/*
|
||||||
{
|
What do we need to know:
|
||||||
// SERVICE: READ FILE
|
Index of FSCI
|
||||||
FSCI fsci;
|
*/
|
||||||
print(my_struct.first);
|
index_as_long = parameter_struct;
|
||||||
print(my_struct.second);
|
disk_service_read_data_from_disk(index_as_long, 1, &fsci, stack_segment);
|
||||||
//strcpy(local_path, local_segment, path, path_segment);
|
print("File System has been loaded: ");
|
||||||
print(local_path);
|
print_newline();
|
||||||
fsci.master_table_index[0] = 42;
|
print_stack(fsci.filesystem_information);
|
||||||
nubmer = 0x55;
|
print_newline();
|
||||||
//dump_ax(fsci.master_table_index[0]);
|
} break;
|
||||||
//dump_ax(nubmer);
|
case SERVICE_FIND_ENTRY:
|
||||||
//fsci_lba_index = 0x1000;
|
{
|
||||||
fsci.filesystem_information[0] = 'i';
|
disk_service_read_data_from_disk(fsci.master_table_index[0], DEFAULT_TABLE_SIZE, ¤t_table, stack_segment);
|
||||||
fsci.filesystem_information[1] = '\0';
|
print("Current table: ");
|
||||||
dump_ax(fsci_lba_index);
|
print_newline();
|
||||||
stub(fsci_lba_index, 1, &fsci, 0x8fc0);
|
print_stack(current_table.entries[0].filename);
|
||||||
//fs_info = fsci.filesystem_information;
|
print_newline();
|
||||||
//dump_ax(&fsci);
|
print_stack(current_table.entries[1].filename);
|
||||||
print_stack(fsci.filesystem_information);
|
print_newline();
|
||||||
dump_ax(fsci.master_table_index[0]);
|
print_stack(current_table.entries[2].filename);
|
||||||
}
|
print_newline();
|
||||||
else
|
} break;
|
||||||
{
|
case SERIVCE_READ_DATA:
|
||||||
print(my_struct.first);
|
{
|
||||||
return 0;
|
/*
|
||||||
}
|
What do we need to know:
|
||||||
|
path
|
||||||
return 0;
|
// 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
|
#asm
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
mov si,4[bp]
|
mov si,4[bp]
|
||||||
call 0x0000:0x7C47
|
call 0x0000:0x7C47
|
||||||
pop bp
|
pop bp
|
||||||
#endasm
|
#endasm
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_stack(argument)
|
void print_stack(argument)
|
||||||
{
|
{
|
||||||
#asm
|
#asm
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
push ds
|
push ds
|
||||||
push ax
|
push ax
|
||||||
|
|
||||||
mov ax, ss
|
mov ax, ss
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov si,4[bp]
|
mov si,4[bp]
|
||||||
call 0x0000:0x7C47
|
call 0x0000:0x7C47
|
||||||
|
|
||||||
pop ax
|
pop ax
|
||||||
pop ds
|
pop ds
|
||||||
pop bp
|
pop bp
|
||||||
#endasm
|
#endasm
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_ax_return(input)
|
dump_ax_return(input)
|
||||||
void* input;
|
void* input;
|
||||||
{
|
{
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_ax(input)
|
void dump_ax(input)
|
||||||
void* input;
|
void* input;
|
||||||
{
|
{
|
||||||
// Force the variable in ax
|
// Force the variable in ax
|
||||||
dump_ax_return(input)
|
dump_ax_return(input)
|
||||||
#asm
|
#asm
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
call 0x000:0x7C2A
|
call 0x000:0x7C2A
|
||||||
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
|
||||||
|
}
|
||||||
Reference in new issue
Block a user