From 9d52e1d64dc2091283052044470c8a2e56b087c9 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Mon, 5 Aug 2024 11:25:35 +0100 Subject: [PATCH] Prev cluster must be zero not 2 for FAT32 directory entry and update info sector for FAT32 --- build/chimaera.img | Bin 368640 -> 368640 bytes build/chimaera.vhd | Bin 34120704 -> 34120704 bytes src/Makefile.unix | 2 +- src/kernel/make.asm | 66 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/build/chimaera.img b/build/chimaera.img index c8767c1233d093e2b062d5037a6c062af85f2813..759b6197612384af68ee2b86871c1b7fefb655a1 100644 GIT binary patch delta 2227 zcmZ`)4^UG_8h>vS68?mQKnQ;lLr^DxzV{^MLTsqC2s|kACnbjjDAc)|w&PtDO+cM$ zOW-N;n!tH(z4q|tEJJ%Ug`-8&^Psk4df2n{tXjOO*g7|ydN&`#jU#o6h!t)hV8=Rl zZ)SJD{r&d)v%BAZ&ll4BLi$5#a(-1^+wry6BU*0NhSh}CP?R)Mi{HkIil3U7zL+Ka z0go1WzOt~ew4l=Ls&Scr%!g4mYba_{VP$z?sri5KG1QtuipsAjE6Xb{Fq6?tX%`(o zaIlinrUkX9e-?c>QC;?MWJ{hoZaFTq`H{$$B7YDWS@j4n3qFJ1krAsE4_lQjs{Mbf zKi+RXU-Za+<&>A$?UkJ{r{(AvPBEUaR|%)$zSQLOfYVuLXgW0{GEX>88}an`wT%oW#BIioMzx7f=o$Bkbyx41{mmL+-kVO!0I_j zo#TXDawIqE`{?t*Up2g~ROn4gh&AEIUoa(?tn#W-l+QKP*3=EjsJkQ8F4$xA7=cN} zJ6|}LSYYpWJGmT%H_@XFeAYFtIJGm;1=Px5)r;M76qkXgf2q?no5fGusiRHngufyu zoDAw-ibBc;<6u727_nu$BYlN&FcK1t#E08ylFXbsVuEeP6n8auR&mXNDBz5eggdq$ zL0b$srSVB^ih<}S8wR5x-axct47jn;Oy9(Z8tb%&lL^cys{sw!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ZkoAmXF+FLun?jeU69q>o{EXbTZ$#c$vcgfWXpOOLg`o)BMyQJ> z#~nO6tMd;y#@UGNieSzppon1BBpAunJsg^eAX9sO{7f(3$(`yGr+#s|%6E>*;aL^; zt4sXkd{xSW@7&KA<=QXtoF|r+(Xn@BYLdb`La)14AvXxgZaFujtWwXugUg&JVbJIc z7-qPvgdrojwl@_Ghm-I3t_u-(XbvaO?n_$p^b%Jua!n#zqO+RKtkPzT9+6t0;VE~( zn)tOtVS#IlsRGV%n?o?Q|Y825efMUrFtR)l>JMuB%3DE9wx-#R2dHR*w6EKkx7 zBxIgZ!lz33LG$_YhYxbZ#;5I)he!i$gme7rIJr$1(R}91O z32CoeUQ>H}8x6XMzBzT;0 zO-pECvbEm8){}$vOWEtBtv-Xc7J90*CD6Pl%L6(&?EE*ihDI`4zdnkl;z{lmuRKl2 z!}s(4)eYe+8z4E2r%=lpvU3wBE^V8%WTjh!GA76t_qq5xYc23SL;n;K1)bHgajw@C zcYm{%Xpfvk6`ADA%_cwVDPh_D#L%>a?D#x>Uh4ENNZ0<0#Wl@gtLJrgomWs9A cMT|cOMI+bX>4w46EFFjr$+^MPQp4T<0Ln~IZU6uP diff --git a/build/chimaera.vhd b/build/chimaera.vhd index 38de4898930509ab5fe0f056527f9fb315daf253..f3a04cbe879f8acffdc1701f63627400b7bd2736 100644 GIT binary patch delta 4716 zcmZ|R30#zA0>|-rUxwiUMg|a(V}!w6Jev0vG8_euR2WPVCkO>ib1S!Fvl67*jujg> zod)edd`sKR$PTr_ED_I9yimNb^(ZS-tA}je%vJGZ|9@QfSDWV z`mf`HOM**GCO(?l|AvkpeYfNKU*z@q8_R>*m%9sca`LhZ9EBx?j{jb6F_rW(nMURm zO5=saKB4G;H*!QA6^x9e8w@qS|+SV+VsxQQcQ6>V3-mheX7vn-A^!u66z2 z2j+16=FqMm`i(=wtA4ZGjLj}--|Xm{H*0QR@BeT1zu)mNckXZAaj>Zj8?I4SJu15Q zk8$eWE#^~ENtOHO9`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wIEyEhV-56ak^=9m$*kfw5EU6d$<}Wxq3A^vCJJ!`X)pM;m zeyMGD@Jy$=Zpm!^NpqA`I~^s5ow$K(oSI(bjyh=7v?KPY5<|l<55E>1>u`i6-84tR z@G57lyR;PRmiXjpjza4OAK-RkpM`EbV#0CJbAq%v9?h$?{Ocarv7FE#V)d8h3k{-& z-XPaBh!{MXaE|db!LheYsf_ScGk(Da)M9zAL5vK*;S@ww@#erm6*z00~= zKZ`@;_a{YY`#K@TzFr+enbq{4X}JtzW8O%)9D6JNz$?gjVRXmXT7I)h7@jNrjfLC3 z6d&K>73&-r)7Q7N){0-Q0mh>GO9FYJ&d3}2AYWude#jpMpg?pB>VmqWZm2s7Lcu5m zg`zOj1BIgqWJi&xC%P5&LbstP)Eo6deNjJjJ2Fu;a-jYw2F0Q~&;S&N1|laKga)G_ zXef$DccNivI2wUQqETox8iU571eA!9&|Tls0tlG)#xCqL5I*`REz4+ z5p)#QqXyK7j-lh|6Z9!Mfli_(bPAnDpP@78Z|HOM1^N{v8BRu!kz^DZO~#P1 zB!MK7BytzIn~Wpl$pn&2CXy7AO70?xOkVna5*R>H2E`mhCEB=lIO@g@;rHg z%qMwd0eO++lZE6Z@-kUO784g)LJCMBSxSn?GP0bkAg_>>WECkUtBE9kA+M6x$m?Vc zd4s%3){?i#IwveslW3r8ulkKE} z>>xYIF0z~KA$y6N>?8Y0C8;6@NHsY~YRDmSnADOwa)cZu^`wC`l4ImJ`GkB*PLPwN ziJT&*$!FvY`5XD1d_le>Uy-xqYjTc!L;gJMumGC;5T=NG_0{$VKuq zxkN6LE2M>7CD+Jxa)bOrZjx3Vk3RzgofyP};Qy+4{1L0M7mq(<{AMHT{k381g%K6_ c?aY)%{QD*QPoL#@(myb8++;uep|n~57fq@n(*OVf 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: -- 2.34.1