|
|
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 ! 1 |
|
|
! 1 # 1 "main.c" |
|
|
! 1 # 1 "std_singos/string.h" |
|
|
! 1 void strcpy (destination, destination_segment, source, source_segment ); |
|
|
!BCC_EOS |
|
|
! 2 |
|
|
! 3 void strcpy (destination, destination_segment, source, source_segment ) |
|
|
! 4 char *destination; |
|
|
export _strcpy |
|
|
_strcpy: |
|
|
!BCC_EOS |
|
|
! 5 int destination_segment; |
|
|
!BCC_EOS |
|
|
! 6 char *source; |
|
|
!BCC_EOS |
|
|
! 7 int source_segment; |
|
|
!BCC_EOS |
|
|
! 8 { |
|
|
! 9 #asm |
|
|
!BCC_ASM |
|
|
_strcpy.source set 6 |
|
|
_strcpy.destination set 2 |
|
|
_strcpy.source_segment set 8 |
|
|
_strcpy.destination_segment set 4 |
|
|
; copy two strings |
|
|
; IN si: the first (zero terminated) string |
|
|
; IN di: the second (zero terminated) string |
|
|
; OUT SF and ZF (same semantics as cmp) |
|
|
|
|
|
! 15 19 |
|
|
|
|
|
push bp |
|
|
mov bp,sp |
|
|
stringcompare: |
|
|
push ax |
|
|
push bx |
|
|
push di |
|
|
push es |
|
|
push si |
|
|
push ds |
|
|
mov ax, 4[bp]; ; |
|
|
mov di, ax |
|
|
mov ax, 6[bp]; ; |
|
|
mov es, ax |
|
|
mov ax, 8[bp]; ; |
|
|
mov si, ax |
|
|
mov ax, 10[bp]; ; |
|
|
mov ds, ax |
|
|
mov cx, 0x050 |
|
|
.loop: |
|
|
movsb |
|
|
cmp cx, 0x0 |
|
|
je .end |
|
|
dec cx |
|
|
jmp .loop |
|
|
.end: |
|
|
pop ds |
|
|
pop si |
|
|
pop es |
|
|
pop di |
|
|
pop bx |
|
|
pop ax |
|
|
pop bp |
|
|
|
|
|
! 53 endasm |
|
|
!BCC_ENDASM |
|
|
! 54 } |
|
|
ret |
|
|
! 55 # 1 "driver/disk.h" |
|
|
! 1 int data_from_disk(index, number_sectors, data_buffer, data_buffer_segment); |
|
|
!BCC_EOS |
|
|
! 2 int sec_stub(); |
|
|
!BCC_EOS |
|
|
! 3 int stub(index, number_sectors, data_buffer, data_buffer_segment); |
|
|
!BCC_EOS |
|
|
! 4 |
|
|
! 5 int stub(index, number_sectors, data_buffer, data_buffer_segment) |
|
|
! 6 long* index; |
|
|
export _stub |
|
|
_stub: |
|
|
!BCC_EOS |
|
|
! 7 long number_sectors; |
|
|
!BCC_EOS |
|
|
! 8 void* data_buffer; |
|
|
!BCC_EOS |
|
|
! 9 int data_buffer_segment; |
|
|
!BCC_EOS |
|
|
! 10 { |
|
|
! 11 |
|
|
! 12 #asm |
|
|
!BCC_ASM |
|
|
_stub.data_buffer set 8 |
|
|
_stub.number_sectors set 4 |
|
|
_stub.data_buffer_segment set $A |
|
|
_stub.index set 2 |
|
|
! 13 17 |
|
|
|
|
|
push bp |
|
|
mov bp,sp |
|
|
pusha |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov ax, #DAPACK |
|
|
call 0x0000:0x7C2A |
|
|
|
|
|
lsfs_load_data: |
|
|
mov ax, 4[bp]; |
|
|
mov WORD [DAPACK.lba_addr_dw_low], ax |
|
|
mov bx, 6[bp]; |
|
|
mov WORD [DAPACK.blkcnt], bx |
|
|
mov cx, 10[bp]; |
|
|
mov WORD [DAPACK.db_addr_segment], cx |
|
|
mov dx, 8[bp]; ; |
|
|
mov WORD [DAPACK.db_addr_offset], dx |
|
|
mov si, #DAPACK ; address of |
|
|
mov ah, #0x42 ; READ |
|
|
mov dl, [global_disk_identifier] |
|
|
int #0x13 |
|
|
call 0x0000:0x7C2A |
|
|
popa |
|
|
pop bp |
|
|
ret |
|
|
|
|
|
|
|
|
DAPACK: |
|
|
DAPACK.dap_Size: db 0x10 |
|
|
DAPACK.rev_byte: db 0x0 |
|
|
DAPACK.blkcnt: dw 0x0 |
|
|
DAPACK.db_addr_offset: dw 0x0 |
|
|
DAPACK.db_addr_segment: dw 0x0 |
|
|
DAPACK.lba_addr_dw_low: dd 0x0 |
|
|
DAPACK.lba_addr_dw_high: dd 0x0 |
|
|
|
|
|
global_disk_identifier: db 0x80 |
|
|
|
|
|
! 58 endasm |
|
|
!BCC_ENDASM |
|
|
! 59 } |
|
|
ret |
|
|
! 60 |
|
|
! 61 int sec_stub() |
|
|
! 62 { |
|
|
export _sec_stub |
|
|
_sec_stub: |
|
|
! 63 return 42; |
|
|
push bp |
|
|
mov bp,sp |
|
|
push di |
|
|
push si |
|
|
mov ax,*$2A |
|
|
pop si |
|
|
pop di |
|
|
pop bp |
|
|
ret |
|
|
!BCC_EOS |
|
|
! 64 # 7 "main.c" |
|
|
! 7 } |
|
|
! 8 |
|
|
! 9 |
|
|
! 10 #define SPACE_VBR_RECORD 2048 |
|
|
! 11 |
|
|
! 12 #define DEFAULT_ENTRY_SIZE 1 |
|
|
! 13 |
|
|
! 14 #define NUMBER_OF_MBR_PARTITIONS 4 |
|
|
! 15 |
|
|
! 16 #define DEFAULT_DATA_POINTER_SIZE 4 |
|
|
! 17 |
|
|
! 18 |
|
|
! 19 |
|
|
! 20 void dump_ax(input); |
|
|
!BCC_EOS |
|
|
! 21 void print_stack(argument); |
|
|
!BCC_EOS |
|
|
! 22 |
|
|
! 23 typedef struct Directory_Table Directory_Table; |
|
|
!BCC_EOS |
|
|
! 24 typedef struct struct_table_entry struct_table_entry; |
|
|
!BCC_EOS |
|
|
! 25 typedef struct struct_partition_control partition_control; |
|
|
!BCC_EOS |
|
|
! 26 typedef struct File_System_Control_Information FSCI; |
|
|
!BCC_EOS |
|
|
! 27 typedef struct meta_information_format mif; |
|
|
!BCC_EOS |
|
|
! 28 typedef struct tag_record tag_record; |
|
|
!BCC_EOS |
|
|
! 29 typedef struct lsfs_file lsfs_file; |
|
|
!BCC_EOS |
|
|
! 30 |
|
|
! 31 typedef enum Table_Entry_Kind |
|
|
! 32 { |
|
|
! 33 |
|
|
! 34 ENTRY_EMPTY = 0, |
|
|
! 35 ENTRY_FILE = 1, |
|
|
! 36 ENTRY_DIRECTORY = 2, |
|
|
! 37 } Table_Entry_Kind; |
|
|
!BCC_EOS |
|
|
! 38 |
|
|
! 39 int number_low; |
|
|
!BCC_EOS |
|
|
! 40 int selector; |
|
|
!BCC_EOS |
|
|
! 41 |
|
|
! 42 struct File_System_Control_Information |
|
|
! 43 { |
|
|
! 44 char filesystem_information[256]; |
|
|
!BCC_EOS |
|
|
! 45 long master_table_index[2]; |
|
|
!BCC_EOS |
|
|
! 46 long this_partition_offset_on_disk[2]; |
|
|
!BCC_EOS |
|
|
! 47 long next_free_sector[2]; |
|
|
!BCC_EOS |
|
|
! 48 long next_uniqe_id[2]; |
|
|
!BCC_EOS |
|
|
! 49 long next_sector_reuse_pointer[2]; |
|
|
!BCC_EOS |
|
|
! 50 long last_sector_index_on_partition[2]; |
|
|
!BCC_EOS |
|
|
! 51 long maximum_sectors_on_disk[2]; |
|
|
!BCC_EOS |
|
|
! 52 long sector_size_on_disk[2]; |
|
|
!BCC_EOS |
|
|
! 53 long not_used[48]; |
|
|
!BCC_EOS |
|
|
! 54 |
|
|
! 55 }; |
|
|
!BCC_EOS |
|
|
! 56 |
|
|
! 57 struct test |
|
|
! 58 { |
|
|
! 59 char* first; |
|
|
!BCC_EOS |
|
|
! 60 char* second; |
|
|
!BCC_EOS |
|
|
! 61 }; |
|
|
!BCC_EOS |
|
|
! 62 |
|
|
! 63 int argument; |
|
|
!BCC_EOS |
|
|
! 64 void print(argument); |
|
|
!BCC_EOS |
|
|
! 65 |
|
|
! 66 int main(selector, path, path_segment, fsci_lba_index) |
|
|
! 67 int path_segment; |
|
|
export _main |
|
|
_main: |
|
|
!BCC_EOS |
|
|
! 68 int fsci_lba_index; |
|
|
!BCC_EOS |
|
|
! 69 char path[256]; |
|
|
!BCC_EOS |
|
|
! 70 { |
|
|
! 71 |
|
|
! 72 |
|
|
! 73 |
|
|
! 74 |
|
|
! 75 int local_segment = 0x7e0; |
|
|
push bp |
|
|
mov bp,sp |
|
|
push di |
|
|
push si |
|
|
dec sp |
|
|
dec sp |
|
|
! Debug: eq int = const $7E0 to int local_segment = [S+8-8] (used reg = ) |
|
|
mov ax,#$7E0 |
|
|
mov -6[bp],ax |
|
|
!BCC_EOS |
|
|
! 76 char* local_path = "Hello world |