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 inc dl
mov [si], dl ; 1-based mov [si], dl ; 1-based
.log dec dl .log dec dl
mov ax, cs
mov ds, ax
call logdrv ; 0-based call logdrv ; 0-based
pop dx pop dx
pop ds pop ds

View File

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