??? 02/16/07 09:09 Modified: 02/16/07 09:47 Read: times |
#133111 - SDCC Responding to: ???'s previous message |
The pointer-dereference-postincrement example: ;*a++ = *b++; mov r0,_a mov r1,_b mov ar2,@r1 inc _b mov @r0,ar2 inc _a ret ;------------------------------------------------------------ ;*a = *b; mov r0,_a mov r1,_b mov ar2,@r1 mov @r0,ar2 ;++a; inc _a ;++b; inc _b ret The loop example: ;somechar = 10; mov _somechar,#0x0A ;while(somechar-- != 0) { 00101$: r2,_somechar dec _somechar cjne r2,#0x00,00108$ ret ; i++; // this is the DOSOMETHING :-) (some body of the loop) 00108$: inc _i sjmp 00101$ ;} ;------------------------------------------------------------ ;somechar = 10; mov _somechar,#0x0A ;do { ; i++; // DOSOMETHING 00101$: inc _i ;while(--somechar != 0); dec _somechar mov a,_somechar jz 00108$ sjmp 00101$ 00108$: ret SDCC is Version 2.6.1 #4478 (Nov 23 2006), run with no explicit commandline argument; examples compiled without any explicit pragma. JW |