DSPRelated.com
Forums

Calling Assembly within assembly

Started by wilbur March 7, 2007
Wilbur,

May be a late reply as I was on leave. Not looked in
to what other folks had written. below are my thoughts
about your problem.

Compiler takes care of this in linear assembly.
In case of interrupts with in those functions you need
to take care of the registers, otherwise one need not
bother about registers with in the scope of functions.
By default the stack pointer is aligned. If your
adressing is different, you just need to check the
alignment. I think it is always word aligned.

Corruption might be because of some misplaced logic in
the code. Please review your code and reverify. I
would like to have a look at the piece of code which
is troubling you.

Regards
Harish

--- wilbur wrote:

> Hi All,
>
> A Correction to the data values getting corrupted...
> The first byte of data is consistently getting
> corrupted for the packed data.The second byte is
> correct. I initially mentioned it as
> > the upper two bytes of the LSB data and the lower
> two bytes of my packed MSB data get corrupted. Sorry
> bout tht if someone was thinkin bout this :)
>
> What sort of alignment needs to be done?
>
> Regards,
> Wilbur
>
> --- wilbur wrote:
>
> > Hi All,
> >
> > What precautions does one need to take when
> calling
> > an
> > assembly function within the scope of another
> > assembly
> > function in linear assembly. Does the compiler
> take
> > care of this? or do I have to store the values of
> > the
> > registers that I require?.
> >
> > Another question I have is...do I need to align
> the
> > stack pointer in anyway for C64xx when I enter and
> > exit the assembly function? My data is getting
> > corrupted in some way..specifically the upper two
> > bytes of the LSB data and the lower two bytes of
> my
> > packed MSB data. To give you some more
> > information..I
> > call an assembly function from C. Inside this
> > assembly
> > function I call another assembly function which
> does
> > some scaling routine.Then I return to my program
> in
> > C.
> > What I observe here is the next chunk of data i.e
> > lets
> > say the next 256 data values in my C program
> itself
> > has the alignment problem I described above!! Has
> > anyone faced this issue? Any suggestions will be
> > helpful. Thanks !
> >
> > Warm Regards,
> > Wilbur
> >
> >
> >
> >
>
____________________________________________________________________________________
> Bored stiff? Loosen up...
> Download and play hundreds of games for free on
> Yahoo! Games.
> http://games.yahoo.com/games/front
>

____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
Hi Harish,

Thanks for your inputs. That issue is now solved.
There were 2 reasons why the data was getting
corrupted. One was a coding error and the other
because I was not restoring the state of the circular
address register back to linear addressing. Thanks
anyway.

Regards,
Wilbur
--- Harish Kumar wrote:

> Wilbur,
>
> May be a late reply as I was on leave. Not looked in
> to what other folks had written. below are my
> thoughts
> about your problem.
>
> Compiler takes care of this in linear assembly.
> In case of interrupts with in those functions you
> need
> to take care of the registers, otherwise one need
> not
> bother about registers with in the scope of
> functions.
> By default the stack pointer is aligned. If your
> adressing is different, you just need to check the
> alignment. I think it is always word aligned.
>
> Corruption might be because of some misplaced logic
> in
> the code. Please review your code and reverify. I
> would like to have a look at the piece of code which
> is troubling you.
>
> Regards
> Harish
>
> --- wilbur wrote:
>
> > Hi All,
> >
> > A Correction to the data values getting
> corrupted...
> > The first byte of data is consistently getting
> > corrupted for the packed data.The second byte is
> > correct. I initially mentioned it as
> > > the upper two bytes of the LSB data and the
> lower
> > two bytes of my packed MSB data get corrupted.
> Sorry
> > bout tht if someone was thinkin bout this :)
> >
> > What sort of alignment needs to be done?
> >
> > Regards,
> > Wilbur
> >
> > --- wilbur wrote:
> >
> > > Hi All,
> > >
> > > What precautions does one need to take when
> > calling
> > > an
> > > assembly function within the scope of another
> > > assembly
> > > function in linear assembly. Does the compiler
> > take
> > > care of this? or do I have to store the values
> of
> > > the
> > > registers that I require?.
> > >
> > > Another question I have is...do I need to align
> > the
> > > stack pointer in anyway for C64xx when I enter
> and
> > > exit the assembly function? My data is getting
> > > corrupted in some way..specifically the upper
> two
> > > bytes of the LSB data and the lower two bytes of
> > my
> > > packed MSB data. To give you some more
> > > information..I
> > > call an assembly function from C. Inside this
> > > assembly
> > > function I call another assembly function which
> > does
> > > some scaling routine.Then I return to my program
> > in
> > > C.
> > > What I observe here is the next chunk of data
> i.e
> > > lets
> > > say the next 256 data values in my C program
> > itself
> > > has the alignment problem I described above!!
> Has
> > > anyone faced this issue? Any suggestions will be
> > > helpful. Thanks !
> > >
> > > Warm Regards,
> > > Wilbur
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> ____________________________________________________________________________________
> > Bored stiff? Loosen up...
> > Download and play hundreds of games for free on
> > Yahoo! Games.
> > http://games.yahoo.com/games/front
> >
>
____________________________________________________________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail
> arrives.
> http://tools.search.yahoo.com/toolbar/features/mail/
>

____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html