Hello,

> Hi,
>
> Thanks a lot for the reply. It is mcs51. I guess I will take a look at
> that. What if I need to exchange more than a byte of data? Should I just
> increment the location pointed to by dpl? Is that how this works?

No, but again look at the generated assembly for something similar.

> Also another question and I find it rather strange. I am trying to
> pass pointers through functions in sdcc
>
> void a()
> {
>
> unsigned char a;
> a=some value
> b(&a);
> }
>
> void b(unsigned char *a )
> {
> *a='s';
> }
>
> I keep getting this error
>
>  warning 127: non-pointer type cast to generic pointer
> from type 'unsigned-char fixed'
>
> I have tried specifying __xdata, but it still throws the same error. Any
> ideas?

If you don't show the code that produces this error, we can't help. We
will not try to guess it.

And since you're not developing SDCC itself, could you please reply on the
user mailing list?

Maarten

> On Sun, May 8, 2016 at 11:06 AM, Erik Petrich <
> epetr...@ivorytower.norman.ok.us> wrote:
>
>>
>>
>> On Sun, 8 May 2016, Sab V wrote:
>>
>> > Hi,
>> >
>> > I have a C function which calls a function in c but written in
>> assembly
>> >
>> > void a()
>> > {
>> >
>> > callassembly(a);
>> >
>> > }
>> >
>> > void callassembly(char a)
>> > {
>> >
>> > //assembly level
>> >
>> > }
>> >
>> > How do I access the char a data in assembly. Also if I need to return
>> data back, how do I do this?
>>
>> You'll get a better answer if you could at least specify which
>> architecture you are compiling for. For hc08 and s08, a single parameter
>> of type char would be passed in the A register and a char return value
>> would also be passed in the A register. For mcs51 and ds390, it would be
>> the same except the DPL register would be used instead of A. For the Z80
>> family, the parameter is passed on the stack and the return value is
>> passed in the L register.
>>
>> You could also compile a simple function such as
>>
>>   char foo(char x)
>>   {
>>     return x+1;
>>   }
>>
>> to see how the parameter and return value are passed.
>>
>>    Erik

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to