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 r0 to a destination pointed at by r1.

What will be an ideal response?

AREA scan, CODE, READWRITE


Entry
ADR r0,String1 ;r0 points to the source string
ADR r1,String2 ;r1 points to the dest string
Copy LDRB r2,[r0],#1 ;read a byte and update pointer
STRB r2,[r1],#1 ;copy the byte and update ptr
CMP r2,#0x00 ;test for terminator
BNE Copy ;repeat until terminator found
SVC #0x123456 ;stop
String1 DCB "this is a string", 0x00 ;dummy string
String2 SPACE 20 ;reserve 20 bytes for copy
END

Computer Science & Information Technology

You might also like to view...

Consider a brokerage ?rm database with relations Holdings(AccountId, StockSymbol, CurrentPrice, Quantity) and Balance(AccountId, Balance). Write the triggers for maintaining the correctness of the account balance when stock is bought (a tuple is added to Holdings or Quantity is incremented), sold (a tuple is deleted from Holdings or Quantity is decremented), or a price change occurs. Solve the

problem using both row-level and statement-level triggers. Give an example of a situation when row-level triggers are more appropriate for the above problem and when statement-level triggers are more appropriate. What will be an ideal response?

Computer Science & Information Technology

One-dimensional arrays are examples of a(n) ____ type.

A. composed B. primitive C. structured D. atomic

Computer Science & Information Technology