www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Enhancing inline assembler

reply Dan <Dan_member pathlink.com> writes:
I was just working in Assembler and contemplating how powerful D is for it.
In fact, if I could write Assembler using the D language without GC or
heap/stack I would use it for everything including boot code.

Right now it uses much the same system for addressing structures as NASM does,
which is a kludge at best.  I want this:

lea eax, MyStruct.myFavoriteMember;

But if we do this:

lea eax, MyStruct.mySubStruct.myMember;

I know it will fail.  Why?  Because we're accessing a struct, and then getting a
member from that struct to get another struct.  We need to first get
mySubStruct, and THEN we can get myMember.  It needs two lea's.

lea eax, MyStruct.mySubStruct;
lea eax, eax.myMember;

That would make programming assembler in D unbelievably cool.  Unfortunately, I
know about zilch about the D implementation code.  

My only other gripe is the lack of assembler coloring in any D editors I've
encountered.
Oct 25 2005
parent "Garett Bass" <garettbass studiotekne.com> writes:
If you're using TextPad, it's pretty easy to add keywords to 
the D.syn file; it's just text.


"Dan" <Dan_member pathlink.com> wrote in message 
news:djmffm$1io7$1 digitaldaemon.com...
 I was just working in Assembler and contemplating how 
 powerful D is for it.
 In fact, if I could write Assembler using the D language 
 without GC or
 heap/stack I would use it for everything including boot 
 code.

 Right now it uses much the same system for addressing 
 structures as NASM does,
 which is a kludge at best.  I want this:

 lea eax, MyStruct.myFavoriteMember;

 But if we do this:

 lea eax, MyStruct.mySubStruct.myMember;

 I know it will fail.  Why?  Because we're accessing a 
 struct, and then getting a
 member from that struct to get another struct.  We need to 
 first get
 mySubStruct, and THEN we can get myMember.  It needs two 
 lea's.

 lea eax, MyStruct.mySubStruct;
 lea eax, eax.myMember;

 That would make programming assembler in D unbelievably 
 cool.  Unfortunately, I
 know about zilch about the D implementation code.

 My only other gripe is the lack of assembler coloring in 
 any D editors I've
 encountered.

 
Nov 01 2005