ARM assembly language

; 1. Code the following IF-THEN statement:

;

;    if (r2 != r7)

;       r2 = r2 – r7;

;    else

;       r2 = r2 + r4;

;

;    Your code have to work with any numbers in R2, R7 and R4

;    (5, 25(0x19))

;

    MOVW    R2, #10

    MOVW    R7, #5

    MOVW    R4, #15

;

;   MOVW    R2, #10

;   MOVW    R7, #10

;   MOVW    R4, #15

;

;– Your instructions here —

;– Approx. 3 instructions —

———————————————————————————————————————

; 2. Write a program that converts a hexadecimal value between 0x0 and 0xf in register

;    R0 into its ASCII representation. Store ASCII representation into R1.

;

;    Digits ‘0’ through ‘9’ are represented with the ASCII codes 0x30 to 0x39. The digits

;    ‘A’ through ‘F’ are coded as 0x41 through 0x46. (See ‘ascii.pdf’ file)

;

;    Test your code with R0 = 15, 0 and 9

;    (0x46, 0x30, 0x39)

;

    MOV     R0, #15

;   MOV     R0, #0

;   MOV     R0, #9

;– Your instructions here —

———————————————————————————————————————

;

; 3. Modify the code you did for task #2 to check for valid number (0..15) in R0.

;    Store ‘*’ (0x2a) into R1 if R0 is out of valid range. Store ASCII representation

;    for valid numbers (from 0 to 15 inclusive).

;

;    Test your code with R0 = 255, 15, 0, 9, 12 and 16

;    (0x2a, 0x46, 0x30, 0x39, 0x43, 0x2a)

;

    MOV     R0, #255

;   MOV     R0, #15

;   MOV     R0, #0

;   MOV     R0, #9

;   MOV     R0, #12

;   MOV     R0, #16

;– Your instructions here —

———————————————————————————————————————

;

; 4. Write a program that counts number of binary ‘1’s and number of binary ‘0’s in R0.

;    Save number of ‘1’s into R1, number of ‘0’s in R2. You may use any other register(s) and

;    do not need to preserve the value of R0 register.

;

;    Your code have to work with any number in R0

;

;    Debug your program with tets values R0 = 0xAAAAAAAA and R0 = 0x55555555. Both should give

;    you 16 1’s and 16 0’s

;

;    Then run your progarm with R0 = 0x708. Is your result correct? (use online converter to check)

    MOV     R0, #0xAAAAAAAA

;   MOV     R0, #0x55555555

;   MOVW    R0, #0x708

;– Your instructions here —

———————————————————————————————————————

;

; 5. Write a “shift, test and restore” division algorithm (See “Binary Division.pdf” for details).

;

;    For i = 1 to 32 do { we’re using 32-bit representations }

;    {

;       Left Shift the RQ pair

;       Subtract the Divisor from R

;       If R is positive then

;          Set the low order (right most) bit in Q to 1

;       Else

;          Restore R by Adding back the Divisor

;    }

;

;    R0 = remainder         (R)

;    R1 = divident/quotient (Q)

;    R2 = divisor           (D)

;

;    R1,R0 = R1/R2

;

;    Do not use UDIV and SDIV ARM commands!

;

;    Your code have to work with any valid numbers in R0. You may use any other register(s). Check your

;    code with given values first. Then  try some another numbers in R1 and R2.

    MOVW    R1, #163    ; 163/10 = 16, 3

    MOVW    R2, #10

;– Your instructions here —

———————————————————————————————————————

;

; 6. Write a small program to compare two 64-bit values. Set R0 to 0 if two values

;    are equal, set R0 to 1 if two values are not equal. First 64-bit number placed into

;    R1(HI bits) and R2(LO bits), second number is in R3(HI bits) and R4(LO bits). Use only

;    4 ARM instructions!

;

;    Your code have to work with any numbers in R1-R4

;

;    Check your code with all test sets below

;

    MOV     R1, #0xAAAAAAAA

    MOV     R2, #0x55555555

    MOV     R3, #0xAAAAAAAA

    MOV     R4, #0x55555555

; —-

;   MOV     R3, #0x55555555

;   MOV     R4, #0xAAAAAAAA

; —-

;   MOV     R3, #0xAAAAAAAA

;   MOV     R4, #0xAAAAAAAA

; —-

;   MOV     R3, #0x55555555

;   MOV     R4, #0x55555555

;– Your 4 instructions here —

———————————————————————————————————————

;

; 7. (Bonus). Write a code that allows you to rotate 64-bit values in registers

;    R0 and R1. The code should shift value left…

;

;    +——————–+   +——————–+

; +<-!         R0         !<–!         R1         !<–+

; !  +——————–+   +——————–+   !

; !                                                    !

; +–>———————->————————->+

;

;    …then right by one bit.

;

;    +——————–+   +——————–+

; +->!         R0         !–>!         R1         !–>+

; !  +——————–+   +——————–+   !

; !                                                    !

; +<————————<———————–<–+

;

;    – Do not use any other registers.

;

;    – Make sure that after two shifts the final value is equal to original one.

;

;    Tip: Left shift is tricky. You may remember: a << 1 = a * 2; a * 2 = ???

;    … and take care of LSB…

;

;    Check your code with all 3 test sets below:

;

    MOVW    R0, #0x0001

    MOVT    R0, #0x8000

    MOVW    R1, #0x0001

    MOVT    R1, #0x8000

; —-

;   MOVW    R0, #0xAAAA

;   MOVT    R0, #0x8555

;   MOVW    R1, #0x0F0F

;   MOVT    R1, #0xF0F0

; —-

;   MOV     R0, #0x00000001

;   MOV     R1, #0x00000001

;

; — left —

;–     Your instructions here    —

;– May be done in 3 instructions —

; — right —

;–     Your instructions here    —

;– May be done in 3 instructions —

———————————————————————————————————————

; 8. (Bonus++). Write a program that check if the binary pattern 2_11001010 are presented at least once

;    somewhere in the number R0. The program should set R1 to 1 if the pattern is found, and clear R1 to 0

;    if no pattern in the R0.

;

;    Your code have to work with any number in R0

;

;    Your code have to preserve (do not change) the value in R0

;

;    You may use any other registers

;

;    Examples: the number 2_11001101100100101111001010101100 (0xCD92F2AC) has the pattern inside

;                                             ——–

;                         2_11001100110011001100110110010100 (0xCCCCCD94) has the pattern inside

;                                                  ——–

;                         2_11011010101101110011100111010101 (0xDAB739D5) – no pattern

;

    MOVW    R0, #0xF2AC

    MOVT    R0, #0xCD92

;—

;   MOVW    R0, #0xCD94

;   MOVT    R0, #0xCCCC

;—

;   MOVW    R0, #0x39D5

;   MOVT    R0, #0xDAB7

;– Your instructions here —

Research Paper 101
Calculate your paper price
Pages (550 words)
Approximate price: -

Reasons to trust Research Paper 101

On Time Delivery

We pride ourselves in meeting the deadlines of our customers. We take your order, assign a writer but allow some more time for ourselves to edit the paper before delivering to you. You are guaranteed a flawless paper on a timely manner...

24x7 Customer Live Support

Our team at Research Paper 101 is committed to handling your paper according to the specfications and are available 24*7 for communication. Whenever you need a quick help, you can talk to our writers via the system messaging or contact support via live chat and we will deliver your message instantly.

Experienced Subject Experts

Online Experts from Research Paper 101 are qualified both academically and in their experiences. Many are Masters and Phd holders and therefore, are qualified to handle complex assignments that require critical thinking and analyses...

Customer Satisfaction

We offer dissertation papers as per students’ wishes. We also help craft out the best topics and design concept papers. By ordering with us, you are guaranteed of defending and making through those hard faced professors in the defense panel!

100% Plagiarism Free

We at Research Paper 101 take plagiarism as a serious offence. From the start, we train our writers to write all their papers from scratch. We also check if the papers have been cited appropriately. Our website also has a tool designed to check for plagiarism that has been made erroniusly. In essense, the paper you get will be 100% legit...

Affordable Prices

We understand that being a student is very challenging, some students balance between work and studies in order to survive. We therefore offer pocket friendly rates that are very competitive in the market.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

error: