Which registers can I use freely in subroutine asm parts?

General discussion on mikroPascal PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Which registers can I use freely in subroutine asm parts?

#1 Post by Dany » 22 Aug 2013 12:20

Hi,

I want to insert some assembly code insided mP soubroutines for P24, to fasten up some processing.

My questions are now:

- Which registers of the group W0..W15 can I use freely in the assembly code I insert?
- Are there restrictions for the actual processor registers (which should I leave alone?)
- How are parameters passed to a subroutine by mP (in which registers or Wx ... or on the stack?)
- How are subroutine results passed back to the calling routine (in which registers or Wx or ...)

I do not want to interfere with the mP generated code when I start to use assembly...

Thanks in advance!
Last edited by Dany on 16 Jan 2014 22:43, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: Which registers can I use freely in subroutine asm parts

#2 Post by dejan.odabasic » 23 Aug 2013 13:25

Hello,

The answer is similar to this one: http://www.mikroe.com/forum/viewtopic.p ... 26#p220526
The only difference is that subroutine parameter as passed in W10, W11, W12, W13 registers and if required other parameters are passed on function frame.
Result value is places in W0 and W1 (depending on size of result value).

Best regards.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Which registers can I use freely in subroutine asm parts

#3 Post by Dany » 23 Aug 2013 18:52

dejan.odabasic wrote:Hello,

The answer is similar to this one: http://www.mikroe.com/forum/viewtopic.p ... 26#p220526
The only difference is that subroutine parameter as passed in W10, W11, W12, W13 registers and if required other parameters are passed on function frame.
Result value is places in W0 and W1 (depending on size of result value).

Best regards.
Thanks for both P18 and P24 replies! :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for dsPIC30/33 and PIC24 General”