delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/11/29/05:34:16

Date: Mon, 29 Nov 93 01:52:12 PST
From: Vaughan Pratt <pratt AT CS DOT Stanford DOT EDU>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: int86 -- the problem code

I don't know if it will help, but here's the code that's giving me the
int 0x13 grief.  All it does is try to read the master boot record of
the first disk into struct ParSec.  (Some of the symbols will be
recognized as coming from PCIntern.)  The commented-out bits are
intended to be the int86x equivalent, as best I understand it.

Vaughan Pratt

#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct {unsigned char Head; unsigned short SecCyl;} SECPOS;
typedef struct {unsigned char Status; SECPOS StartSec;
		unsigned char PartTyp; SECPOS EndSec;       
		unsigned long SecOfs; unsigned long SecNum;} PARTENTRY;
typedef struct {unsigned char BootCode[ 0x1BE ]; PARTENTRY PartTable[ 4 ];
		unsigned short IdCode;} PARTSEC;
typedef PARTSEC *PARSPTR;
PARTSEC    ParSec, *PS;	/* Current partition sector */

int main()
{
	union REGS   Regs;	/* Processor registers for interrupt call */
        struct SREGS  SRegs;
	Regs.x.ax = 0x0201;     /* Funct. no.: READ for first sector */
	Regs.x.dx = 0x80;          /* head 0, Disk 1 */
	Regs.x.cx = 1;		  /* sctcyl 1 */
/*	Regs.x.bx = ((unsigned long) &ParSec) & 0xffff;
	SRegs.es  = ((unsigned long) &ParSec) >> 16; */
	Regs.x.bx = (unsigned long) &ParSec;

/*	int86x( 0x13, &Regs, &Regs, &SRegs );  */
	int86( 0x13, &Regs, &Regs ); 
	printf("0x%x %d 0x%x\n",
		Regs.x.cflag,
		ParSec.PartTable[0].SecNum,
		ParSec.IdCode);
}

- Raw text -


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