Просмотр исходного кода

lsfs format is updated, svim updated to handle the correct size of file

pull/3/head
Jørn Guldberg 5 лет назад
Родитель
Сommit
296807eb68
5 измененных файлов: 70 добавлений и 39 удалений
  1. +43
    -13
      filesystems/lsfs/lsfs.nasm
  2. +1
    -1
      filesystems/lsfs/test_lsfs.nasm
  3. +2
    -2
      kernel.nasm
  4. +9
    -8
      lib/svim.nasm
  5. +15
    -15
      vbr.nasm

+ 43
- 13
filesystems/lsfs/lsfs.nasm Просмотреть файл

@ -121,6 +121,8 @@ lsfs_read_file:
int 0x13
popa
mov ax, [lsfs_loading_buffer + 264]
ret
@ -128,16 +130,25 @@ lsfs_write_file:
; INPUT ax = file index
; INPUT bx = filebuffer
; INOUT cx = file size
pusha ; save all register state
; We need to find the data pointers for the file.
push bx
push bp
mov bp, sp
sub sp, 6
%define var_file_id [bp - 0]
%define var_file_buffer [bp - 2]
%define var_file_size [bp - 4]
mov var_file_buffer, bx
mov var_file_size, cx
mov dx, LSFS_magic_start_sector
add ax, dx ; senctor number, into the master Table.
mov var_file_id, ax
call dumpax
mov WORD [DAPACK.db_addr_offset], lsfs_loading_buffer
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x1 ; Read to sectors, that is what the space is for the buffer in svim
@ -146,10 +157,9 @@ lsfs_write_file:
mov ah, 0x42 ; READ
mov dl, [global_disk_identifier]
int 0x13
pop bx
; Save the buffer addr
mov bx, var_file_buffer
mov WORD [DAPACK.db_addr_offset], bx
mov bx, [lsfs_loading_buffer + 288] ; this is the first data pointer
mov WORD [DAPACK.lba_addr_dw_low], bx
@ -157,10 +167,25 @@ lsfs_write_file:
mov WORD [DAPACK.blkcnt], 0x4 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [DAPACK.db_addr_segment], 0x50
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x43 ; READ
mov ah, 0x43 ; WRITE
mov dl, [global_disk_identifier]
int 0x13
mov ax, var_file_id
mov bx, var_file_size
mov [lsfs_loading_buffer + 264], bx
mov WORD [DAPACK.db_addr_offset], lsfs_loading_buffer
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x1 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [DAPACK.db_addr_segment], 0x50
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x43 ; WRITE
mov dl, [global_disk_identifier]
int 0x13
mov sp, bp
pop bp
popa
ret
@ -248,7 +273,7 @@ lsfs_create_file:
mov [.new_file_data_pointer], bx
mov ax, [lsfs_loading_buffer + 508]
mov [.to_write_fileindex], ax
mov [.to_write_fileindex_16_bit_part], ax
add DWORD [lsfs_loading_buffer + 510], 4 ; First save the data pointer, and then add 4 sectors to get the next free sectors.
add DWORD [lsfs_loading_buffer + 508], 1 ; Increment since we are creating a new file.
@ -272,7 +297,7 @@ lsfs_create_file:
mov bx, ds
mov es, bx
mov ax, [.to_write_fileindex] ; The number of files in the system
mov ax, [.to_write_fileindex_16_bit_part] ; The number of files in the system
add ax, LSFS_magic_start_sector ; The Master Record is at LSFS_magic_start_sector, plus the file index, then we have the sector where the file information has to be placed.
mov WORD [DAPACK.lba_addr_dw_low], ax
@ -291,12 +316,17 @@ lsfs_create_file:
.new_filename_buffer times 256 db 0
;.file_id:
.to_write_fileindex dw 2
.to_write_fileindex_16_bit_part dw 0
.to_write_fileindex dw 0, 0, 0
;.file_size
.new_file_size dw 4
.new_file_size dw 0, 0, 0
.new_file_size_16_bit_part dw 0
.ext_file_data dw 0, 0, 0, 0
.control_bits dw 0, 0, 0, 0
;.file_data_pointers
.new_file_data_pointer dw 0
times 250 db 0
times 222 db 0
lsfs_list_files_command:
; This function takes the adress of the first sector of the disk
@ -336,7 +366,7 @@ lsfs_list_files_command:
mov dl, [global_disk_identifier]
int 0x13
mov ax, [lsfs_loading_buffer + 262]
mov ax, [lsfs_loading_buffer + 256]
mov bx, ax
mov cx, ' '
mov dx, 'X'

+ 1
- 1
filesystems/lsfs/test_lsfs.nasm Просмотреть файл

@ -1,7 +1,7 @@
BITS 16
%define LSFS_magic_start_sector 24
;This is for the FSCI, where this is stored on the disk.
lsfs_format_disk_buffer db 'LSFS v0.0.13-exp', 13, 10, '(LessSimpelFileSystem)', 13, 10, 'Developed to SingOS', 13, 10, 'by Jorn Guldberg', 13, 10, 0 ; 66 chars + 8 bytes
lsfs_format_disk_buffer db 'LSFS v0.1.1-exp', 13, 10, '(LessSimpelFileSystem)', 13, 10, 'Developed to SingOS', 13, 10, 'by Jorn Guldberg', 13, 10, 0 ; 66 chars + 8 bytes
times 506-($-$$) db 0
dw LSFS_magic_start_sector, 3, 2306 ; Start index, number of files, next free index
; 4 is right now the next number of file

+ 2
- 2
kernel.nasm Просмотреть файл

@ -283,7 +283,7 @@ global_vars:
; this is the bios ID
data:
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS VERSION 0.0.4.4-exp #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS VERSION 0.0.4.5-exp #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
exit_message db 13, 10, 'Goodbye from SingOS',13,10,'The system has halted.', 0
command_line db 13, 10, 'groot@SingOS $ ', 0
number_one_zstring db '71', 0
@ -300,4 +300,4 @@ data:
times ((1<<20)-($-$$) - 26) db 0 ; sector 258 to sector 2048 should be avaliable to the filesystem.
magic_string_end_of_SingOS_kernel db '** END OF KERNEL SingOS **'
times ((1<<23)-($-$$)) db 0
times ((1<<24)-($-$$)) db 0

+ 9
- 8
lib/svim.nasm Просмотреть файл

@ -138,9 +138,9 @@ svim:
mov bx, [.buffer_for_svim_base]
call lsfs_read_file
mov bx, [.buffer_for_svim_base]
add bx, svim_magic_buffer_size - 2
mov ax, [bx]
;mov bx, [.buffer_for_svim_base]
;add bx, svim_magic_buffer_size - 2
;mov ax, [bx]
mov [.buffer_counter_svim], ax
; print buffer
mov si, [.buffer_for_svim_base]
@ -194,13 +194,14 @@ svim:
int 0x10 ; print char
jmp .svim_loop
.end_svim:
mov ax, [.buffer_counter_svim]
mov bx, [.buffer_for_svim_base]
add bx, svim_magic_buffer_size - 2
mov [bx], ax
;mov bx, [.buffer_for_svim_base]
;add bx, svim_magic_buffer_size - 2
;mov [bx], ax
mov ax, [.fileindex_for_open_file]
mov bx, [.buffer_for_svim_base]
mov cx, [.buffer_counter_svim]
call lsfs_write_file
call os_clear_screen
@ -243,7 +244,7 @@ svim:
.debug_buffer_counter db 'Buffer count: %d', 13, 10, 0
.welcome_svim db 'Vim like text editor for SingOS, ESC to exit', 0
.welcome_svim_select_file db 'svim v0.0.3 - Open file: ', 0
.welcome_svim_select_file db 'svim v0.0.5 - Open file: ', 0
.welcome_svim_enter_fileindex db 'Enter fileindex: ', 0
.seperate_line db '________________________________________________________________________________', 0
.fileindex_for_open_file dw 0

+ 15
- 15
vbr.nasm Просмотреть файл

@ -69,8 +69,8 @@ vbr_lfsf:
mov ah, 0x42 ; READ
mov dl, [vbr_disk_identifier]
int 0x13
call dumpax
call DISK_SERVICE
;call dumpax
;call DISK_SERVICE
mov [vbr_disk_identifier], dl
mov al, dl
@ -109,13 +109,13 @@ vbr_lfsf:
mov dl, [vbr_disk_identifier]
int 0x13
call dumpax
;call dumpax
xor ax, ax
mov dl, [vbr_disk_identifier]
mov al, dl
call dumpax
;call dumpax
mov dl, [vbr_disk_identifier]
@ -183,44 +183,44 @@ times 224 db 0
;.file_id:
dw 0x0, 0x0, 0x0, 0x00 ; 64-bits
;.file_size
dw 0x0, 0x0, 0x0, 0x01 ; 64-bits Should be the actual number of bytes.
dw 512, 0x0, 0x0, 0x0 ; 64-bits Should be the actual number of bytes.
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 64-bits
dw 0x0, 0x0, 0x0, 0x0
;.file_data_pointers
dw 88
times 223 db 0
dw 88, 0x0, 0x0, 0x0
times 216 db 0
; Entry Two:
db 'LessSimpelFileSystem', 0
times 235 db 0
;.file_id:
dw 0x0, 0x0, 0x0, 0x1
dw 0x01, 0x0, 0x0, 0x0
;.file_size
dw 0x0, 0x0, 0x0, 0x08
dw 4096, 0x0, 0x0, 0x0
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 64-bits
dw 0x0, 0x0, 0x0, 0x0
;.file_data_pointers
dw 89
times 223 db 0
dw 89, 0x0, 0x0, 0x0
times 216 db 0
; Entry Three:
db 'kernel', 0
times 249 db 0
;.file_id:
dw 0x0, 0x0, 0x0, 0x2
dw 0x02, 0x0, 0x0, 0x0
;.file_size
dw 0x0, 0x0, 0x0, 0x4
dw 0x00, 0x10, 0x0, 0x0
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 64-bits
dw 0x0, 0x0, 0x0, 0x0
;.file_data_pointers
dw 97
times 223 db 0
dw 97, 0x0, 0x0, 0x0
times 216 db 0
times 4096 + (32768-($-$$)) db 0

Загрузка…
Отмена
Сохранить