Board index » delphi » Borland Pascal 7.0 -- Software-IRQ in DPMI mode

Borland Pascal 7.0 -- Software-IRQ in DPMI mode

Hello!

Because my applications are growing big and bigger, I decided to change from
Turbo-Pascal 7.0 to Borland Pascal 7.0 because of its DPMI feature.
Hereby I encountered big difficulties in interfacing my Local Network and I
ask kindly for your help.

Problem:
--------
My Network (dscNEXOS/386) is interfaced by software IRQ $21. The basic I/O
routine follows. If only 8/16 bit values are to be transferred, this will be
done by placing them directly inside of CPU-Registers. This is working fine in
Real Mode and in DPMI mode.
If bigger data are to be transferred, this is done by assigning Pointers to
data buffers instead of the values themselves. This works fine in REAL MODE,
but in DPMI mode there's going something wrong.

-- part of the basic calling proc -------------------------------------
   with REGS do
     AX:=$ff00;         ($ff00 = Server-Call, $fe00 = Local Redirector Call)
     BX:=....;          (16 bit, defining the wanted function...)

     ES:=Seg(Data_Out); (Pointer to data block for received data from IRQ)
     DI:=Ofs(Data_Out);

     DS:=Seg(Data_In);  (Pointer to data block to be sent by the IRQ)
     SI:=Ofs(Data_In);
   end;

   Intr($21, REGS);     (Calling NEXOS with applied data)
------------------------------------------------------------------------

I think this is because BP7 is placing the data buffers outside of the memory
range of real mode, maybe it also depends in a wrong conversion of Seg/Ofs to
the buffers.

If there is anybody who can help, please send me an e-Mail to
"hants...@hantsch.co.at". It is relatively urgent.

Thanks in forward,

Rainer Hantsch

 

Re:Borland Pascal 7.0 -- Software-IRQ in DPMI mode


Hello!

Because my applications are growing big and bigger, I decided to change from
Turbo-Pascal 7.0 to Borland Pascal 7.0 because of its DPMI feature.
Hereby I encountered big difficulties in interfacing my Local Network and I
ask kindly for your help.

Problem:
--------
My Network (dscNEXOS/386) is interfaced by software IRQ $21. The basic I/O
routine follows. If only 8/16 bit values are to be transferred, this will be
done by placing them directly inside of CPU-Registers. This is working fine in
Real Mode and in DPMI mode.
If bigger data are to be transferred, this is done by assigning Pointers to
data buffers instead of the values themselves. This works fine in REAL MODE,
but in DPMI mode there's going something wrong.

-- part of the basic calling proc -------------------------------------
   with REGS do
     AX:=$ff00;         ($ff00 = Server-Call, $fe00 = Local Redirector Call)
     BX:=....;          (16 bit, defining the wanted function...)

     ES:=Seg(Data_Out); (Pointer to data block for received data from IRQ)
     DI:=Ofs(Data_Out);

     DS:=Seg(Data_In);  (Pointer to data block to be sent by the IRQ)
     SI:=Ofs(Data_In);
   end;

   Intr($21, REGS);     (Calling NEXOS with applied data)
------------------------------------------------------------------------

I think this is because BP7 is placing the data buffers outside of the memory
range of real mode, maybe it also depends in a wrong conversion of Seg/Ofs to
the buffers.

If there is anybody who can help, please send me an e-Mail to
"hants...@hantsch.co.at". It is relatively urgent.

Thanks in forward,

Rainer Hantsch

Re:Borland Pascal 7.0 -- Software-IRQ in DPMI mode


Hello!

Because my applications are growing big and bigger, I decided to change from
Turbo-Pascal 7.0 to Borland Pascal 7.0 because of its DPMI feature.
Hereby I encountered big difficulties in interfacing my Local Network and I
ask kindly for your help.

Problem:
--------
My Network (dscNEXOS/386) is interfaced by software IRQ $21. The basic I/O
routine follows. If only 8/16 bit values are to be transferred, this will be
done by placing them directly inside of CPU-Registers. This is working fine in
Real Mode and in DPMI mode.
If bigger data are to be transferred, this is done by assigning Pointers to
data buffers instead of the values themselves. This works fine in REAL MODE,
but in DPMI mode there's going something wrong.

-- part of the basic calling proc -------------------------------------
   with REGS do
     AX:=$ff00;         ($ff00 = Server-Call, $fe00 = Local Redirector Call)
     BX:=....;          (16 bit, defining the wanted function...)

     ES:=Seg(Data_Out); (Pointer to data block for received data from IRQ)
     DI:=Ofs(Data_Out);

     DS:=Seg(Data_In);  (Pointer to data block to be sent by the IRQ)
     SI:=Ofs(Data_In);
   end;

   Intr($21, REGS);     (Calling NEXOS with applied data)
------------------------------------------------------------------------

I think this is because BP7 is placing the data buffers outside of the memory
range of real mode, maybe it also depends in a wrong conversion of Seg/Ofs to
the buffers.

If there is anybody who can help, please send me an e-Mail to
"hants...@hantsch.co.at". It is relatively urgent.

Thanks in forward,

Rainer Hantsch

Re:Borland Pascal 7.0 -- Software-IRQ in DPMI mode


Hello!
The problem is that protected mode uses selectors instead of segments,
and real mode code can't see the memory above 1MB.

If you want to transfer data between real and protected mode, you have to do
the following:

1. Allocate REAL mode memory for the buffer.
   You have to use GlobalDosAlloc(). This allocates memory in the first
   1MB then returns a segment-offset value that points to the buffer, so
   you can use this pointer ONLY in real mode.
2. If you want to access the buffer in protected mode, allocate a selector
   with AllocSelector(). This returns a valid selector. Set the selector
   base to the linear address of this buffer (seg*16+ofs) with
   SetSelectorBase() and the limit to the buffer size (or 64K) with
   SetSelectorLimit()
3. Now you have two pointers:
   - a pointer to the buffer (for real mode)
   - and a selector-offset to access the buffer from protected mode.
     Use Ptr(selector,0)^.
4. If you're done: free the selector and the memory block.
   FreeSelector() and GlobalDosFree()

It seems to be difficult, but I used this in my pmode programs!

BandiT

In article <619vq9$af...@news.Austria.EU.net>, hants...@hantsch.co.at says...

Quote

>Problem:
>--------
>My Network (dscNEXOS/386) is interfaced by software IRQ $21. The basic I/O
>routine follows. If only 8/16 bit values are to be transferred, this will be
>done by placing them directly inside of CPU-Registers. This is working fine
in
>Real Mode and in DPMI mode.
>If bigger data are to be transferred, this is done by assigning Pointers to
>data buffers instead of the values themselves. This works fine in REAL MODE,
>but in DPMI mode there's going something wrong.

>-- part of the basic calling proc -------------------------------------
>   with REGS do
>     AX:=$ff00;         ($ff00 = Server-Call, $fe00 = Local Redirector Call)
>     BX:=....;          (16 bit, defining the wanted function...)

>     ES:=Seg(Data_Out); (Pointer to data block for received data from IRQ)
>     DI:=Ofs(Data_Out);

>     DS:=Seg(Data_In);  (Pointer to data block to be sent by the IRQ)
>     SI:=Ofs(Data_In);
>   end;

>   Intr($21, REGS);     (Calling NEXOS with applied data)
>------------------------------------------------------------------------

>I think this is because BP7 is placing the data buffers outside of the memory
>range of real mode, maybe it also depends in a wrong conversion of Seg/Ofs to
>the buffers.

Re:Borland Pascal 7.0 -- Software-IRQ in DPMI mode


Hello!

Because my applications are growing big and bigger, I decided to change from
Turbo-Pascal 7.0 to Borland Pascal 7.0 because of its DPMI feature.
Hereby I encountered big difficulties in interfacing my Local Network and I
ask kindly for your help.

Problem:
--------
My Network (dscNEXOS/386) is interfaced by software IRQ $21. The basic I/O
routine follows. If only 8/16 bit values are to be transferred, this will be
done by placing them directly inside of CPU-Registers. This is working fine in
Real Mode and in DPMI mode.
If bigger data are to be transferred, this is done by assigning Pointers to
data buffers instead of the values themselves. This works fine in REAL MODE,
but in DPMI mode there's going something wrong.

-- part of the basic calling proc -------------------------------------
   with REGS do
     AX:=$ff00;         ($ff00 = Server-Call, $fe00 = Local Redirector Call)
     BX:=....;          (16 bit, defining the wanted function...)

     ES:=Seg(Data_Out); (Pointer to data block for received data from IRQ)
     DI:=Ofs(Data_Out);

     DS:=Seg(Data_In);  (Pointer to data block to be sent by the IRQ)
     SI:=Ofs(Data_In);
   end;

   Intr($21, REGS);     (Calling NEXOS with applied data)
------------------------------------------------------------------------

I think this is because BP7 is placing the data buffers outside of the memory
range of real mode, maybe it also depends in a wrong conversion of Seg/Ofs to
the buffers.

If there is anybody who can help, please send me an e-Mail to
"hants...@hantsch.co.at". It is relatively urgent.

Thanks in forward,

Rainer Hantsch

Re:Borland Pascal 7.0 -- Software-IRQ in DPMI mode


Quote
> 1. Allocate REAL mode memory for the buffer.
>    You have to use GlobalDosAlloc(). This allocates memory in the first
>    1MB then returns a segment-offset value that points to the buffer, so
>    you can use this pointer ONLY in real mode.
> 2. If you want to access the buffer in protected mode, allocate a
selector
>    with AllocSelector(). This returns a valid selector. Set the selector
>    base to the linear address of this buffer (seg*16+ofs) with
>    SetSelectorBase() and the limit to the buffer size (or 64K) with
>    SetSelectorLimit()
> 3. Now you have two pointers:
>    - a pointer to the buffer (for real mode)
>    - and a selector-offset to access the buffer from protected mode.
>      Use Ptr(selector,0)^.
> 4. If you're done: free the selector and the memory block.
>    FreeSelector() and GlobalDosFree()

You don't have to use AllocSelector and FreeSelector since the
GlobalDosAlloc returns two words, one with the real DOS segment and one
with the selector. Look in the help; I made a SB DMA unit with this...

Arsne von Wyss
avonwyss @ beaulieu-software.ch

******************************************************
*    I removed my reply address to avoid spamming.   *
* Please use the address above to reply or write me. *
******************************************************

Other Threads