Sign in

username or email:

password:



Not a member?
Forgot your Password?

Search Comp.Arch.Embedded



Search tips


Sponsor

Discussion Groups

See Also

DSPFPGA

Discussion Groups | Comp.Arch.Embedded | syntax for asm in sdcc

There are 7 messages in this thread.

You are currently looking at messages 1 to 7.


So far in June, you have voted 0 times ou of a total of 16 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.

syntax for asm in sdcc - john111w - 2012-06-08 11:50:00

I need to use the sdcc compiler in an IDE. I have about 16K of ASM51 code
that I need to compile with sdcc so that I can use the source in the debug
pane. The IDE only shows dissambly (with label numbers) unless you use C.

So I fugured I'd create a C "shell" and import my asm51 file

Where can I go to learn how to embed the asm?

The IDE has a C example which compiles with sdcc. I tried 2 hours of web
searches last night to find the syntax to add 2 trial lines.

__asm
mov a,b
mov b,a
__ endasm

I tried single underscore, double underscore, quotes, slashes, parens, as
shown in many web search examples 
I even tried without the mov's just 
__asm/
__endasm   as shown in an SDCC forum example.

I can't see how to create a thread in the SourceForge.net to ask this
question
Help is greatly appreciated.
	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com

Re: syntax for asm in sdcc - Rocky - 2012-06-08 12:15:00

On Jun 8, 5:50 pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
> I need to use the sdcc compiler in an IDE. I have about 16K of ASM51 code
> that I need to compile with sdcc so that I can use the source in the debug
> pane. The IDE only shows dissambly (with label numbers) unless you use C.
>
> So I fugured I'd create a C "shell" and import my asm51 file
>
> Where can I go to learn how to embed the asm?
>
> The IDE has a C example which compiles with sdcc. I tried 2 hours of web
> searches last night to find the syntax to add 2 trial lines.
>
> __asm
> mov a,b
> mov b,a
> __ endasm
>
> I tried single underscore, double underscore, quotes, slashes, parens, as
> shown in many web search examples
> I even tried without the mov's just
> __asm/
> __endasm   as shown in an SDCC forum example.
>
> I can't see how to create a thread in the SourceForge.net to ask this
> question
> Help is greatly appreciated.
>
> ---------------------------------------
> Posted throughhttp://www.EmbeddedRelated.com

Mmmm,  I'm not sure about the '/' after asm. This is what I used a
while ago to do some footling with interupts.


    __asm
    push psw
    push acc
    push dpl
    push dph
    push b
    mov a,#(.+9)
    push    acc
    mov a,#((.+5) >> 8)
    push    acc
    reti

    nop

    __endasm;

Re: syntax for asm in sdcc - john111w - 2012-06-08 12:24:00

>On Jun 8, 5:50 pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
>> I need to use the sdcc compiler in an IDE. I have about 16K of ASM51
code
>> that I need to compile with sdcc so that I can use the source in the
debu>g
>> pane. The IDE only shows dissambly (with label numbers) unless you use
C.
>>
>> So I fugured I'd create a C "shell" and import my asm51 file
>>
>> Where can I go to learn how to embed the asm?
>>
>> The IDE has a C example which compiles with sdcc. I tried 2 hours of
web
>> searches last night to find the syntax to add 2 trial lines.
>>
>> __asm
>> mov a,b
>> mov b,a
>> __ endasm
>>
>> I tried single underscore, double underscore, quotes, slashes, parens,
as
>> shown in many web search examples
>> I even tried without the mov's just
>> __asm/
>> __endasm   as shown in an SDCC forum example.
>>
>> I can't see how to create a thread in the SourceForge.net to ask this
>> question
>> Help is greatly appreciated.
>>
>> ---------------------------------------
>> Posted throughhttp://www.EmbeddedRelated.com
>
>Mmmm,  I'm not sure about the '/' after asm. This is what I used a
>while ago to do some footling with interupts.
>
>
>    __asm
>    push psw
>    push acc
>    push dpl
>    push dph
>    push b
>    mov a,#(.+9)
>    push    acc
>    mov a,#((.+5) >> 8)
>    push    acc
>    reti
>
>    nop
>
>    __endasm;
>	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com

Re: syntax for asm in sdcc - john111w - 2012-06-08 12:27:00

>On Jun 8, 5:50 pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
>> I need to use the sdcc compiler in an IDE. I have about 16K of ASM51
code
>> that I need to compile with sdcc so that I can use the source in the
debu>g
>> pane. The IDE only shows dissambly (with label numbers) unless you use
C.
>>
>> So I fugured I'd create a C "shell" and import my asm51 file
>>
>> Where can I go to learn how to embed the asm?
>>
>> The IDE has a C example which compiles with sdcc. I tried 2 hours of
web
>> searches last night to find the syntax to add 2 trial lines.
>>
>> __asm
>> mov a,b
>> mov b,a
>> __ endasm
>>
>> I tried single underscore, double underscore, quotes, slashes, parens,
as
>> shown in many web search examples
>> I even tried without the mov's just
>> __asm/
>> __endasm   as shown in an SDCC forum example.
>>
>> I can't see how to create a thread in the SourceForge.net to ask this
>> question
>> Help is greatly appreciated.
>>
>> ---------------------------------------
>> Posted throughhttp://www.EmbeddedRelated.com
>
>Mmmm,  I'm not sure about the '/' after asm. This is what I used a
>while ago to do some footling with interupts.
>
>
>    __asm
>    push psw
>    push acc
>    push dpl
>    push dph
>    push b
>    mov a,#(.+9)
>    push    acc
>    mov a,#((.+5) >> 8)
>    push    acc
>    reti
>
>    nop
>
>    __endasm;
>
I just tried:
__asm
__endasm;  received syntax error token-> '__endasm' column 8  (the letter
m)

 	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com

Re: syntax for asm in sdcc - Tim Wescott - 2012-06-08 13:23:00

On Fri, 08 Jun 2012 11:27:58 -0500, john111w wrote:

>>On Jun 8, 5:50 pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
>>> I need to use the sdcc compiler in an IDE. I have about 16K of ASM51
> code
>>> that I need to compile with sdcc so that I can use the source in the
> debu>>g
>>> pane. The IDE only shows dissambly (with label numbers) unless you use
> C.
>>>
>>> So I fugured I'd create a C "shell" and import my asm51 file
>>>
>>> Where can I go to learn how to embed the asm?
>>>
>>> The IDE has a C example which compiles with sdcc. I tried 2 hours of
> web
>>> searches last night to find the syntax to add 2 trial lines.
>>>
>>> __asm
>>> mov a,b
>>> mov b,a
>>> __ endasm
>>>
>>> I tried single underscore, double underscore, quotes, slashes, parens,
> as
>>> shown in many web search examples
>>> I even tried without the mov's just
>>> __asm/
>>> __endasm   as shown in an SDCC forum example.
>>>
>>> I can't see how to create a thread in the SourceForge.net to ask this
>>> question
>>> Help is greatly appreciated.
>>>
>>> --------------------------------------- Posted
>>> throughhttp://www.EmbeddedRelated.com
>>
>>Mmmm,  I'm not sure about the '/' after asm. This is what I used a while
>>ago to do some footling with interupts.
>>
>>
>>    __asm
>>    push psw
>>    push acc
>>    push dpl
>>    push dph
>>    push b
>>    mov a,#(.+9)
>>    push    acc
>>    mov a,#((.+5) >> 8)
>>    push    acc
>>    reti
>>
>>    nop
>>
>>    __endasm;
>>
> I just tried:
> __asm
> __endasm;  received syntax error token-> '__endasm' column 8  (the
> letter m)
> 
> 
>  	   
> --------------------------------------- Posted through
> http://www.EmbeddedRelated.com

Perhaps you need to indent?  You shouldn't -- but the compiler is 
obviously being picky on you.

(I really like the Gnu "asm" syntax by the way -- in my opinion it's the 
best thought-out, and complete, way to implement assembly that I've seen).

As a work-around, can you implement those critical functions entirely in 
assembly?  You'll have call overhead, but you'll have less totally non-
portable structures scattered around your code.

-- 
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com

Re: syntax for asm in sdcc - Rocky - 2012-06-08 17:02:00

On Jun 8, 6:27 pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
> >On Jun 8, 5:50=A0pm, "john111w" <g...@n_o_s_p_a_m.nni.com> wrote:
> >> I need to use the sdcc compiler in an IDE. I have about 16K of ASM51
> code
> >> that I need to compile with sdcc so that I can use the source in the
> debu=
> >g
> >> pane. The IDE only shows dissambly (with label numbers) unless you use
> C.
>
> >> So I fugured I'd create a C "shell" and import my asm51 file
>
> >> Where can I go to learn how to embed the asm?
>
> >> The IDE has a C example which compiles with sdcc. I tried 2 hours of
> web
> >> searches last night to find the syntax to add 2 trial lines.
>
> >> __asm
> >> mov a,b
> >> mov b,a
> >> __ endasm
>
> >> I tried single underscore, double underscore, quotes, slashes, parens,
> as
> >> shown in many web search examples
> >> I even tried without the mov's just
> >> __asm/
> >> __endasm =A0 as shown in an SDCC forum example.
>
> >> I can't see how to create a thread in the SourceForge.net to ask this
> >> question
> >> Help is greatly appreciated.
>
> >> ---------------------------------------
> >> Posted throughhttp://www.EmbeddedRelated.com
>
> >Mmmm,  I'm not sure about the '/' after asm. This is what I used a
> >while ago to do some footling with interupts.
>
> >    __asm
> >    push psw
> >    push acc
> >    push dpl
> >    push dph
> >    push b
> >    mov a,#(.+9)
> >    push    acc
> >    mov a,#((.+5) >> 8)
> >    push    acc
> >    reti
>
> >    nop
>
> >    __endasm;
>
> I just tried:
> __asm
> __endasm;  received syntax error token-> '__endasm' column 8  (the letter
> m)
>
> ---------------------------------------
> Posted throughhttp://www.EmbeddedRelated.com- Hide quoted text -
>
> - Show quoted text -

I tried downloading the latest version and the code compiled - didn't
check if it worked :(  too much hassle right now.
Version:
C:\SDCC\bin>sdcc -v
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/
ds400/hc08/s08
 3.1.5 #7874 (Jun  7 2012) (MINGW32)

C:\SDCC\bin>

Re: syntax for asm in sdcc - Philipp Klaus Krause - 2012-06-11 03:28:00

On 08.06.2012 23:02, Rocky wrote:

> I tried downloading the latest version and the code compiled - didn't
> check if it worked :(  too much hassle right now.
> Version:
> C:\SDCC\bin>sdcc -v
> SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/
> ds400/hc08/s08
>  3.1.5 #7874 (Jun  7 2012) (MINGW32)

Historically sdcc used _asm and _endasm. Some time ago this was changed
to also allow __asm and __endasm. Recently the old _asm and _endasm has
been removed, and sdcc now only supports the standard-compliant __asm
and __endasm. So depending on how old the sdcc version used is, it will
support _asm, __asm or both.

Philipp