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

Introduction to embedded systems Microprocessors MSP430 Problem 2. Two word-size

ID: 664455 • Letter: I

Question

Introduction to embedded systems Microprocessors MSP430

Problem 2. Two word-size signed data stored in memory locations named NUM1 and NUM2 are to be used in a subroutine to generate a third signed number to be stored in location NUM3. The flow graph shown in Fig. P. 2 shows the steps to generate and store the new number. Use this flow graph or an equivalent one (you have to show it!) to generate the assembly code for your subroutine (include comments!). [NOTE: Remember that shifting or rotating left or right we can multiply or divide by 2.)

Explanation / Answer


START:
MOV NUM1,R5   //ASSIGN VALUE NUM1
MOV NUM2,R11   //ASSIGN VALUE NUM2

Test:
GO TO YES CONDITION:

CMP R5,0    //CONDITION CHECK
JG R14      //JUMP GREATER THAN
MUL R14,2,R11   //MULTIPLICATION
MOV R14,NUM3   //MOVE R14 VALUE IN NUM3

GOTO NO CONDITION:
    GOTO YES CONDITION:
CMP 0,R5    //COMPARISION
JL R14      //JUMP LOWER THAN
DIV R14,2,R11    //DIVISION
MOV R14,NUM3     //MOVE R14 VALUE IN NUM3

GOTO NO CONDITION:
   MOV 0,R14       //SET R14 AS 0
   MOV R14,NUM3    //MOVE R14 VALUE IN NUM3

   END

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