Properly access directory when launching files
This commit is contained in:
parent
572362f04f
commit
bd9a62c1ce
2 changed files with 14 additions and 4 deletions
|
@ -5,6 +5,8 @@ GLOBAL_DIRENTS equ 0x2000
|
||||||
|
|
||||||
FS_DIRENT_SIZE equ 32
|
FS_DIRENT_SIZE equ 32
|
||||||
FS_DIRENT_NAME_SIZE equ 30
|
FS_DIRENT_NAME_SIZE equ 30
|
||||||
|
FS_DIRENT_NAME_OFFSET equ 2
|
||||||
|
FS_DIRECTORY_DIRENTS equ 512/FS_DIRENT_SIZE
|
||||||
FS_FILE_MAX_SIZE equ 128
|
FS_FILE_MAX_SIZE equ 128
|
||||||
|
|
||||||
COLUMNS equ 80
|
COLUMNS equ 80
|
||||||
|
|
16
shell.asm
16
shell.asm
|
@ -396,6 +396,8 @@ click:
|
||||||
sub ax, [si + window.y]
|
sub ax, [si + window.y]
|
||||||
jz .end
|
jz .end
|
||||||
dec ax
|
dec ax
|
||||||
|
cmp ax, FS_DIRECTORY_DIRENTS
|
||||||
|
jae .end
|
||||||
|
|
||||||
push ds
|
push ds
|
||||||
|
|
||||||
|
@ -406,9 +408,15 @@ click:
|
||||||
mul bp
|
mul bp
|
||||||
mov si, GLOBAL_DIRENTS
|
mov si, GLOBAL_DIRENTS
|
||||||
add si, ax
|
add si, ax
|
||||||
add si, 2 ; File name begins two bytes into the start of the dirent
|
|
||||||
|
cmp word [si], 0
|
||||||
|
jne .dirent_present
|
||||||
|
pop ds
|
||||||
|
jmp .end
|
||||||
|
.dirent_present:
|
||||||
|
|
||||||
; Copy file name to launch_filename
|
; Copy file name to launch_filename
|
||||||
|
add si, FS_DIRENT_NAME_OFFSET
|
||||||
mov di, launch_filename
|
mov di, launch_filename
|
||||||
mov cx, FS_DIRENT_NAME_SIZE
|
mov cx, FS_DIRENT_NAME_SIZE
|
||||||
rep movsb
|
rep movsb
|
||||||
|
@ -752,11 +760,11 @@ print_ls:
|
||||||
|
|
||||||
push cx
|
push cx
|
||||||
push di
|
push di
|
||||||
mov si, GLOBAL_DIRENTS + 2
|
mov si, GLOBAL_DIRENTS + FS_DIRENT_NAME_OFFSET
|
||||||
|
|
||||||
xor ax, ax ; Maximum filename size
|
xor ax, ax ; Maximum filename size
|
||||||
.name_loop:
|
.name_loop:
|
||||||
cmp word [ds:si - 2], 0
|
cmp word [ds:si - FS_DIRENT_NAME_OFFSET], 0
|
||||||
je .done_names
|
je .done_names
|
||||||
|
|
||||||
push cx
|
push cx
|
||||||
|
@ -789,7 +797,7 @@ print_ls:
|
||||||
add di, dx
|
add di, dx
|
||||||
|
|
||||||
add si, FS_DIRENT_SIZE
|
add si, FS_DIRENT_SIZE
|
||||||
cmp si, GLOBAL_DIRENTS + 0x200
|
cmp si, GLOBAL_DIRENTS + FS_DIRECTORY_DIRENTS*FS_DIRENT_SIZE
|
||||||
jge .done_names
|
jge .done_names
|
||||||
|
|
||||||
dec cx
|
dec cx
|
||||||
|
|
Loading…
Reference in a new issue