Delta AH500 — 6.21.2 Explanation of String Processing Instructions

Chapter 6 Applied Instructions API 2115 Symbol: S 1 : String which is searched Word S 2 : String which is searched for Word n : n th character in S 2 from which the search begins Word D : Search result Word Explanation: 1. The instruction is used to search the string from the n th character in S 2 for the string which is the same as the string in S 1 , and the search result is stored in D . 2. Suppose the string in S 2 is “ABCDEFGHIJK”, the string in S 1 is “EFGH”, and n is 3. The search begins from the third character in S 2 , and the value in D is 5.

b15 b0 b7 b8 S1 b15 b0 b7 b8 +1 S1 +2 S1 Matching character Searching the string from the third character After the instruction is executed 5 D Example: 6-485 Instruction code Operand Function $SER P S , S , n, D 1 2 Searching the string Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1          S 2          n            D          Pulse instruction 16-bit instruction (9-21 steps) 32-bit instruction AH500 AH500 - 16#46(F) 16#45(E) 16#48(H) 16#47(G) 忽略 16#00 16#42(B) 16#41(A) S2 S2 +1 16#44(D) 16#43(C) 16#46(F) 16#45(E) S2 +2 16#48(H) 16#47(G) S2 +3 S2 +4 S2 +5 16#4A(J) 16#49(I) 16#00 16#4B(K)