Thanks to WINDRV and Budian!!
WINDRV's method hasn't been tested yet. I'll reply after testing.
Budian:
Actually, the main purpose for me to use GRUB is that GRUB can restore the BIOS environment polluted by DOS. Restore it to a real BIOS environment. Because the program I want to boot may run based on the BIOS (not based on DOS). However, my computer is diskless, and I must boot from the network card ROM first, and the code of the network card ROM will also pollute the BIOS environment.
My idea is like this: Boot the diskless computer from the network card ROM, start diskless DOS, after loading the network card driver under DOS, download the sys.img I need to the virtual memory disk (XMSDSK virtualized memory disk) in DOS. Then, I use a DOS program to exit the code of the network card ROM. This program is ready-made and has been tested.
At this time, the state of the diskless machine is: DOS has been started, the DOS files are placed in the memory disk (XMSDSK virtualized), and this DOS is a relatively clean DOS (because the network card boot code has been exited by my exit program). At this time, there is no longer the A drive virtualized by the network card boot code in DOS.
In this case, I need to use GRUB to call sys.img in the DOS memory virtual disk to simulate booting.
Budian: If you have time and can test in an environment, do it like this: You use a disked computer to boot into a DOS and load XMSDSK to simulate a DOS memory virtual disk, then copy a FLOPPY.IMG to this memory disk. Then the environment is ready. Now what needs to be done is:
1: Compile a DOS program to push the FLOPPY.IMG in the XMSDSK memory disk into the physical memory you specify.
2: Virtualize the physical memory you just specified as a hard disk and tell the BIOS.
3: Use GRUB to call this newly generated hard disk and boot from it. Or call this FLOPPY.IMG inside and boot from it.
4: Done.
That is to say, my requirement has nothing to do with whether it was ever started with a diskless boot chip, because I can exit the boot chip program in DOS, which is equivalent to not having used diskless boot.
For example, I boot into a DOS with a boot CD, which will generate a virtual A drive. At the same time, I load XMSDSK to generate a virtual DOS memory disk. Then, suppose I run a DOS program to exit the control code of the boot CD, and the virtual A drive generated by the boot CD will naturally disappear. At this time, my computer is equivalent to a normal disked boot, equivalent to not having been booted with the CD. In this case, I still need to use GRUB to call FLOPPY.IMG in the DOS memory disk (generated by xmsdsk). However, GRUB cannot point to the DOS memory virtual disk. GRUB does not support the format MAP J:\FLOPPY.IMG (FD0). So, we need another program to push the FLOPPY.img in this memory disk into the specified physical memory segment, then virtualize this physical memory segment as a hard disk and boot from it. Or call this FLOPPY.IMG inside and boot from it. ---------Of course, this is just an example. In fact, we don't have a program to exit the control code of the boot CD, but we have a program to exit the control code of the boot chip.
WINDRV's method hasn't been tested yet. I'll reply after testing.
Budian:
Actually, the main purpose for me to use GRUB is that GRUB can restore the BIOS environment polluted by DOS. Restore it to a real BIOS environment. Because the program I want to boot may run based on the BIOS (not based on DOS). However, my computer is diskless, and I must boot from the network card ROM first, and the code of the network card ROM will also pollute the BIOS environment.
My idea is like this: Boot the diskless computer from the network card ROM, start diskless DOS, after loading the network card driver under DOS, download the sys.img I need to the virtual memory disk (XMSDSK virtualized memory disk) in DOS. Then, I use a DOS program to exit the code of the network card ROM. This program is ready-made and has been tested.
At this time, the state of the diskless machine is: DOS has been started, the DOS files are placed in the memory disk (XMSDSK virtualized), and this DOS is a relatively clean DOS (because the network card boot code has been exited by my exit program). At this time, there is no longer the A drive virtualized by the network card boot code in DOS.
In this case, I need to use GRUB to call sys.img in the DOS memory virtual disk to simulate booting.
Budian: If you have time and can test in an environment, do it like this: You use a disked computer to boot into a DOS and load XMSDSK to simulate a DOS memory virtual disk, then copy a FLOPPY.IMG to this memory disk. Then the environment is ready. Now what needs to be done is:
1: Compile a DOS program to push the FLOPPY.IMG in the XMSDSK memory disk into the physical memory you specify.
2: Virtualize the physical memory you just specified as a hard disk and tell the BIOS.
3: Use GRUB to call this newly generated hard disk and boot from it. Or call this FLOPPY.IMG inside and boot from it.
4: Done.
That is to say, my requirement has nothing to do with whether it was ever started with a diskless boot chip, because I can exit the boot chip program in DOS, which is equivalent to not having used diskless boot.
For example, I boot into a DOS with a boot CD, which will generate a virtual A drive. At the same time, I load XMSDSK to generate a virtual DOS memory disk. Then, suppose I run a DOS program to exit the control code of the boot CD, and the virtual A drive generated by the boot CD will naturally disappear. At this time, my computer is equivalent to a normal disked boot, equivalent to not having been booted with the CD. In this case, I still need to use GRUB to call FLOPPY.IMG in the DOS memory disk (generated by xmsdsk). However, GRUB cannot point to the DOS memory virtual disk. GRUB does not support the format MAP J:\FLOPPY.IMG (FD0). So, we need another program to push the FLOPPY.img in this memory disk into the specified physical memory segment, then virtualize this physical memory segment as a hard disk and boot from it. Or call this FLOPPY.IMG inside and boot from it. ---------Of course, this is just an example. In fact, we don't have a program to exit the control code of the boot CD, but we have a program to exit the control code of the boot chip.


