VMS Help MACRO, VAX MACRO Assembler, Instructions, CMPCx *Conan The Librarian (sorry for the slow response - running on an old VAX) |
Purpose: Compare two character strings Format: opcode len.rw,src1addr.ab,src2addr.ab ;3 operand opcode src1len.rw,src1addr.ab,fill.rb ;5 operand src2len.rw,src2addr.ab Operation: {compare two strings with optional filling} C. Codes: [final codes reflect last affecting of codes in the operation.] N = {{first byte} LSS {second byte}}, Z = {{first byte} EQL {second byte}}, V = 0, C = {{first byte} LSSU {second byte}} Exceptions: None Opcodes: 29 CMPC3 Compare character 3 operand 2D CMPC5 Compare character 5 operand Description: In 3-operand format the bytes of string 1 specified by len and src1addr are compared with string 2 specified by len and src2addr. In 5-operand format the bytes of string 1 specified by src1len and src1addr are compared with string 2 specified by src2len and src2addr. If one string is longer than the other the shorter string is conceptually extended by appending bytes with the value of fill to the end. Comparison proceeds until all the bytes have been examined or inequality is detected. Condition codes are affected by the last character comparison. Notes: After execution of CMPC3: R0 = number of bytes remaining in string 1 (including byte that terminated comparison); R0 is 0 only is strings are equal R1 = address of the byte in string 1 that terminated comparison; if strings are equal, address of one byte beyond string 1 R2 = R0 R3 = address of the byte in string 2 that terminated comparison; if strings are equal, address of one byte beyond string 2 After execution of CMPC5: R0 = number of bytes remaining in string 1 (including byte that terminated comparison); R0 is 0 only if string1 and string 2 are of equal length or string 1 was exhausted before comparison terminated R1 = address of the byte in string 1 that terminated comparison; if comparison did not terminate before string 1 exhausted, address of one byte beyond string 1 R2 = number of bytes remaining in string 2 (including byte that terminated comparison); R2 is 0 only if string 1 and string 2 are of equal length or string 2 was exhausted before comparison terminated R3 = address of the byte in string 2 that terminated comparison; if conmparison did not terminate before string 2 was exhausted, address of one byte beyond string 2
|