Tuesday 15 January 2013

assembly - goto $ when stack is empty -


This is part of my final exam, I was given the following code and was asked about its behavior. In the code we can clearly see that there is no branch (ie. call or an interval), and according to my knowledge it means that the program stack is empty. Still there is a goto $ at the end of the code, which gives instructions to the compiler (?), Whatever (empty) stack is above.

Can anyone tell me what behavior is expected in these cases in general and how will it behave in particular in the code below? Taking into account we are working on PIC16F877 .

Thank you.

code

I do not know how you make a relationship from $ to stack.

$ is used to refer to the current address You can type:

  any_label: jmp any_label  

Or leave the label and use $

  jmp $  

Since $ current address, both assembler details make the same code. It is used to stop the execution of the program running in the endless loop.

CPU does not stop and consumes cycles and power at the same address Some CPUs have power saving mode which can be better in this situation.


No comments:

Post a Comment