Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
fm77(R)

11.05.2011, 11:48
 

Documentation for RTM.EXE (16-Bit) from Borland (Developers)

Sorry if this might not fit here.

Where can I find the documentation of the definition for the headers of RTM.EXE (16-Bit) from Borland (included with their compilers)?

so for example I know (from Borlands MEMORY.PAS included with BP7)

----------------------------------------------------------------------
function MemAllocateBlock(HeapHandle, Size, Attributes: Word;
EventProc: Pointer; var Selector: Word): Integer; far;
external 'RTM' index $0005;

function MemFreeBlock(Selector: Word): Integer; far;
external 'RTM' index $0006;

function MemResizeBlock(Selector: Word; Size: Word): Integer; far;
external 'RTM' index $0007;

function MemGetBlockSize(Selector: Word; var Size: Longint): Integer; far;
external 'RTM' index $0014;
----------------------------------------------------------------------

however where can I find the definition for the other functions (for example index $0015)?

I know that on Japheth?s homepage there was years ago some of the definitions in one of his files (not in pascal though), but I cant find it anymore ? but since he has written an dos extender there must be some documentation.

any help would be appreciated!

---
I am still so much in love with Borland Pascal Version 7.0

Japheth(R)

Homepage

Germany (South),
11.05.2011, 19:31

@ fm77
 

Documentation for RTM.EXE (16-Bit) from Borland

> I know that on Japheth?s homepage there was years ago some of the
> definitions in one of his files (not in pascal though), but I cant find it
> anymore ? but since he has written an dos extender there must be some
> documentation.

There's not much. It was a very rudimentary "emulation", consisting more or less of just the "memory" functions that you already mentioned.

Here's the definition file for "rtm.dll":



LIBRARY RTM

EXETYPE WINDOWS

CODE LOADONCALL FIXED
DATA LOADONCALL MOVEABLE

EXPORTS
 WEP                        @1  RESIDENTNAME
 MEMALLOCATEBLOCK           @5
 MEMFREEBLOCK               @6
 MEMRESIZEBLOCK             @7
 MEMGETBLOCKSIZE            @20
 MEMQUERYFREEMEM            @21
; dummy33                    @33 NONAME
; dummy34                    @34 NONAME
 InitSwapping               @35
 DoneSwapping               @36
; dummy47                    @47 NONAME
; dummy49                    @49 NONAME
; dummy50                    @50 NONAME
; dummy51                    @51 NONAME
; dummy52                    @52 NONAME
 MEMINITSWAPFILE            @58
 MEMCLOSESWAPFILE           @92
; RTMGETVERSION              @17152


The "swapping" functions in the emulation didn't contain any functionality.

---
MS-DOS forever!

fm77(R)

11.05.2011, 23:20

@ Japheth
 

Documentation for RTM.EXE (16-Bit) from Borland

Hello Japheth,

Thank you for a super fast reply! ...and yes, I think that "LIBRARY RTM" was the file I saw years ago in some of your zip files. Today I just downloaded the source of your HX DOS Extender (HXSRC216.zip) but its not in there. Where was that?

> There's not much. It was a very rudimentary "emulation", consisting more or
> less of just the "memory" functions that you already mentioned.

But my understanding is that you wrote that "emulation". How did you find out the meaning of the parameters on the stack?

Especially how do I find out the parameters needed for function RTM.21 (MemQueryFreeMem) and if it has a return value (in AX)?

> LIBRARY RTM
> ......
> MEMQUERYFREEMEM @21
> ......

One more question (sorry): I didn't try it but, if I used your HX DOS Extender with the Delphi V1 command line compiler DCC.EXE (16-Bit) it might not work since it uses for example RTM.46 - I don't even have a name for that function.

Japheth(R)

Homepage

Germany (South),
12.05.2011, 09:58

@ fm77
 

Documentation for RTM.EXE (16-Bit) from Borland

> Thank you for a super fast reply! ...and yes, I think that "LIBRARY RTM"
> was the file I saw years ago in some of your zip files. Today I just
> downloaded the source of your HX DOS Extender (HXSRC216.zip) but its not in
> there. Where was that?

It is in the "16-bit" dev package, in a directory called RTMSUBST.

> But my understanding is that you wrote that "emulation". How did you find
> out the meaning of the parameters on the stack?

I can't remember, perhaps by RE.

> Especially how do I find out the parameters needed for function RTM.21
> (MemQueryFreeMem) and if it has a return value (in AX)?

see file rtm.asm in the package mentioned above.

> One more question (sorry): I didn't try it but, if I used your HX DOS
> Extender with the Delphi V1 command line compiler DCC.EXE (16-Bit) it might
> not work since it uses for example RTM.46 - I don't even have a name for
> that function.

I also have no idea what this is supposed to do.

---
MS-DOS forever!

fm77(R)

12.05.2011, 10:55

@ Japheth
 

Documentation for RTM.EXE (16-Bit) from Borland

> It is in the "16-bit" dev package, in a directory called RTMSUBST.

Super! I found it - many thanks!

fm77(R)

04.05.2012, 11:42

@ Japheth
 

Documentation for RTM.EXE (16-Bit) from Borland

> > One more question (sorry): I didn't try it but, if I used your HX DOS
> > Extender with the Delphi V1 command line compiler DCC.EXE (16-Bit) it might
> > not work since it uses for example RTM.46 - I don't even have a name for
> > that function.
>
> I also have no idea what this is supposed to do.

Just for completeness, I found the definition of the function RTM.46 in the newsgroup:

Dmitry Dmitrienko wrote on May 05, 1997 in comp.lang.pascal.borland

> There are no problems if you use protected mode and write using DPMI
> target of BP. E.g. you can use RTM entry point i've 'discovered'
> tree years ago:

function MemAllocateBigBlock(HeapHandle: Word; Size: LongInt;
  Flags: Word; EventProc: Pointer; var Selector: Word): Integer; far;
  external 'RTM' index $002E;

function MemFreeBlock(Selector: Word): Integer; far;
  external 'RTM' index $0006;

> Usually, i'm using this functions in following manner:

var
  Selector1M: Word;
  Size: Longint;
begin
  Size:=1024 * 1024;
  if MemAllocateBigblock(0, Size, 4, nil, Selector1M) = 0
  then begin
    {allocated ok}
    SetSelectorLimit(Selector1M,Size-1);
  end
  else begin
    {function failed}
  end;
{ use this memory block }
{ free memory block}
  MemFreeBlock(Selector1M);
end;

> where procedure SetSelectorLimit looks like:

procedure SetSelectorLimit(Sel: Word; Limit: Longint);
begin
  if Limit > 1024 * 1024 then { page-align needed }
  begin
    Limit:=(Limit + $FFF) and NOT $FFF;
  end;
  asm
        mov     ax,8 { set selector limit}
        mov     bx,Sel
        mov     cx,word ptr Limit[2]
        mov     dx,word ptr Limit[0]
        int     31h
  end;
end;

I believe Dmitry Dmitrienko can be reached through http://www.php-debugger.com/resume/, but I am not quite sure.

I am reposting this here because it seems to me that the information in the newsgroups are disappearing over time.

Comparing RTM.46 (MemAllocateBigBlock) with RTM.5 (MemAllocateBlock) it looks reasonable:

function MemAllocateBigBlock(HeapHandle: Word; Size: LongInt; Flags: Word;
  EventProc: Pointer; var Selector: Word): Integer; far;
  external 'RTM' index $002E;

function MemAllocateBlock(HeapHandle, Size, Attributes: Word;
  EventProc: Pointer; var Selector: Word): Integer; far;
  external 'RTM' index $0005;

Hope someone will find that usefull.

BTW: Searching or browsing the newsgroups with google is getting worse every day - why?

---
I am still so much in love with Borland Pascal Version 7.0

Arjay(R)

05.05.2012, 11:13

@ fm77
 

Scalar: How to patch Borland Pascal 7.0 to use 32-Bit DPMI

How To Patch Borland Pascal 7.0 To Use 32-Bit DPMI

Laaca(R)

Homepage

Czech republic,
05.05.2012, 17:46

@ Arjay
 

Scalar: How to patch Borland Pascal 7.0 to use 32-Bit DPMI

Does not work for me.

---
DOS-u-akbar!

Arjay(R)

05.05.2012, 18:11

@ Laaca
 

Scalar: How to patch Borland Pascal 7.0 to use 32-Bit DPMI

> Does not work for me.
ok. Just did a few quick tests myself using TPX and I it appeared to work fine when I kept the original RTM.EXE and renamed DPMI32VM.OVL to DPMI16BI.OVL

DPMI16BI OVL 58,376 05-05-2012 17:00
RTM EXE 85,998 05-05-2012 17:01
TPX EXE 474,311 05-05-2012 16:58


I then copied TPX.EXE to TPX32.EXE patched EXE (manually) and it worked fine:

TPX32 EXE 474,311 05-05-2012 17:03
RTM EXE 85,998 05-05-2012 17:01
DPMI32VM OVL 58,376 05-05-2012 16:57



How is it failing for you?

Arjay(R)

06.05.2012, 12:41

@ fm77
 

Documentation for RTM.EXE (16-Bit) from Borland

> any help would be appreciated!
One method that is often overlooked is to get the compiler to tell you, e.g. via ADDR etc. However for reserved system items this will result in "Error 20: Variable identifier expected." this however can be worked around via MOVE etc.
e.g. I have written some code to disable delay and other functions via such methods to enable distribution of code/TPU's to people with unpatched compilers. If I get time today I'll dig out some example code which is on a different machine.

fm77(R)

08.05.2012, 16:50

@ Arjay
 

Documentation for RTM.EXE (16-Bit) from Borland

> > any help would be appreciated!
> One method that is often overlooked is to get the compiler to tell you,
> e.g. via ADDR etc. However for reserved system items this will result in
> "Error 20: Variable identifier expected." this however can be worked around
> via MOVE etc.

I am not quite sure if I understand you correctly, but in my case you tell the compiler with the external declaration in the source code - and not vice versa. e.g.

function MemAllocateBlock(HeapHandle, Size, Attributes: Word;
  EventProc: Pointer; var Selector: Word): Integer; far;
  external 'RTM' index $0005;

function MemFreeBlock(Selector: Word): Integer; far;
  external 'RTM' index $0006;


> e.g. I have written some code to disable delay and other functions via such
> methods to enable distribution of code/TPU's to people with unpatched
> compilers. If I get time today I'll dig out some example code which is on
> a different machine.

I think you mean something different here.... anyway, I am still glad for your respose - many thanks!

---
I am still so much in love with Borland Pascal Version 7.0

Back to index page
Thread view  Board view
15188 Postings in 1365 Threads, 250 registered users, 15 users online (0 registered, 15 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum