CAN YOU PLEASE ANSWER AND ONE OR TWO OF THESE NOT ALL OF THEM PLEASE Write ARM7
ID: 3710067 • Letter: C
Question
CAN YOU PLEASE ANSWER AND ONE OR TWO OF THESE NOT ALL OF THEM PLEASE
Write ARM7 assembly programs to solve 5 of the problems listed below - use the VisUAL ARM Emulator as discussed in class and use the program shell from Find8.s as a starting point for each program 1. Write a program called SUB64 to subtract the 64-bit integer in memory locations 0x0150 from the 64- bit integer in 0x0160. Store the result in memory location 0x0170 2. Write a program called COMBINE that combines the low-order nibbles ofthe four bytes in memory locations 0x0150, 0x0154, 0x0158, and 0x015C into a single 16-bit word. The nibbles should be ordered low-to-high in the result beginning with the data from location 0x0150. Store the result as 16-bits in memory location 0x0160 4. Write a program called LSHIFT to shift logically the 32-bit contents of memory location 0x0150 left according to the 8-bit shift count stored in memory location 0x0154 and store the results at memory address 0x0158 5. Write a program called FIND32 to find the largest unsigned 32-bit word in a list. The list begins at address 0x0160. The length of the list is stored in an 8-bit variable at address 0x0150. Store the largest entry in memory location 0x0154 6. Write a program called SCAN to scan a list of unsigned bytes and find the smallest and largest entries in the list. The length of the list is stored in a 16-bit variable at address 0x0158. The list begins at address 0x0160. Store the smallest byte at address 0x0150 and the largest byte at address 0x0154 7. Write a program called COUNT to count the number of characters in a null-terminated ASCII string that are equal to a KEY. The KEY is stored in memory location 0x0150. The string is stored in memory beginning at address 0x0160. Store the 8-bit count in memory location 0x0154 8. Write a program called ONES to determine the number of bits equal to one in a 32-bit variable. The 32- bit variable is in memory location 0x0154. Store the 8-bit counter in memory location 0x0150.] 9. Write a program called UNPACK to convert the 16-bit BCD variable in memory locations 0x0150 and 0x0151 to four ASCII characters with the high-order digit first, beginning in memory location 0x0154 NOTE: for 10 write a short program which will load the required data into registers and then branch with link to the subroutine, then after calling the subroutine then branch to END 10. Write a subroutine called REPLACE that processes a null-terminated string of decimal characters and replaces leading zeros with spaces. Pass the 32-bit address of the beginning of the string to the subroutine in register R0Explanation / Answer
As per your requirement , I'm Solving Only one of the problems:
9)answer:
// store two two-digit BCD numbers in the memory locations 0150Hand 0151H
// Store the result i.e, the characters of digits in the memorylocations 0154H, 0155H, 0156H and 0157H
#ORG 0000H
#BEGIN 0000H
LDA 0150H //Get the first packed BCD number from thememory
MOV B,A
MVI C,04
ANI F0
L1: RRC // Need to rotate the content of accumulator in theright for C times(i.e. 4 times)
DCR C
JNZ L1
STA 0154H
MOV A,B
ANI 0F
STA 0155H
LDA 0151H // to Get the second packed BCD number from the memory
MOV B,A
MVI C,04
ANI F0
L2: RRC // Need to rotate the content of accumulator in theright for C times(i.e. 4 times)
DCR C
JNZ L2
STA 0156H
MOV A,B
ANI 0F
STA 0157H
// sort in descending order
SORT: MVI B, 03
LXI H, 0154H
MVI C, 03H
BACK: MOV A, M
INX H
CMP M
JG SKIP
MOV D, M
MOV M, A
DCX H
MOV M, D
INX H
SKIP: DCR C
JNZ BACK
DCR B
JNZ SORT
HLT
// suppose data at 0150H is 98 (a two digit BCD number)
// we will have 09 at 0154H and 08 at 0155H
Please give Thumbs up if it helped you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.