I wrote a program in C to copy a kernel image on floppy disk and used it to
copy the MenuetOS Image "M32-084.IMG"
But after booting the system with floppy the computer just hung up
showing the following messages:
Starting MenuetOS
KERNEL MNT ?
Here is the source code of my C Program for your reference:
********************************************************
#include <stdio.h>
#include <string.h>
#include <dos.h>
int main()
{
union REGS in, out;
FILE *infp;
char fname[128];
char buffer[512];
int n, tries;
int track, sect;
long kb;
printf("Full path-name of file: ");
fgets(fname, sizeof fname, stdin);
fname[strlen(fname)-1] = '\0';
if ((infp = fopen(fname, "rb")) == NULL)
{
printf("Could not open: %s", fname);
return 1;
}
sect = 1;
track = 0;
while (1)
{
memset(buffer, 0, sizeof buffer);
n = fread(buffer, 1, sizeof buffer, infp);
if (n <= 0) break;
if (track == 80)
{
puts("Disk full,");
return 3;
}
memset((char*)&out, 0, sizeof out);
for (tries=10; tries; tries--)
{
in.x.ax = 0x0301;
in.x.bx = (int)buffer;
in.h.ch = track;
in.h.cl = sect;
in.h.dh = 0;
in.h.dl = 0; // A:
int86(0x13, &in, &out);
if (!out.x.cflag)
{
break;
}
}
if (!tries)
{
puts("Disk write failed.");
return 2;
}
kb = ((track * 18L + sect-1) * 512L + n) / 1024L;
printf("Tracks: %d, Sectors: %d (%ld KBs)\n", track, sect, kb);
if(++sect > 1
{
track++;
sect = 1;
}
}
puts("Done !");
fclose(infp);
return 0;
}