Browse Source

lsfs_16-bit now includes its own print functions

pull/2/head
Jørn Guldberg 4 years ago
parent
commit
0f6e818ff6
6 changed files with 306 additions and 349 deletions
  1. BIN
      disk.out
  2. +0
    -8
      driver/disk.h
  3. +0
    -2
      implementation/lsfs.c
  4. +2
    -11
      main.c
  5. +253
    -325
      main.s
  6. +51
    -3
      std_singos/stdio.h

BIN
disk.out View File


+ 0
- 8
driver/disk.h View File

@ -19,25 +19,17 @@ unsigned int data_buffer_segment;
pusha
lsfs_load_data:
mov ax, index
call 0x0000:0x7C2A
mov WORD [DAPACK.lba_addr_dw_low], ax
mov bx, number_sectors
mov ax, bx
call 0x0000:0x7C2A
mov WORD [DAPACK.blkcnt], bx
mov cx, data_buffer_segment
mov ax, cx
call 0x0000:0x7C2A
mov WORD [DAPACK.db_addr_segment], cx
mov dx, data_buffer;
mov ax, dx
call 0x0000:0x7C2A
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

+ 0
- 2
implementation/lsfs.c View File

@ -91,7 +91,6 @@ unsigned int data_segment;
int data_pointer_index = 0; /* start at first data pointer. */
dump_ax(file->size);
if (data_length > buffer_size)
{
data_length = buffer_size;
@ -121,7 +120,6 @@ unsigned int data_segment;
}
disk_service_read_data_from_disk(file->data_pointer[data_pointer_index], DEFAULT_DATA_POINTER_SIZE, tmp_buffer, 0x7e0);
print_newline();
dump_ax(file->data_pointer[data_pointer_index]);
print_newline();
memcpy((data + amount_read), data_segment, tmp_buffer, 0x7e0, amount_to_read);
data_length -= amount_to_read;

+ 2
- 11
main.c View File

@ -1,7 +1,3 @@
/* Adress to dump ax, 7C2A*/
/* Address to print 7C47*/
/* */
/* */
#include "main.h"
@ -43,7 +39,6 @@ void* pointer_parameter_struct;
print_newline();
print(fsci->filesystem_information);
print_newline();
dump_ax(fsci->master_table_index[0]);
print_newline();
} break;
case SERVICE_FIND_ENTRY:
@ -51,8 +46,8 @@ void* pointer_parameter_struct;
String_Array *path_array;
lsfs_file* find_file;
int i;
dump_ax(fsci->master_table_index[0]);
disk_service_read_data_from_disk(fsci->master_table_index[0], (long) DEFAULT_TABLE_SIZE, &current_table, stack_segment);
/*
print("Current table: ");
print_newline();
print_stack(current_table.entries[0].filename);
@ -61,11 +56,10 @@ void* pointer_parameter_struct;
print_newline();
print_stack(current_table.entries[2].filename);
print_newline();
*/
memcpy(&parameter_struct, stack_segment, pointer_parameter_struct, pointer_parameter_segment, sizeof(Parameter_Struct));
path_length = strlen(parameter_struct.path, pointer_parameter_segment);
dump_ax(path_length);
local_path = malloc(256);
memcpy(local_path, local_segment, parameter_struct.path, pointer_parameter_segment, path_length);
local_path[path_length] = 0;
@ -90,13 +84,10 @@ void* pointer_parameter_struct;
print(find_file->filename);
print_newline();
print("Kernel file id: ");
dump_ax(find_file->file_id[0]);
print_newline();
print("Kernel file size: ");
dump_ax(find_file->size[0]);
print_newline();
print("Kernel first data pointer: ");
dump_ax(find_file->data_pointer[0]);
lsfs_disk_read_data_from_file(find_file, 0xffff, 0x00, (long) 0x0, 0x50);

+ 253
- 325
main.s
File diff suppressed because it is too large
View File


+ 51
- 3
std_singos/stdio.h View File

@ -8,11 +8,27 @@ char* string;
push bp
mov bp,sp
mov si,4[bp]
call 0x0000:0x7C47
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
new_print_print:
; Prints string in si
; IN si: zero terminated string to print
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah, #0xE ; Specify 'int 0x10' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
.new_print_printchar:
lodsb ; Load byte at address SI into AL, and increment SI
test al, al
jz .new_print_done ; If the character is zero (NUL), stop writing the string
int #0x10 ; Otherwise, print the character via 'int 0x10'
jmp .new_print_printchar ; Repeat for the next character
.new_print_done:
pop bp
#endasm
}
void print_stack(argument)
{
#asm
@ -24,7 +40,20 @@ void print_stack(argument)
mov ax, ss
mov ds, ax
mov si,4[bp]
call 0x0000:0x7C47
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print_stack_print:
; Prints string in si
; IN si: zero terminated string to print
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah, #0xE ; Specify 'int 0x10' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
.print_stack_printchar:
lodsb ; Load byte at address SI into AL, and increment SI
test al, al
jz .print_stack_done ; If the character is zero (NUL), stop writing the string
int #0x10 ; Otherwise, print the character via 'int 0x10'
jmp .print_stack_printchar ; Repeat for the next character
.print_stack_done:
pop ax
pop ds
@ -45,7 +74,26 @@ void* input;
#asm
push bp
mov bp,sp
call 0x000:0x7C2A
pusha ; save registers
mov bx, ax
mov ah, #0xE ; Teletype output
mov cx, #4 ; 4 nipples in a 16 bit word
.dump_ax_loop:
rol bx, #4 ; rotate to next nipple
mov al, bl ; we copy to al because we need to mask only the low 4 bits
and al, #%1111 ; Do the masking
add al, #48 ; convert to ASCII
cmp al, #57 ; If we are greater than 9 ascii, we add 7 to make digit 10 be represented as 'A'
jbe .dump_ax_skip ; -|-
add al, #7 ; -|-
.dump_ax_skip: ; -|-
int #0x10 ; BIOS call 'output'
loop .dump_ax_loop
popa ; restore registers
pop bp
#endasm
}

Loading…
Cancel
Save