Board index » delphi » 32 bit Pascal with Novell

32 bit Pascal with Novell

Hi all,

I'm trying to solve a problem for someone who's porting a program from
Turbo Pascal (DOS, 16 bit) to TMT Pascal (DOS, 32 bit, mostly
Turbo-compatible). Most of the code works fine, but the Novell calls
aren't doing anything. Now the TMT FAQ says:

> Q: I need to call a real mode interrupt (say int 21h), and I have to set DS:DX to the

segment:offset of some data
variable. How can I do that?
> A: It's possible to emulate the real mode interrupt by means of special DPMI function,

which is implemented in MsDos and Intr
procedures (see our on-line help system for the DOS unit description).
Just keep in mind, that you have to allocate a data block in
the low memory area (1st megabyte) using AllocDosMemoryBlock or
DosMemoryAlloc function from the DPMI unit.

And I modified the code accordingly, but still no luck. TMT's tech
support haven't come up with anything, nor has a search of Google or
Novell's web site. A relevant section of code follows - any of you
have any idea what's going wrong? Any help would be much appreciated.


Function OpenSemNovell(Semaphore:Str80;Var Users:Byte;Var
Var Regs : Registers;
    TempSem : Str255;

  memseg: word;
  memaddr: dword;
  memptr: ^char;
  i: dword;
   TempSem:= MakeSemaphoreName(Semaphore);

  memseg := dosmemoryalloc(256);
  memaddr := dword(memseg) * 16;
  memptr := pointer(memaddr);
  for i := 0 to 255 do
    memptr^ := char(tempsem[i]);

   Regs.AH := $C5;             { AH = General SEMAPHORE function }
   Regs.AL := 0;               { AL = Open a semaphore }
   Regs.DS := memseg;  { Data segment of semaphore }
   Regs.EDX := 0;  { Data segment offset of Sem.} := 0;
   regs.fs := 0; := 0;
   Regs.CL := 1;               { Initial value of Semaphore count }
   Intr(33,Regs);              { Issue software interupt }


   HiHandle := Regs.DX;
   LoHandle := Regs.CX;
   Users := Regs.BL;           { No. of users that have this semaphore
open }
   If Regs.AL <> 0 Then        { errors returned in Regs.AL }
      OpenSemNovell := False;
      Case Regs.AL of
        $FF : Warning('Invalid initial value in OPEN SEMAPHORE');
        $FE : Warning('Invalid string length in OPEN SEMAPHORE');
        $96 : Warning('Out of work memory in file server');
        Else  Warning('Unknown error in OPEN SEMAPHORE');
   Else OpenSemNovell := True;

"Mercy to the guilty is treachery to the innocent."


Re:32 bit Pascal with Novell

In article <>, Russell Wallace wrote:

>   memseg := dosmemoryalloc(256);
>   memaddr := dword(memseg) * 16;
>   memptr := pointer(memaddr);
>   for i := 0 to 255 do
>   begin
>     memptr^ := char(tempsem[i]);
>     inc(memptr);
>   end;

I don't know TMT, I speak from 32bit dos experience with FPC, but this
doesn't sound right.

memseg:memaddr are in low dos memory.


is in the first megabyte of your protected memory, which isn't necessarily the

Probably you either have to use a special move() procedure (FPC:segmove) to
move data from one segment to the other, or maybe TMT has a special type for
ptrs to dos space. (the definition of memptr must change then).

But it is possible that TMT does things different (e.g. map dos MB in the
first MB of protected memory).

Only doable way to find out things like that is to call support or use the

If you use TMT because it is free, I recommend you to switch to one of the
Free compilers. (like FPC, or GPC. IMHO FPC is more
suitable for TP porting)
This because they come with source and manuals.

If you don't get my explanation, get the FPC units manual here:   (entire PDF, several MBs) or (online HTML, poor mans layout)

read specially the GO32 unit (the DPMI extender of FPC) part and its examples.

Other Threads