Write an assembly code that would do the following Set R10x1

Write an assembly code that would do the following: Set R1=0x1234 5678 R2=0x7856 3412 R3=0xABCD 5678 R4=0x0000 7856 Read bit 4 of a word stored at memory location 0x2000 0008 If bit 4 is set, then use branch instruction, and use multiple load access instruction to read the contents of 4 consecutive memory (word) locations starting at 0x8000 to R1 to R4. Then reset bit 4 of 0x2000 0008. Then stop the program If bit 4 is not set, use multiple write access instruction to write R1-R4 to the memory location (word) starting at 0x8000. Then set the bit 4 of 0x2000 0008

Solution

The assembly level code is as follows:

MOV R1,#12345678H ;load R1 with 12345678H

MOV R2,#78563412H ;load R2 with 78563412H

MOV R3,#ABCD5678H ;load R3 with ABCD5678H

MOV R4,#00007856H ;load R4 with 00007856H

MOV R5,#20000008H

MOV A,R5

CMP A,#0001000H ;compare fourth bit ;if 1 go to HERE

JNZ HERE

MOV R1,#8000H

MOV R2,#8008H

MOV R3,#8016H

MOV R4,#8022H

HERE:MOV R6,A ;jump here

MOV R5,#0001000H ;set the fourth bit

RET ;end program

 Write an assembly code that would do the following: Set R1=0x1234 5678 R2=0x7856 3412 R3=0xABCD 5678 R4=0x0000 7856 Read bit 4 of a word stored at memory locat

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site