Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the assembly language code listing below: a) Identify the fields of this s

ID: 3719984 • Letter: G

Question

Given the assembly language code listing below:


a) Identify the fields of this structured program using the Main loop here section ONLY!!!


b) Assuming that the initial contents of R6 = 1BB1h then what are the updated contents in each register after compiling and stepping through each line of the code in Mainloop?


c) What type of format (double-operand, single-operand, or jump instruction) is used for each line of code in Mainloop?


d) What type of addressing mode is used for each line of code in Mainloop?



;-------------------------------------------------------------------------------

; MSP430 Assembler Code Template for use with TI Code Composer Studio

;

;

;-------------------------------------------------------------------------------

.cdecls C,LIST,"msp430.h" ; Include device header file

;-------------------------------------------------------------------------------

.def   RESET ; Export program entry-point to

     ; make it known to linker.

;-------------------------------------------------------------------------------

.text       ; Assemble into program memory.

.retain      ; Override ELF conditional linking

   ; and retain current section.

.retainrefs   ; And retain any sections that have

         ; references to current section.

;-------------------------------------------------------------------------------

RESET    mov.w   #__STACK_END,SP        ; Initialize stackpointer

StopWDT     mov.w   #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer

;-------------------------------------------------------------------------------

; Main loop here

;-------------------------------------------------------------------------------

Mainloop:

?   add.w #77h,R6   ;add hexadecimal value 77 to existing contents of R6

?   mov.w R6,R7   ;move contents of R6 into R7

?   rrc R6      ;rotate right through carry (bitwise) the contents of R6

?   rrc R6    ;rotate right through carry (bitwise) the contents of R6

?   jmp     Mainloop ;

;-------------------------------------------------------------------------------

; Stack Pointer definition

;-------------------------------------------------------------------------------

.global __STACK_END

.sect .stack

;-------------------------------------------------------------------------------

; Interrupt Vectors

;-------------------------------------------------------------------------------

.sect ".reset" ; MSP430 RESET Vector

.short RESET

.end

Explanation / Answer

Answer is as follows :

a) We know that fields are the variable sor register used in any of the program.

So here in the main loop only two fields or registers are used i.e. R6 and R7.

b) We have R6 = 1BB1 h in hexadecimal and 0001 1011 1011 0001 in binary.

add this with 77 h i.e. 0111 0111 in binary.

We get 0001 1100 0010 1000 i.e. 1C28 in hexadecimal.

Now move contents of R6 i.e. 1C28 in R7. so now R7 contains 1C28.

Shift the content of R6 to rigth by carry we get 0000 1110 0001 0100

Again shift right the contents of R6 we get 0000 0111 0000 1010 i.e. 070A.

Than program will jump to Mainloop.

so the value in R6 contains 070A and R7 contains 1C28.

c)

First two instructions are double operands.

Third and fourth instructions are single operand.

last instruction is jump instrution.

d)

In first instruct direct addressing mode is used.

Next three instruction using register addressing mode.

last instruction using indexed mode.

if there is any query please ask in comments...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote