From: Mario <mar...@gm...> - 2011-08-29 22:51:20
|
Hello, its me ...once again. I have tried to do the following. #define SOMEASMHERE __asm\ ASM INSTRUCTION\ OTHER ONE\ ETC\ __endasm; where “ASM INSTRUCTION”, “OTHER ONE”, “ETC”, are ...assembler instructions. SDCC does not complain at all but I get error code 256. from gpasm. The strange part, is that it will work with a single asm instruction inside, for example. #define SOMEASMHERE __asm\ ASM INSTRUCTION\ __endasm; Works as expected, but... if I do.- #define SOMEASMHERE __asm\ ASM INSTRUCTION\ OTHER ONE\ __endasm; Only “ASM INSTRUCTION” will be included and the second one wont, as if I have never entered it. If I try with three or more, the error code 256 from gpasm happens. However I have found a workaround for this bug: #define SOMEASMHERE __asm ASM INSTRUCTION __endasm;/ __asm OTHER ONE __endasm;/ __asm ETC __endasm; which works alright for this. Greetings. |
From: Zafi R. <zr...@gm...> - 2011-08-29 23:40:45
|
How about: #define SOMEASMHERE __asm\ ASM INSTRUCTION; \ OTHER ONE; \ ETC; \ __endasm; Regards, Zafi. On Tue, Aug 30, 2011 at 12:51 AM, Mario <mar...@gm...> wrote: > Hello, its me ...once again. > > I have tried to do the following. > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > ETC\ > __endasm; > > where “ASM INSTRUCTION”, “OTHER ONE”, “ETC”, are ...assembler instructions. > SDCC does not complain at all but I get error code 256. from gpasm. > > The strange part, is that it will work with a single asm instruction > inside, for example. > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > __endasm; > > Works as expected, but... if I do.- > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > __endasm; > > Only “ASM INSTRUCTION” will be included and the second one wont, as if > I have never entered it. > If I try with three or more, the error code 256 from gpasm happens. > > However I have found a workaround for this bug: > > #define SOMEASMHERE __asm ASM INSTRUCTION __endasm;/ > __asm OTHER ONE __endasm;/ > __asm ETC __endasm; > > which works alright for this. > Greetings. > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > |
From: Mario <mar...@gm...> - 2011-08-29 23:49:21
|
Even more strange. :/ Compiler won’t complain at all, but only the first one works. I never saw in the manual that semicolons were used for inline assembler code, but it does not fail also. lol On Mon, Aug 29, 2011 at 8:40 PM, Zafi Ramarosandratana <zr...@gm...> wrote: > How about: > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION; \ > OTHER ONE; \ > ETC; \ > __endasm; > > Regards, > Zafi. > > On Tue, Aug 30, 2011 at 12:51 AM, Mario <mar...@gm...> wrote: >> Hello, its me ...once again. >> >> I have tried to do the following. >> >> #define SOMEASMHERE __asm\ >> ASM INSTRUCTION\ >> OTHER ONE\ >> ETC\ >> __endasm; >> >> where “ASM INSTRUCTION”, “OTHER ONE”, “ETC”, are ...assembler instructions. >> SDCC does not complain at all but I get error code 256. from gpasm. >> >> The strange part, is that it will work with a single asm instruction >> inside, for example. >> >> #define SOMEASMHERE __asm\ >> ASM INSTRUCTION\ >> __endasm; >> >> Works as expected, but... if I do.- >> >> #define SOMEASMHERE __asm\ >> ASM INSTRUCTION\ >> OTHER ONE\ >> __endasm; >> >> Only “ASM INSTRUCTION” will be included and the second one wont, as if >> I have never entered it. >> If I try with three or more, the error code 256 from gpasm happens. >> >> However I have found a workaround for this bug: >> >> #define SOMEASMHERE __asm ASM INSTRUCTION __endasm;/ >> __asm OTHER ONE __endasm;/ >> __asm ETC __endasm; >> >> which works alright for this. >> Greetings. >> >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> Sdcc-user mailing list >> Sdc...@li... >> https://lists.sourceforge.net/lists/listinfo/sdcc-user >> > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > |
From: Kustaa N. <Kus...@pl...> - 2011-08-30 08:45:49
|
I'm no expert on this (in line assembly) but assembler in general is line based where as a C #define is all one line, so I would not expect the multiline assembler code work at all. The line continuation character '\' is removed by the pre-processor and the compiler only sees a single line, and all the compiler does is to pass everything between _asm and _endasm to the assembler. Maybe this should be explained in the SDCC manual although it really should be obvious to anyone who is competent and courageous to enough to try to inject assembly code inline. At the end of the day the behavior depends on the assembler unless we want SDCC to understand the asm syntax. Spelling all that out in the SDCC manual would not hurt ... br Kusti On 8/30/11 01:51, "Mario" <mar...@gm...> wrote: >Hello, its me ...once again. > >I have tried to do the following. > >#define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > ETC\ > __endasm; > >where ³ASM INSTRUCTION², ³OTHER ONE², ³ETC², are ...assembler >instructions. >SDCC does not complain at all but I get error code 256. from gpasm. > >The strange part, is that it will work with a single asm instruction >inside, for example. > >#define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > __endasm; > >Works as expected, but... if I do.- > >#define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > __endasm; > >Only ³ASM INSTRUCTION² will be included and the second one wont, as if >I have never entered it. >If I try with three or more, the error code 256 from gpasm happens. > >However I have found a workaround for this bug: > >#define SOMEASMHERE __asm ASM INSTRUCTION __endasm;/ > __asm OTHER ONE __endasm;/ > __asm ETC __endasm; > >which works alright for this. >Greetings. > >-------------------------------------------------------------------------- >---- >Special Offer -- Download ArcSight Logger for FREE! >Finally, a world-class log management solution at an even better >price-free! And you'll get a free "Love Thy Logs" t-shirt when you >download Logger. Secure your free ArcSight Logger TODAY! >http://p.sf.net/sfu/arcsisghtdev2dev >_______________________________________________ >Sdcc-user mailing list >Sdc...@li... >https://lists.sourceforge.net/lists/listinfo/sdcc-user > -- Kustaa Nyholm Research Manager, Software Research and Technology Division PLANMECA OY Asentajankatu 6 00880 HELSINKI FINLAND Please note our new telephone and fax numbers! Tel: +358 20 7795 572 (direct) Fax: +358 20 7795 676 GSM: +358 40 580 5193 e-mail: kus...@pl... |
From: Borut R. <bor...@gm...> - 2011-08-30 17:57:30
|
On 08/30/2011 10:45 AM, Kustaa Nyholm wrote: > Maybe this should be explained in the SDCC manual although it really > should be obvious to anyone who is competent and courageous to enough > to try to inject assembly code inline. Actually it is explained in chapter 3.19 Pragmas, pragma preproc_asm: "To define multilines of assembly code you have to include each assembly line into it's own __asm __endasm block." In chapter 3.13.1 A Step by Step Introduction is also written: "It is recommended that each assembly instruction (including labels) be placed in a separate line (as the example shows).", although no related to macro expansion. But I definitely agree that the explanation is not clear enough and is not in the right place. > At the end of the day > the behavior depends on the assembler unless we want SDCC to > understand the asm syntax. Exactly. Some assemblers support multiple mnemonics in one line, others don't. I think that the original ASXXXX supports it, but if I'm not wrong, Maarten some time ago removed the support in sdasm. > Spelling all that out in the SDCC > manual would not hurt ... Be my guest: just send me the patch for sdccman.lyx ;-) Borut |
From: Kustaa N. <Kus...@pl...> - 2011-08-30 18:17:05
|
On 8/30/11 20:57, "Borut Razem" <bor...@gm...> wrote: >On 08/30/2011 10:45 AM, Kustaa Nyholm wrote: >> Maybe this should be explained in the SDCC manual although it really >> should be obvious to anyone who is competent and courageous to enough >> to try to inject assembly code inline. > >Actually it is explained in chapter 3.19 Pragmas, pragma preproc_asm: >"To define multilines of assembly code you have to include each assembly >line into it's own __asm __endasm block." >In chapter 3.13.1 A Step by Step Introduction is also written: "It is >recommended that each assembly instruction (including labels) be placed >in a separate line (as the example shows).", although no related to >macro expansion. But I definitely agree that the explanation is not >clear enough and is not in the right place. > >> At the end of the day >> the behavior depends on the assembler unless we want SDCC to >> understand the asm syntax. > >Exactly. Some assemblers support multiple mnemonics in one line, others >don't. I think that the original ASXXXX supports it, but if I'm not >wrong, Maarten some time ago removed the support in sdasm. > >> Spelling all that out in the SDCC >> manual would not hurt ... > >Be my guest: just send me the patch for sdccman.lyx ;-) In a way I feel that the responsibility lies with the OP since he was the one who complained ;-) but I might send a patch. We will see. br Kusti |
From: Maarten B. <sou...@ds...> - 2011-08-30 21:46:55
|
> > At the end of the day > > the behavior depends on the assembler unless we want SDCC to > > understand the asm syntax. > > Exactly. Some assemblers support multiple mnemonics in one line, others > don't. I think that the original ASXXXX supports it, but if I'm not > wrong, Maarten some time ago removed the support in sdasm. I removed that from sdasm but at the same time implemented a way to turn multiline __asm macros into multiline assembly. The main reason was that it was very difficult for the optimers (peephole and other) to detect. It also generates better readable assembly. Maarten |
From: Sebastien L. <seb...@lo...> - 2011-08-30 13:11:54
|
Hi, what about using movf with inline assembly? Sebastien Le 30/08/2011 00:51, Mario a écrit : > Hello, its me ...once again. > > I have tried to do the following. > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > ETC\ > __endasm; > > where “ASM INSTRUCTION”, “OTHER ONE”, “ETC”, are ...assembler instructions. > SDCC does not complain at all but I get error code 256. from gpasm. > > The strange part, is that it will work with a single asm instruction > inside, for example. > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > __endasm; > > Works as expected, but... if I do.- > > #define SOMEASMHERE __asm\ > ASM INSTRUCTION\ > OTHER ONE\ > __endasm; > > Only “ASM INSTRUCTION” will be included and the second one wont, as if > I have never entered it. > If I try with three or more, the error code 256 from gpasm happens. > > However I have found a workaround for this bug: > > #define SOMEASMHERE __asm ASM INSTRUCTION __endasm;/ > __asm OTHER ONE __endasm;/ > __asm ETC __endasm; > > which works alright for this. > Greetings. > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |