22.11.2.7 Search Memory

Performs a data search in block units, starting from the first item in the specified range. Compares data blocks, starting from the specified (offset) blocks and returns (saves) the search result to the specified storage address. When a matching block is found, the offset value of the block (1 or higher) is saved. When no matching block is found, "FFFFh" is saved. When an error occurs, the error status value is written to LS9153.

_memsearch ([Searched Block Address], [Search Start Address], [Search End Address], [Search Result Storage Address], Offset from Start Block, Number of Compared Words, Words in 1 Block)

Data to be written

Example expression 1:

_memsearch([w:[#INTERNAL]LS1000],[w:[#INTERNAL]LS1005],[w:[#INTERNAL]LS1025],[w:[#INTERNAL]LS0100],0,1,5)

(Searches from LS1005 to LS1025 for a 1 word block with the same value. Starts from offset 0 of the source search block, and stores the result in LS0100.)

In this case, the value of "Block 1" matches the value of "the source search block". As a result the search result "1" is stored in LS0100.

Example expression 2:

_memsearch([w:[#INTERNAL]LS1000],[w:[#INTERNAL]LS1005],[w:[#INTERNAL]LS1025],[w:[#INTERNAL]LS0100],3,2,5)

(Searches from LS1005 to LS1025 for a 2 word block with the same value. Uses two words, starting from an offset of 3, and stores the result in LS0100.)

In this case, the value of "Block 4" matches the value of "the source search block". As a result the search result "4" is stored in LS0100.

Error Status

Editor Function Name

LS Area

Error Status

Cause

_memsearch ( )

LS9153

0000h

Completed Successfully

0001h

Parameter error

0003h

Write/Read error