| Purpose: | Alphabetically compare two (2) character strings, both of which are in SRAM. | ||||
| Assumes: | Both strings are NULL terminated ASCII (i.e., "ASCIIz") strings. | ||||
| Passed: | R25:R24 | BYTE * | szPtrString1 | pointer to the buffer containing the first ASCIIz string | |
| R23:R22 | BYTE * | szPtrString2 | pointer ot the buffer containing the second ASCIIz string | ||
| Returns: | R24 | CHAR | cResult | less than 0 when String#1 alphabetically preceeds String#2 OR equal to 0 when the strings are same length and have identical BYTEs OR greater than 0 when String#1 alphabetically follows String#2 |
|
| Alters: | R25, R26, R27, R30, R31, and the FLAGs (the "T" FLAG, specifically) | ||||
| Example: |
|
| Test it: |
|
| Notes: | Less than zero means that cResult, the signed result returned in R24, is 0x80 through 0xFF (i.e., the most significant bit is set.) |
| More than zero means that cResult is 1 through 0x7F (= 127.) | |
| The comparison is case-sensitive. | |
| Dropin: (setup code) |
; Setup for the strcmp() call:
; Passed: R25:R24 BYTE * szPtrString1 pointer to the buffer with String#1
; R23:R22 BYTE * szPtrString2 pointer to the buffer with String#2
; Returns: R24 CHAR < 0 if String#1 alphabetically preceeds String#2
; = 0 if the strings are same length and identical
; > 0 if String#1 alphabetically follows String #2
; Alters: R25, R26, R27, R30, R31, and the FLAGs ("T", specifically) |
| Also see: | The strcmpPGM, strchr, strcpy, and strlen System Functions. |