'Search for ASM instructions in memory
Usage:
MYNAME "asmcode" start end
MYNAME "asmcode" mapname'

def asmsearch(self, *arg):

    (asmcode, start, end) = normalize_argv(arg, 3)
    if (asmcode is None):
        self._missing_argument()
    if (not self._is_running()):
        return
    asmcode = arg[0]
    result = []
    if (end is None):
        mapname = start
        if (mapname is None):
            mapname = 'binary'
        maps = peda.get_vmmap(mapname)
        msg(('Searching    for    ASM    code:    %s    in:    %s    ranges' % (repr(asmcode), mapname)))
        for (start, end, _, _) in maps:
            if (not peda.is_executable(start, maps)):
                continue
            result += peda.search_asm(start, end, asmcode)
    else:
        msg(('Searching    for    ASM    code:    %s    in    range:    0x%x    -    0x%x' % (repr(asmcode), start, end)))
        result = peda.search_asm(start, end, asmcode)
    text = 'Not    found'
    if result:
        text = ''
        for (addr, (byte, code)) in result:
            text += ('%s    :    (%s) DCTB %s\n' % (to_address(addr), byte.decode('utf-8'), code))
    pager(text)
    return
