Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1: Write an ARM assembly language program that scans a string terminated by the null byte 0x00 and copies the string from a source

image text in transcribed

Exercise 1: Write an ARM assembly language program that scans a string terminated by the null byte 0x00 and copies the string from a source location pointed at by rO to a destination pointed at by r1 AREA scan, CODE, READWRITE Entry ADR r0, Stringl ADR rl, String2 :r0 points to the source string :rl points to the dest string r2, [r01,#1 r2, [r1],#1 r2 , #0x00 Copy #0x123456 ; read a byte and update pointer ; copy the byte and update ptr ; test for terminator repeat until terminator found ; stop Copy LDRB STRB CMP BNE SVC Stringl DCB "this is a string", 0x00 String2 SPACE 20 : dummy string ireserve 20 bytes for copy END Exercise 2: Write an ARM assembly language program to determine whether a string of characters with an odd length is a palindrome, for example, mom, under the following constraints 1. The string of ASIC-encoded characters is stored in memory 2. At the start of the program, register r1 contains the address of the first character in the string and r2 contains the address of the last character. On exit from the program, register rO contains a 0 if the string is not a palindrome and 1 if it is Exercise 1: Write an ARM assembly language program that scans a string terminated by the null byte 0x00 and copies the string from a source location pointed at by rO to a destination pointed at by r1 AREA scan, CODE, READWRITE Entry ADR r0, Stringl ADR rl, String2 :r0 points to the source string :rl points to the dest string r2, [r01,#1 r2, [r1],#1 r2 , #0x00 Copy #0x123456 ; read a byte and update pointer ; copy the byte and update ptr ; test for terminator repeat until terminator found ; stop Copy LDRB STRB CMP BNE SVC Stringl DCB "this is a string", 0x00 String2 SPACE 20 : dummy string ireserve 20 bytes for copy END Exercise 2: Write an ARM assembly language program to determine whether a string of characters with an odd length is a palindrome, for example, mom, under the following constraints 1. The string of ASIC-encoded characters is stored in memory 2. At the start of the program, register r1 contains the address of the first character in the string and r2 contains the address of the last character. On exit from the program, register rO contains a 0 if the string is not a palindrome and 1 if it is

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions