Ask Assembly Expert

Assignment

Part 1

1. A 32-bit word 112233FA(16)  is stored in a byte-addressed little endian main memory at address 100(16). The byte 33 is stored at address ......101(16).......

2. Explain the register-displacement addressing mode. What stands for PC-relative addressing mode?

3. Assume an ARM-like CPU but with only 8-bit registers and ALU.  In register r0 a byte is stored 1000 0000, in r1=0000 0010. The CPU performs the following instruction

ADD r2, r0, r1.

Perform the binary addition and provide the decimal value of the result assuming that:

a. The numbers in r0 and r1 are unsigned:

b. The numbers in r0 and r1 are signed:

Part 2. ARM assembly programming

Remark: Assume that the variables are loaded in some registers.

4. Write in ARM assembly language the following operations without using multiplication instruction (5p. each)

4.1. A * 17
4.2. A * 23

5. In ARM assembly program of only two instructions (addition and/or subtraction) implement the following calculation: a*105 (hint: 105=15*7).

6.  Write an ARM assembly program that performs the following pseudo code. Assume that the variables are already loaded in some registers.

If (a==b) AND (c==d) then d = a +b + c + 1

7.  In ARM assembly program calculate the absolute value of some variable a.

Hint: The pseudo code is: 

if a

8. Suppose that register r0 contains 0x20001400. Show the value (binary or hexadecimal) in the destination registers after every instruction. What is the final value of r2 after the execution of this peace of code?

                             MOVS r2, #0
                             ADD r2, r2, r0
Equal                     ADDLT r2, r2, #2
                             MOVNE r2, #&ABCD
                             MOV  r2, #&FF
OK                         ;r2= . . . .  .

9. Binary value 0xFFFFFFFF is loaded in r0 and 0x3FF80000 in r1. Show the value (binary or hexadecimal) in the destination register after every instruction. What is the final binary value in r2 after the following code? Considering the value in r2 as a signed number, what is the decimal value in r2?

start         MOV  r6,#0
                ADDS   r6, r6, #0
                MOV    r2, #&5
MOVS r2,  #FF, ROR 8
Equal        MOVPL r2, #2
Done        MVNEQ r2, #3
               MOVCS r2, #&FF
OK           ;r2= . . . .  .

10.  Binary value 0xAB1FFFF2 is loaded in r0 and 0x3FF80000 in r1. Show the value (binary or hexadecimal) in every destination register after every instruction. What is the final binary value in r2 after the following code? Considering the value in r2 as a signed number, what is the decimal value in r2?

start         MOV  r6,#0
                ADDS   r6, r6, #0
MOV r2, #0
                ADD r3, r0, r1
                MVNGE r2, #2
                MVNMI r2, #3
OK            ;r2= . . . .  .

11. Trace the following program and declare what will be the value in r0. Show the hexadecimal values in registers r0, r5, r6 and r7 after every instruction that is executed and changes some of those registers. Show the values of the flags after every instruction that changes the flags.

start          MOV  r6,#0
                 ADDS   r6, r6, #0
        MOV  r0, #&FF
MOV   r5, #0x7F
                 MOV     r5, r5, ROR #8
                 MOV     r6, r5
                 ADDS    r7, r5, r6
                 MOVGE                r0, #0xE5
                 ...

12. Write ARM assembly program that performs the following pseudo code. It converts an unsigned integer 0≤i≤15 to a hexadecimal character c. Assume that the variables are already loaded in some registers.

       IF (i<10) c= i +'0'           ;if the digit is 0 to 9
       ELSE c =i + "A" -10        ;If the number is 10 to 15.

Assembly, Programming

  • Category:- Assembly
  • Reference No.:- M92698858

Have any Question?


Related Questions in Assembly

Really need to find a correct answer to this questionwrite

Really need to find a correct answer to this question: Write a MIPS assembly program that can search for a number that is entered by a user in an array with 20 integer number. Make sure it also prints the index of the ar ...

Question a sequence string of one-byte ascii characters is

Question : A sequence (string) of one-byte ASCII characters is stored at memory location $600 onward. A second sequence of equal length is stored at memory location $700 onward. Each sequence ends with the character $0 ( ...

Task 1using masm sdk write an assembly language program

TASK 1 Using MASM SDK, write an assembly language program which converts an integer inputted via the console to binary. Your program should be well commented and well formatted. TASK 2 Using MASM SDK, write an assembly l ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As