www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/12/12:50:39

Xref: news2.mv.net comp.os.msdos.djgpp:1019
Newsgroups: comp.os.msdos.djgpp
From: kaikow AT standards DOT com
Subject: bios
Originator: kaikow AT mv DOT mv DOT com
Message-ID: <DMoA7H.CJ8@mv.mv.com>
Sender: kaikow AT standards DOT com
Reply-To: kaikow AT standards DOT com
Organization: MV Communications, Inc.
Date: Mon, 12 Feb 1996 17:06:52 GMT
Followup-To: kaikow AT standards DOT com
Lines: 47
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Where are the valid values for the device numbers documented?
I thought that the device numbers were just 0, 1, 2, ...

The following program works for devices A and B, but not for C.

/* READDISK.C: This program reads a disk sector.
  */

#include <conio.h>
#include <stdio.h>
#include <bios.h>


int  main (int argc, char **argv)
{
   	unsigned char buffer [2352];
        unsigned status = 0;
   	int i, drive;
   	drive = (int) toupper (argv[1] [0]) - (int) 'A';
        struct _diskinfo_t disk_info;
   
        disk_info.drive         =0;
        disk_info.head          =0;
        disk_info.track         =0;
        disk_info.sector        =1;
        disk_info.nsectors      =1;
        disk_info.buffer        =&buffer [0];
   
   	disk_info.drive = drive;
   	printf("%d\n", drive);

        status = _bios_disk(_DISK_RESET, &disk_info);
        if (status & 0xff00) printf("DISK RESET Error: 0x%.4x\n", status);
        printf("Insert disk into drive %c: and press any key\n", drive + 'A');
        getchar();
        status = _bios_disk(_DISK_READ, &disk_info);
        if (status & 0xff00) printf("DISK READ Error: 0x%.4x\n", status);

   	for (i = 0; i < 62; i++)
     {
        if (i % 32 == 0) printf("\n%d\t",i);
	
        printf("%02X", buffer [i]);       
     }
   
   }

- Raw text -


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