Board index » delphi » $300 for correct TSR/ISR help with Borland 7.0 Pascal

$300 for correct TSR/ISR help with Borland 7.0 Pascal

I'm creating a TSR to allow a Protected mode program to communicate with a
Real mode program via a simulated real-mode interrupt.  Most of this was
suggested by Borland as we discussed what we needed to do.  I am currently
running into 2 major problems:

1)  Borland suggested that I allocate the shared real-mode/protected-mode buffer
from the protected-mode program via int 31h with AX=2.  The memory address
will be hard-coded.  The code I have so far is:

asm
  MOV  AX,2
  MOV  BX,{segment address}
  int  31h
end;

How can I tell what memory is/will be available?  
Where do I get the segment address for that memory from?  
As I understand it, the selector that I should then use will be returned in AX.  
How do i then move that into a normal variable accessible outside of assembler?  
What other register setup (if any) is required before the int call?

2)  We were told to use interrupt 31, function 300 to simulate the real-mode
interrupt. My interrupt call currently looks like this:

asm
  MOV  BH,0
  MOV  CX,0
  MOV  AX,0300h
  MOV  BL,65h
  int  31h
end;

What other setup is necessary to get this to work?  Currently when I execute it
the program hangs when it hits the int 31h.  I've setup my new ISR for int65 via
SetIntVec.  All that procedure does is write a message to a file, so I can tell it
got executed.  The file is never updated currently.

Call me ASAP at 503-929-6075.  I should be available all day Saturday.  I will send
a check for $300 to the first person can provide the correct information for me to
get these routines working.

 

Re:$300 for correct TSR/ISR help with Borland 7.0 Pascal


Hi!

Quote
>1)  Borland suggested that I allocate the shared real-mode/protected-mode
>buffer from the protected-mode program via int 31h with AX=2.  The memory
>address will be hard-coded.  The code I have so far is:

>asm
>  MOV  AX,2
>  MOV  BX,{segment address}
>  int  31h
>end;

  DPMI function 2 is not for allocating shared memory. It is called
something like the transformation of real mode segment address into the
descriptor.
  If your int65 handler use some memory address (buffer) to write to then
you have to use this function:

-------
Allocate memory in the DOS pool (within the 1st megabyte):
Input:
        AX = 0100h
        BX = size of the block in paragraphs (16-bytes chunks)
Output:
        CF = 1 if error (error code in AX: 07h - MCB destroyed, 08h - size
requsted is too large)
        AX = segment address for real mode
        DX = selector of the block for PM
-------
and:
-------
Free the block allocated by fn100h:
Input:
        AX = 0101h
        DX = selector of the block
Output:
        CF = 1 if error (AX: 07h - MCB destroyed, 09h - invalid selector)
-------

Quote

>How can I tell what memory is/will be available?  
>Where do I get the segment address for that memory from?  

  For fn0002 you use the segment address for real mode in BX and selector
in AX for PM.

Quote
>As I understand it, the selector that I should then use will be returned in
>AX.   How do i then move that into a normal variable accessible outside of
>assembler?   What other register setup (if any) is required before the int

  Use, for example this (as you usually do it):

        mov     ds, ax
        mov     [SomeLocation], SomeValue

Quote
>call?

  We had the similar problem and the following technics works fine:
1) TSR starts in real mode;
2) Allocate the real mode buffer via fn100h if your TSR waits for or fills
such a buffer;
3) your DPMI program will access it via int 33h, ax = 0300h.
4) Use and deallocate the buffer.

Quote
>2)  We were told to use interrupt 31, function 300 to simulate the
>real-mode  interrupt. My interrupt call currently looks like this:

>asm
>  MOV  BH,0
>  MOV  CX,0
>  MOV  AX,0300h
>  MOV  BL,65h
>  int  31h
>end;

>What other setup is necessary to get this to work?  Currently when I
>execute it the program hangs when it hits the int 31h.  I've setup my new
>ISR for int65 via SetIntVec.  All that procedure does is write a message to
>a file, so I can tell it got executed.  The file is never updated
>currently.

  But who has told you that AX, CX, BX is the only parameters to pass to
int 33 fn300h? Look here:
------- Simulate a real mode interrupt:
Input:
        AX      = 0300h
        BL      = IntNo
        BH      = Flags: bit0 = 1 - reset interrupt controller and A20 line
        CX      = words count to be copied from PM stack into RM stack
        ES:(E)DI= register structure (see below)
Output:
        CF      = 1 if error
        ES:(E)DI= structure modified

Register structure layout:
Offset          Register
00H              EDI
04H              ESI
08H              EBP
0CH              Reserv
10H              EBX
14H              EDX
18H              ECX
1CH              EAX
20H              FLAGS
22H              ES
24H              DS
26H              FS
28H              GS
2AH              IP
2CH              CS
2EH              SP
30H              SS
-------

  So, you need to fill this structure with appropriate values for your TSR
functions.

Regards,
Alex

Re:$300 for correct TSR/ISR help with Borland 7.0 Pascal


In article: <4v5fct$4...@news-s01.ny.us.ibm.net>  jhns...@ibm.net writes:

Quote

>I'm creating a TSR to allow a Protected mode program to communicate with a
>Real mode program via a simulated real-mode interrupt.  Most of this was
>suggested by Borland as we discussed what we needed to do.  I am currently
>running into 2 major problems:

>1)  Borland suggested that I allocate the shared real-mode/protected-mode

buffer from the protected-mode program via int 31h with AX=2.

Did they really, that was a little {*word*194} of them, since this function is
designed for allocating stuff like the SegXXXX variables. The reason is:

"Descriptors created by this function can never be modified or freed. For this
reason, use this function sparingly. Applications should not call this function
to to obtain descriptors to private data areas."

That's a quote from Borland's own "Open Architechture Handbook".

Quote
>  The memory address will be hard-coded.  The code I have so far is:

>asm
>  MOV  AX,2
>  MOV  BX,{segment address}
>  int  31h
>end;

>How can I tell what memory is/will be available?

function MapDosSegment(Segment: Word): Word;
asm
      MOV  AX,2
      MOV  BX,[Segment]
      int  31h
      mov  ax,bx
      jnc  @@1
      xor  ax,ax
@@1:
end;

A non-zero return indicates a successful call. The returned selector is a r/w
data selector with a 64k limit. eg,

type
  PtrRec: record
    Ofs: Word;
    Seg: Word;
  end;

var
  VideoAdr: Pointer;
begin
  PtrRec(VideoAdr).Ofs := 0;
  PtrRec(VideoAdr).Seg := MapDosSegment($A000);
  if VideoAdr = nil
    then Halt[1];
  ...

Quote
>Where do I get the segment address for that memory from?  
>As I understand it, the selector that I should then use will be returned in AX.

No, BX with the above call.

Quote
>How do i then move that into a normal variable accessible outside of assembler?

I've just don it for you. :-)

Quote
>What other register setup (if any) is required before the int call?

None. The above function is all that's required.

Quote

>2)  We were told to use interrupt 31, function 300 to simulate the real-mode
>interrupt. My interrupt call currently looks like this:

>asm
>  MOV  BH,0
>  MOV  CX,0
>  MOV  AX,0300h
>  MOV  BL,65h
>  int  31h
>end;

This won't work. You need to setup ES:DI to point to the real-mode registers
structure containing the values of the registers you want to pass to the real
mode interrupt.

Quote
>What other setup is necessary to get this to work?  Currently when I execute it
>the program hangs when it hits the int 31h.  I've setup my new ISR for int65

via SetIntVec.

That's setting a PROTECTED mode interrupt vector, not a real-mode one.

Quote
>  All that procedure does is write a message to a file, so I can tell it
>got executed.  The file is never updated currently.

If you're still stuck, then email me with *exactly* what you want to do, and
I'll write the necessary procedures.

-- Jay

 ---------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA  |
| g...@jayman.demon.co.uk   ftp://SimTel/msdos/turbopas/gv4svga1.zip          |
|                         http://www.en.com/users/grendel/prog/tv_prog.html |
 ---------------------------------------------------------------------------

Re:$300 for correct TSR/ISR help with Borland 7.0 Pascal


In article: <4v5fct$4...@news-s01.ny.us.ibm.net>  jhns...@ibm.net writes:

Quote

>I'm creating a TSR to allow a Protected mode program to communicate with a
>Real mode program via a simulated real-mode interrupt.  Most of this was
>suggested by Borland as we discussed what we needed to do.  I am currently
>running into 2 major problems:

>1)  Borland suggested that I allocate the shared real-mode/protected-mode
buffer
>from the protected-mode program via int 31h with AX=2.  The memory address
>will be hard-coded.  The code I have so far is:

>asm
>  MOV  AX,2
>  MOV  BX,{segment address}
>  int  31h
>end;

>How can I tell what memory is/will be available?  
>Where do I get the segment address for that memory from?  
>As I understand it, the selector that I should then use will be returned in AX.
>How do i then move that into a normal variable accessible outside of assembler?
>What other register setup (if any) is required before the int call?

>2)  We were told to use interrupt 31, function 300 to simulate the real-mode
>interrupt. My interrupt call currently looks like this:

>asm
>  MOV  BH,0
>  MOV  CX,0
>  MOV  AX,0300h
>  MOV  BL,65h
>  int  31h
>end;

>What other setup is necessary to get this to work?  Currently when I execute it
>the program hangs when it hits the int 31h.  I've setup my new ISR for int65
via
>SetIntVec.  All that procedure does is write a message to a file, so I can tell
it
>got executed.  The file is never updated currently.

>Call me ASAP at 503-929-6075.  I should be available all day Saturday.  I will
send
>a check for $300 to the first person can provide the correct information for me
to
>get these routines working.

--
 ---------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA  |
| g...@jayman.demon.co.uk   ftp://SimTel/msdos/turbopas/gv4svga1.zip          |
|                         http://www.en.com/users/grendel/prog/tv_prog.html |
 ---------------------------------------------------------------------------

Other Threads