Fix rootdir.asm re-using potentially wrong DS

This commit is contained in:
Nero 2021-03-19 19:26:38 +00:00
parent 5e3ae0aa08
commit b617709684
2 changed files with 8 additions and 3 deletions

View File

@ -33,6 +33,8 @@ fcbdrv push ds
inc dl
mov [si], dl ; 1-based
.log dec dl
mov ax, cs
mov ds, ax
call logdrv ; 0-based
pop dx
pop ds

View File

@ -46,7 +46,7 @@ fndnxt mov bp, sp
mov ax, [es:di+FCBSIZ]
inc word [es:di+FCBSIZ]
; bail out if we are at end of dir
cmp ax, [bpb+BPBRDE]
cmp ax, [cs:bpb+BPBRDE]
jnc .err
; load entry and first byte
push ds
@ -58,7 +58,7 @@ fndnxt mov bp, sp
test byte [cs:di+0x0B], 0xDA
jnz .loop
; bail out if end of dir
mov al, [di]
mov al, [cs:di]
cmp al, 0
je .err
; next if deleted entry
@ -85,11 +85,13 @@ fndnxt mov bp, sp
movsb
; copy filename
push ds
push si
mov ax, cs
mov ds, ax
mov si, bx
mov cx, 11
rep movsb
pop si
pop ds
; done!
xor ax, ax
@ -103,7 +105,8 @@ open call fndfst
test al, al
jnz .ret
; read start cluster
mov ax, [cs:bx+26]
mov ax, [cs:bx+0x1A]
mov bx, dx
mov [ds:bx+FCBCLUS], ax
; reset record number
mov byte [ds:bx+FCBRN], 0