www.digitalmars.com         C & C++   DMDScript  

D - Assembly in D

reply kinghajj <kinghajj_member pathlink.com> writes:
2 flaws I've found so far:

you can't name data, such as:
hello db "Hello, world!$"

and, do register names really HAVE to be upper-case? Why can't they be lower
case, too?
Jan 26 2004
parent reply "Walter" <walter digitalmars.com> writes:
"kinghajj" <kinghajj_member pathlink.com> wrote in message
news:bv4bm6$2j6q$1 digitaldaemon.com...
 2 flaws I've found so far:

 you can't name data, such as:
 hello db "Hello, world!$"

Add a : after the label: hello: db "dddd";
 and, do register names really HAVE to be upper-case? Why can't they be

 case, too?

Because it has to tokenize like the rest of the D language, and keywords are case sensitive. It makes it a lot simpler.
Jan 26 2004
parent reply kinghajj <kinghajj_member pathlink.com> writes:
this still doesn't work:

asm
{
hello: db "Hello world!$";
mov AH, 0x09;
mov DX, hello;
int 0x21;
}

error: undefined identifier 'hello'

any suggestions?
Jan 26 2004
parent reply "Walter" <walter digitalmars.com> writes:
"kinghajj" <kinghajj_member pathlink.com> wrote in message
news:bv4jjk$2vs4$1 digitaldaemon.com...
 this still doesn't work:

 asm
 {
 hello: db "Hello world!$";
 mov AH, 0x09;
 mov DX, hello;
 int 0x21;
 }

 error: undefined identifier 'hello'

 any suggestions?

char[] hello = "hello world!$"; asm { mov AH, 0x09; mov DX, offset hello; int 0x21; }
Jan 26 2004
parent reply kinghajj <kinghajj_member pathlink.com> writes:
Still doesn't work:

char[] hello = "Hello, world$";
asm
{
mov AH, 0x09;
mov DX, offset hello; // <- error here
int 0x21;
}

still doesn't work

error: bad type/size of operands 'mov'

too big of a memory address?
Jan 26 2004
parent imr1984 <imr1984_member pathlink.com> writes:
DX i think is a 16 bit register, and addresses are 32 bits. try moving the
address into a 32 bit register like eax

In article <bv4uge$gb0$1 digitaldaemon.com>, kinghajj says...
Still doesn't work:

char[] hello = "Hello, world$";
asm
{
mov AH, 0x09;
mov DX, offset hello; // <- error here
int 0x21;
}

still doesn't work

error: bad type/size of operands 'mov'

too big of a memory address?

Jan 27 2004