www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/04/12/11:26:30

Date: Mon, 12 Apr 93 16:46:28 +0100
From: frigault AT gla DOT ecoledoc DOT ibp DOT fr
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: [Q] Dos interrupt call and memory allocation problem
Cc: frigault AT gla DOT ecoledoc DOT ibp DOT fr

	I want to access to my scsi tape drive in a program. I have the programming specifications and I can access to it with the 0x11 interrupt. It works fine under borland C++ 3.1, but under djgpp only the functions that don't need a buffer work . The others (read a buffer and write it) don't work because (i think) I don't know how to allocate memory that I can give the segment and offset to the interrupt call. It semmed to me that may be valloc(0) could help me, but it doesn't work.... so please hellllpppppp

This code works fine under BC++ 3.1

void SDLP_Read(char Unite)
{
union REGS regs;
struct SREGS sregs;
char buffer[4096];
 
regs.h.ah=2;
regs.h.al=Unite;
regs.h.ch=0;
regs.x.dx=0;
sregs.es=_SS;
regs.x.bx=(int)buffer;
regs.h.cl=8;
regs.x.si=0x6a6a;
 
int86x(0x11,&regs,&regs,&sregs);
 
}

but
 this one doesn't under djgpp 1.0[8-9]

void SDLP_Read(char Unite)
{
union REGS regs;
struct SREGS sregs;
char *Buffer;
unsigned Indice;
 
 
Buffer=(char *)valloc(0);
 
for(Indice=0;Indice<4095;Indice++)
  Buffer[Indice]='z';
Buffer[4095]='\0';
 
printf("%x\n",(unsigned)Buffer);
regs.h.ah=2;
regs.h.al=Unite;
regs.h.ch=0;
regs.x.dx=0;
sregs.es=(unsigned)Buffer >> 16; /* segment needed here */
regs.x.bx=(unsigned)Buffer && 0x0000ffff; /* offset here */
regs.h.cl=8;
regs.x.si=0x6a6a;
 
int86x(0x11,&regs,&regs,&sregs);
  
}
	Thanks in advance
 
	Laurent

 _________________________________________ ______________________________
|            Laurent FRIGAULT             |                              |
| Universite Pierre & Marie Curie Paris 6 |    administrateur systeme    |
| DESS de Genie des Logiciels Applicatifs | frigault AT gla DOT ecoledoc DOT ibp DOT fr |
|_________________________________________|______________________________|

- Raw text -


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