asm woes...
Era Scarecrow via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 27 03:00:40 PDT 2016
On Friday, 27 May 2016 at 09:51:56 UTC, rikki cattermole wrote:
> Me and p0nce solved this on IRC.
>
> struct Foo {
> int x;
>
> void foobar() {
> asm {
> mov EAX, this;
> inc [EAX+Foo.x.offsetof];
> }
> }
> }
>
> void main() {
> import std.stdio;
>
> Foo foo = Foo(8);
> foo.foobar;
>
> writeln(foo.x);
> }
>
> You have to reference the field via a register.
This is good progress. Using the assembler doesn't have many
documentation examples of how to do things, guess the x[ESP]
example was totally useless on the iasm page.
More information about the Digitalmars-d-learn
mailing list