(Assembly language MSP430)
1. Strings are placed in memory and their end is marked with abyte equal to zero (\0). This simplifies the use because it onlyneeds the initial address, while the final address is indicated by0. The figure below shows an example of a small string that isloaded from the address 0x2400. Of course, each letter isrepresented by its ASCII code.
a) Write SIZE_STR subroutine which receives the start address ofa string in R5 and returns its length in R10. The zero that marksthe end of the string must not be counted.
b) Write CHK_STR subroutine that compares two strings of thesame length whose addresses are in R5 and R6. The subroutinereturns: • if the strings are identical --> flag Z = 1 and • ifthe strings are not identical --> flag Z = 0
0x2400 0x2401 R P 0x2402 0x2403 O V 0x2404 A 0x2405 0x2406 U 0x2407 0x2408 0 M 0x2409
(Assembly language MSP430) 1. Strings are placed in memory and their end is marked with a byte equal to zero (\0). This
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am