Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 02, 2006 [Issue 474] New: in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=474 Summary: in ASM block last line can't be a label Product: D Version: 0.173 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: davidl@126.com asm { jmp label1; mov EBX,EAX; label1: } when i have label in the last line of my asm block would make the compiler fail to compiler it and i wonder how can this kind of hack being done asm { mov label1, EAX; //modify the code to get it run differently label1: dw 00; } and also if i have a array item i want i can get the address directly asm { mov ax, myarray[1]; } -- |
November 02, 2006 Re: [Issue 474] New: in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | <d-bugmail@puremagic.com> wrote in message news:bug-474-3@http.d.puremagic.com/issues/... > asm > { > jmp label1; > mov EBX,EAX; > label1: > } > > when i have label in the last line of my asm block would make the compiler > fail > to compiler it Just put a semicolon after the label. The same thing applies with regular D code -- a label must be followed by a statement, even if it's the empty statement. > and i wonder how can this kind of hack being done > asm > { > mov label1, EAX; //modify the code to get it run differently > label1: dw 00; > } > > and also if i have a array item i want i can get the address directly > asm > { > mov ax, myarray[1]; > } Those I can't help you with :\ |
November 02, 2006 Re: [Issue 474] New: in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | d-bugmail@puremagic.com wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=474 > > Summary: in ASM block last line can't be a label > Product: D > Version: 0.173 > Platform: PC > OS/Version: Windows > Status: NEW > Severity: normal > Priority: P2 > Component: DMD > AssignedTo: bugzilla@digitalmars.com > ReportedBy: davidl@126.com > > > asm > { > jmp label1; > mov EBX,EAX; > label1: > } > > when i have label in the last line of my asm block would make the compiler fail > to compiler it > > > and i wonder how can this kind of hack being done > asm > { > mov label1, EAX; //modify the code to get it run differently > label1: dw 00; > } Or, label: nop; > and also if i have a array item i want i can get the address directly > asm > { > mov ax, myarray[1]; > } I think you'd want "lea eax, myarray[1]". L. |
November 03, 2006 [Issue 474] in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=474 davidl@126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|in ASM block last line can't|in ASM block last line can't |be a label |be a label ------- Comment #2 from davidl@126.com 2006-11-03 01:18 ------- consider this class { int dynamicarray[]; void method() { asm { mov EAX,this; //failed; } asm { lea EAX, dynamicarray[0]; //without this this ain't gonna work properly } } } and consider this in a func bar void bar() { int dynamicarray[]; asm { lea EAX,dynamicarray[1]; //this won't tell the address IMHO } } and how to deal with dynamic array in ASM is a pain in ass in D -- |
November 09, 2006 [Issue 474] in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=474 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #3 from bugzilla@digitalmars.com 2006-11-09 03:38 ------- This is the way it's supposed to work; a label is not a statement. To make it compile, add an empty statement: asm { jmp label1; mov EBX,EAX; label1: ; // <== add this } Labels outside of asm blocks work the same way. Also, if there are separate issues, please list them as separate items in bugzilla. -- |
November 09, 2006 [Issue 474] in ASM block last line can't be a label | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=474 ------- Comment #4 from bugzilla@digitalmars.com 2006-11-09 03:42 ------- int dynamicarray[]; asm { mov EAX,dynamicarray; // gets the length mov EAX,dynamicarray+4; // gets pointer to the data } -- |
Copyright © 1999-2021 by the D Language Foundation