Short:    Grep through memory for strings! *KYZSMLCLXN*
Author:   Kyzer/CSG
Uploader: Kyzer/CSG <kyzer@4u.net>
Type:     util/cli

Grepmem is named after a unix program that hunts through files for a string
or a pattern. But let me tell you now, GREPMEM DOESN'T DO PATTERNS!

Instead, it will search through memory for an exact match of the string
you supply to it. You can also define which part of memory to search - if
you don't, it will assume to search all chip memory.

You do not have to, but it is a good idea to put "quotes round the string"
that you want to search for. Why? Well, getting your input into memory and
printing it out a few times will leave some copies around in memory. If
you put quotes around your string, it will search for the string WITHOUT
THE QUOTES, and if it finds a copy that *is* in quotes, it will NOT match
it.

If you are using addresses, you must supply them in hexadecimal. It can be
any format, either the naked hex number on it's own, or starting with "$"
or "0x", but BEWARE! I parse the address by assuming all characters are
part of the address, and "$" and "x" are equal to the digit "0", therefore:

0xDEADBEEF   = 00DEADBEEF = DEADBEEF
DEAD0xBEEF   = DEAD00BEEF and is NOT = DEADBEEF
$11 = 11
11$ = 110
1$1 = 101

So be careful about that.

There is a final option, PADZEROS, which means (if you switch it on) that:

Grepping memory for "c" from $200 to $F00, please wait.
Hits:       $59B        $59D        $E52        $ED9        
Grep finished, 4 occurences.

will become:

Grepping memory for "c" from $500 to $F00, please wait.
Hits:       $0000059B   $0000059D   $00000E52   $00000ED9   
Grep finished, 4 occurences.

EXAMPLES:
look through chipmem for a powerpacker file
1> grepmem "PP20"
look through the amiga rom for references to Amiga
1> grepmem "Amiga" f80000 1000000

If you run the program without supplying any arguements, it will show a
brief little help message. The program is pure and can be made resident.
There is a little hack for the PADZERO option that is not pure, but it will
not cause a problem of any kind except if you use the PADZERO option while
another resident copy of grepmem is running, you will get this interesting
effect:

Grepping memory for "c" from $500 to $5F00, please wait.
Hits:       $59B        $59D        $E52        $ED9        $F39
$1035       $2043       $0000059D   $00000E52   $00000ED9

....

Requires 2.04 or better.

****************************************************************************
*          THIS PROGRAM IS PART OF THE "KYZER'S SMALLS" COLLECTION         *
*                                                                          *
*      The KyzSmlClxn is a set of very small, but useful CLI commands.     *
*                                                                          *
*   Source in assembler is included. Install by copying the command to C:  *
*                                                                          *
*     Kyzer/CSG, 49 Fairview Road, AB22 8ZG, Scotland ---- kyzer@4u.net    *
****************************************************************************


============================= Archive contents =============================

Original  Packed Ratio    Date     Time    Name
-------- ------- ----- --------- --------  -------------
    1400     935 33.2% 08-Apr-97 02:56:28  GrepMem
    5217    2245 56.9% 08-Apr-97 02:56:20  GrepMem.asm
    3110    1362 56.2% 08-Apr-97 05:26:16  GrepMem.readme
-------- ------- ----- --------- --------
    9727    4542 53.3% 10-Apr-97 19:05:44   3 files
