Board index » delphi » Asm 16-bit & 32-bit compatibility

Asm 16-bit & 32-bit compatibility

I have Delphi 1.0, and i write my programs with Asm...End  blocks.
In the future i will convert my programs to Delphi 2.0 (32-bit) but I don't
know if my Asm blocks will work properly in 32-bit environment.

Please Look in the following examples:
Is it possible to run them on Delphi 2.0 ???

procedure test1;
var
  s: String;
begin
  asm
    mov byte ptr [s],1
    mov byte ptr [s+1],'A'
  end;

procedure test2;
var
   i: ^Integer;
begin
   new(i);
   asm
      les di,i
      mov word ptr [es:di],500
   end;
   dispose(i);
end;

 

Re:Asm 16-bit & 32-bit compatibility


On Fri, 22 Mar 1996 05:44:50 GMT, n...@netvision.net.il (Nir Sofer)
wrote:

Quote
>I have Delphi 1.0, and i write my programs with Asm...End  blocks.
>In the future i will convert my programs to Delphi 2.0 (32-bit) but I don't
>know if my Asm blocks will work properly in 32-bit environment.

>Please Look in the following examples:
>Is it possible to run them on Delphi 2.0 ???

No, but the second requires only minor changes:

Quote
>var
>  s: String;
>begin
>  asm
>    mov byte ptr [s],1
>    mov byte ptr [s+1],'A'
>  end;

Strings are handled quite differently now (no 255 byte limitations).
This kind of code won't work at all.

Quote
>var
>   i: ^Integer;
>begin
>   new(i);
>   asm
>      les di,i
>      mov word ptr [es:di],500

This should work if you drop the use of ES (not needed) and change DI
to EDI:

  lea edi,i
  mov word ptr[edi],500

I hope this helps.

Duncan Murdoch

Other Threads