Save work
This commit is contained in:
1 parent
c7ad92b3b2
commit
e12768398d
4 files changed
+277
-159
No files matched your search
@@ -111,9 +111,10 @@ void* pointer_parameter_struct;
|
|||||||
Parameter_Struct parameter_struct;
|
Parameter_Struct parameter_struct;
|
||||||
int local_segment = 0x7e0;
|
int local_segment = 0x7e0;
|
||||||
int stack_segment = 0x8fc0;
|
int stack_segment = 0x8fc0;
|
||||||
|
int path_length;
|
||||||
long index_as_long;
|
long index_as_long;
|
||||||
|
|
||||||
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[256];
|
||||||
service_action = selector;
|
service_action = selector;
|
||||||
|
|
||||||
switch (service_action)
|
switch (service_action)
|
||||||
@@ -134,7 +135,10 @@ void* pointer_parameter_struct;
|
|||||||
case SERVICE_FIND_ENTRY:
|
case SERVICE_FIND_ENTRY:
|
||||||
{
|
{
|
||||||
memcpy(¶meter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
|
memcpy(¶meter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
|
||||||
dump_ax(parameter_struct.buffer_size);
|
path_length = strlen(parameter_struct.path, pointer_parameter_segment);
|
||||||
|
memcpy(local_path, stack_segment, parameter_struct.path, pointer_parameter_segment, path_length);
|
||||||
|
local_path[path_length] = 0;
|
||||||
|
print_stack(local_path);
|
||||||
print_newline();
|
print_newline();
|
||||||
disk_service_read_data_from_disk(fsci.master_table_index[0], DEFAULT_TABLE_SIZE, ¤t_table, stack_segment);
|
disk_service_read_data_from_disk(fsci.master_table_index[0], DEFAULT_TABLE_SIZE, ¤t_table, stack_segment);
|
||||||
print("Current table: ");
|
print("Current table: ");
|
||||||
|
|||||||
@@ -12,22 +12,64 @@ retf
|
|||||||
! 1 # 1 "std_singos/string.h"
|
! 1 # 1 "std_singos/string.h"
|
||||||
! 1 void strcpy (destination, destination_segment, source, source_segment );
|
! 1 void strcpy (destination, destination_segment, source, source_segment );
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 2 void memcpy (destination, destination_segment, source, source_segment, num_bytes );
|
! 2 int strlen (source, source_segment);
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 3
|
! 3 void memcpy (destination, destination_segment, source, source_segment, num_bytes );
|
||||||
! 4 void strcpy (destination, destination_segment, source, source_segment )
|
!BCC_EOS
|
||||||
! 5 char *destination;
|
! 4
|
||||||
|
! 5 int strlen (source, source_segment)
|
||||||
|
! 6 {
|
||||||
|
export _strlen
|
||||||
|
_strlen:
|
||||||
|
! 7 #asm
|
||||||
|
!BCC_ASM
|
||||||
|
_strlen.source set 2
|
||||||
|
_strlen.source_segment set 4
|
||||||
|
|
||||||
|
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
push ds
|
||||||
|
push bx
|
||||||
|
|
||||||
|
mov ax, 6[bp];
|
||||||
|
mov ds, ax
|
||||||
|
|
||||||
|
mov bx, 4[bp];
|
||||||
|
|
||||||
|
label_strlen:
|
||||||
|
mov cx, #0x0 ; Set counte to zero
|
||||||
|
.label_strlen_loop:
|
||||||
|
mov BYTE al, [bx]
|
||||||
|
cmp al, #0x0
|
||||||
|
je .label_strlen_done
|
||||||
|
inc cx ; Count 1
|
||||||
|
inc bx ; Look at next char
|
||||||
|
jmp .label_strlen_loop
|
||||||
|
.label_strlen_done:
|
||||||
|
mov ax, cx
|
||||||
|
|
||||||
|
pop bx
|
||||||
|
pop ds
|
||||||
|
pop bp
|
||||||
|
! 35 endasm
|
||||||
|
!BCC_ENDASM
|
||||||
|
! 36 }
|
||||||
|
ret
|
||||||
|
! 37
|
||||||
|
! 38 void strcpy (destination, destination_segment, source, source_segment )
|
||||||
|
! 39 char *destination;
|
||||||
export _strcpy
|
export _strcpy
|
||||||
_strcpy:
|
_strcpy:
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 6 int destination_segment;
|
! 40 int destination_segment;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 7 char *source;
|
! 41 char *source;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 8 int source_segment;
|
! 42 int source_segment;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 9 {
|
! 43 {
|
||||||
! 10 #asm
|
! 44 #asm
|
||||||
!BCC_ASM
|
!BCC_ASM
|
||||||
_strcpy.source set 6
|
_strcpy.source set 6
|
||||||
_strcpy.destination set 2
|
_strcpy.destination set 2
|
||||||
@@ -38,11 +80,11 @@ _strcpy.destination_segment set 4
|
|||||||
; IN di: the second (zero terminated) string
|
; IN di: the second (zero terminated) string
|
||||||
; OUT SF and ZF (same semantics as cmp)
|
; OUT SF and ZF (same semantics as cmp)
|
||||||
|
|
||||||
! 16 20
|
! 50 54
|
||||||
|
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
stringcompare:
|
label_strcpy:
|
||||||
push ax
|
push ax
|
||||||
push bx
|
push bx
|
||||||
push di
|
push di
|
||||||
@@ -58,13 +100,13 @@ _strcpy.destination_segment set 4
|
|||||||
mov ax, 10[bp]; ;
|
mov ax, 10[bp]; ;
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov cx, 0x050
|
mov cx, 0x050
|
||||||
.loop:
|
.label_strcpy_loop:
|
||||||
movsb
|
movsb
|
||||||
cmp cx, 0x0
|
cmp cx, 0x0
|
||||||
je .end
|
je .label_strcpy_end
|
||||||
dec cx
|
dec cx
|
||||||
jmp .loop
|
jmp .label_strcpy_loop
|
||||||
.end:
|
.label_strcpy_end:
|
||||||
pop ds
|
pop ds
|
||||||
pop si
|
pop si
|
||||||
pop es
|
pop es
|
||||||
@@ -73,26 +115,26 @@ _strcpy.destination_segment set 4
|
|||||||
pop ax
|
pop ax
|
||||||
pop bp
|
pop bp
|
||||||
|
|
||||||
! 54 endasm
|
! 88 endasm
|
||||||
!BCC_ENDASM
|
!BCC_ENDASM
|
||||||
! 55 }
|
! 89 }
|
||||||
ret
|
ret
|
||||||
! 56
|
! 90
|
||||||
! 57 void memcpy (destination, destination_segment, source, source_segment, num_bytes)
|
! 91 void memcpy (destination, destination_segment, source, source_segment, num_bytes)
|
||||||
! 58 void *destination;
|
! 92 void *destination;
|
||||||
export _memcpy
|
export _memcpy
|
||||||
_memcpy:
|
_memcpy:
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 59 int destination_segment;
|
! 93 int destination_segment;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 60 void *source;
|
! 94 void *source;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 61 int source_segment;
|
! 95 int source_segment;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 62 int num_bytes;
|
! 96 int num_bytes;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 63 {
|
! 97 {
|
||||||
! 64 #asm
|
! 98 #asm
|
||||||
!BCC_ASM
|
!BCC_ASM
|
||||||
_memcpy.source set 6
|
_memcpy.source set 6
|
||||||
_memcpy.destination set 2
|
_memcpy.destination set 2
|
||||||
@@ -104,11 +146,11 @@ _memcpy.destination_segment set 4
|
|||||||
; IN di: the second (zero terminated) string
|
; IN di: the second (zero terminated) string
|
||||||
; OUT SF and ZF (same semantics as cmp)
|
; OUT SF and ZF (same semantics as cmp)
|
||||||
|
|
||||||
! 70 75
|
! 104 109
|
||||||
|
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
memcpy:
|
label_memcpy:
|
||||||
push ax
|
push ax
|
||||||
push bx
|
push bx
|
||||||
push di
|
push di
|
||||||
@@ -124,13 +166,13 @@ _memcpy.destination_segment set 4
|
|||||||
mov ax, 10[bp]; ;
|
mov ax, 10[bp]; ;
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov cx, 12[bp];
|
mov cx, 12[bp];
|
||||||
.memcpy_loop:
|
.label_memcpy_loop:
|
||||||
movsb
|
movsb
|
||||||
cmp cx, 0x0
|
cmp cx, 0x0
|
||||||
je .end
|
je .label_memcpy_end
|
||||||
dec cx
|
dec cx
|
||||||
jmp .loop
|
jmp .label_memcpy_loop
|
||||||
.memcpy_end:
|
.label_memcpy_end:
|
||||||
pop ds
|
pop ds
|
||||||
pop si
|
pop si
|
||||||
pop es
|
pop es
|
||||||
@@ -139,13 +181,12 @@ _memcpy.destination_segment set 4
|
|||||||
pop ax
|
pop ax
|
||||||
pop bp
|
pop bp
|
||||||
|
|
||||||
! 109 endasm
|
! 143 endasm
|
||||||
!BCC_ENDASM
|
!BCC_ENDASM
|
||||||
! 110 # 6 "main.c"
|
! 144 # 6 "main.c"
|
||||||
! 6 }
|
! 6 }
|
||||||
ret
|
ret
|
||||||
! 7 # 1 "std_
|
! 7 # 1 "std_singos/stdio.h"
|
||||||
! 0 singos/stdio.h"
|
|
||||||
! 1 void print(string);
|
! 1 void print(string);
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 2
|
! 2
|
||||||
@@ -341,8 +382,7 @@ ret
|
|||||||
! 12
|
! 12
|
||||||
! 13 #define DEFAULT_ENTRY_SIZE 1
|
! 13 #define DEFAULT_ENTRY_SIZE 1
|
||||||
! 14
|
! 14
|
||||||
! 15 #def
|
! 15 #define NUMBER_OF_MBR_PARTITIONS 4
|
||||||
! 15 ine NUMBER_OF_MBR_PARTITIONS 4
|
|
||||||
! 16
|
! 16
|
||||||
! 17 #define DEFAULT_DATA_POINTER_SIZE 4
|
! 17 #define DEFAULT_DATA_POINTER_SIZE 4
|
||||||
! 18
|
! 18
|
||||||
@@ -428,7 +468,8 @@ ret
|
|||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 71 long this_partition_offset_on_disk[2];
|
! 71 long this_partition_offset_on_disk[2];
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 72 long next_free_sector[2];
|
! 72 long next
|
||||||
|
! 72 _free_sector[2];
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 73 long next_uniqe_id[2];
|
! 73 long next_uniqe_id[2];
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
@@ -482,8 +523,7 @@ _main:
|
|||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 102 void* pointer_parameter_segment;
|
! 102 void* pointer_parameter_segment;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 103 void* pointer_parameter_struct
|
! 103 void* pointer_parameter_struct;
|
||||||
! 103 ;
|
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 104 {
|
! 104 {
|
||||||
! 105
|
! 105
|
||||||
@@ -514,53 +554,55 @@ dec sp
|
|||||||
mov ax,#$8FC0
|
mov ax,#$8FC0
|
||||||
mov -$221A[bp],ax
|
mov -$221A[bp],ax
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 114 long index_as_long;
|
! 114 int path_length;
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 115
|
! 115 long index_as_long;
|
||||||
! 116 char local_path[256];
|
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 117 service_action = selector;
|
! 116
|
||||||
add sp,#-$104
|
! 117 char local_path[256];
|
||||||
! Debug: eq int selector = [S+$2320+2] to int service_action = [S+$2320-$208] (used reg = )
|
!BCC_EOS
|
||||||
|
! 118 service_action = selector;
|
||||||
|
add sp,#-$106
|
||||||
|
! Debug: eq int selector = [S+$2322+2] to int service_action = [S+$2322-$208] (used reg = )
|
||||||
mov ax,4[bp]
|
mov ax,4[bp]
|
||||||
mov -$206[bp],ax
|
mov -$206[bp],ax
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 118
|
! 119
|
||||||
! 119 switch (service_action)
|
! 120 switch (service_action)
|
||||||
mov ax,-$206[bp]
|
mov ax,-$206[bp]
|
||||||
! 120 {
|
! 121 {
|
||||||
br .3
|
br .3
|
||||||
! 121 case SERIVCE_LOAD_DISK:
|
! 122 case SERIVCE_LOAD_DISK:
|
||||||
! 122 {
|
! 123 {
|
||||||
.4:
|
.4:
|
||||||
! 123
|
|
||||||
! 124
|
! 124
|
||||||
! 125
|
! 125
|
||||||
! 126
|
! 126
|
||||||
! 127 index_as_long = pointer_parameter_struct;
|
! 127
|
||||||
! Debug: eq * void pointer_parameter_struct = [S+$2320+6] to long index_as_long = [S+$2320-$2220] (used reg = )
|
! 128 index_as_long = pointer_parameter_struct;
|
||||||
|
! Debug: eq * void pointer_parameter_struct = [S+$2322+6] to long index_as_long = [S+$2322-$2222] (used reg = )
|
||||||
mov ax,8[bp]
|
mov ax,8[bp]
|
||||||
xor bx,bx
|
xor bx,bx
|
||||||
mov -$221E[bp],ax
|
mov -$2220[bp],ax
|
||||||
mov -$221C[bp],bx
|
mov -$221E[bp],bx
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 128 disk_service_read_data_from_disk(index_as_long, 1, &fsci, stack_segment);
|
! 129 disk_service_read_data_from_disk(index_as_long, 1, &fsci, stack_segment);
|
||||||
! Debug: list int stack_segment = [S+$2320-$221C] (used reg = )
|
! Debug: list int stack_segment = [S+$2322-$221C] (used reg = )
|
||||||
push -$221A[bp]
|
push -$221A[bp]
|
||||||
! Debug: list * struct File_System_Control_Information fsci = S+$2322-$206 (used reg = )
|
! Debug: list * struct File_System_Control_Information fsci = S+$2324-$206 (used reg = )
|
||||||
lea bx,-$204[bp]
|
lea bx,-$204[bp]
|
||||||
push bx
|
push bx
|
||||||
! Debug: list int = const 1 (used reg = )
|
! Debug: list int = const 1 (used reg = )
|
||||||
mov ax,*1
|
mov ax,*1
|
||||||
push ax
|
push ax
|
||||||
! Debug: list long index_as_long = [S+$2326-$2220] (used reg = )
|
! Debug: list long index_as_long = [S+$2328-$2222] (used reg = )
|
||||||
push -$221C[bp]
|
|
||||||
push -$221E[bp]
|
push -$221E[bp]
|
||||||
|
push -$2220[bp]
|
||||||
! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
|
! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
|
||||||
call _disk_service_read_data_from_disk
|
call _disk_service_read_data_from_disk
|
||||||
add sp,*$A
|
add sp,*$A
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 129 print("File System has been loaded: ");
|
! 130 print("File System has been loaded: ");
|
||||||
! Debug: list * char = .5+0 (used reg = )
|
! Debug: list * char = .5+0 (used reg = )
|
||||||
mov bx,#.5
|
mov bx,#.5
|
||||||
push bx
|
push bx
|
||||||
@@ -569,12 +611,12 @@ call _print
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 130 print_newline();
|
! 131 print_newline();
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
call _print_newline
|
call _print_newline
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 131 print_stack(fsci.filesystem_information);
|
! 132 print_stack(fsci.filesystem_information);
|
||||||
! Debug: list * char fsci = S+$2320-$206 (used reg = )
|
! Debug: list * char fsci = S+$2322-$206 (used reg = )
|
||||||
lea bx,-$204[bp]
|
lea bx,-$204[bp]
|
||||||
push bx
|
push bx
|
||||||
! Debug: func () void = print_stack+0 (used reg = )
|
! Debug: func () void = print_stack+0 (used reg = )
|
||||||
@@ -582,62 +624,99 @@ call _print_stack
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 132 print_newline();
|
! 133 print_newline();
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
call _print_newline
|
call _print_newline
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 133 } break;
|
! 134 } break;
|
||||||
br .1
|
br .1
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 134 case SERVICE_FIND_ENTRY:
|
! 135 case SERVICE_FIND_ENTRY:
|
||||||
! 135 {
|
! 136 {
|
||||||
.6:
|
.6:
|
||||||
! 136 memcpy(¶meter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
|
! 137 memcpy(¶meter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
|
||||||
! Debug: list int = const $10 (used reg = )
|
! Debug: list int = const $10 (used reg = )
|
||||||
mov ax,*$10
|
mov ax,*$10
|
||||||
push ax
|
push ax
|
||||||
! Debug: list * void pointer_parameter_segment = [S+$2322+4] (used reg = )
|
! Debug: list * void pointer_parameter_segment = [S+$2324+4] (used reg = )
|
||||||
push 6[bp]
|
push 6[bp]
|
||||||
! Debug: list * void pointer_parameter_struct = [S+$2324+6] (used reg = )
|
! Debug: list * void pointer_parameter_struct = [S+$2326+6] (used reg = )
|
||||||
push 8[bp]
|
push 8[bp]
|
||||||
! Debug: list int stack_segment = [S+$2326-$221C] (used reg = )
|
! Debug: list int stack_segment = [S+$2328-$221C] (used reg = )
|
||||||
push -$221A[bp]
|
push -$221A[bp]
|
||||||
! Debug: list * struct Parameter_Struct parameter_struct = S+$2328-$2218 (used reg = )
|
! Debug: list * struct Parameter_Struct parameter_struct = S+$232A-$2218 (used reg = )
|
||||||
lea bx,-$2216[bp]
|
lea bx,-$2216[bp]
|
||||||
push bx
|
push bx
|
||||||
! Debug: func () void = memcpy+0 (used reg = )
|
! Debug: func () void = memcpy+0 (used reg = )
|
||||||
call _memcpy
|
call _memcpy
|
||||||
add sp,*$A
|
add sp,*$A
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 137 dump_ax(parameter_struct.buffer_size);
|
! 138 path_length = strlen(parameter_struct.path, pointer_parameter_segment);
|
||||||
! Debug: list int parameter_struct = [S+$2320-$2210] (used reg = )
|
! Debug: list * void pointer_parameter_segment = [S+$2322+4] (used reg = )
|
||||||
push -$220E[bp]
|
push 6[bp]
|
||||||
! Debug: func () void = dump_ax+0 (used reg = )
|
! Debug: list * char parameter_struct = [S+$2324-$2218] (used reg = )
|
||||||
call _dump_ax
|
push -$2216[bp]
|
||||||
|
! Debug: func () int = strlen+0 (used reg = )
|
||||||
|
call _strlen
|
||||||
|
add sp,*4
|
||||||
|
! Debug: eq int = ax+0 to int path_length = [S+$2322-$221E] (used reg = )
|
||||||
|
mov -$221C[bp],ax
|
||||||
|
!BCC_EOS
|
||||||
|
! 139 memcpy(local_path, stack_segment, parameter_struct.path, pointer_parameter_segment, path_length);
|
||||||
|
! Debug: list int path_length = [S+$2322-$221E] (used reg = )
|
||||||
|
push -$221C[bp]
|
||||||
|
! Debug: list * void pointer_parameter_segment = [S+$2324+4] (used reg = )
|
||||||
|
push 6[bp]
|
||||||
|
! Debug: list * char parameter_struct = [S+$2326-$2218] (used reg = )
|
||||||
|
push -$2216[bp]
|
||||||
|
! Debug: list int stack_segment = [S+$2328-$221C] (used reg = )
|
||||||
|
push -$221A[bp]
|
||||||
|
! Debug: list * char local_path = S+$232A-$2322 (used reg = )
|
||||||
|
lea bx,-$2320[bp]
|
||||||
|
push bx
|
||||||
|
! Debug: func () void = memcpy+0 (used reg = )
|
||||||
|
call _memcpy
|
||||||
|
add sp,*$A
|
||||||
|
!BCC_EOS
|
||||||
|
! 140 local_path[path_length] = 0;
|
||||||
|
! Debug: ptradd int path_length = [S+$2322-$221E] to [$100] char local_path = S+$2322-$2322 (used reg = )
|
||||||
|
mov ax,-$221C[bp]
|
||||||
|
mov bx,bp
|
||||||
|
add bx,ax
|
||||||
|
! Debug: eq int = const 0 to char = [bx-$2320] (used reg = )
|
||||||
|
xor al,al
|
||||||
|
mov -$2320[bx],al
|
||||||
|
!BCC_EOS
|
||||||
|
! 141 print_stack(local_path);
|
||||||
|
! Debug: list * char local_path = S+$2322-$2322 (used reg = )
|
||||||
|
lea bx,-$2320[bp]
|
||||||
|
push bx
|
||||||
|
! Debug: func () void = print_stack+0 (used reg = )
|
||||||
|
call _print_stack
|
||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 138 print_newline();
|
! 142 print_newline();
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
call _print_newline
|
call _print_newline
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 139 disk_service_read_data_from_disk(fsci.master_table_index[0], 16 , ¤t_table, stack_segment);
|
! 143 disk_service_read_data_from_disk(fsci.master_table_index[0], 16 , ¤t_table, stack_segment);
|
||||||
! Debug: list int stack_segment = [S+$2320-$221C] (used reg = )
|
! Debug: list int stack_segment = [S+$2322-$221C] (used reg = )
|
||||||
push -$221A[bp]
|
push -$221A[bp]
|
||||||
! Debug: list * struct Directory_Table current_table = S+$2322-$2208 (used reg = )
|
! Debug: list * struct Directory_Table current_table = S+$2324-$2208 (used reg = )
|
||||||
lea bx,-$2206[bp]
|
lea bx,-$2206[bp]
|
||||||
push bx
|
push bx
|
||||||
! Debug: list int = const $10 (used reg = )
|
! Debug: list int = const $10 (used reg = )
|
||||||
mov ax,*$10
|
mov ax,*$10
|
||||||
push ax
|
push ax
|
||||||
! Debug: list long fsci = [S+$2326-$106] (used reg = )
|
! Debug: list long fsci = [S+$2328-$106] (used reg = )
|
||||||
push -$102[bp]
|
push -$102[bp]
|
||||||
push -$104[bp]
|
push -$104[bp]
|
||||||
! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
|
! Debug: func () int = disk_service_read_data_from_disk+0 (used reg = )
|
||||||
call _disk_service_read_data_from_disk
|
call _disk_service_read_data_from_disk
|
||||||
add sp,*$A
|
add sp,*$A
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 140 print("Current table: ");
|
! 144 print("Current table: ");
|
||||||
! Debug: list * char = .7+0 (used reg = )
|
! Debug: list * char = .7+0 (used reg = )
|
||||||
mov bx,#.7
|
mov bx,#.7
|
||||||
push bx
|
push bx
|
||||||
@@ -646,12 +725,13 @@ call _print
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 141 print_newline();
|
! 145 print_newline(
|
||||||
|
! 145 );
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
call _print_newline
|
call _print_newline
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 142 print_stack(current_table.entries[0].filename);
|
! 146 print_stack(current_table.entries[0].filename);
|
||||||
! Debug: list * char current_table = S+$2320-$2208 (used reg = )
|
! Debug: list * char current_table = S+$2322-$2208 (used reg = )
|
||||||
lea bx,-$2206[bp]
|
lea bx,-$2206[bp]
|
||||||
push bx
|
push bx
|
||||||
! Debug: func () void = print_stack+0 (used reg = )
|
! Debug: func () void = print_stack+0 (used reg = )
|
||||||
@@ -659,45 +739,45 @@ call _print_stack
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 143 print_newline();
|
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
|
||||||
call _print_newline
|
|
||||||
!BCC_EOS
|
|
||||||
! 144 print_stack(current_table.entries[1].filename);
|
|
||||||
! Debug: list * char current_table = S+$2320-$2008 (used reg = )
|
|
||||||
lea bx,-$2006[bp]
|
|
||||||
push bx
|
|
||||||
! Debug: func () void = print_stack+0 (used reg = )
|
|
||||||
call _print_stack
|
|
||||||
inc sp
|
|
||||||
inc sp
|
|
||||||
!BCC_EOS
|
|
||||||
! 145 print_newline();
|
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
|
||||||
call _print_newline
|
|
||||||
!BCC_EOS
|
|
||||||
! 146 print_stack(current_table.entries[2].filename);
|
|
||||||
! Debug: list * char current_table = S+$2320-$1E08 (used reg = )
|
|
||||||
lea bx,-$1E06[bp]
|
|
||||||
push bx
|
|
||||||
! Debug: func () void = print_stack+0 (used reg = )
|
|
||||||
call _print_stack
|
|
||||||
inc sp
|
|
||||||
inc sp
|
|
||||||
!BCC_EOS
|
|
||||||
! 147 print_newline();
|
! 147 print_newline();
|
||||||
! Debug: func () void = print_newline+0 (used reg = )
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
call _print_newline
|
call _print_newline
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 148 } break;
|
! 148 print_stack(current_table.entries[1].filename);
|
||||||
|
! Debug: list * char current_table = S+$2322-$2008 (used reg = )
|
||||||
|
lea bx,-$2006[bp]
|
||||||
|
push bx
|
||||||
|
! Debug: func () void = print_stack+0 (used reg = )
|
||||||
|
call _print_stack
|
||||||
|
inc sp
|
||||||
|
inc sp
|
||||||
|
!BCC_EOS
|
||||||
|
! 149 print_newline();
|
||||||
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
|
call _print_newline
|
||||||
|
!BCC_EOS
|
||||||
|
! 150 print_stack(current_table.entries[2].filename);
|
||||||
|
! Debug: list * char current_table = S+$2322-$1E08 (used reg = )
|
||||||
|
lea bx,-$1E06[bp]
|
||||||
|
push bx
|
||||||
|
! Debug: func () void = print_stack+0 (used reg = )
|
||||||
|
call _print_stack
|
||||||
|
inc sp
|
||||||
|
inc sp
|
||||||
|
!BCC_EOS
|
||||||
|
! 151 print_newline();
|
||||||
|
! Debug: func () void = print_newline+0 (used reg = )
|
||||||
|
call _print_newline
|
||||||
|
!BCC_EOS
|
||||||
|
! 152 } break;
|
||||||
jmp .1
|
jmp .1
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 149 case SERIVCE_READ_DATA:
|
! 153 case SERIVCE_READ_DATA:
|
||||||
! 150 {
|
! 154 {
|
||||||
.8:
|
.8:
|
||||||
! 151 # 159
|
! 155 # 163
|
||||||
! 159
|
! 163
|
||||||
! 160 print("Hit READ case");
|
! 164 print("Hit READ case");
|
||||||
! Debug: list * char = .9+0 (used reg = )
|
! Debug: list * char = .9+0 (used reg = )
|
||||||
mov bx,#.9
|
mov bx,#.9
|
||||||
push bx
|
push bx
|
||||||
@@ -706,28 +786,28 @@ call _print
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 161 } break;
|
|
||||||
jmp .1
|
|
||||||
!BCC_EOS
|
|
||||||
! 162 case SERIVCE_WRITE_DATA:
|
|
||||||
! 163 {
|
|
||||||
.A:
|
|
||||||
! 164 print("Hit WRITE case");
|
|
||||||
! Debug: list * char = .B+0 (used reg = )
|
|
||||||
mov bx,#.B
|
|
||||||
push bx
|
|
||||||
! Debug: func () void = print+0 (used reg = )
|
|
||||||
call _print
|
|
||||||
inc sp
|
|
||||||
inc sp
|
|
||||||
!BCC_EOS
|
|
||||||
! 165 } break;
|
! 165 } break;
|
||||||
jmp .1
|
jmp .1
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 166 default:
|
! 166 case SERIVCE_WRITE_DATA:
|
||||||
! 167 {
|
! 167 {
|
||||||
|
.A:
|
||||||
|
! 168 print("Hit WRITE case");
|
||||||
|
! Debug: list * char = .B+0 (used reg = )
|
||||||
|
mov bx,#.B
|
||||||
|
push bx
|
||||||
|
! Debug: func () void = print+0 (used reg = )
|
||||||
|
call _print
|
||||||
|
inc sp
|
||||||
|
inc sp
|
||||||
|
!BCC_EOS
|
||||||
|
! 169 } break;
|
||||||
|
jmp .1
|
||||||
|
!BCC_EOS
|
||||||
|
! 170 default:
|
||||||
|
! 171 {
|
||||||
.C:
|
.C:
|
||||||
! 168 print("Default case");
|
! 172 print("Default case");
|
||||||
! Debug: list * char = .D+0 (used reg = )
|
! Debug: list * char = .D+0 (used reg = )
|
||||||
mov bx,#.D
|
mov bx,#.D
|
||||||
push bx
|
push bx
|
||||||
@@ -736,10 +816,10 @@ call _print
|
|||||||
inc sp
|
inc sp
|
||||||
inc sp
|
inc sp
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 169 }
|
! 173 }
|
||||||
! 170 }
|
! 174 }
|
||||||
! 171
|
! 175
|
||||||
! 172 return 0;
|
! 176 return 0;
|
||||||
jmp .1
|
jmp .1
|
||||||
.3:
|
.3:
|
||||||
sub ax,*1
|
sub ax,*1
|
||||||
@@ -752,7 +832,7 @@ sub ax,*1
|
|||||||
je .A
|
je .A
|
||||||
jmp .C
|
jmp .C
|
||||||
.1:
|
.1:
|
||||||
..FFFF = -$2320
|
..FFFF = -$2322
|
||||||
xor ax,ax
|
xor ax,ax
|
||||||
lea sp,-4[bp]
|
lea sp,-4[bp]
|
||||||
pop si
|
pop si
|
||||||
@@ -760,9 +840,9 @@ pop di
|
|||||||
pop bp
|
pop bp
|
||||||
ret
|
ret
|
||||||
!BCC_EOS
|
!BCC_EOS
|
||||||
! 173
|
! 177
|
||||||
! 174 }
|
! 178 }
|
||||||
! 175
|
! 179
|
||||||
! Register BX used in function main
|
! Register BX used in function main
|
||||||
.D:
|
.D:
|
||||||
.E:
|
.E:
|
||||||
|
|||||||
+44
-10
@@ -1,6 +1,40 @@
|
|||||||
void strcpy (destination, destination_segment, source, source_segment );
|
void strcpy (destination, destination_segment, source, source_segment );
|
||||||
|
int strlen (source, source_segment);
|
||||||
void memcpy (destination, destination_segment, source, source_segment, num_bytes );
|
void memcpy (destination, destination_segment, source, source_segment, num_bytes );
|
||||||
|
|
||||||
|
int strlen (source, source_segment)
|
||||||
|
{
|
||||||
|
#asm
|
||||||
|
#define strlen_SOURCE 4[bp];
|
||||||
|
#define strlen_SOURCE_SEGMENT 6[bp];
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
push ds
|
||||||
|
push bx
|
||||||
|
|
||||||
|
mov ax, strlen_SOURCE_SEGMENT
|
||||||
|
mov ds, ax
|
||||||
|
|
||||||
|
mov bx, strlen_SOURCE
|
||||||
|
|
||||||
|
label_strlen:
|
||||||
|
mov cx, #0x0 ; Set counte to zero
|
||||||
|
.label_strlen_loop:
|
||||||
|
mov BYTE al, [bx]
|
||||||
|
cmp al, #0x0
|
||||||
|
je .label_strlen_done
|
||||||
|
inc cx ; Count 1
|
||||||
|
inc bx ; Look at next char
|
||||||
|
jmp .label_strlen_loop
|
||||||
|
.label_strlen_done:
|
||||||
|
mov ax, cx
|
||||||
|
|
||||||
|
pop bx
|
||||||
|
pop ds
|
||||||
|
pop bp
|
||||||
|
#endasm
|
||||||
|
}
|
||||||
|
|
||||||
void strcpy (destination, destination_segment, source, source_segment )
|
void strcpy (destination, destination_segment, source, source_segment )
|
||||||
char *destination;
|
char *destination;
|
||||||
int destination_segment;
|
int destination_segment;
|
||||||
@@ -20,7 +54,7 @@ int source_segment;
|
|||||||
|
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
stringcompare:
|
label_strcpy:
|
||||||
push ax
|
push ax
|
||||||
push bx
|
push bx
|
||||||
push di
|
push di
|
||||||
@@ -36,13 +70,13 @@ int source_segment;
|
|||||||
mov ax, SOURCE_SEGMENT;
|
mov ax, SOURCE_SEGMENT;
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov cx, 0x050 // TODO(Jørn) Hardcded number of bytes to copy
|
mov cx, 0x050 // TODO(Jørn) Hardcded number of bytes to copy
|
||||||
.loop:
|
.label_strcpy_loop:
|
||||||
movsb
|
movsb
|
||||||
cmp cx, 0x0
|
cmp cx, 0x0
|
||||||
je .end
|
je .label_strcpy_end
|
||||||
dec cx
|
dec cx
|
||||||
jmp .loop
|
jmp .label_strcpy_loop
|
||||||
.end:
|
.label_strcpy_end:
|
||||||
pop ds
|
pop ds
|
||||||
pop si
|
pop si
|
||||||
pop es
|
pop es
|
||||||
@@ -75,7 +109,7 @@ int num_bytes;
|
|||||||
|
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
memcpy:
|
label_memcpy:
|
||||||
push ax
|
push ax
|
||||||
push bx
|
push bx
|
||||||
push di
|
push di
|
||||||
@@ -91,13 +125,13 @@ int num_bytes;
|
|||||||
mov ax, SOURCE_SEGMENT;
|
mov ax, SOURCE_SEGMENT;
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov cx, NUM_BYTES
|
mov cx, NUM_BYTES
|
||||||
.memcpy_loop:
|
.label_memcpy_loop:
|
||||||
movsb
|
movsb
|
||||||
cmp cx, 0x0
|
cmp cx, 0x0
|
||||||
je .end
|
je .label_memcpy_end
|
||||||
dec cx
|
dec cx
|
||||||
jmp .loop
|
jmp .label_memcpy_loop
|
||||||
.memcpy_end:
|
.label_memcpy_end:
|
||||||
pop ds
|
pop ds
|
||||||
pop si
|
pop si
|
||||||
pop es
|
pop es
|
||||||
|
|||||||
Reference in new issue
Block a user