Properly read the file names from the directory in shell

This commit is contained in:
Juhani Krekelä 2023-03-23 18:21:03 +02:00
parent e9462804f5
commit 572362f04f
1 changed files with 13 additions and 18 deletions

View File

@ -395,30 +395,25 @@ click:
mov ax, bx
sub ax, [si + window.y]
jz .end
dec ax
; Find the start of the line user clicked on
mov bx, [si + window.width]
shl bx, 1
mul bx
push ds
mov si, [si + window.data]
mov bp, PONYDOS_SEG
mov ds, bp
mov bp, FS_DIRENT_SIZE
mul bp
mov si, GLOBAL_DIRENTS
add si, ax
; Zero out launch_filename
mov di, launch_filename
mov cx, FS_DIRENT_NAME_SIZE
xor al, al
rep stosb
add si, 2 ; File name begins two bytes into the start of the dirent
; Copy file name to launch_filename
mov di, launch_filename
.copy_filename_loop:
lodsw
test al, al
jz .copy_filename_loop_end
stosb
jmp .copy_filename_loop
.copy_filename_loop_end:
mov cx, FS_DIRENT_NAME_SIZE
rep movsb
pop ds
call launch