Mail Archives: djgpp/2000/11/04/12:45:20
I made a program that works with biosdisk :
#include <bios.h>
#include <stdio.h>
void main(int argc,char *argv[])
{
FILE *fil;
long lax;
unsigned char buffer[520];
printf("BootSectorCopy v1.0 by Eivind A. Moland (Made for eamOS)\n");
if(argv[1]==NULL) {
printf("Usage: [%s] [file] [sector]",argv[0]);
exit(0);
}
if(argv[2]==NULL) {
printf("Usage: [%s] [file] [sector]",argv[0]);
exit(0);
}
fil = fopen(argv[1], "rb");
if(fil==NULL) {
printf("Can't Load File");
exit(0);
}
lax = atoi(argv[2]);
fread(&buffer, 512, 1, fil);
while(biosdisk(3, 0, 0, 0, lax, 1, buffer));
fclose(fil);
printf("Done!");
}
It writes a binary file to a sector on a floppy.
It works to .. there is a error i cant figure out..
I do BootSectorCopy boot.bin 1 to write boot.bin to the bootsector (first
sector) and everything works ok.
Then i do BootSectorCopy something.bin 2 to write something.bin to the
second sector. the something.bin is 512 bytes but when i write it to the
floppy it takes up like 135kb (wierd)..
I use dos debug to L 100 0 1 1(load the sector) and D(dump the sector) and i
see that the code on the sector is NOT the code in my something.bin .. its
something else ... and i dont know what ... ;(
Thats why i wanted to try writeing the sector with something else.
anyone know what could be wrong?
- Raw text -