VOGONS


Reply 20 of 25, by Ringding

User metadata
Rank Member
Rank
Member
wierd_w wrote on 2025-04-25, 14:32:

Which is VERY close to his suggested 519 cyl.

He might have backed off on the cyl count for other reasons.

Yes. I configured this many years ago, and I remember that I wanted to use the same image for DOSBox svn (at the time), DOSBox-X and DOSBox-staging, one of which had problems with 520, so I backed off by one cylinder for safety. I don’t remember which one it was, though, and I could probably also not reproduce it, as I am many Fedora versions later than back then – which matters because I build all DOSBox versions that I use from source.

Reply 21 of 25, by davidmorom

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2025-04-25, 15:58:
wierd_w wrote on 2025-04-25, 15:01:

So, 'an actually 2GiB volume' has an ECHS geometry of

512, 32,128,1024

There are very valid reasons for not wanting to have exactly the max cyl count.

The most valid reason is that 1024 doesn't fit in 10 bits, making it an invalid value.

1024 cylinders, numbered from 0 to 1023, should fit on 10 bits, unless the all zeroes or all ones combinations have some special meaning, which it shouldn't. Indeed, MS-DOS 6.22 fdisk is perfectly capable to detect the HDD size increase when going from 1023 to 1024 cylinders. Maybe there are some good reasons to not use 1024 cylinders (there are for not using 256 heads), but I made a DOS 6.22 install on DOSBox with 512,63,255,1024 geometry and it worked fine.

Reply 22 of 25, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
davidmorom wrote on 2025-04-25, 18:20:

I made a DOS 6.22 install on DOSBox with 512,63,255,1024 geometry and it worked fine.

Using a size that large is definitely asking for trouble - as I mentioned earlier, DOSBox uses regular buffered file I/O functions (fseek, ftell, fread, etc.) which do not handle file offsets larger than 2GB. Any tool/program that tries to access the drive beyond 2GB will likely fail, in the worst case experiencing an integer overflow that could position the file pointer at the beginning of the file when writing.

Reply 23 of 25, by davidmorom

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2025-04-26, 00:53:
davidmorom wrote on 2025-04-25, 18:20:

I made a DOS 6.22 install on DOSBox with 512,63,255,1024 geometry and it worked fine.

Using a size that large is definitely asking for trouble - as I mentioned earlier, DOSBox uses regular buffered file I/O functions (fseek, ftell, fread, etc.) which do not handle file offsets larger than 2GB. Any tool/program that tries to access the drive beyond 2GB will likely fail, in the worst case experiencing an integer overflow that could position the file pointer at the beginning of the file when writing.

That's very interesting, but it would be a global 2GB limit, completely independent from the the geometry. It would be unrelated with the 1023 vs. 1024 cylinders issue we were discussing.

After reading your post, in part for curiosity and in part to have things clearer, I made some extensive testing, and these are the results.

I made a 512,63,255,1024 (8422686720 bytes) image an mounted it, booted DOS 6.22 install disk and the hdd was correctly partitioned and formatted (one 2GB FAT16 partition). After installing DOS, with fdisk I created another 3 2GB FAT16 partitions and formatted them. With WinImage I injected a text file on the last partition, which is past de 6GB barrier, and opened the file inside the emulated machine using EDIT. The file is perfectly accessible.

Now comes the interesting part. The above is true for DOSBox-Staging v0.82.1 and DOSBox-X v2025.02.01 (both 32 and 64 bits). On the old official DOSBox 0.74-3 the hdd is totally inaccessible. To narrow down the issue, I created smaller hdd images dividing the heads number by two. With 512,63,128,1024 (4227858432 bytes) it also failed, but with 512,63,64,1024 (2113929216 bytes) it worked perfectly.

So, as you stated, the original DOSBox 0.74-3 is affected by the 2GB IO limit, you could use any geometry you want as long as the resulting image is smaller than 2GB. But all the up to date variants (Staging and X) are perfectly capable to use hdd images up to 8GB with 512,63,255,1024 geometry.

UPDATE: with DOSBox-X, as it supports LBA, you could go even beyond the 8GB barrier. I created a 16GB image with standard 63,16 geometry (512,63,16,32768 or 16911433728 bytes), partitioned and formatted it with a Windows 98 boot disk, and injected files with WinImage at several positions inside the image. All files are accessible from the emulated machine.

Reply 24 of 25, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

As this is the official DOSBox forum discussion of forks is off-topic.

Reply 25 of 25, by davidmorom

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2025-04-26, 16:21:

As this is the official DOSBox forum discussion of forks is off-topic.

Yes, you are totally right, sorry for the off topic. Anyway, I hope this helps the OP, as he mentioned trying also DOSBox Staging.