Question

Explain how the program is working each line please. Thanks,

Given the following program, what is the value of the SP after the program execution? text .global STRT mov.w #0x300,SP STRT

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer in the comments below:

.text ; This is the assembler directive indicating the beginning of program in the flash memory

.global _STRT ; .global is also as assembler directive. It makes the assembly language module titled ;STRT available to linker. This, in turn, allows other programs to use it if needed

STRT mov.w #0x300,SP; This initializes the stack pointer to RAM address 300 hex

StopWDT mov.w #WDTPW+WDTHOLD, WDTCTL ; This stops the watch-dog timer

push R6 ; This decrements SP by two and then pushes the contents of register R6 on to the stack. If ;this program is for MSP430 family then stack pointer would be decremented to 0x28E and then the two ;bytes of R6 would be stored on the RAM locations pointed by SP.

ed jump ed; This is an infinite loop. The program keeps executing this loop till it MCU receives a reset or an interrupt. Effectively this is a halt instruction.

Hope this helps  

Add a comment
Know the answer?
Add Answer to:
Explain how the program is working each line please. Thanks, Given the following program, what is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT