Board index » delphi » Problems with assembly code of the Freeware component Objects7 (unit ExtObjects.pas) and Delphi 2

Problems with assembly code of the Freeware component Objects7 (unit ExtObjects.pas) and Delphi 2

Quote
alf.christopher...@basalmed.uio.no (Alf Christophersen) wrote:
>The following code compile fine with Delphi 1, but with Delphi 2 I get an
>error Operand size mismatch on the first line of code in the beginning :
>FUNCTION TExtendedObject.CopyData2(Destination      : TExtendedObject) : BOOLEAN;
>ASSEMBLER;
>ASM
>    LES     DI,Destination
>    MOV     AX, ES
>    OR      AX, DI
>    JZ      @@1                     { Destination = NIL }
>That is, the LES DI,Destination gives the error.
>Why did this work with Delphi 1, but not in Delphi 2?
>Beside, are there plans for a Delphi 2 version of the Objects7 unit that is a
>substitute for the missing general stream concept in Delphi (which was
>available in BPW where not only one object could be stored to file, but a lot
>of different object also and also randomly in the file)

Hi Alf,

The reason that this does not work with Delphi 2 is that the assembler
in Delphi 32 is 32 bit, and the above code is 16 bit.  In delphi 32,
the code would look like the following:

ASM
        MOV     EDI, Destination
        CMP     EDI, 0
        JZ      @@1
:

The problem is that DI is a 16 bit register and the address of
Destination is 32 bit (flat memory model pointer)  There are no
segment registers needed in Delphi 32 (thank you very much!!).  So the
ES register is not needed for the SSSS:OOOO pair because now, OOOO is
not 16 bit, it is 32 bit.

Jay Cole
=======
NitroSort provides mainframe file sorting performance at PC prices.
See www.nitrosort.com

 

Re:Problems with assembly code of the Freeware component Objects7 (unit ExtObjects.pas) and Delphi 2


The following code compile fine with Delphi 1, but with Delphi 2 I get an
error Operand size mismatch on the first line of code in the beginning :

FUNCTION TExtendedObject.CopyData2(Destination  : TExtendedObject) : BOOLEAN;
ASSEMBLER;

ASM
        LES     DI,Destination
        MOV     AX, ES
        OR      AX, DI
        JZ      @@1                     { Destination = NIL }

That is, the LES DI,Destination gives the error.

Why did this work with Delphi 1, but not in Delphi 2?

Beside, are there plans for a Delphi 2 version of the Objects7 unit that is a
substitute for the missing general stream concept in Delphi (which was
available in BPW where not only one object could be stored to file, but a lot
of different object also and also randomly in the file)

--
--------------------------------------
Alf Christophersen, Computer engineer
Nordic School of Nutrition,
PO Box 1046, Blindern, N-0316 Oslo  Norway
Tel. +47 22 85 13 27, Fax: 22 85 15 32
URL: http://www.uio.no/~achristo

Other Threads