Question

Write a possible assembly language instruction or set of instructions to accomplish the following: Compare the...

Write a possible assembly language instruction or set of instructions to accomplish the following:
Compare the byte stored at the memory location pointed to by register R4 to the upper (higher) byte stored in register R5


b) Branch to instruction at label ‘ZERO’ if the lower byte of register R6 is zero

c) Jump to the instruction at label ‘EVEN’ if the value in register R7 is an even number

Homework Answers

Answer #1

Writtten for ARM 32 bit

a) LDRB R4,[R4] ; loads byte pointed by memoy address in R4 to R4

MOV R5,R5 LSR #0x18 ; R5 is shifted 24 times(hexa number 18) right so that R5(32 bit reg) contains upper byte

; if reisters are 16 bits as in Keil ARM , then shift only 8 times

CMP R4,R5 ;compare R4 and R5

b)AND R6,R6,#0x00FF ; And with 00ff ,all bits except lower byte, set to 0. lower byte retained.

CBZ $R6,ZERO ;if R6 is zero, jump to label ZERO or use (CMP $R6,#0 BEQ ZERO )

c)AND R7,R7,#0x0001 ; if even number, AND results 1 else 0

CBZ $R7,EVEN ; if R7 is 0, then even number  or use (CMP $R7,#0 BEQ EVEN )

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1]; In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x,  and $s2 for the base address of y. Make sure your code includes all necessary declarations such that it could run in SPIM.
Microprocessor 8086 material. Choose the correct answer. 1- For a (64K x 8) RAM, the number...
Microprocessor 8086 material. Choose the correct answer. 1- For a (64K x 8) RAM, the number of address lines is: * 17 19 16 15 20 14 18 2-Which of the following instructions requires (BYTE PTR)? * SHR [500H], 3h LDS SI, [1000H] LAHF PUSH [9AAH] ADD AX, [800H] 3-Where are the interrupt vectors located in the microprocessor’s memory? * in the first 64K byte in the first 1K byte in the first 256K byte in the first 1M byte...
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022...
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022 ori $t0, $t0, 2048 srl $t1, $t0, 18 sw $t0, 101($t1) slti $t2, $t1, 5 beq $t2, $0, label3 label2:... ... label3:... a) The code modifies a word in memory at the following address (circle one): (i) 1022 (ii) 101 (iii) 5 (iv) 10220000 (v) Other (provide your own answer): _________________ b) The following value is stored in memory (circle one): (i) 0x17 (ii)...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...