digitalmars.D.bugs - [Issue 474] New: in ASM block last line can't be a label
- d-bugmail puremagic.com (32/32) Nov 01 2006 http://d.puremagic.com/issues/show_bug.cgi?id=474
- Jarrett Billingsley (6/26) Nov 01 2006 Just put a semicolon after the label. The same thing applies with regul...
- Lionello Lunesu (5/42) Nov 02 2006 Or,
- d-bugmail puremagic.com (35/35) Nov 02 2006 http://d.puremagic.com/issues/show_bug.cgi?id=474
- d-bugmail puremagic.com (20/20) Nov 09 2006 http://d.puremagic.com/issues/show_bug.cgi?id=474
- d-bugmail puremagic.com (9/9) Nov 09 2006 http://d.puremagic.com/issues/show_bug.cgi?id=474
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]; } --
Nov 01 2006
<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 itJust 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 :\
Nov 01 2006
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.
Nov 02 2006
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 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 --
Nov 02 2006
http://d.puremagic.com/issues/show_bug.cgi?id=474 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID 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. --
Nov 09 2006
http://d.puremagic.com/issues/show_bug.cgi?id=474 int dynamicarray[]; asm { mov EAX,dynamicarray; // gets the length mov EAX,dynamicarray+4; // gets pointer to the data } --
Nov 09 2006