delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/11/12:42:31

From: "Angelene and Klaus Thane" <thane AT nospam DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT LNX DOT 4 DOT 10 DOT 10001091531110 DOT 570-100000 AT yahoo DOT com>
Subject: It works, it works....THANK YOU!!!!(One ity, bity question more, multiple choice)
Lines: 129
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <%CAe4.19283$Ak.294380@news1.mia>
Date: Tue, 11 Jan 2000 01:05:08 -0600
NNTP-Posting-Host: 216.76.248.157
X-Trace: news1.mia 947574331 216.76.248.157 (Tue, 11 Jan 2000 02:05:31 EST)
NNTP-Posting-Date: Tue, 11 Jan 2000 02:05:31 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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

#include <sys/types.h>
#include <sys/movedata.h>
#include <dpmi.h>
#include <go32.h>

int main (void)
{
  __dpmi_regs regs;
  int DosMem01, DosMem02, DosBufferSlct01, DosBufferSlct02;
  short CallSize=0x001A;
  unsigned short BytesPerSector;
  FILE *fp;

  if ((fp=fopen("output.txt", "w"))==NULL)
  {
     fprintf(stderr, "unable to open file for writing");
     return 1;
  }

  clrscr();
  fprintf(fp, "Output.txt \n"
              "Allocating %d paragraphs of DOS memory\n", ((CallSize+15) >>
4));
  fprintf(stdout, "Output.txt \n"
              "Allocating %d paragraphs of DOS memory\n", ((CallSize+15) >>
4));

  getch();
  DosMem01=
     __dpmi_allocate_dos_memory(((CallSize+15)>>4), &DosBufferSlct01);

  fprintf(fp, "%x is the segment, making ", DosMem01);
  fprintf(stdout, "%x is the segment, making ", DosMem01);

  DosMem01=DosMem01 << 4;
  fprintf(fp, "%x the linear address\n", DosMem01);
  fprintf(stdout, "%x the linear address\n", DosMem01);
  getch();
  dosmemput(&CallSize, 2, DosMem01);

  regs.h.ah=0x48;
  regs.h.dl=0x80;
  regs.x.ds = DosMem01 / 0x10;
  regs.x.si = DosMem01 % 0x10;
   __dpmi_int(0x13, &regs);
  if (regs.x.flags & 1)
  {
     fprintf(stderr, "int call failure");
     exit(1);
  }
  dosmemget(DosMem01 + 0x18, 2, &BytesPerSector);
  fprintf(fp, "There are %d bytes per sector", BytesPerSector);
  fprintf(stdout, "There are %d bytes per sector", BytesPerSector);
  fflush(stdout);
  fflush(fp);
  fclose(fp);
  getch();
  return 0;
}

=====================================================================
Output.txt
Allocating 2 paragraphs of DOS memory
1819 is the segment, making 18190 the linear address
There are 512 bytes per sector
=====================================================================


I have completely dumped the idea of using the __tb since it is only
guaranteed to be 2K;  I'll need a little more.  Which brings me to my next
question! (short answer, I swear)

Considering this function:

Extended int13 read

Inp.:
 AH = 42h
 DL = drive number
 DS:SI -> disk address packet (see #0182)
Return: CF clear if successful
     AH = 00h
 CF set on error
     AH = error code (see #0144)
     disk address packet's block count field set to number of blocks
       successfully transferred

Table 0182
Format of disk address packet:
Offset Size Description
 00h BYTE 10h (size of packet)
 01h BYTE reserved (0)
 02h WORD number of blocks to transfer (max 007Fh for Phoenix EDD)
 04h DWORD -> transfer buffer
 08h QWORD starting absolute block number
  (for non-LBA devices, compute as
    (Cylinder*NumHeads + SelectedHead) * SectorPerTrack +
    SelectedSector - 1

Copied from Ralf Brown's Interrupt List

04h DWORD -> transfer buffer is a _________?
    a.   A linear address in the format of an unsigned integer
    b.  An address in the format segment:offset (segment=04h 05h; offset=06h
07h)
    c.  An address in the format segment:offset (offset=05h 04h; segment=07h
06h)
    d.  None of the above

While it seems to me 'b' might be the right answer, I really have not idea.


TIA
KT











- Raw text -


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