Mail Archives: djgpp/1997/04/10/16:16:41
--=====================_860716690==_
Content-Type: text/plain; charset="us-ascii"
--=====================_860716690==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="MY_MAIL2.TXT"
10th. April, 1997
I mail to you because I need some help. I have some trouble when I intended
to run my program developed in ADA and C.
I programed some functions in `C' to do interrupts and use NETBIOS service routines.
My `C' program run well.
Later I imported from `C' to ADA95 the functions using pragma 'Import'. Because ADA95
run in protected mode I had problems with ADA program.
I want to call a NETBIOS functions, previously loaded in the interrupts vector,
which requires a pointer to a buffer `ES:BX' register pair. Interrupt number is 5CH.
Questions are:
*Q1* How do I get the segment to put into the `ES' register?
*Q2* How can I obtein the buffer's address when I alloc memory using `malloc' function
since it returned me an address formated in 20 bits (lineal address) and I need
an adress formated like this: segment:offset (32 bits). NETBIOS functions
requests ES and BX to be setted.
*Q3* How can I run ada95 in real mode?. Exist any way to run ada95 in non protected mode?
I found some answers in a file called `DJGPPFAQ.TXT' :
**1st. A** : Use `int86x', then just put the address of your buffer into the register
which expects the offset (`regs.x.bx') and forget about the segment.These functions
are processed specially by the library, which will take care of the rest.
* I did it and the program crashed showing an ERROR: `General Protection Fault'.
**2nd. A** : Call `__dpmi_int,' and then put into that register pair an address
of some buffer in *conventional* memory (in the first 1 MByte).The buffer's size
that I need is 64 bytes only.
* My program doesn't crash but I can't obtein the segment and the offset to send as
parameter to the function `__dmpi_int'.
**3rd. A** : I found a method for transform lineal address to segment-offset address:
OFFSET = (LINEAL_ADDRESS)&000Fh
SEGMENT = (shift_right(LINEAL_ADDRSS,4))&FFFFh
in C:
offset = lineal_address&0x000F;
segment = (lineal_address>>4)&0xFFFF;
* I did it and then I used `__dpmi_int'. The program didn't show any error
but it didn't call NETBIOS functions.
**4th. A** : Use the transfer buffer. That buffer is used for all DOS/BIOS
services supported by DJGPP, and it resides in conventional memory.
* How can I write into this buffer?
* Should I pass as parameters to the interrupt these addresses :
dpmi_regs.x.bx =
_go32_info_block.linear_address_of_transfer_buffer & 0x0f;
dpmi_regs.x.es =
(_go32_info_block.linear_address_of_transfer_buffer >> 4) & 0xffff;
**5th. A** : Allocate my own buffer in conventional memory with a call to the
`__dpmi_allocate_dos_memory' library function. It returns me the segment of
the allocated block (the offset is zero).
* OK, I've the offset and the segment but when I intended write into the buffer
I get "Segmentation Violation and "General Protection Fault".
I look forward to hearing from you and thank you in advance.
--=====================_860716690==_--
- Raw text -