www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/04/12:45:20

From: "rw" <rw AT rw DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <xcEM5.2239$mx DOT 50892 AT news1 DOT oke DOT nextra DOT no> <2950-Sat04Nov2000085212+0200-eliz AT is DOT elta DOT co DOT il>
Subject: Re: sectors
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <hJXM5.2757$mx.61209@news1.oke.nextra.no>
Date: Sat, 4 Nov 2000 18:21:06 +0100
NNTP-Posting-Host: 130.67.97.200
X-Complaints-To: news-abuse AT nextra DOT no
X-Trace: news1.oke.nextra.no 973359053 130.67.97.200 (Sat, 04 Nov 2000 18:30:53 MET)
NNTP-Posting-Date: Sat, 04 Nov 2000 18:30:53 MET
Organization: Nextra Public Access
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019