Chapter 6 Applied Instructions
6-487
5. If the value in S
3
is equal to 0, the instruction is not executed.
Example:
When M0 is ON, the data in D0~D7 is “1234ABAB1234AB”, and the data in D10~D11 is “CDEF”.
When the instruction $RPLC is executed, the characters in D0~D7 starting from the character
indicated by the value in D51 are replaced by the characters in D10~D11. The number of characters
which are replaced is indicated by the value in D50, and the result is stored in D20~D27.
If the values in D50 and D51 are 3 and 4 respectively, the execution result is as follows.
Afte r the in structio n
is execu ted.
b15 b 0b7b8
0016#
D1
D2
D3
16#31(1)16# 32 (2)
33(3)16#34 (4)16#
42(B)16# 41(A)16 #
41(A )16#42(B)16#
31(1)16#
D4
b15 b 0b7b8
執行後
43(C)16#44 (D)16#
D5
32(2)16#
3
4
開始取代的位置
取代數量
33(3)16#
34(4)16#
42(B)16#
41(A)16#
D50
D51
D0
45(E)16#45(F)16#
D6
D7
D21
D22
D23
D24
D25
D20
D26
D27
16#31(1)32(2)16#
33 (3)16#43(C)16#
16#45(E) 44(D)16#
46(F)16#41 (A)16#
42 (B)16#
31 (1)16#
32 (2)16#
33 (3)16#
41(A)16# 34(4)16#
42 (B)16#
D10
D11
16 #00
忽略
D12 16#00忽略
I g n or ed
Ig n o re d
C h a ra c t e r wh ic h is re p la c e d
N u m b e r of c h ar ac t er s wh ic h ar e r e p la ce d