🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.language.basm
Article #13

Re: Do I know how to use OFFSET?

#13
From: Bob Gonder
Date: Mon, 16 Jul 2007 19:31
41 lines
2005 bytes
Larry Griffiths wrote:

>class x
>{
>unsigned __int64 A;
>unsigned __int64 B;
>};
>
>I add some assembler to a method of the class:

Does ECX already point to a memory location?
If so, then this should be
	mov	DWORD PTR [ECX], this;	Store at ecx

If not, if you are building an address in ecx, then
	mov	ecx, this;	(ECX isn't a pointer)
	add	ecx,.....

>    asm     mov     DWORD PTR     ecx, this;
>    asm     add     DWORD PTR    ecx, OFFSET this.B
>
>The offset to "B" is $08 but the generated code only adds $04 to ECX.

Don't know off the top of my head (haven't done Class Asm)
might it be
	add	DWORD PTR [ecx], OFFSET x.B
or if building ecx, maybe
	add	ecx, OFFSET x.B

Might even be smart enought to allow
	OFFSET  B

It looks like you are trying to do
	mov	[ecx], &B

which looks like this:
	lea	eax,  this.B
	mov	[ecx], eax

Unless you are attempting to put the address of B into ecx
	lea	ecx, this.B
Technical Details
Message-ID: <qrgn93hicasnl4bdmubgokc0fl0n1j6abk@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <465af3d6@newsgroups.borland.com> <469ba1a0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 107b11,be1aae1f5a23b04f
X-Google-Attributes: gid107b11,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.language.basm
Subject: Re: Do I know how to use OFFSET?
Date: Mon, 16 Jul 2007 12:31:56 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <qrgn93hicasnl4bdmubgokc0fl0n1j6abk@4ax.com>
References: <465af3d6@newsgroups.borland.com> <469ba1a0$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.89.174
X-Trace: newsgroups.borland.com 1184614312 69.69.89.174 (16 Jul 2007 12:31:52 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail