From: Robert Pengelly Date: Mon, 5 Aug 2024 10:25:35 +0000 (+0100) Subject: Prev cluster must be zero not 2 for FAT32 directory entry and update info sector... X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=9d52e1d64dc2091283052044470c8a2e56b087c9;p=chimaera.git Prev cluster must be zero not 2 for FAT32 directory entry and update info sector for FAT32 --- diff --git a/build/chimaera.img b/build/chimaera.img index c8767c1..759b619 100644 Binary files a/build/chimaera.img and b/build/chimaera.img differ diff --git a/build/chimaera.vhd b/build/chimaera.vhd index 38de489..f3a04cb 100644 Binary files a/build/chimaera.vhd and b/build/chimaera.vhd differ diff --git a/src/Makefile.unix b/src/Makefile.unix index 5fc7711..ad0e40e 100644 --- a/src/Makefile.unix +++ b/src/Makefile.unix @@ -48,5 +48,5 @@ chimaera.vhd: all utils/dosfstools/mcopy --arca --offset 17 -i $@ apps/pcomm/pcomm.com ::command.com run-qemu: chimaera.img chimaera.vhd - qemu-system-i386 -cpu 486 -drive file="chimaera.img",format=raw,if=floppy,index=0 -m 4M +# qemu-system-i386 -cpu 486 -drive file="chimaera.img",format=raw,if=floppy,index=0 -m 4M qemu-system-i386 -cpu 486 -drive file="chimaera.vhd",format=raw,if=ide,index=0 -m 4M diff --git a/src/kernel/make.asm b/src/kernel/make.asm index 741438f..4216d22 100644 --- a/src/kernel/make.asm +++ b/src/kernel/make.asm @@ -116,6 +116,26 @@ _make_dos_entry: mov word ptr [bp - 48], ax mov word ptr [bp - 46], dx + cmp dx, cs:[_root_cluster + 2] + jne _make_dos_entry.got_prev + + cmp ax, cs:[_root_cluster] + jne _make_dos_entry.got_prev + + push ax + push dx + + xor ax, ax + xor dx, dx + + mov word ptr [bp - 48], ax + mov word ptr [bp - 46], dx + + pop dx + pop ax + +_make_dos_entry.got_prev: + mov word ptr [bp - 36], cx mov word ptr [bp - 32], bx @@ -443,6 +463,52 @@ _make_dos_entry.got_clust: xor bx, bx call _write_sectors + mov ax, cs:[_info_sector] + + and ax, ax + jz _make_dos_entry.done + + xor dx, dx + + add ax, cs:[_hidden_sectors] + adc dx, cs:[_hidden_sectors + 2] + + mov bx, cs:[_disk_scratch] + mov es, bx + xor bx, bx + + mov cx, 1 + call _read_sectors + + mov di, HEX (01E0) + + mov ax, es:[di + 8] + mov dx, es:[di + 10] + + sub ax, 1 + sbb dx, 0 + + mov es:[di + 8], ax + mov es:[di + 10], dx + + mov ax, es:[di + 12] + mov dx, es:[di + 14] + + add ax, 1 + adc dx, 0 + + mov es:[di + 12], ax + mov es:[di + 14], dx + + mov ax, cs:[_info_sector] + xor dx, dx + + add ax, cs:[_hidden_sectors] + adc dx, cs:[_hidden_sectors + 2] + + mov cx, 1 + call _write_sectors + jmp _make_dos_entry.done _make_dos_entry.error: