Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to do the following in ARM assembly language Goals: Initialize register X, Y, and Z to zero. Loop 10 times, each time adding

I need to do the following in ARM assembly language

Goals:

Initialize register X, Y, and Z to zero.

Loop 10 times, each time adding 1 to register X.

If register X is even, add one to register Y.

If register X is divisible by 3, add one to register Z.

Result:

Register X at 10.

Register Y at 5.

Register Z at 3 or 4 (depending on how whether you count zero or not).

Here is what I have:

;Homework #3 ARM

AREA Homework2, CODE, READONLY

EXPORT__main

__main B start

start ;initialize registers x, y, and z to zero MOV r0, #0 ;moves 0 into register 0 (x) MOV r1, #0 ;moves 0 into register 1 (y) MOV r2, #0 ;moves 0 into register 2 (z)

;loop ten times, each time adding 1 to register loop CMP #0, r0 mod 2 ;checks if it's even addeq r1, r1, #1 CMP #0, ro mod 3 ;checks if divisible by 3 addeq r2, r2, #1 add r0, r0, #1 cmp r0, #10 beq endloop B loop endloop

stop B stop

END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions