Re: An Object-Oriented Syntax for x86 Assembly
- From: Johannes Kroll <j-kroll(remove-this)@gmx.de>
- Date: Sun, 24 Apr 2005 15:29:40 +0200
On 23 Apr 2005 14:41:52 -0700
randyhyde@xxxxxxxxxxxxx wrote:
>
> Johannes Kroll remove-this]@gmx.de> wrote:
> >
> > Nice to have would be something like
> >
> > eax.add(5).mul(ebx).div(12)
> >
> > i. e. you use the result of the previous instruction as an operand
> for
> > the next one, without writing it twice. The above could be
> > translated
> to
> >
> > add eax, 5
> > mul ebx
> > ; and here's the first problem...
> > mov ecx, 12
> > div ecx
>
> In HLA, when you do something like "div( 12, edx:eax);" you get code
> like the following:
>
> twelve:dword := 12;
> .
> .
> .
> div twelve
Ok, this is probably better, or easier, then thrashing a register. It
would be best to use a register if one is "free", and a memory variable
if not. But then you would have to have some register allocation code,
which makes it all more HLL-like.
But it would be a nice way to write long calculations in an asm-like
way. Maybe. :-) I'd probably be more interested in writing it than in
using it...
> No reason you couldn't do something similar with the object-oriented
> syntax. Of course, there is the issue of EDX (or DX, or AH) being
> involved in the calculation and how do you note that in this syntax.
> In the HLA system, for example, you have to explicitly provide a
> second operand that specifies the size. I suppose in the
> object-oriented approach you could assume that the size is twice the
> object's and write
>
> eax.div( xxx ) --- means edx:eax/xxx
I'd expect that one to read from EAX only, not from EDX:EAX.
> or make it explicit
>
> edx:eax.div( xxx )
>
> You could also write
>
> edx:eax.mod( xxx )
>
> which would be exactly the same instruction as above, except it
> returns EDX as its operand rather than EAX, i.e.,
>
> edx:eax.mod( xxx ).add(3)
>
> would compute
>
> edx = (edx:eax % xxx) + 3
Yes, that's good. But then
ebx.mod(10)
or maybe even
ebx:ecx.mod(esi)
should work, too.
> Just a thought.
> Randy Hyde
>
.
- References:
- An Object-Oriented Syntax for x86 Assembly
- From: randyhyde
- Re: An Object-Oriented Syntax for x86 Assembly
- From: Johannes Kroll
- Re: An Object-Oriented Syntax for x86 Assembly
- From: randyhyde
- An Object-Oriented Syntax for x86 Assembly
- Prev by Date: Re: Report from the LuxAsm mailing list for Betov
- Next by Date: Re: Report from the LuxAsm mailing list for Betov
- Previous by thread: Re: An Object-Oriented Syntax for x86 Assembly
- Next by thread: Re: An Object-Oriented Syntax for x86 Assembly
- Index(es):
Relevant Pages
|