VOGONS


First post, by Irq5

User metadata
Rank Newbie
Rank
Newbie

Hey all!

I was tinkering around with building MS-DOS 4 from the released source code with the intent of creating a (eventually dockerized) build pipeline capable of providing some form of bootable install media.

Currently, the easy part is done: from a linux host VM, I use qemu to spin up a Freedos VM that runs nmakr and compiles MS-DOS. The hard part now is figuring out how to take build artifacts (at least io.sys, msdos.sys and command.com) and using those to create a bootable disk image. Using sys.com from Freedos to install the system files doesn't seem to yield a bootable disk; Running sys.com from the build output in a callver 4.00 command.com process seems to have issues interpreting the VM disk images as hardware it can interact with. It seems I need MS-DOS to properly install MS-DOS, and I can't install MS-DOS because yada yada.

The next option I am thinking of is writing a tool that can generate a bootable floppy image from the three OS files (io.sys, msdos.sys, and command.com) by outputting a FAT12 floppy image bytestream, assuming no tool like that currently exists.

Thoughts?

Hoepfully I can go from a bare Linux install to a set of floppy disk images in various sizes containing DOS 4, but we'll see.

Reply 1 of 16, by myne

User metadata
Rank Member
Rank
Member

I suspect the problem is just the boot sector.
There are tools which will write various boot sectors (possibly including freedos' sys command).
The issue might simply be compatibility, or attaining the correct 512b boot sector file.

This might help
https://teaching.idallen.com/dat2343/09f/note … skStructure.htm

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)
Script to backup Win9x\ME drivers from a working install

Reply 3 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie
Azarien wrote on 2024-05-22, 08:26:

It seems that this guy had a similar problem, he used a real MS-DOS 4 floppy to get correct boot sector:
https://www.youtube.com/watch?v=BR6F0EdyulA

I watched that video and the Freedos video on compiling DOS 4 from source beforing starting on this. While using an existing system disk in the process would work, the ideal would be to generate the bootable image from scratch.

myne wrote on 2024-05-22, 05:32:
I suspect the problem is just the boot sector. There are tools which will write various boot sectors (possibly including freedos […]
Show full quote

I suspect the problem is just the boot sector.
There are tools which will write various boot sectors (possibly including freedos' sys command).
The issue might simply be compatibility, or attaining the correct 512b boot sector file.

This might help
https://teaching.idallen.com/dat2343/09f/note … skStructure.htm

You are correct, writing a boot sector is the problem (or more specifically writing a boot sector that boots DOS 4). I did get Freedos's sys.com to write to a floppy image using the build's io.sys file in place of the freedos kernel but the resulting image did not boot. Using sys with the Freedos command interpreter and kernel on the disk image boots in the VM, as does a random DOS 4 install disk from the Internet Archive, so I know I can create a bootable thing and I know I can boot the target OS, I just need to make a bootable thing that boots with the target OS.

I wonder how installing a development build worked back in the day; someone would have had to install the first DOS 4.0 system for the first time....

Reply 4 of 16, by myne

User metadata
Rank Member
Rank
Member

https://home.mnet-online.de/willybilly/fdhelp … rd/base/sys.htm

/oem:Ms ?

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)
Script to backup Win9x\ME drivers from a working install

Reply 5 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie
myne wrote on 2024-05-22, 14:18:

It would be awesome if that was the case. The documentation online for Sys.com has /oem:ms listed but the command itself doesn't seem to support it and I can't tell if the executable is newer and the functionality removed or if the executable is older than the documentation. If it's the latter, then I need to hunt down a new freedos kernel package.

Reply 6 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie

I did find a copy of the 512 bytes MS DOS writes to the boot sector of a disk in the source itself (boot.inc). The media type descripter is not correct but if I munge that together with a blank formatted disk image, the VM at least starts booting from floppy and then hits the error handler in the boot disk that display's the boot disk's "non-system disk" error, which feels like progress. At this point it seems like either I need to alter the bootloader code to point to where io.sys is located or locate io.sys to where the bootloader expects it.

Reply 7 of 16, by weedeewee

User metadata
Rank l33t
Rank
l33t

wouldn't it be possible to remove the dos version check from sys, and use that to write the bootsector and other files(io,msdos,command) to disk ?

Seems easier to do it that way
or if freedos has some functionality like SETVER , use that

Right to repair is fundamental. You own it, you're allowed to fix it.
How To Ask Questions The Smart Way
Do not ask Why !
https://www.vogonswiki.com/index.php/Serial_port

Reply 8 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie
weedeewee wrote on 2024-05-22, 18:04:

wouldn't it be possible to remove the dos version check from sys, and use that to write the bootsector and other files(io,msdos,command) to disk ?

Seems easier to do it that way
or if freedos has some functionality like SETVER , use that

Freedos has the "callver" command which works in terms of allowing executables to run, but the DOS 4 tools like FORMAT and SYS running from Freedos seem confused either by what the virtualized hardware is telling it or confused by their interactions with the Freedos kernel. I already tried that approach and it did not seem to pan out.

Reply 9 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie

Attached GDB to QEMU and did hbreak at *0x7c00.

Looks like the C/H/S calculation for the sector to read from disk is wrong:

----------------------------[ CPU ]----
AX: 0201 BX: 0500 CX: 0002 DX: 0100
SI: 6027 DI: 7C49 SP: 7BF6 BP: 0000
CS: 0000 DS: 0000 ES: 0000 SS: 0000

=> 0x7d90: int 0x13

Basically, the VM is about to call interrupt 13h function 2 to read 1 sector from cylinder 0, sector 2, head 1. I don't think that is right so something is messing up the calculation from sector number to a c/h/s tuple (CH/DH/CL or 0/1/2)

Hopefully I can track down the errant byte sequence...

Reply 10 of 16, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

Why do you think that's wrong, e.g. what LBA do you think that will attempt to read vs. which LBA should it be reading? The sector parameter for that BIOS call is based at 1, not 0... so the head parameter is what you should probably be focusing on but without knowing how the disk is partitioned it's impossible to say if it's correct or not.

Reply 11 of 16, by myne

User metadata
Rank Member
Rank
Member

Are you sure /oem doesn't work?

It's still in there. Typo? Case sensitive?

https://github.com/FDOS/sys/blob/master/docs/sys.txt

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)
Script to backup Win9x\ME drivers from a working install

Reply 12 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie
myne wrote on 2024-05-23, 02:59:

Are you sure /oem doesn't work?

It's still in there. Typo? Case sensitive?

https://github.com/FDOS/sys/blob/master/docs/sys.txt

The OEM arg is present in the SYS.COM distribute d on the FD13Full live image but supports fewer options. I might try to pull the newer version and build it and give that a shot.

Reply 13 of 16, by myne

User metadata
Rank Member
Rank
Member

It hasn't changed in over 10 years. Just how much newer can it be?

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)
Script to backup Win9x\ME drivers from a working install

Reply 14 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie
myne wrote on 2024-05-23, 05:02:

It hasn't changed in over 10 years. Just how much newer can it be?

I hear you, it looks like the /oem:ms option is part of a feature set that is not enabled by default (https://github.com/FDOS/kernel/blob/master/sys/sys.c#L34).

Looks like the source tree for sys.com as a standalone is not used and sys.com is compiled with the freedos kernel.

Reply 15 of 16, by Irq5

User metadata
Rank Newbie
Rank
Newbie

so using sys with the additional OEM types enabled at compile time worked! now to wrap it all up with something to package up some disk images and I'll have myself a regular DOS factory.

Reply 16 of 16, by myne

User metadata
Rank Member
Rank
Member

Seems weird to disable it, but whatever.
Glad it's working.

Now you've made the first, you've chicken and egged it, right? You can use 4.0 sys now.

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)
Script to backup Win9x\ME drivers from a working install