Properly access directory when launching files
This commit is contained in:
parent
572362f04f
commit
bd9a62c1ce
|
@ -5,6 +5,8 @@ GLOBAL_DIRENTS equ 0x2000
|
|||
|
||||
FS_DIRENT_SIZE equ 32
|
||||
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
|
||||
|
||||
COLUMNS equ 80
|
||||
|
|
16
shell.asm
16
shell.asm
|
@ -396,6 +396,8 @@ click:
|
|||
sub ax, [si + window.y]
|
||||
jz .end
|
||||
dec ax
|
||||
cmp ax, FS_DIRECTORY_DIRENTS
|
||||
jae .end
|
||||
|
||||
push ds
|
||||
|
||||
|
@ -406,9 +408,15 @@ click:
|
|||
mul bp
|
||||
mov si, GLOBAL_DIRENTS
|
||||
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
|
||||
add si, FS_DIRENT_NAME_OFFSET
|
||||
mov di, launch_filename
|
||||
mov cx, FS_DIRENT_NAME_SIZE
|
||||
rep movsb
|
||||
|
@ -752,11 +760,11 @@ print_ls:
|
|||
|
||||
push cx
|
||||
push di
|
||||
mov si, GLOBAL_DIRENTS + 2
|
||||
mov si, GLOBAL_DIRENTS + FS_DIRENT_NAME_OFFSET
|
||||
|
||||
xor ax, ax ; Maximum filename size
|
||||
.name_loop:
|
||||
cmp word [ds:si - 2], 0
|
||||
cmp word [ds:si - FS_DIRENT_NAME_OFFSET], 0
|
||||
je .done_names
|
||||
|
||||
push cx
|
||||
|
@ -789,7 +797,7 @@ print_ls:
|
|||
add di, dx
|
||||
|
||||
add si, FS_DIRENT_SIZE
|
||||
cmp si, GLOBAL_DIRENTS + 0x200
|
||||
cmp si, GLOBAL_DIRENTS + FS_DIRECTORY_DIRENTS*FS_DIRENT_SIZE
|
||||
jge .done_names
|
||||
|
||||
dec cx
|
||||
|
|
Loading…
Reference in New Issue