Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-04

ASM code conversion from Delphi

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello all,

How can I write as ASM this assignment which is valid code for Delphi:

mov DWord ptr TCPUIDData (edi).r_eax,eax

where TCPUIDData is declared as:

TYPE  TCPUIDData     =PACKED RECORD
                        r_eax               :CARDINAL;
                        r_ebx               :CARDINAL;
                        r_edx               :CARDINAL;
                        r_ecx               :CARDINAL;
                      END;

Thanks.

Jonas Maebe
to Roland Turcan
Roland Turcan wrote
Delphi: mov DWord ptr TCPUIDData (edi).r_eax,eax

By using this:
mov DWord ptr TCPUIDData ([edi]).r_eax,eax

As far as I can tell from the manuals posted at http://docs.embarcadero.com/products/rad_studio/ , the fact that Delphi accepts your code is a bug in Delphi. Your original instruction would mean that you type cast the register "edi" to TCPUIDData, which does not make sense.

Still, this Delphi incompatibility has been fixed recently in FPC, so both ways will work in 2.4.0: http://bugs.freepascal.org/view.php?id=9327

Jonas

m2
to Jonas Maebe
Jonas Maebe wrote 11 lines
On 29 Apr 2009, at 14:23, Roland Turcan wrote: > Delphi: > > mov DWord ptr TCPUIDData (edi).r_eax,eax By using this: mov DWord ptr TCPUIDData ([edi]).r_eax,eax

or this

mov [edi+TCPUIDData.r_eax], eax

that also works with both Delphi and FPC.

mm
----
http://www.ellipsa.net/