Hi,
 
I've made this code with DJGPP under real dos.
It doesn't work !!
It always show me the same bytes in the buffer, not the sectors that I asked for !
 
Could someone help me, please.
 
Thanx
D-fence
 
Here is the source :
 
#include <dos.h>
#include <conio.h>
#include <dpmi.h>
 
struct DAP
{
 unsigned char Packet_Size;
 unsigned char Reserved;
 unsigned char Numb_of_blcks_to_trsf;
 unsigned char Reserved_1;
 unsigned short Buffer_segment;
 unsigned short Buffer_offset;
 unsigned long long Starting_LBA;
}test;
 
int readlba (long long lba_adress)
{
 int buffer_selector1,buffer_selector2;
 int buffer_size;
 short buffer_adress;
 short dap_adress;
 unsigned char buffer[16];
 unsigned char buf[512];
 unsigned short essai;
 int i;
 __dpmi_regs registres;
 clrscr;
 for (i=0;i<513;i++) buf[i]="X";
 buffer_adress=__dpmi_allocate_dos_memory(32,&buffer_selector1);
 dap_adress=__dpmi_allocate_dos_memory(1,&buffer_selector2);
 test.Packet_Size=16;
 test.Reserved=0;
 test.Numb_of_blcks_to_trsf=1;
 test.Reserved_1=0;
 test.Buffer_segment=buffer_adress;
 test.Buffer_offset=0;
 test.Starting_LBA=lba_adress;
 memmove (&buffer,&test,16);
 dosmemput(buffer,16,dap_adress*16);
 registres.x.ax=0x4200;
 registres.x.dx=0x0080;
 registres.x.ds=dap_adress;
 registres.x.si=0;
 __dpmi_int(0x13,&registres);
 printf ("AX returned : %x\n",registres.x.ax);
 dosmemget(buffer_adress*16,512,buf);
 __dpmi_free_dos_memory(buffer_selector1);
 __dpmi_free_dos_memory(buffer_selector2);
 for  (i=0;i<512;i++)
 {
  printf ("%c",buf[i]);
 }
}
 
int main (void)
{
 long long i;
 for (i=1000;i<1500;i++)
 {
 readlba(i);
 }
}

Reply via email to